use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class PatientReader method read.
@NotNull
public Patient read(@NotNull final EcrfPatient ecrfPatient, @NotNull final List<SampleData> sequencedSamples) throws IOException {
LOGGER.info("Reading patient " + ecrfPatient.patientId() + " with samples: " + sequencedSamples);
final BaselineData baselineData = cpctPatientReader.read(ecrfPatient);
final PreTreatmentData preTreatmentData = preTreatmentReader.read(ecrfPatient);
final List<BiopsyData> clinicalBiopsies = BiopsyReader.read(ecrfPatient);
final List<BiopsyTreatmentData> treatments = biopsyTreatmentReader.read(ecrfPatient);
final List<BiopsyTreatmentResponseData> treatmentResponses = BiopsyTreatmentResponseReader.read(ecrfPatient);
final List<TumorMarkerData> tumorMarkers = TumorMarkerReader.read(ecrfPatient);
final MatchResult<BiopsyData> matchedBiopsies = BiopsyMatcher.matchBiopsiesToTumorSamples(ecrfPatient.patientId(), sequencedSamples, clinicalBiopsies);
final MatchResult<BiopsyTreatmentData> matchedTreatments = TreatmentMatcher.matchTreatmentsToBiopsies(ecrfPatient.patientId(), clinicalBiopsies, treatments);
final MatchResult<BiopsyTreatmentResponseData> matchedResponses = TreatmentResponseMatcher.matchTreatmentResponsesToTreatments(ecrfPatient.patientId(), treatments, treatmentResponses);
final 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, findings);
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class BiopsyReaderTest method buildTestPatient.
@NotNull
private static EcrfPatient buildTestPatient() {
final String patient = "dummy";
EcrfItemGroup biopsy = new EcrfItemGroup(patient);
biopsy.addItem(BiopsyReader.FIELD_BIOPSY_TAKEN, "Yes");
biopsy.addItem(BiopsyReader.FIELD_BIOPSY_EVALUABLE, "Yes");
// KODU: Create initial biopsy.
EcrfItemGroup biopsies1 = new EcrfItemGroup(patient);
biopsies1.addItem(BiopsyReader.FIELD_BIOPSY_DATE, "2017-11-10");
biopsies1.addItem(BiopsyReader.FIELD_LOCATION, "liver");
biopsies1.addItem(BiopsyReader.FIELD_SITE, "other");
biopsies1.addItem(BiopsyReader.FIELD_SITE_OTHER, "body");
EcrfForm form1 = new EcrfForm(patient, FormStatusState.SAVED, true);
form1.addItemGroup(BiopsyReader.ITEMGROUP_BIOPSY, biopsy);
form1.addItemGroup(BiopsyReader.ITEMGROUP_BIOPSIES, biopsies1);
// KODU: Create empty 2nd biopsy
EcrfItemGroup biopsies2 = new EcrfItemGroup(patient);
EcrfForm form2 = new EcrfForm(patient, FormStatusState.SAVED, true);
form2.addItemGroup(BiopsyReader.ITEMGROUP_BIOPSY, biopsy);
form2.addItemGroup(BiopsyReader.ITEMGROUP_BIOPSIES, biopsies2);
// KODU: Create duplicate 3rd biopsy
EcrfItemGroup biopsies3 = new EcrfItemGroup(patient);
biopsies3.addItem(BiopsyReader.FIELD_BIOPSY_DATE, "2017-11-10");
biopsies3.addItem(BiopsyReader.FIELD_LOCATION, "liver");
biopsies3.addItem(BiopsyReader.FIELD_SITE, "other");
biopsies3.addItem(BiopsyReader.FIELD_SITE_OTHER, "body");
EcrfForm form3 = new EcrfForm(patient, FormStatusState.SAVED, true);
form3.addItemGroup(BiopsyReader.ITEMGROUP_BIOPSY, biopsy);
form3.addItemGroup(BiopsyReader.ITEMGROUP_BIOPSIES, biopsies3);
EcrfStudyEvent studyEvent = new EcrfStudyEvent(patient);
studyEvent.addForm(BiopsyReader.FORM_BIOPS, form1);
studyEvent.addForm(BiopsyReader.FORM_BIOPS, form2);
studyEvent.addForm(BiopsyReader.FORM_BIOPS, form3);
Map<String, List<EcrfStudyEvent>> studyEvents = Maps.newHashMap();
studyEvents.put(BiopsyReader.STUDY_BIOPSY, Lists.newArrayList(studyEvent));
return new EcrfPatient(patient, studyEvents, Lists.newArrayList());
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class PatientReaderTest method canReadCpctPatientTreatmentResponses.
@Test
public void canReadCpctPatientTreatmentResponses() {
final CpctEcrfModel model = loadTestEcrf();
assertEquals(1, model.patientCount());
final EcrfPatient cpctPatient = model.patients().iterator().next();
final List<BiopsyTreatmentResponseData> treatmentResponses = BiopsyTreatmentResponseReader.read(cpctPatient);
assertEquals(4, treatmentResponses.size());
assertEquals(LocalDate.parse("2012-02-09", DATE_FORMATTER), treatmentResponses.get(0).date());
assertEquals(null, treatmentResponses.get(0).response());
assertEquals(null, treatmentResponses.get(0).measurementDone());
assertEquals(LocalDate.parse("2012-03-05", DATE_FORMATTER), treatmentResponses.get(1).date());
assertEquals("PD", treatmentResponses.get(1).response());
assertEquals(null, treatmentResponses.get(1).measurementDone());
assertEquals(LocalDate.parse("2012-04-23", DATE_FORMATTER), treatmentResponses.get(2).date());
assertEquals("SD", treatmentResponses.get(2).response());
assertEquals(null, treatmentResponses.get(2).measurementDone());
assertEquals(LocalDate.parse("2012-06-08", DATE_FORMATTER), treatmentResponses.get(3).date());
assertEquals("PR", treatmentResponses.get(3).response());
assertEquals("Yes", treatmentResponses.get(3).measurementDone());
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class PatientReaderTest method canReadCpctPatientPreTherapy.
@Test
public void canReadCpctPatientPreTherapy() throws IOException {
final CpctEcrfModel model = loadTestEcrf();
assertEquals(1, model.patientCount());
final EcrfPatient cpctPatient = model.patients().iterator().next();
final PreTreatmentData preTreatmentData = new PreTreatmentReader(createTreatmentCurator()).read(cpctPatient);
assertEquals("Yes", preTreatmentData.treatmentGiven());
assertEquals("Yes", preTreatmentData.radiotherapyGiven());
final List<DrugData> drugs = preTreatmentData.drugs();
assertEquals(6, drugs.size());
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class PatientReaderTest method canReadCpctPatientTreatments.
@Test
public void canReadCpctPatientTreatments() throws IOException {
final CpctEcrfModel model = loadTestEcrf();
assertEquals(1, model.patientCount());
final EcrfPatient cpctPatient = model.patients().iterator().next();
final List<BiopsyTreatmentData> treatments = new BiopsyTreatmentReader(createTreatmentCurator()).read(cpctPatient);
assertEquals(1, treatments.size());
assertEquals(1, treatments.get(0).drugs().size());
final LocalDate startDate = LocalDate.parse("2012-02-18", DATE_FORMATTER);
final LocalDate endDate = LocalDate.parse("2012-04-02", DATE_FORMATTER);
assertEquals("Bevacizumab", treatments.get(0).drugs().get(0).name());
assertEquals(startDate, treatments.get(0).drugs().get(0).startDate());
assertEquals(endDate, treatments.get(0).drugs().get(0).endDate());
assertEquals(startDate, treatments.get(0).startDate());
assertEquals(endDate, treatments.get(0).endDate());
assertEquals("Bevacizumab", treatments.get(0).treatmentName());
assertEquals("Yes", treatments.get(0).treatmentGiven());
}
Aggregations