OMOP/extras/codeToRun.R

53 lines
1.9 KiB
R
Raw Normal View History

# This script is meant to create the OMOP Common Data Model DDLs for each dialect as well as the pdf of the documentation.
# For a given cdmVersion, create all ddl sql files for every sql dialect
# Results are written to inst/ddl/cdm_version/dialect.
cdmVersion <- "5.3"
2022-01-21 20:35:13 +00:00
supportedVersions <- CommonDataModel::listSupportedVersions()
for (cdmVersion in supportedVersions) {
for (targetDialect in CommonDataModel::listSupportedDialects()) {
2022-01-21 20:35:13 +00:00
CommonDataModel::writeDdl(targetDialect = targetDialect,
cdmVersion = cdmVersion)
2022-01-21 20:35:13 +00:00
CommonDataModel::writePrimaryKeys(targetDialect = targetDialect,
cdmVersion = cdmVersion)
2022-01-21 20:35:13 +00:00
CommonDataModel::writeForeignKeys(targetDialect = targetDialect,
cdmVersion = cdmVersion)
2022-01-21 20:35:13 +00:00
CommonDataModel::writeIndex(targetDialect = targetDialect,
cdmVersion = cdmVersion)
}
}
CommonDataModel::buildRelease("5.3")
#############
# Zipping release
# All dialects
CommonDataModel::buildReleaseZip(cdmVersion="5.3", outputfolder="output")
buildReleaseZip()
# One dialect
buildReleaseZip(cdmVersion="5.4", targetDialect="postgresql", outputfolder="output")
#############
# 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
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
# 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)