Skip to content

Commit 0c07bfe

Browse files
committed
add option to only include subset of tables
1 parent 759270d commit 0c07bfe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

extras/createERDiagram.R

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
cdmVersion <- '5.4'
33
cdmPart <- c('CDM','VOCAB', 'RESULTS')
4+
cdmTables <- NULL #c('PERSON', 'OBSERVATION_PERIOD', 'VISIT_OCCURRENCE', 'CONDITION_OCCURRENCE', 'CONCEPT')
5+
46
cdmTableCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Table_Level.csv")), package = "CommonDataModel", mustWork = TRUE)
57
cdmFieldCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Field_Level.csv")), package = "CommonDataModel", mustWork = TRUE)
68

@@ -15,6 +17,9 @@ for (i in 1:nrow(tableSpecs)) {
1517
if (!(table$schema %in% cdmPart)) {
1618
next
1719
}
20+
if (!is.null(cdmTables) && !(table$cdmTableName %in% cdmTables)) {
21+
next
22+
}
1823
mermaidDdlLines <- c(mermaidDdlLines,
1924
sprintf(' %s {', tableName))
2025

@@ -37,6 +42,9 @@ for (i in 1:nrow(tableSpecs)) {
3742
if (!(fkTable$schema %in% cdmPart)) {
3843
next
3944
}
45+
if (!is.null(cdmTables) && !(fkTable$cdmTableName %in% cdmTables)) {
46+
next
47+
}
4048

4149
fkRelation <- sprintf(' %s ||--o{ %s : ""', tableName, field$fkTableName)
4250
if (fkRelation %in% mermaidFkLines) {

0 commit comments

Comments
 (0)