add option to only include subset of tables

This commit is contained in:
Maxim Moinat 2022-12-01 13:59:57 +01:00
parent 759270d000
commit 0c07bfe881
No known key found for this signature in database
GPG Key ID: 94EA516FB6174455
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,8 @@
cdmVersion <- '5.4'
cdmPart <- c('CDM','VOCAB', 'RESULTS')
cdmTables <- NULL #c('PERSON', 'OBSERVATION_PERIOD', 'VISIT_OCCURRENCE', 'CONDITION_OCCURRENCE', 'CONCEPT')
cdmTableCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Table_Level.csv")), package = "CommonDataModel", mustWork = TRUE)
cdmFieldCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Field_Level.csv")), package = "CommonDataModel", mustWork = TRUE)
@ -15,6 +17,9 @@ for (i in 1:nrow(tableSpecs)) {
if (!(table$schema %in% cdmPart)) {
next
}
if (!is.null(cdmTables) && !(table$cdmTableName %in% cdmTables)) {
next
}
mermaidDdlLines <- c(mermaidDdlLines,
sprintf(' %s {', tableName))
@ -37,6 +42,9 @@ for (i in 1:nrow(tableSpecs)) {
if (!(fkTable$schema %in% cdmPart)) {
next
}
if (!is.null(cdmTables) && !(fkTable$cdmTableName %in% cdmTables)) {
next
}
fkRelation <- sprintf(' %s ||--o{ %s : ""', tableName, field$fkTableName)
if (fkRelation %in% mermaidFkLines) {