Search in sources :

Example 6 with EcrfItemGroup

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

the class CpctPatientReader method setDeathData.

private static void setDeathData(@NotNull final ImmutableBaselineData.Builder builder, @NotNull final EcrfPatient patient) {
    for (final EcrfStudyEvent endStudyEvent : patient.studyEventsPerOID(STUDY_ENDSTUDY)) {
        for (final EcrfForm deathForm : endStudyEvent.nonEmptyFormsPerOID(FORM_DEATH, false)) {
            for (final EcrfItemGroup deathItemGroup : deathForm.nonEmptyItemGroupsPerOID(ITEMGROUP_DEATH, false)) {
                builder.deathDate(deathItemGroup.readItemDate(FIELD_DEATH_DATE, 0, DATE_FORMATTER, false));
                builder.deathStatus(deathForm.status());
                builder.deathLocked(deathForm.locked());
            }
        }
    }
}
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)

Example 7 with EcrfItemGroup

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

the class PreTreatmentReader method readDrugs.

@NotNull
private List<DrugData> readDrugs(@NotNull final EcrfForm treatmentForm) throws IOException {
    final List<DrugData> drugs = Lists.newArrayList();
    for (final EcrfItemGroup itemGroup : treatmentForm.nonEmptyItemGroupsPerOID(ITEMGROUP_DRUGS, false)) {
        final LocalDate drugStart = itemGroup.readItemDate(FIELD_PRE_DRUG_START, 0, DATE_FORMATTER, false);
        final LocalDate drugEnd = itemGroup.readItemDate(FIELD_PRE_DRUG_END, 0, DATE_FORMATTER, false);
        final String drugName = itemGroup.readItemString(FIELD_PRE_DRUG, 0, false);
        final String bestResponse = itemGroup.readItemString(FIELD_PRE_BEST_RESPONSE, 0, false);
        final List<CuratedTreatment> curatedDrugs = drugName == null ? Lists.newArrayList() : treatmentCurator.search(drugName);
        drugs.add(ImmutableDrugData.of(drugName, drugStart, drugEnd, bestResponse, curatedDrugs));
    }
    return drugs;
}
Also used : DrugData(com.hartwig.hmftools.patientdb.data.DrugData) ImmutableDrugData(com.hartwig.hmftools.patientdb.data.ImmutableDrugData) CuratedTreatment(com.hartwig.hmftools.patientdb.data.CuratedTreatment) EcrfItemGroup(com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup) LocalDate(java.time.LocalDate) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with EcrfItemGroup

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

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

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

EcrfItemGroup (com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)13 EcrfForm (com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm)11 NotNull (org.jetbrains.annotations.NotNull)8 EcrfStudyEvent (com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent)7 LocalDate (java.time.LocalDate)6 EcrfPatient (com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient)3 List (java.util.List)3 CuratedTreatment (com.hartwig.hmftools.patientdb.data.CuratedTreatment)2 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 BiopsyTreatmentResponseData (com.hartwig.hmftools.patientdb.data.BiopsyTreatmentResponseData)1 ImmutableBiopsyData (com.hartwig.hmftools.patientdb.data.ImmutableBiopsyData)1 ImmutableBiopsyTreatmentResponseData (com.hartwig.hmftools.patientdb.data.ImmutableBiopsyTreatmentResponseData)1