-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_synthea_to_omop.R
78 lines (56 loc) · 1.67 KB
/
test_synthea_to_omop.R
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# install.packages("devtools")
# devtools::install_github("OHDSI/ETL-Synthea")
library(DatabaseConnector)
library(ETLSyntheaBuilder)
cd <- DatabaseConnector::createConnectionDetails(
dbms = "postgresql",
server = "broadsea-atlasdb/postgres",
user = "postgres",
password = "mypass",
port = 5432
)
cdmSchema <- "cdm_synthea10"
cdmVersion <- "5.4"
syntheaVersion <- "3.0.0"
syntheaSchema <- "vocab"
syntheaFileLoc <- "/tmp/KIDS23-Team3/scd_csv"
#vocabFileLoc <- "/tmp/omop_vocab"
### Updated vocab file path to include CPT4 updates
vocabFileLoc <- "/tmp/omop_vocab"
ETLSyntheaBuilder::CreateCDMTables(
connectionDetails = cd,
cdmSchema = cdmSchema,
cdmVersion = cdmVersion
)
ETLSyntheaBuilder::CreateSyntheaTables(
connectionDetails = cd,
syntheaSchema = syntheaSchema,
syntheaVersion = syntheaVersion
)
# Modified Patient and Provider tables in the syntheaSchema (native)
### Patient - Added - fips (numeric), income (numeric)
### Provider - Dropped - utilization, Added - encounters (numeric), procedures (numeric)
ETLSyntheaBuilder::LoadSyntheaTables(
connectionDetails = cd,
syntheaSchema = syntheaSchema,
syntheaFileLoc = syntheaFileLoc
)
# Update patient
ETLSyntheaBuilder::LoadVocabFromCsv(
connectionDetails = cd,
cdmSchema = cdmSchema,
vocabFileLoc = vocabFileLoc
)
ETLSyntheaBuilder::LoadEventTables(
connectionDetails = cd,
cdmSchema = cdmSchema,
syntheaSchema = syntheaSchema,
cdmVersion = cdmVersion,
syntheaVersion = syntheaVersion
)
# ----
#sql_create<-"create schema native"
#sql_drop<-"drop schema native cascade"
#executeSql(conn,sql=sql_drop)
#executeSql(conn,sql=sql_create)
list.files(path = "/tmp/")