LimsJsonSampleData { @NotNull @Value.Derived public String labProcedures() { Pattern pattern = Pattern.compile("PREP(\\d+)V(\\d+)-QC(\\d+)V(\\d+)-SEQ(\\d+)V(\\d+)"); Matcher matcher = pattern.matcher(labSopVersions()); if (matcher.find()) { return labSopVersions(); } else { return Lims.NOT_AVAILABLE_STRING; } }  @NotNull @SerializedName("sample_name") abstract String sampleId(); @NotNull @SerializedName("patient") abstract String patientId(); @Nullable @SerializedName("ref_sample_id") abstract String refBarcode(); @NotNull @SerializedName("sample_id") abstract String tumorBarcode(); @NotNull @SerializedName("arrival_date") abstract String arrivalDate(); @Nullable @SerializedName("sampling_date") abstract String samplingDate(); @SerializedName("shallowseq") abstract boolean shallowSeq(); @Nullable @SerializedName("tumor_perc") abstract String pathologyTumorPercentage(); @NotNull @SerializedName("conc") abstract String dnaConcentration(); @NotNull @SerializedName("ptum") abstract String primaryTumor(); @NotNull @SerializedName("submission") abstract String submission(); @Nullable @SerializedName("hospital_patient_id") abstract String hospitalPatientId(); @Nullable @SerializedName("hospital_pa_sample_id") abstract String hospitalPathologySampleId(); @SerializedName("report_germline") abstract boolean reportGermlineVariants(); @Nullable @SerializedName("report_germline_level") abstract String germlineReportingLevel(); @SerializedName("report_viral") abstract boolean reportViralInsertions(); @NotNull @SerializedName("cohort") abstract String cohort(); @NotNull @Value.Derived String labProcedures();  }
@Test public void canConvertSOPsToLabProceduresString() { LimsJsonSampleData missingPrepNum = buildLimsSampleEntry("PREPV23-QC037V20-SEQ008V25"); assertEquals(Lims.NOT_AVAILABLE_STRING, missingPrepNum.labProcedures()); LimsJsonSampleData missingPrepVersion = buildLimsSampleEntry("PREP013V-QC037V20-SEQ008V25"); assertEquals(Lims.NOT_AVAILABLE_STRING, missingPrepVersion.labProcedures()); LimsJsonSampleData missingQcNum = buildLimsSampleEntry("PREP013V23-QCV20-SEQ008V25"); assertEquals(Lims.NOT_AVAILABLE_STRING, missingQcNum.labProcedures()); LimsJsonSampleData missingQcVersion = buildLimsSampleEntry("PREP013V23-QC037V-SEQ008V25"); assertEquals(Lims.NOT_AVAILABLE_STRING, missingQcVersion.labProcedures()); LimsJsonSampleData missingSeqNum = buildLimsSampleEntry("PREP013V23-QC037V20-SEQV25"); assertEquals(Lims.NOT_AVAILABLE_STRING, missingSeqNum.labProcedures()); LimsJsonSampleData missingSeqVersion = buildLimsSampleEntry("PREP013V23-QC037V20-SEQ008V"); assertEquals(Lims.NOT_AVAILABLE_STRING, missingSeqVersion.labProcedures()); String completeSopString = "PREP013V23-QC037V20-SEQ008V25"; LimsJsonSampleData completeEntry = buildLimsSampleEntry(completeSopString); assertEquals(completeSopString, completeEntry.labProcedures()); }