Search in sources :

Example 6 with EcrfForm

use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm 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 7 with EcrfForm

use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm 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 8 with EcrfForm

use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm in project hmftools by hartwigmedical.

the class BiopsyTreatmentReader method read.

@NotNull
List<BiopsyTreatmentData> read(@NotNull final EcrfPatient patient) throws IOException {
    final List<BiopsyTreatmentData> treatments = Lists.newArrayList();
    for (final EcrfStudyEvent studyEvent : patient.studyEventsPerOID(STUDY_AFTERBIOPT)) {
        for (final EcrfForm treatmentForm : studyEvent.nonEmptyFormsPerOID(FORM_TREATMENT, false)) {
            final String treatmentGiven = readTreatmentGiven(treatmentForm);
            final String radiotherapyGiven = readRadiotherapyGiven(treatmentForm);
            final List<DrugData> drugs = readDrugs(treatmentForm);
            treatments.add(ImmutableBiopsyTreatmentData.of(treatmentGiven, radiotherapyGiven, drugs, treatmentForm.status(), treatmentForm.locked()));
        }
    }
    return treatments;
}
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) ImmutableBiopsyTreatmentData(com.hartwig.hmftools.patientdb.data.ImmutableBiopsyTreatmentData) BiopsyTreatmentData(com.hartwig.hmftools.patientdb.data.BiopsyTreatmentData) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with EcrfForm

use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm in project hmftools by hartwigmedical.

the class CpctPatientReader method setInformedConsent.

private void setInformedConsent(@NotNull final ImmutableBaselineData.Builder builder, @NotNull final EcrfStudyEvent studyEvent) {
    for (final EcrfForm informedConsentForm : studyEvent.nonEmptyFormsPerOID(FORM_INFORMED_CONSENT, false)) {
        for (final EcrfItemGroup informedConsentItemGroup : informedConsentForm.nonEmptyItemGroupsPerOID(ITEMGROUP_INFORMED_CONSENT, false)) {
            builder.informedConsentDate(informedConsentItemGroup.readItemDate(FIELD_INFORMED_CONSENT_DATE, 0, DATE_FORMATTER, false));
            builder.informedConsentStatus(informedConsentForm.status());
            builder.informedConsentLocked(informedConsentForm.locked());
        }
    }
}
Also used : EcrfForm(com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm) EcrfItemGroup(com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)

Example 10 with EcrfForm

use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm in project hmftools by hartwigmedical.

the class CpctPatientReader method setPrimaryTumorData.

private void setPrimaryTumorData(@NotNull final ImmutableBaselineData.Builder builder, @NotNull final EcrfStudyEvent studyEvent) {
    for (final EcrfForm carcinomaForm : studyEvent.nonEmptyFormsPerOID(FORM_CARCINOMA, false)) {
        for (final EcrfItemGroup carcinomaItemGroup : carcinomaForm.nonEmptyItemGroupsPerOID(ITEMGROUP_CARCINOMA, false)) {
            String primaryTumorLocation = carcinomaItemGroup.readItemString(FIELD_PRIMARY_TUMOR_LOCATION, 0, false);
            if (primaryTumorLocation != null && primaryTumorLocation.trim().toLowerCase().startsWith("other")) {
                primaryTumorLocation = carcinomaItemGroup.readItemString(FIELD_PRIMARY_TUMOR_LOCATION_OTHER, 0, false);
            }
            builder.cancerType(tumorLocationCurator.search(primaryTumorLocation));
            builder.primaryTumorStatus(carcinomaForm.status());
            builder.primaryTumorLocked(carcinomaForm.locked());
        }
    }
}
Also used : EcrfForm(com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm) EcrfItemGroup(com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)

Aggregations

EcrfForm (com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm)13 EcrfItemGroup (com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)11 EcrfStudyEvent (com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent)9 NotNull (org.jetbrains.annotations.NotNull)8 LocalDate (java.time.LocalDate)4 EcrfPatient (com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient)3 List (java.util.List)3 DrugData (com.hartwig.hmftools.patientdb.data.DrugData)2 ImmutableDrugData (com.hartwig.hmftools.patientdb.data.ImmutableDrugData)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 EcrfDataField (com.hartwig.hmftools.common.ecrf.datamodel.EcrfDataField)1 EcrfResolveException (com.hartwig.hmftools.common.ecrf.datamodel.EcrfResolveException)1 FormStatusData (com.hartwig.hmftools.common.ecrf.formstatus.FormStatusData)1 FormStatusKey (com.hartwig.hmftools.common.ecrf.formstatus.FormStatusKey)1 ImmutableFormStatusKey (com.hartwig.hmftools.common.ecrf.formstatus.ImmutableFormStatusKey)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 ImmutableBiopsyData (com.hartwig.hmftools.patientdb.data.ImmutableBiopsyData)1 ImmutableBiopsyTreatmentData (com.hartwig.hmftools.patientdb.data.ImmutableBiopsyTreatmentData)1