Commit 772d028f authored by R.W.Majeed's avatar R.W.Majeed

Added given-name, surname to PatientÃ

parent e7656201
......@@ -33,7 +33,7 @@
<visit>
<patid>XX12345</patid>
<surname>Dampf</surname>
<names>A</names>
<names>A B</names>
<birthdate>2001-01-01</birthdate>
<deathdate>2020</deathdate>
<sex>F</sex>
......
......@@ -29,9 +29,9 @@
<!-- weitere metadaten nötig? wertebereich, datentypen, ontologie, ...? -->
</meta>
<patient id="XX12345"><!--
<patient id="XX12345">
<given-name>A B</given-name>
<surname>Dampf</surname>
<given-name>A</given-name> -->
<gender>Female</gender>
<birthdate>2001-01-01</birthdate>
<deathdate>2020</deathdate>
......
......@@ -45,6 +45,12 @@ public interface Patient extends IdExtensionType, ExternalSourceType{
Sex getSex();
void setSex(Sex sex);
String getSurname();
void setSurname(String surname);
String getGivenName();
void setGivenName(String givenName);
public enum Sex{
Female, Male
}
......
......@@ -35,6 +35,7 @@ public class PatientImpl extends StoredExtensionType implements Patient {
private DateTimeAccuracy birthDate;
private DateTimeAccuracy deathDate;
private Sex sex;
private String surname, givenName;
public PatientImpl(){
......@@ -78,5 +79,25 @@ public class PatientImpl extends StoredExtensionType implements Patient {
this.sex = sex;
}
@Override
public String getSurname() {
return surname;
}
@Override
public void setSurname(String surname) {
this.surname = surname;
}
@Override
public String getGivenName() {
return givenName;
}
@Override
public void setGivenName(String givenName) {
this.givenName = givenName;
}
}
......@@ -280,10 +280,10 @@ public class FlatObservationSupplier extends AbstractObservationParser implement
currentPatient.setSex(sex);
break;
case PatientNames:
// TODO
currentPatient.setGivenName(record.getValue());
break;
case PatientSurname:
// TODO
currentPatient.setSurname(record.getValue());
break;
case Visit:
lazyCreateVisit(record.getVisitID(), record.getPatID());
......
......@@ -212,9 +212,26 @@ public class GroupedXMLWriter extends GroupedObservationHandler{
formatPush();
// TODO: how write dedicated source information
// write surname
// write given name
if( patient.getGivenName() != null ){
formatIndent();
writer.writeStartElement("given-name");
writer.writeCharacters(patient.getGivenName());
writer.writeEndElement();
formatNewline();
}
// write surname
if( patient.getSurname() != null ){
formatIndent();
writer.writeStartElement("surname");
writer.writeCharacters(patient.getSurname());
writer.writeEndElement();
formatNewline();
}
// gender
if( patient.getSex() != null ){
formatIndent();
......
......@@ -124,6 +124,13 @@ public class JAXBObservationSupplier implements ObservationSupplier {
if( patientData.containsKey("gender") ){
currentPatient.setSex(Sex.valueOf(patientData.get("gender")));
}
if( patientData.containsKey("surname") ){
currentPatient.setSurname(patientData.get("surname"));
}
if( patientData.containsKey("given-name") ){
currentPatient.setGivenName(patientData.get("given-name"));
}
}
/**
* Reads encounter element with content.
......
......@@ -168,7 +168,9 @@ class XMLObservationParser extends AbstractObservationParser{
patient.setBirthDate(birthDate);
patient.setDeathDate(deathDate);
patient.setSex(sex);
// TODO set name, surname, etc.
// set names, surname, etc.
patient.setGivenName(visitData.get("names"));
patient.setSurname(visitData.get("surname"));
}
}else{
fact.setExtension(Patient.class, patient);
......
......@@ -86,6 +86,8 @@ public class FileObservationProviderTest {
Assert.assertEquals(DateTimeAccuracy.parsePartialIso8601("2001-01-01"), p.getBirthDate());
Assert.assertEquals(DateTimeAccuracy.parsePartialIso8601("2020"), p.getDeathDate());
Assert.assertEquals(Sex.Female, p.getSex());
Assert.assertEquals("A B", p.getGivenName());
Assert.assertEquals("Dampf", p.getSurname());
// TODO: test more patient information
Visit v = o.getExtension(Visit.class);
......
......@@ -86,6 +86,8 @@ public class FactGroupingQueue{
currentPatientInstance.setBirthDate(currentPatient.getBirthDate());
currentPatientInstance.setDeathDate(currentPatient.getDeathDate());
currentPatientInstance.setSex(currentPatient.getSex());
currentPatientInstance.setSurname(currentPatient.getSurname());
currentPatientInstance.setGivenName(currentPatient.getGivenName());
// TODO sync patient with extension factory / add fields
addFactsToWorkQueue(currentPatient);
......
......@@ -14,19 +14,13 @@ import de.sekmi.histream.impl.PatientImpl;
*
*/
public class PatientRow extends PatientImpl implements FactRow{
String firstname;
String lastname;
// TODO concepts
List<Observation> facts;
private List<Observation> facts;
public void setNames(String first, String last){
this.firstname = first;
this.lastname = last;
public PatientRow(){
this.facts = new ArrayList<>();
}
@Override
public List<Observation> getFacts() {
return facts;
......
......@@ -29,7 +29,8 @@ public class PatientTable extends Table<PatientRow> implements ConceptTable{
@XmlAccessorType(XmlAccessType.FIELD)
public static class IDAT extends IdatColumns{
StringColumn firstname;
@XmlElement(name="given-name")
StringColumn givenName;
StringColumn surname;
DateTimeColumn birthdate;
DateTimeColumn deathdate;
......@@ -42,7 +43,7 @@ public class PatientTable extends Table<PatientRow> implements ConceptTable{
ColumnMap map = new ColumnMap(headers);
map.registerColumn(idat.patientId);
map.registerColumn(idat.firstname);
map.registerColumn(idat.givenName);
map.registerColumn(idat.surname);
map.registerColumn(idat.birthdate);
map.registerColumn(idat.deathdate);
......@@ -56,7 +57,8 @@ public class PatientTable extends Table<PatientRow> implements ConceptTable{
public PatientRow fillRecord(ColumnMap map, Object[] row, ObservationFactory factory) throws ParseException {
PatientRow patient = new PatientRow();
patient.setId(idat.patientId.valueOf(map, row));
patient.setNames(idat.firstname.valueOf(map, row), idat.surname.valueOf(map, row));
patient.setGivenName(idat.givenName.valueOf(map, row));
patient.setSurname(idat.surname.valueOf(map, row));
patient.setBirthDate(idat.birthdate.valueOf(map, row));
patient.setDeathDate(idat.deathdate.valueOf(map, row));
// concepts
......
......@@ -84,6 +84,8 @@ public class TestETLSupplier {
Assert.assertEquals(DateTimeAccuracy.parsePartialIso8601("2003-02-11"), p.getDeathDate());
// TODO verify other patient information
Assert.assertEquals("v1", p.getGivenName());
Assert.assertEquals("n1", p.getSurname());
}
@Test
......
......@@ -30,6 +30,9 @@ public class TestMarshall {
Assert.assertEquals("patid",ds.patientTable.idat.patientId.name);
Assert.assertEquals("geburtsdatum",ds.patientTable.idat.birthdate.name);
Assert.assertEquals("geschlecht",ds.patientTable.idat.gender.name);
Assert.assertEquals("vorname",ds.patientTable.idat.givenName.name);
Assert.assertEquals("nachname",ds.patientTable.idat.surname.name);
// visit table
Assert.assertNotNull(ds.visitTable);
Assert.assertNotNull(ds.visitTable.source);
......
......@@ -12,7 +12,7 @@
</source>
<idat>
<patient-id>patid</patient-id>
<firstname>vorname</firstname>
<given-name>vorname</given-name>
<surname>nachname</surname>
<birthdate format="d.M.u" na="">geburtsdatum</birthdate>
<deathdate format="d.M.u" na="">verstorben</deathdate>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment