forked from OHDSI/ETL-Synthea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindowsLoader.r
30 lines (26 loc) · 1.26 KB
/
WindowsLoader.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
#
# Execute Synthea ETL Builder from Windows command line
#
# Usage: C:> Rscript SyntheaWindowsBulkLoader.r postgresql localhost synthea_v2 public public postgres postgres D:\Apps\Git\synthea\output\csv D:\synthea\V2\csv\vocabulary 5432
#
SyntheaWindowsBulkLoader <- function(dbms, server, dbName, syntheaSchema, vocabSchema, username, password, syntheaFileLoc, vocabFileLoc, port)
{
cd <- DatabaseConnector::createConnectionDetails(
dbms = dbms,
server = paste0(server,"/",dbName),
user = username,
password = password,
port = port
)
ETLSyntheaBuilder::DropCDMTables(cd,vocabSchema)
ETLSyntheaBuilder::DropSyntheaTables(cd,syntheaSchema)
ETLSyntheaBuilder::CreateCDMTables(cd,vocabSchema)
ETLSyntheaBuilder::CreateSyntheaTables(cd,syntheaSchema)
ETLSyntheaBuilder::LoadSyntheaTables(cd,syntheaSchema,syntheaFileLoc)
ETLSyntheaBuilder::LoadVocabTables(cd,vocabSchema,vocabFileLoc)
ETLSyntheaBuilder::CreateVocabMapTables(cd,vocabSchema)
ETLSyntheaBuilder::CreateVisitRollupTables(cd,vocabSchema,syntheaSchema)
ETLSyntheaBuilder::LoadCDMTables(cd,vocabSchema,syntheaSchema)
}
args <- commandArgs(trailingOnly=TRUE)
SyntheaWindowsBulkLoader(args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10])