Search in sources :

Example 1 with PreTreatmentData

use of com.hartwig.hmftools.patientdb.data.PreTreatmentData 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);
}
Also used : Patient(com.hartwig.hmftools.patientdb.data.Patient) EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) BaselineData(com.hartwig.hmftools.patientdb.data.BaselineData) BiopsyTreatmentData(com.hartwig.hmftools.patientdb.data.BiopsyTreatmentData) BiopsyTreatmentResponseData(com.hartwig.hmftools.patientdb.data.BiopsyTreatmentResponseData) ValidationFinding(com.hartwig.hmftools.common.ecrf.datamodel.ValidationFinding) TumorMarkerData(com.hartwig.hmftools.patientdb.data.TumorMarkerData) BiopsyData(com.hartwig.hmftools.patientdb.data.BiopsyData) PreTreatmentData(com.hartwig.hmftools.patientdb.data.PreTreatmentData) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with PreTreatmentData

use of com.hartwig.hmftools.patientdb.data.PreTreatmentData 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());
}
Also used : DrugData(com.hartwig.hmftools.patientdb.data.DrugData) EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) PreTreatmentData(com.hartwig.hmftools.patientdb.data.PreTreatmentData) CpctEcrfModel(com.hartwig.hmftools.common.ecrf.CpctEcrfModel) Test(org.junit.Test)

Example 3 with PreTreatmentData

use of com.hartwig.hmftools.patientdb.data.PreTreatmentData in project hmftools by hartwigmedical.

the class PreTreatmentReader method read.

@NotNull
PreTreatmentData read(@NotNull final EcrfPatient patient) throws IOException {
    PreTreatmentData preTreatmentData = null;
    for (final EcrfStudyEvent studyEvent : patient.studyEventsPerOID(STUDY_BASELINE)) {
        for (final EcrfForm treatmentForm : studyEvent.nonEmptyFormsPerOID(FORM_TREATMENT, false)) {
            String treatmentGiven = readTreatmentGiven(treatmentForm);
            String radiotherapyGiven = readRadiotherapyGiven(treatmentForm);
            final List<DrugData> drugs = readDrugs(treatmentForm);
            if (preTreatmentData == null) {
                preTreatmentData = ImmutablePreTreatmentData.of(treatmentGiven, radiotherapyGiven, drugs, treatmentForm.status(), treatmentForm.locked());
            } else {
                LOGGER.warn("Multiple pre-therapy forms for found patient: " + patient.patientId());
            }
        }
    }
    return preTreatmentData != null ? preTreatmentData : ImmutablePreTreatmentData.of(null, null, Lists.newArrayList(), FormStatusState.UNKNOWN, false);
}
Also used : DrugData(com.hartwig.hmftools.patientdb.data.DrugData) ImmutableDrugData(com.hartwig.hmftools.patientdb.data.ImmutableDrugData) EcrfStudyEvent(com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent) EcrfForm(com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm) ImmutablePreTreatmentData(com.hartwig.hmftools.patientdb.data.ImmutablePreTreatmentData) PreTreatmentData(com.hartwig.hmftools.patientdb.data.PreTreatmentData) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with PreTreatmentData

use of com.hartwig.hmftools.patientdb.data.PreTreatmentData in project hmftools by hartwigmedical.

the class BaselineDataValidationTest method reportMissingPreTreatment.

@Test
public void reportMissingPreTreatment() {
    PreTreatmentData emptyData = ImmutablePreTreatmentData.builder().formLocked(false).formStatus(FormStatusState.UNKNOWN).build();
    assertEquals(2, PatientValidator.validatePreTreatmentData(PATIENT_IDENTIFIER, emptyData).size());
    PreTreatmentData actualData = ImmutablePreTreatmentData.builder().radiotherapyGiven("Yes").treatmentGiven("No").formLocked(false).formStatus(FormStatusState.UNKNOWN).build();
    assertEquals(0, PatientValidator.validatePreTreatmentData(PATIENT_IDENTIFIER, actualData).size());
    PreTreatmentData onlyRadioTherapyPresent = ImmutablePreTreatmentData.builder().radiotherapyGiven("Yes").formLocked(false).formStatus(FormStatusState.UNKNOWN).build();
    assertEquals(1, PatientValidator.validatePreTreatmentData(PATIENT_IDENTIFIER, onlyRadioTherapyPresent).size());
    PreTreatmentData onlyTreatmentPresent = ImmutablePreTreatmentData.builder().treatmentGiven("Yes").formLocked(false).formStatus(FormStatusState.UNKNOWN).build();
    assertEquals(1, PatientValidator.validatePreTreatmentData(PATIENT_IDENTIFIER, onlyTreatmentPresent).size());
}
Also used : ImmutablePreTreatmentData(com.hartwig.hmftools.patientdb.data.ImmutablePreTreatmentData) PreTreatmentData(com.hartwig.hmftools.patientdb.data.PreTreatmentData) Test(org.junit.Test)

Aggregations

PreTreatmentData (com.hartwig.hmftools.patientdb.data.PreTreatmentData)4 EcrfPatient (com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient)2 DrugData (com.hartwig.hmftools.patientdb.data.DrugData)2 ImmutablePreTreatmentData (com.hartwig.hmftools.patientdb.data.ImmutablePreTreatmentData)2 NotNull (org.jetbrains.annotations.NotNull)2 Test (org.junit.Test)2 CpctEcrfModel (com.hartwig.hmftools.common.ecrf.CpctEcrfModel)1 EcrfForm (com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm)1 EcrfStudyEvent (com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent)1 ValidationFinding (com.hartwig.hmftools.common.ecrf.datamodel.ValidationFinding)1 BaselineData (com.hartwig.hmftools.patientdb.data.BaselineData)1 BiopsyData (com.hartwig.hmftools.patientdb.data.BiopsyData)1 BiopsyTreatmentData (com.hartwig.hmftools.patientdb.data.BiopsyTreatmentData)1 BiopsyTreatmentResponseData (com.hartwig.hmftools.patientdb.data.BiopsyTreatmentResponseData)1 ImmutableDrugData (com.hartwig.hmftools.patientdb.data.ImmutableDrugData)1 Patient (com.hartwig.hmftools.patientdb.data.Patient)1 TumorMarkerData (com.hartwig.hmftools.patientdb.data.TumorMarkerData)1