DrupPatientReader implements EcrfPatientReader { @NotNull @Override public Patient read(@NotNull EcrfPatient ecrfPatient, @NotNull List<SampleData> sequencedSamples) { BaselineData baselineData = baselineReader.read(ecrfPatient); PreTreatmentData noPreTreatmentData = ImmutablePreTreatmentData.builder().formStatus(FormStatus.undefined()).build(); List<BiopsyData> clinicalBiopsies = biopsyReader.read(ecrfPatient, baselineData.curatedTumorLocation()); MatchResult<BiopsyData> matchedBiopsies = BiopsyMatcher.matchBiopsiesToTumorSamples(ecrfPatient.patientId(), sequencedSamples, clinicalBiopsies); return new Patient(ecrfPatient.patientId(), baselineData, noPreTreatmentData, sequencedSamples, matchedBiopsies.values(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), matchedBiopsies.findings()); } DrupPatientReader(@NotNull TumorLocationCurator tumorLocationCurator, @NotNull BiopsySiteCurator biopsySiteCurator); @NotNull @Override Patient read(@NotNull EcrfPatient ecrfPatient, @NotNull List<SampleData> sequencedSamples);  }
@Test public void canReadEmptyPatient() { DrupPatientReader patientReader = new DrupPatientReader(TestCuratorFactory.tumorLocationCurator(), TestCuratorFactory.biopsySiteCurator()); 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); }