Commit 381b966a authored by R.W.Majeed's avatar R.W.Majeed
Browse files

allow widetable immplementations without patient id column. in these cases,...

allow widetable immplementations without patient id column. in these cases, only visit id is used for matching
parent 1dd487ac
......@@ -251,7 +251,10 @@ public class FactGroupingQueue implements Supplier<Observation>{
continue; // index will now point to next table
}else if( row.getPatientId().equals(currentPatient.getPatientId()) && compareWithNulls(row.getVisitId(), currentVisitId) == 0 ){
}if( (row.getPatientId() == null || row.getPatientId().equals(currentPatient.getPatientId())) && compareWithNulls(row.getVisitId(), currentVisitId) == 0 ){
// if the row does not have a patient id, it is assumed that the visit id is unique and sufficient for matching
// if the row has both patient id and visit id, both are used for matching
// row fits into current group
// prefetch next row
......@@ -24,13 +24,15 @@ public class WideTable extends Table<WideRow> implements ConceptTable{
ColumnMap map = new ColumnMap(headers);
if( idat.patientId == null ){
throw new ParseException("datasource/wide-table/idat/patient-id column not specified");
// missing patientId column is allowed. In these cases visitId should be unique for identification
// TODO write INFO message that patient-id is not available and visit-id is used for matching
}else {
if( idat.visitId == null ){
throw new ParseException("datasource/wide-table/idat/visit-id column not specified");
for( Concept c : concepts ){
......@@ -45,8 +47,16 @@ public class WideTable extends Table<WideRow> implements ConceptTable{
public WideRow fillRecord(ColumnMap map, Object[] row, ObservationFactory factory) throws ParseException {
String patid = idat.patientId.valueOf(map, row);
String visit = idat.visitId.valueOf(map, row);
String patid;
if( idat.patientId == null ) {
// if there is no patient id in this table,
// we can get the patient id by lookup by visit
System.out.println("No patient");
patid = null;
}else {
patid = idat.patientId.valueOf(map, row);
WideRow rec = new WideRow(patid,visit);
for( Concept c : concepts ){
Observation o = c.createObservation(patid, visit, factory, map, row);
Supports Markdown
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