CpctPatientReader implements EcrfPatientReader { @NotNull @Override public Patient read(@NotNull EcrfPatient ecrfPatient, @NotNull List<SampleData> sequencedSamples) { BaselineData baselineData = baselineReader.read(ecrfPatient); PreTreatmentData preTreatmentData = preTreatmentReader.read(ecrfPatient); List<BiopsyData> clinicalBiopsies = biopsyReader.read(ecrfPatient, baselineData.curatedTumorLocation()); List<BiopsyTreatmentData> treatments = biopsyTreatmentReader.read(ecrfPatient); List<BiopsyTreatmentResponseData> treatmentResponses = BiopsyTreatmentResponseReader.read(ecrfPatient); List<TumorMarkerData> tumorMarkers = TumorMarkerReader.read(ecrfPatient); List<RanoMeasurementData> ranoMeasurements = RanoMeasurementReader.read(ecrfPatient); MatchResult<BiopsyData> matchedBiopsies = BiopsyMatcher.matchBiopsiesToTumorSamples(ecrfPatient.patientId(), sequencedSamples, clinicalBiopsies); MatchResult<BiopsyTreatmentData> matchedTreatments = TreatmentMatcher.matchTreatmentsToBiopsies(ecrfPatient.patientId(), withSampleMatchOnly(matchedBiopsies), treatments); MatchResult<BiopsyTreatmentResponseData> matchedResponses = TreatmentResponseMatcher.matchTreatmentResponsesToTreatments(ecrfPatient.patientId(), matchedTreatments.values(), treatmentResponses); List<ValidationFinding> findings = Lists.newArrayList(); findings.addAll(matchedBiopsies.findings()); findings.addAll(matchedTreatments.findings()); findings.addAll(matchedResponses.findings()); return new Patient(ecrfPatient.patientId(), baselineData, preTreatmentData, sequencedSamples, matchedBiopsies.values(), matchedTreatments.values(), matchedResponses.values(), tumorMarkers, ranoMeasurements, findings); } CpctPatientReader(@NotNull TumorLocationCurator tumorLocationCurator, @NotNull Map<Integer, String> hospitals,
            @NotNull BiopsySiteCurator biopsySiteCurator, @NotNull TreatmentCurator treatmentCurator); @NotNull @Override Patient read(@NotNull EcrfPatient ecrfPatient, @NotNull List<SampleData> sequencedSamples);  }
@Test public void canLoadEmptyPatient() { CpctPatientReader patientReader = new CpctPatientReader(TestCuratorFactory.tumorLocationCurator(), Maps.newHashMap(), TestCuratorFactory.biopsySiteCurator(), TestCuratorFactory.treatmentCurator()); EcrfPatient ecrfPatient = new EcrfPatient("empty", Maps.newHashMap(), Lists.newArrayList()); SampleData sample = sampleBuilder(LocalDate.parse("2017-01-01")).build(); Patient patient = patientReader.read(ecrfPatient, Lists.newArrayList(sample)); assertNotNull(patient); }