-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (48 loc) · 2.78 KB
/
Makefile
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
59
60
61
62
63
all: initdb omop vocab data f-tables build-container
DB=synpuf2
HOST=pdbmedcit.services.brown.edu
fetch-vocabs:
echo "Fetching vocabularies..."
curl --output vocabulary_download_v5.tar.gz --location https://www.dropbox.com/scl/fi/ilmwaqayxr2k6eaisi0eg/vocabulary_download_v5.tar.gz?rlkey=hbtzkjrjvrh2wa2lnq10bej5r&dl=0
untar-vocabs:
tar --warning=no-unknown-keyword -xvzf vocabulary_download_v5.tar.gz
rm vocabulary_download_v5/data/._*.csv
initdb:
echo "Initializing database..."
psql --host $(HOST) --echo-all --file sql/create_user_roles.sql
psql --host $(HOST) --echo-all --file sql/create_db.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-all --file sql/create_schemas.sql
omop:
echo "Creating OMOP tables..."
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/OMOP_CDM_postgresql_5.3_ddl.sql
vocab:
echo "Loading vocabularies..."
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-all --file sql/load_vocabs.sql
data:
echo "Loading data..."
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/load_synpuf.sql
echo "Loading indices and constraints..."
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/OMOP_CDM_postgresql_5.3_indices.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/OMOP_CDM_postgresql_5.3_constraints.sql
f-tables:
echo "Creating FHIR tables..."
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/names.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/omoponfhir_f_person_ddl.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/insert_names_to_f_person.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/omoponfhir_f_cache_ddl.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/omoponfhir_v5.3_f_immunization_view_ddl.sql
psql --host $(HOST) --username omop_admin_user --dbname ${DB} --echo-errors --file sql/omoponfhir_v5.3_f_observation_view_ddl.sql
build-container:
echo "Building FHIR server container..."
cd omoponfhir-main-v531-r4 && docker build -t synpuf2 .
start:
cd omoponfhir-main-v531-r4 && docker run --detach --publish 9090:8080 --env-file=../.env synpuf2
get-capabilities:
curl --request GET --location http://localhost:8080/fhir/metadata
get-epilepsy:
curl --request GET --location http://localhost:8080/fhir/Condition?code=84757009&_pretty=true
clean:
echo "Cleaning up..."
psql --command="DROP DATABASE IF EXISTS omop_on_fhir;"
psql --echo-all --file sql/drop_user_roles.sql
.PHONY: all initdb omop vocab data build-container f-tables start clean