Search in sources :

Example 1 with DrugData

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

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

the class BiopsyTreatmentReader 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_SYSPOSTBIO, false)) {
        final LocalDate drugStart = itemGroup.readItemDate(FIELD_DRUG_START, 0, DATE_FORMATTER, false);
        final LocalDate drugEnd = itemGroup.readItemDate(FIELD_DRUG_END, 0, DATE_FORMATTER, false);
        String drugName = itemGroup.readItemString(FIELD_DRUG, 0, false);
        if (drugName == null || drugName.trim().toLowerCase().startsWith("other")) {
            drugName = itemGroup.readItemString(FIELD_DRUG_OTHER, 0, false);
        }
        final List<CuratedTreatment> curatedDrugs = drugName == null ? Lists.newArrayList() : treatmentCurator.search(drugName);
        drugs.add(ImmutableDrugData.of(drugName, drugStart, drugEnd, null, 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 3 with DrugData

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

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

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

Aggregations

DrugData (com.hartwig.hmftools.patientdb.data.DrugData)5 ImmutableDrugData (com.hartwig.hmftools.patientdb.data.ImmutableDrugData)4 NotNull (org.jetbrains.annotations.NotNull)4 EcrfForm (com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm)2 EcrfItemGroup (com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)2 EcrfStudyEvent (com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent)2 CuratedTreatment (com.hartwig.hmftools.patientdb.data.CuratedTreatment)2 PreTreatmentData (com.hartwig.hmftools.patientdb.data.PreTreatmentData)2 LocalDate (java.time.LocalDate)2 CpctEcrfModel (com.hartwig.hmftools.common.ecrf.CpctEcrfModel)1 EcrfPatient (com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient)1 BiopsyTreatmentData (com.hartwig.hmftools.patientdb.data.BiopsyTreatmentData)1 ImmutableBiopsyTreatmentData (com.hartwig.hmftools.patientdb.data.ImmutableBiopsyTreatmentData)1 ImmutablePreTreatmentData (com.hartwig.hmftools.patientdb.data.ImmutablePreTreatmentData)1 Test (org.junit.Test)1