Search in sources :

Example 6 with EcrfPatient

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());
}
Also used : EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) BiopsyData(com.hartwig.hmftools.patientdb.data.BiopsyData) CpctEcrfModel(com.hartwig.hmftools.common.ecrf.CpctEcrfModel) Test(org.junit.Test)

Example 7 with EcrfPatient

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);
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) XMLEcrfDatamodel(com.hartwig.hmftools.common.ecrf.reader.XMLEcrfDatamodel) EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) XMLInputFactory(javax.xml.stream.XMLInputFactory) FileInputStream(java.io.FileInputStream) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with EcrfPatient

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());
}
Also used : EcrfStudyEvent(com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent) EcrfItemGroup(com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup) EcrfForm(com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm) List(java.util.List) EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) Assert.assertNotNull(org.junit.Assert.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with EcrfPatient

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());
}
Also used : TumorMarkerData(com.hartwig.hmftools.patientdb.data.TumorMarkerData) EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) CpctEcrfModel(com.hartwig.hmftools.common.ecrf.CpctEcrfModel) Test(org.junit.Test)

Example 10 with EcrfPatient

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());
}
Also used : EcrfPatient(com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient) BaselineData(com.hartwig.hmftools.patientdb.data.BaselineData) CpctEcrfModel(com.hartwig.hmftools.common.ecrf.CpctEcrfModel) Test(org.junit.Test)

Aggregations

EcrfPatient (com.hartwig.hmftools.common.ecrf.datamodel.EcrfPatient)15 Test (org.junit.Test)8 NotNull (org.jetbrains.annotations.NotNull)7 CpctEcrfModel (com.hartwig.hmftools.common.ecrf.CpctEcrfModel)6 EcrfForm (com.hartwig.hmftools.common.ecrf.datamodel.EcrfForm)3 EcrfItemGroup (com.hartwig.hmftools.common.ecrf.datamodel.EcrfItemGroup)3 EcrfStudyEvent (com.hartwig.hmftools.common.ecrf.datamodel.EcrfStudyEvent)3 FileInputStream (java.io.FileInputStream)3 List (java.util.List)3 XMLInputFactory (javax.xml.stream.XMLInputFactory)3 XMLStreamReader (javax.xml.stream.XMLStreamReader)3 ImmutableFormStatusModel (com.hartwig.hmftools.common.ecrf.formstatus.ImmutableFormStatusModel)2 BaselineData (com.hartwig.hmftools.patientdb.data.BaselineData)2 BiopsyData (com.hartwig.hmftools.patientdb.data.BiopsyData)2 BiopsyTreatmentData (com.hartwig.hmftools.patientdb.data.BiopsyTreatmentData)2 BiopsyTreatmentResponseData (com.hartwig.hmftools.patientdb.data.BiopsyTreatmentResponseData)2 Patient (com.hartwig.hmftools.patientdb.data.Patient)2 PreTreatmentData (com.hartwig.hmftools.patientdb.data.PreTreatmentData)2 TumorMarkerData (com.hartwig.hmftools.patientdb.data.TumorMarkerData)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2