use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class PatientReaderTest method canReadCpctPatientBiopsies.
@Test
public void canReadCpctPatientBiopsies() {
final CpctEcrfModel model = loadTestEcrf();
assertEquals(1, model.patientCount());
final EcrfPatient cpctPatient = model.patients().iterator().next();
final List<BiopsyData> biopsies = BiopsyReader.read(cpctPatient);
assertEquals(1, biopsies.size());
assertEquals("Soft tissue", biopsies.get(0).site());
assertEquals("near right scapula", biopsies.get(0).location());
assertEquals(LocalDate.parse("2012-02-17", DATE_FORMATTER), biopsies.get(0).date());
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class CpctEcrfModel method loadFromXML.
@NotNull
public static CpctEcrfModel loadFromXML(@NotNull final String ecrfXmlPath, @NotNull final FormStatusModel formStatusModel) throws XMLStreamException, FileNotFoundException {
final XMLInputFactory factory = XMLInputFactory.newInstance();
final XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(ecrfXmlPath));
final XMLEcrfDatamodel datamodel = XMLEcrfDatamodelReader.readXMLDatamodel(reader);
final Iterable<EcrfPatient> patients = XMLPatientReader.readPatients(reader, datamodel, formStatusModel);
return new CpctEcrfModel(datamodel, patients);
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class BiopsyTreatmentResponseReaderTest method buildTestPatient.
@NotNull
private static EcrfPatient buildTestPatient() {
final String patient = "dummy";
EcrfItemGroup response1 = new EcrfItemGroup(patient);
response1.addItem(BiopsyTreatmentResponseReader.FIELD_MEASUREMENT_DONE, "Yes");
response1.addItem(BiopsyTreatmentResponseReader.FIELD_RESPONSE, "PR");
EcrfForm form1 = new EcrfForm(patient, FormStatusState.SAVED, true);
form1.addItemGroup(BiopsyTreatmentResponseReader.ITEMGROUP_TUMOR_MEASUREMENT, response1);
EcrfItemGroup response2 = new EcrfItemGroup(patient);
EcrfForm form2 = new EcrfForm(patient, FormStatusState.SAVED, true);
form1.addItemGroup(BiopsyTreatmentResponseReader.ITEMGROUP_TUMOR_MEASUREMENT, response2);
EcrfStudyEvent studyEvent = new EcrfStudyEvent(patient);
studyEvent.addForm(BiopsyTreatmentResponseReader.FORM_TUMOR_MEASUREMENT, form1);
studyEvent.addForm(BiopsyTreatmentResponseReader.FORM_TUMOR_MEASUREMENT, form2);
Map<String, List<EcrfStudyEvent>> studyEvents = Maps.newHashMap();
studyEvents.put(BiopsyTreatmentResponseReader.STUDY_TREATMENT, Lists.newArrayList(studyEvent));
return new EcrfPatient(patient, studyEvents, Lists.newArrayList());
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient 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());
}
use of com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient in project hmftools by hartwigmedical.
the class PatientReaderTest method canReadCpctPatientInfo.
@Test
public void canReadCpctPatientInfo() {
final CpctEcrfModel model = loadTestEcrf();
assertEquals(1, model.patientCount());
final EcrfPatient cpctPatient = model.patients().iterator().next();
final CpctPatientReader cpctPatientReader = new CpctPatientReader(model, createTumorLocationCurator());
final BaselineData baselineData = cpctPatientReader.read(cpctPatient);
assertEquals("Breast cancer", baselineData.cancerType().searchTerm());
assertEquals("Breast", baselineData.cancerType().category());
assertEquals("Breast Cancer: subtype unknown", baselineData.cancerType().subcategory());
assertEquals("female", baselineData.gender());
assertEquals("Bernhoven uden", baselineData.hospital());
assertEquals(new Integer(1963), baselineData.birthYear());
assertEquals(LocalDate.parse("2012-06-22", DATE_FORMATTER), baselineData.deathDate());
assertEquals(LocalDate.parse("2012-02-17", DATE_FORMATTER), baselineData.registrationDate());
assertEquals(LocalDate.parse("2012-02-17", DATE_FORMATTER), baselineData.informedConsentDate());
}
Aggregations