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);
}
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;
}
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;
}
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());
}
}
}
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());
}
}
}
Aggregations