forked from dbmi-pitt/faersdbstats
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
58 lines (46 loc) · 2.17 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# Script is used as part of an EMC internal data processing pipeline, but 'should work' by itself
# Process expects:
# 1. vocabulary to be preloaded in schema staging_vocabulary
# 2. All the non legacy faers files to be downloaded in the faers_data_files folder
# 3. required postgres variables to be set
# 4. Java and Maven
export PGPASSWORD=${POSTGRES_PASSWORD}
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -c "\CREATE SCHEMA IF NOT EXISTS faers" "${POSTGRES_DATABASE}"
echo "Loading reference data"
cd reference_and_mapping_data || exit 1
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -f load_country_code_table.sql "${POSTGRES_DATABASE}"
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -f create_meddra_snomed_mapping_table.sql "${POSTGRES_DATABASE}"
cd ../
echo "Done loading reference data"
echo "Loading raw data"
cd load_data_files_from_website || exit 1
./download_all_and_create_files.sh
for SQLFILE in ./load*.sql; do
echo "executing ${SQLFILE}"
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -f "${SQLFILE}" "${POSTGRES_DATABASE}"
done
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -f delete_deleted_records.sql "${POSTGRES_DATABASE}"
cd ../
echo "Done loading raw data"
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -f handle_duplicate_cases/derive_unique_all_case.sql "${POSTGRES_DATABASE}"
psql -h "${POSTGRES_HOST}" -U "${POSTGRES_USER}" -f handle_duplicate_cases/deduplication_demographics.sql "${POSTGRES_DATABASE}"
echo "Downloading Aioli app"
curl -L -O https://github.com/RowanErasmus/aioli/archive/refs/heads/master.zip
unzip master.zip
echo "Creating config file for aioli app"
SETTINGS_FILE_NAME="config.properties"
cat >${SETTINGS_FILE_NAME} <<EOF
port=${POSTGRES_PORT}
host=${POSTGRES_HOST}
user=${POSTGRES_USER}
password=${POSTGRES_PASSWORD}
name=${POSTGRES_DATABASE}
EOF
rm aioli-master/src/main/resources/${SETTINGS_FILE_NAME}
mv ${SETTINGS_FILE_NAME} aioli-master/src/main/resources/${SETTINGS_FILE_NAME}
cd aioli-master || exit 1
mvn clean package assembly:single
java -jar target/ailoi_java-1.0-SNAPSHOT-jar-with-dependencies.jar -tv rxnorm -rmin false || exit 1
./standardized_output/standardize.sh
echo "That's it aeolus is done!!!!"