Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91684583
05-i2b2-orig-data.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 13, 10:59
Size
4 KB
Mime Type
text/x-shellscript
Expires
Fri, Nov 15, 10:59 (2 d)
Engine
blob
Format
Raw Data
Handle
22305396
Attached To
R4444 MedCo Deployment
05-i2b2-orig-data.sh
View Options
#!/bin/bash
set -e
# load the structure and data of i2b2 database (including some bug fixes)
function loadI2b2Data {
DB_NAME="$1"
IS_ADDITIONAL_DB="$2"
# ---------- CRC data ----------
cd "$I2B2_DATA_DIR/edu.harvard.i2b2.data/Release_1-7/NewInstall/Crcdata"
cat > db.properties <<EOL
db.type=postgresql
db.username=i2b2demodata
db.password=$DB_PASSWORD
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/$DB_NAME?searchpath=i2b2demodata
db.project=demo
EOL
ant -f data_build.xml create_crcdata_tables_release_1-7
ant -f data_build.xml create_procedures_release_1-7
if ! ${IS_ADDITIONAL_DB}
then
ant -f data_build.xml db_demodata_load_data
fi
# ---------- Hive data ----------
cd "$I2B2_DATA_DIR/edu.harvard.i2b2.data/Release_1-7/NewInstall/Hivedata"
cat > db.properties <<EOL
db.type=postgresql
db.username=i2b2hive
db.password=$DB_PASSWORD
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/$DB_NAME?searchpath=i2b2hive
EOL
if ! ${IS_ADDITIONAL_DB}
then
ant -f data_build.xml create_hivedata_tables_release_1-7
ant -f data_build.xml db_hivedata_load_data
fi
# ---------- IM data ----------
cd "$I2B2_DATA_DIR/edu.harvard.i2b2.data/Release_1-7/NewInstall/Imdata"
cat > db.properties <<EOL
db.type=postgresql
db.username=i2b2imdata
db.password=$DB_PASSWORD
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/$DB_NAME?searchpath=i2b2imdata
db.project=demo
EOL
ant -f data_build.xml create_imdata_tables_release_1-7
if ! ${IS_ADDITIONAL_DB}
then
ant -f data_build.xml db_imdata_load_data
fi
# ---------- Metadata ----------
cd "$I2B2_DATA_DIR/edu.harvard.i2b2.data/Release_1-7/NewInstall/Metadata"
cat > db.properties <<EOL
db.type=postgresql
db.username=i2b2metadata
db.password=$DB_PASSWORD
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/$DB_NAME?searchpath=i2b2metadata
db.project=demo
EOL
ant -f data_build.xml create_metadata_tables_release_1-7
if ! ${IS_ADDITIONAL_DB}
then
ant -f data_build.xml db_metadata_load_data
fi
# ---------- PM data ----------
cd "$I2B2_DATA_DIR/edu.harvard.i2b2.data/Release_1-7/NewInstall/Pmdata"
cat > db.properties <<EOL
db.type=postgresql
db.username=i2b2pm
db.password=$DB_PASSWORD
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/$DB_NAME?searchpath=i2b2pm
EOL
if ! ${IS_ADDITIONAL_DB}
then
ant -f data_build.xml create_pmdata_tables_release_1-7
ant -f data_build.xml create_triggers_release_1-7
ant -f data_build.xml db_pmdata_load_data
fi
# ---------- Work data ----------
cd "$I2B2_DATA_DIR/edu.harvard.i2b2.data/Release_1-7/NewInstall/Workdata"
cat > db.properties <<EOL
db.type=postgresql
db.username=i2b2workdata
db.password=$DB_PASSWORD
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/$DB_NAME?searchpath=i2b2workdata
db.project=demo
EOL
ant -f data_build.xml create_workdata_tables_release_1-7
ant -f data_build.xml db_workdata_load_data
# ---------- Data bug fixes ----------
if ! ${IS_ADDITIONAL_DB}
then
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d "$DB_NAME" <<-EOSQL
update i2b2hive.crc_db_lookup set c_db_fullschema = 'i2b2demodata' where c_domain_id = 'i2b2demo';
update i2b2hive.im_db_lookup set c_db_fullschema = 'i2b2imdata' where c_domain_id = 'i2b2demo';
update i2b2hive.ont_db_lookup set c_db_fullschema = 'i2b2metadata' where c_domain_id = 'i2b2demo';
update i2b2hive.work_db_lookup set c_db_fullschema = 'i2b2workdata' where c_domain_id = 'i2b2demo';
EOSQL
fi
}
loadI2b2Data $I2B2_DEMO_DB_NAME false
loadI2b2Data $I2B2_MEDCO_DB_NAME true
Event Timeline
Log In to Comment