2017-11-09 19:44:52 +00:00
|
|
|
#This script is meant to create the OMOP Common Data Model DDLs for each dialect as well as the pdf of the documentation.
|
|
|
|
|
|
|
|
|
2017-11-21 13:18:54 +00:00
|
|
|
# Step 1: Update the file inst/sql/sql_server/OMOP CDM ddl.sql with the changes for the new version and set the below variables
|
|
|
|
|
|
|
|
# Step 1.1: The version of the CDM you are writing. This will be used for the name of the pdf so, for example, write v5.3 as v5_3
|
|
|
|
cdmVersion <- "v5_3"
|
|
|
|
|
|
|
|
# Step 1.2: The location of the wiki markdown files. The default is "../../Documentation/CommonDataModel_Wiki_Files"
|
|
|
|
mdFilesLocation <- "../../Documentation/CommonDataModel_Wiki_Files"
|
2017-11-09 19:44:52 +00:00
|
|
|
|
|
|
|
# Step 2: Run the following code to create the DDLs for each dialect:
|
|
|
|
|
|
|
|
writeDDL("bigquery")
|
|
|
|
writeDDL("impala")
|
|
|
|
writeDDL("netezza")
|
|
|
|
writeDDL("oracle")
|
|
|
|
writeDDL("pdw")
|
|
|
|
writeDDL("postgresql")
|
|
|
|
writeDDL("redshift")
|
|
|
|
writeDDL("sql server")
|
|
|
|
|
2017-11-17 20:18:32 +00:00
|
|
|
# Step 3: Run the following code to create the primary key constraints and index files for Oracle, Postgres, PDW and Sql Server
|
2017-11-14 20:19:03 +00:00
|
|
|
|
|
|
|
writeIndex("oracle")
|
2017-11-15 18:09:54 +00:00
|
|
|
writeIndex("postgresql")
|
|
|
|
writeIndex("pdw")
|
|
|
|
writeIndex("sql server")
|
2017-11-14 20:19:03 +00:00
|
|
|
|
2017-12-01 17:08:40 +00:00
|
|
|
# Step 4: Run the following code to create primary key constraints for Netezza
|
|
|
|
|
|
|
|
writePrimaryKeys("netezza")
|
|
|
|
|
|
|
|
# Step 5: Run the following code to create foreign key constraints for Oracle, Postgres, PDW and Sql Server
|
2017-11-09 19:44:52 +00:00
|
|
|
|
2017-11-15 18:09:54 +00:00
|
|
|
writeConstraints("oracle")
|
|
|
|
writeConstraints("postgresql")
|
|
|
|
writeConstraints("pdw")
|
|
|
|
writeConstraints("sql server")
|
|
|
|
|
2017-12-01 17:08:40 +00:00
|
|
|
# step 6: Run the following code to create the pdf documentation. It will be written to the reports folder.
|
2017-11-09 19:44:52 +00:00
|
|
|
|
2017-11-21 13:18:54 +00:00
|
|
|
rmarkdown::render("reports/OMOP_CDM_PDF.Rmd",
|
|
|
|
output_format = "pdf_document",
|
|
|
|
output_file = paste0("OMOP_CDM_",cdmVersion,".pdf"),
|
|
|
|
params = list(mdFilesLocation = mdFilesLocation))
|