2021-08-18 17:42:01 +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.
2021-06-09 00:19:01 +00:00
2021-08-18 17:42:01 +00:00
# For a given cdmVersion, create all ddl sql files for every sql dialect
2022-01-13 18:59:03 +00:00
# Results are written to inst/ddl/cdm_version/dialect.
2024-03-28 19:09:22 +00:00
cdmVersion <- " 5.3"
2021-06-09 00:19:01 +00:00
2022-01-21 20:35:13 +00:00
supportedVersions <- CommonDataModel :: listSupportedVersions ( )
2021-06-09 00:19:01 +00:00
2021-08-18 19:30:04 +00:00
for ( cdmVersion in supportedVersions ) {
2024-03-28 19:09:22 +00:00
for ( targetDialect in CommonDataModel :: listSupportedDialects ( ) ) {
2022-01-21 20:35:13 +00:00
CommonDataModel :: writeDdl ( targetDialect = targetDialect ,
cdmVersion = cdmVersion )
2021-06-09 00:19:01 +00:00
2022-01-21 20:35:13 +00:00
CommonDataModel :: writePrimaryKeys ( targetDialect = targetDialect ,
cdmVersion = cdmVersion )
2021-06-09 00:19:01 +00:00
2022-01-21 20:35:13 +00:00
CommonDataModel :: writeForeignKeys ( targetDialect = targetDialect ,
cdmVersion = cdmVersion )
2021-06-09 00:19:01 +00:00
2022-01-21 20:35:13 +00:00
CommonDataModel :: writeIndex ( targetDialect = targetDialect ,
cdmVersion = cdmVersion )
2021-08-18 19:30:04 +00:00
}
}
2021-06-09 00:19:01 +00:00
2023-02-13 18:49:07 +00:00
CommonDataModel :: buildRelease ( " 5.3" )
2022-01-13 18:59:03 +00:00
2021-08-19 19:43:34 +00:00
#############
# Zipping release
# All dialects
2023-02-13 18:49:07 +00:00
CommonDataModel :: buildReleaseZip ( cdmVersion = " 5.3" , outputfolder = " output" )
2022-01-13 18:59:03 +00:00
buildReleaseZip ( )
2021-08-19 19:43:34 +00:00
# One dialect
buildReleaseZip ( cdmVersion = " 5.4" , targetDialect = " postgresql" , outputfolder = " output" )
2021-06-09 00:19:01 +00:00
#############
# BE SURE TO RUN THE EXTRAS/SITEMAINTENANCE.R BEFORE CREATING THE PDF
# step 9: Run the following code to create the pdf documentation. It will be written to the reports folder. Use knit with pagedown
2023-02-08 20:04:22 +00:00
pagedown :: chrome_print ( " cdm54.Rmd" ) # create a comprehensive rmd with background, conventions, etc like https://stackoverflow.com/questions/25824795/how-to-combine-two-rmarkdown-rmd-files-into-a-single-output
2021-06-09 00:19:01 +00:00
# Step 10: After updating any of the .Rmd files, rendering the site following directions in SiteMaintenance.R, then move the files to the CommonDataModel directory
newdir <- " C:/Git/Github/CommonDataModel/docs"
currentdir <- paste0 ( getwd ( ) , " /docs/" )
file.copy ( currentdir , newdir , recursive = TRUE , overwrite = TRUE )