public class PostgresPatientStore extends PostgresExtension<I2b2Patient> implements PatientStore
The method PostgresExtension.openDatabase(String[]) will load all patients (relevant to the selected project)
into a memory structure based on a Hashtable.
Some optional columns are used: vital_status_cd, birth_date, death_date, sex_cd, download_date, sourcesystem_cd
The store should be separate from the extension? E.g. I2b2PatientExtension which can operate on PostgresStore, OracleStore, etc. HistreamPatientExtension can also operate on I2b2PostgresStore?
The patient_mapping table is used to map actual (source) patient_ide to internal patient_num for facts. The patient_mapping table is also used to store patient merge events (eg. different patient_ide referring to the same patient_num The Observation stream will still use the actual source patient_ide and encounter_ide
In the patient_mapping table, patient_ide_status can assume values Active, Inactive, Deleted, Merged. The 'Active' patient_mapping for the selected project is used as primary patient id, all other rows are used as alias ids.
config, db| Constructor and Description |
|---|
PostgresPatientStore(Map<String,String> configuration)
Construct new postgres patient store.
|
| Modifier and Type | Method and Description |
|---|---|
I2b2Patient |
createInstance(Object... args) |
I2b2Patient |
createInstance(Observation fact) |
void |
deleteWhereSourceId(String sourceId) |
void |
flush()
Write updates to disk.
|
String[] |
getAliasIds(Patient patient) |
Class<?>[] |
getInstanceTypes() |
void |
merge(Patient patient,
String additionalId,
ExternalSourceType source) |
protected void |
prepareStatements() |
void |
purge(String id) |
I2b2Patient |
retrieve(String id) |
int |
size()
Returns the number of patients which are currently available in memory.
|
close, copyProperties, getConnection, getFetchSize, inaccurateSqlTimestamp, openDatabaseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewInstancepublic PostgresPatientStore(Map<String,String> configuration) throws ClassNotFoundException, SQLException
PostgresExtension.PostgresExtension(Map),
the following properties are needed:
jdbc.{host|port|database} or data.jdbc.{host|port|database} to construct the database URI. Any other parameters under jdbc. or data.jdbc. are passed to the JDBC connect method.
project,
Optional properties:
idSourceDefault ('HIVE'), idSourceSeparator (single char, ':') fetchSize (int, 10000)
configuration - configurationSQLException - if the preparation or initialisation failsClassNotFoundException - if postgresql driver not foundprotected void prepareStatements()
throws SQLException
prepareStatements in class PostgresExtension<I2b2Patient>SQLExceptionpublic int size()
public I2b2Patient createInstance(Observation fact)
createInstance in interface Extension<I2b2Patient>public Class<?>[] getInstanceTypes()
getInstanceTypes in interface Extension<I2b2Patient>public I2b2Patient createInstance(Object... args) throws IllegalArgumentException
createInstance in interface Extension<I2b2Patient>IllegalArgumentExceptionpublic I2b2Patient retrieve(String id)
retrieve in interface PatientStorepublic void merge(Patient patient, String additionalId, ExternalSourceType source)
merge in interface PatientStorepublic String[] getAliasIds(Patient patient)
getAliasIds in interface PatientStorepublic void deleteWhereSourceId(String sourceId) throws SQLException
deleteWhereSourceId in class PostgresExtension<I2b2Patient>SQLExceptionpublic void flush()
PostgresExtensionPostgresExtension.close().flush in class PostgresExtension<I2b2Patient>public void purge(String id)
purge in interface PatientStoreCopyright © 2013–2015 R.W.Majeed. All rights reserved.