public class I2b2Inserter extends AbstractObservationHandler implements ObservationHandler, Closeable, Plugin
Need to specify default provider id for i2b2 in property 'nullProvider'. Null values in providerId will be be replaced with this value and stored in provider_id column.
locationId is stored as location_cd, null-values are stored as '@'.
valtype_cd: N numeric, B stored in observation_blob, T text, '@' no value, 'NLP' NLP result xml objects. Undocumented but used in demodata: D: datetime "YYYY-MM-DD HH:mm" stored in tval_char, "YYYYMMDD.HHmm0" stored in nval_num.
The most difficult part is handling the instance_num field. By default, i2b2 uses a four byte signed integer for instance_num. Incrementing instance_num for every record would lead eventually to a number overflow. The primary key consists of patient_num,concept_cd,modifier_cd,start_date,encounter_num,instance_num,provider_id. Ideally, instance_num should be unique to encounter_num and start_date, but there is no realistic way to keep track per start_date, since observations can come in in any order. Therefore, we keep track of the maximum instance_num per encounter in the visit store (which caches visits anyways) and increase the instance_num only for observations with modifiers.
| Constructor and Description |
|---|
I2b2Inserter(Map<String,String> config) |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptOrException(Observation o) |
void |
close() |
int |
getInsertCount() |
void |
purgeSource(String sourceId)
Deletes all observations with the given sourceId
|
void |
purgeVisit(int encounter_num)
Deletes all observations for the given encounter_num
|
void |
resetInsertCount() |
void |
setMeta(String key,
String value) |
accept, reportError, setErrorHandlerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, setErrorHandlernewInstancepublic I2b2Inserter(Map<String,String> config) throws ClassNotFoundException, SQLException
ClassNotFoundExceptionSQLExceptionpublic void purgeSource(String sourceId) throws SQLException
sourceId - source idSQLException - if the DELETE statement failedpublic void purgeVisit(int encounter_num)
throws SQLException
encounter_num - encounter number (e.g. observation_fact.encounter_num)SQLException - if the DELETE statement failed.public void acceptOrException(Observation o) throws ObservationException
acceptOrException in class AbstractObservationHandlerObservationExceptionpublic void close()
throws IOException
close in interface Pluginclose in interface Closeableclose in interface AutoCloseableIOExceptionpublic void setMeta(String key, String value)
setMeta in interface ObservationHandlerpublic int getInsertCount()
public void resetInsertCount()
Copyright © 2013–2015 R.W.Majeed. All rights reserved.