Loading histream-import/TODO.txt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -3,3 +3,8 @@ Validate exceptions test for specific errors in data files, test for specific errors in data files, e.g. missing visit start timestamps in rows. e.g. missing visit start timestamps in rows. To do so, add data files with errors to test/resources To do so, add data files with errors to test/resources Import configuration -------------------- Allow multiple visit tables with different IDs. Fact tables can choose which visit table to reference. e.g. <visit-id table="1">fallnr</visit-id> No newline at end of file histream-import/src/main/java/de/sekmi/histream/etl/ETLObservationSupplier.java +13 −5 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ import de.sekmi.histream.Observation; import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationSupplier; import de.sekmi.histream.ObservationSupplier; import de.sekmi.histream.etl.config.DataSource; import de.sekmi.histream.etl.config.DataSource; import de.sekmi.histream.etl.config.EavTable; import de.sekmi.histream.etl.config.Meta; import de.sekmi.histream.etl.config.Meta; import de.sekmi.histream.etl.config.PatientTable; import de.sekmi.histream.etl.config.PatientTable; import de.sekmi.histream.etl.config.VisitTable; import de.sekmi.histream.etl.config.VisitTable; Loading Loading @@ -62,10 +63,11 @@ public class ETLObservationSupplier implements ObservationSupplier{ private PatientTable pt; private PatientTable pt; private VisitTable vt; private VisitTable vt; private List<WideTable> wt; private List<WideTable> wt; private List<EavTable> et; private RecordSupplier<PatientRow> pr; private RecordSupplier<PatientRow> pr; private RecordSupplier<VisitRow> vr; private RecordSupplier<VisitRow> vr; private List<RecordSupplier<WideRow>> wr; private List<RecordSupplier<? extends FactRow>> fr; private FactGroupingQueue queue; private FactGroupingQueue queue; Loading Loading @@ -118,6 +120,7 @@ public class ETLObservationSupplier implements ObservationSupplier{ pt = ds.getPatientTable(); pt = ds.getPatientTable(); vt = ds.getVisitTable(); vt = ds.getVisitTable(); wt = ds.getWideTables(); wt = ds.getWideTables(); et = ds.getEavTables(); // TODO long tables // TODO long tables Meta meta = ds.getMeta(); Meta meta = ds.getMeta(); Loading @@ -131,12 +134,17 @@ public class ETLObservationSupplier implements ObservationSupplier{ factory.getExtensionAccessor(Visit.class)); factory.getExtensionAccessor(Visit.class)); // open all tables // open all tables wr = new ArrayList<>(wt.size()); fr = new ArrayList<>(wt.size()); for( WideTable t : wt ){ for( WideTable t : wt ){ //@SuppressWarnings("resource") //@SuppressWarnings("resource") RecordSupplier<WideRow> s = t.open(factory, meta); RecordSupplier<WideRow> s = t.open(factory, meta); queue.addFactTable(s); queue.addFactTable(s); wr.add(s); fr.add(s); } for( EavTable t : et ){ RecordSupplier<EavRow> s = t.open(factory, meta); queue.addFactTable(s); fr.add(s); } } queue.prepare(); queue.prepare(); Loading Loading @@ -184,8 +192,8 @@ public class ETLObservationSupplier implements ObservationSupplier{ } } vr=null; vr=null; } } if( wr != null ){ if( fr != null ){ Iterator<RecordSupplier<WideRow>> i = wr.iterator(); Iterator<RecordSupplier<? extends FactRow>> i = fr.iterator(); while( i.hasNext() ){ while( i.hasNext() ){ try{ i.next().close(); } try{ i.next().close(); } catch( IOException e ){ catch( IOException e ){ Loading histream-import/src/main/java/de/sekmi/histream/etl/EavRow.java 0 → 100644 +32 −0 Original line number Original line Diff line number Diff line package de.sekmi.histream.etl; import java.util.Arrays; import java.util.List; import de.sekmi.histream.Observation; /** * Row from EAV table. Per definition, only * a single fact per row is contained. * * @author R.W.Majeed * */ public class EavRow implements FactRow { private Observation fact; public EavRow(Observation fact){ this.fact = fact; } @Override public List<Observation> getFacts() { return Arrays.asList(fact); } @Override public String getPatientId() {return fact.getPatientId();} @Override public String getVisitId() {return fact.getEncounterId();} } histream-import/src/main/java/de/sekmi/histream/etl/WideRow.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,13 @@ import java.util.List; import de.sekmi.histream.Observation; import de.sekmi.histream.Observation; /** * Wide fact row which. A single wide row * may contain multiple facts. * * @author R.W.Majeed * */ public class WideRow implements FactRow{ public class WideRow implements FactRow{ private String patid; private String patid; private String visit; private String visit; Loading histream-import/src/main/java/de/sekmi/histream/etl/config/DataSource.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,9 @@ public class DataSource { @XmlElement(name="wide-table") @XmlElement(name="wide-table") WideTable[] wideTables; WideTable[] wideTables; @XmlElement(name="eav-table") EavTable[] eavTables; public Meta getMeta(){return meta;} public Meta getMeta(){return meta;} public PatientTable getPatientTable(){ public PatientTable getPatientTable(){ Loading @@ -58,4 +61,8 @@ public class DataSource { return Arrays.asList(wideTables); return Arrays.asList(wideTables); } } public List<EavTable> getEavTables(){ return Arrays.asList(eavTables); } } } Loading
histream-import/TODO.txt +5 −0 Original line number Original line Diff line number Diff line Loading @@ -3,3 +3,8 @@ Validate exceptions test for specific errors in data files, test for specific errors in data files, e.g. missing visit start timestamps in rows. e.g. missing visit start timestamps in rows. To do so, add data files with errors to test/resources To do so, add data files with errors to test/resources Import configuration -------------------- Allow multiple visit tables with different IDs. Fact tables can choose which visit table to reference. e.g. <visit-id table="1">fallnr</visit-id> No newline at end of file
histream-import/src/main/java/de/sekmi/histream/etl/ETLObservationSupplier.java +13 −5 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ import de.sekmi.histream.Observation; import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationSupplier; import de.sekmi.histream.ObservationSupplier; import de.sekmi.histream.etl.config.DataSource; import de.sekmi.histream.etl.config.DataSource; import de.sekmi.histream.etl.config.EavTable; import de.sekmi.histream.etl.config.Meta; import de.sekmi.histream.etl.config.Meta; import de.sekmi.histream.etl.config.PatientTable; import de.sekmi.histream.etl.config.PatientTable; import de.sekmi.histream.etl.config.VisitTable; import de.sekmi.histream.etl.config.VisitTable; Loading Loading @@ -62,10 +63,11 @@ public class ETLObservationSupplier implements ObservationSupplier{ private PatientTable pt; private PatientTable pt; private VisitTable vt; private VisitTable vt; private List<WideTable> wt; private List<WideTable> wt; private List<EavTable> et; private RecordSupplier<PatientRow> pr; private RecordSupplier<PatientRow> pr; private RecordSupplier<VisitRow> vr; private RecordSupplier<VisitRow> vr; private List<RecordSupplier<WideRow>> wr; private List<RecordSupplier<? extends FactRow>> fr; private FactGroupingQueue queue; private FactGroupingQueue queue; Loading Loading @@ -118,6 +120,7 @@ public class ETLObservationSupplier implements ObservationSupplier{ pt = ds.getPatientTable(); pt = ds.getPatientTable(); vt = ds.getVisitTable(); vt = ds.getVisitTable(); wt = ds.getWideTables(); wt = ds.getWideTables(); et = ds.getEavTables(); // TODO long tables // TODO long tables Meta meta = ds.getMeta(); Meta meta = ds.getMeta(); Loading @@ -131,12 +134,17 @@ public class ETLObservationSupplier implements ObservationSupplier{ factory.getExtensionAccessor(Visit.class)); factory.getExtensionAccessor(Visit.class)); // open all tables // open all tables wr = new ArrayList<>(wt.size()); fr = new ArrayList<>(wt.size()); for( WideTable t : wt ){ for( WideTable t : wt ){ //@SuppressWarnings("resource") //@SuppressWarnings("resource") RecordSupplier<WideRow> s = t.open(factory, meta); RecordSupplier<WideRow> s = t.open(factory, meta); queue.addFactTable(s); queue.addFactTable(s); wr.add(s); fr.add(s); } for( EavTable t : et ){ RecordSupplier<EavRow> s = t.open(factory, meta); queue.addFactTable(s); fr.add(s); } } queue.prepare(); queue.prepare(); Loading Loading @@ -184,8 +192,8 @@ public class ETLObservationSupplier implements ObservationSupplier{ } } vr=null; vr=null; } } if( wr != null ){ if( fr != null ){ Iterator<RecordSupplier<WideRow>> i = wr.iterator(); Iterator<RecordSupplier<? extends FactRow>> i = fr.iterator(); while( i.hasNext() ){ while( i.hasNext() ){ try{ i.next().close(); } try{ i.next().close(); } catch( IOException e ){ catch( IOException e ){ Loading
histream-import/src/main/java/de/sekmi/histream/etl/EavRow.java 0 → 100644 +32 −0 Original line number Original line Diff line number Diff line package de.sekmi.histream.etl; import java.util.Arrays; import java.util.List; import de.sekmi.histream.Observation; /** * Row from EAV table. Per definition, only * a single fact per row is contained. * * @author R.W.Majeed * */ public class EavRow implements FactRow { private Observation fact; public EavRow(Observation fact){ this.fact = fact; } @Override public List<Observation> getFacts() { return Arrays.asList(fact); } @Override public String getPatientId() {return fact.getPatientId();} @Override public String getVisitId() {return fact.getEncounterId();} }
histream-import/src/main/java/de/sekmi/histream/etl/WideRow.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,13 @@ import java.util.List; import de.sekmi.histream.Observation; import de.sekmi.histream.Observation; /** * Wide fact row which. A single wide row * may contain multiple facts. * * @author R.W.Majeed * */ public class WideRow implements FactRow{ public class WideRow implements FactRow{ private String patid; private String patid; private String visit; private String visit; Loading
histream-import/src/main/java/de/sekmi/histream/etl/config/DataSource.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,9 @@ public class DataSource { @XmlElement(name="wide-table") @XmlElement(name="wide-table") WideTable[] wideTables; WideTable[] wideTables; @XmlElement(name="eav-table") EavTable[] eavTables; public Meta getMeta(){return meta;} public Meta getMeta(){return meta;} public PatientTable getPatientTable(){ public PatientTable getPatientTable(){ Loading @@ -58,4 +61,8 @@ public class DataSource { return Arrays.asList(wideTables); return Arrays.asList(wideTables); } } public List<EavTable> getEavTables(){ return Arrays.asList(eavTables); } } }