Commit eb2ab501 authored by R.W.Majeed's avatar R.W.Majeed

load observation source

parent 0f1a6383
......@@ -10,6 +10,7 @@ import de.sekmi.histream.DateTimeAccuracy;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ObservationSupplier;
import de.sekmi.histream.Value;
import de.sekmi.histream.impl.ExternalSourceImpl;
/**
* Retrieves observations from i2b2. See {@link I2b2ExtractorFactory}.
......@@ -83,6 +84,8 @@ public class I2b2Extractor implements ObservationSupplier {
String lid;
Timestamp start;
Timestamp end;
Timestamp source_ts;
String source_cd;
}
private Row loadRow() throws SQLException{
Row row = new Row();
......@@ -98,6 +101,9 @@ public class I2b2Extractor implements ObservationSupplier {
row.lid = factory.dialect.decodeLocationCd(rs.getString(7)); // location id
row.start = rs.getTimestamp(8);
row.end = rs.getTimestamp(9);
// need source
row.source_ts = rs.getTimestamp(15);
row.source_cd = rs.getString(16);
return row;
}
private Value createValue(Row row){
......@@ -114,6 +120,8 @@ public class I2b2Extractor implements ObservationSupplier {
if( row.lid != null ){
o.setLocationId(row.lid);
}
// TODO try to cache external source if same as previous
o.setSource(new ExternalSourceImpl(row.source_cd, row.source_ts.toInstant()));
// TODO more properties
return o;
}
......
......@@ -47,7 +47,7 @@ public class I2b2ExtractorFactory implements AutoCloseable, ObservationExtractor
public static String ALLOW_WILDCARD_CONCEPT_CODES = "de.sekmi.histream.i2b2.wildcard_concepts";
private static String SELECT_PARAMETERS = "f.patient_num, f.encounter_num, f.instance_num, f.concept_cd, f.modifier_cd, f.provider_id, f.location_cd, f.start_date, f.end_date, RTRIM(f.valtype_cd) valtype_cd, f.tval_char, f.nval_num, RTRIM(f.valueflag_cd) valueflag_cd, f.units_cd, f.sourcesystem_cd";
private static String SELECT_PARAMETERS = "f.patient_num, f.encounter_num, f.instance_num, f.concept_cd, f.modifier_cd, f.provider_id, f.location_cd, f.start_date, f.end_date, RTRIM(f.valtype_cd) valtype_cd, f.tval_char, f.nval_num, RTRIM(f.valueflag_cd) valueflag_cd, f.units_cd, f.download_date, f.sourcesystem_cd";
private static String SELECT_TABLE = "observation_fact f";
//private static String SELECT_ORDER_CHRONO = "ORDER BY start_date, patient_num, encounter_num, instance_num, modifier_cd NULLS FIRST";
private static String SELECT_ORDER_GROUP = "ORDER BY f.patient_num, f.encounter_num, f.start_date, f.instance_num, f.concept_cd, f.modifier_cd NULLS FIRST";
......
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