Search in sources :

Example 1 with TumorMarkerData

use of com.hartwig.hmftools.patientdb.data.TumorMarkerData 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 TumorMarkerData

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

the class TumorMarkerReader method read.

@NotNull
static List<TumorMarkerData> read(@NotNull final EcrfPatient patient) {
    final List<TumorMarkerData> tumorMarkers = Lists.newArrayList();
    for (final EcrfStudyEvent studyEvent : patient.studyEventsPerOID(STUDY_TREATMENT)) {
        for (final EcrfForm form : studyEvent.nonEmptyFormsPerOID(FORM_RESPONSE, false)) {
            for (final EcrfItemGroup responseGroup : form.nonEmptyItemGroupsPerOID(ITEMGROUP_RESPONSE, false)) {
                LocalDate date = responseGroup.readItemDate(FIELD_DATE, 0, DATE_FORMATTER, false);
                String marker = responseGroup.readItemString(FIELD_MARKER, 0, false);
                String measurement = responseGroup.readItemString(FIELD_MEASUREMENT, 0, false);
                String unit = responseGroup.readItemString(FIELD_UNIT, 0, false);
                tumorMarkers.add(ImmutableTumorMarkerData.of(patient.patientId(), date, marker, measurement, unit, form.status(), form.locked()));
            }
        }
    }
    return tumorMarkers;
}
Also used : EcrfStudyEvent(com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent) EcrfForm(com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm) EcrfItemGroup(com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup) TumorMarkerData(com.hartwig.hmftools.patientdb.data.TumorMarkerData) ImmutableTumorMarkerData(com.hartwig.hmftools.patientdb.data.ImmutableTumorMarkerData) LocalDate(java.time.LocalDate) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with TumorMarkerData

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

the class PatientReaderTest method canReadTumorMarkers.

@Test
public void canReadTumorMarkers() {
    final CpctEcrfModel model = loadTestEcrf();
    assertEquals(1, model.patientCount());
    final EcrfPatient cpctPatient = model.patients().iterator().next();
    final List<TumorMarkerData> tumorMarkers = TumorMarkerReader.read(cpctPatient);
    assertEquals(0, tumorMarkers.size());
}
Also used : TumorMarkerData(com.hartwig.hmftools.patientdb.data.TumorMarkerData) EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) CpctEcrfModel(com.hartwig.hmftools.common.ecrf.CpctEcrfModel) Test(org.junit.Test)

Aggregations

TumorMarkerData (com.hartwig.hmftools.patientdb.data.TumorMarkerData)3 EcrfPatient (com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient)2 NotNull (org.jetbrains.annotations.NotNull)2 CpctEcrfModel (com.hartwig.hmftools.common.ecrf.CpctEcrfModel)1 EcrfForm (com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm)1 EcrfItemGroup (com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)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 ImmutableTumorMarkerData (com.hartwig.hmftools.patientdb.data.ImmutableTumorMarkerData)1 Patient (com.hartwig.hmftools.patientdb.data.Patient)1 PreTreatmentData (com.hartwig.hmftools.patientdb.data.PreTreatmentData)1 LocalDate (java.time.LocalDate)1 Test (org.junit.Test)1