├── .Rbuildignore ├── .github └── workflows │ ├── R_CMD_check.yaml │ └── codespell.yml ├── .gitignore ├── CRAN-SUBMISSION ├── CommonDataModel.Rproj ├── DESCRIPTION ├── NAMESPACE ├── NEWS.md ├── R ├── CommonDataModel-package.R ├── WikiParser.R ├── buildRelease.R ├── createDdl.R ├── downloadCurrentDdl.R ├── executeDdl.R ├── listSupportedVersions.R ├── utils.R └── writeDDL.R ├── README.md ├── cran-comments.md ├── docs ├── background.html ├── cdm30.html ├── cdm53.html ├── cdm531.html ├── cdm54.html ├── cdm54Changes.html ├── cdm54ToolingSupport.html ├── cdm54erd.html ├── cdm60.html ├── cdmDecisionTree.html ├── cdmPrivacy.html ├── cdmRPackage.html ├── cdmRefreshProcess.html ├── cdmRequestProcess.html ├── contactVocab.html ├── contribute.html ├── customConcepts.html ├── dataModelConventions.html ├── download.html ├── drug_dose.html ├── ehrObsPeriods.html ├── faq.html ├── favicon.html ├── favicon.ico ├── images │ ├── ATLAS_Persistence_Window.png │ ├── AWS_clusters.png │ ├── Athena_download_box.png │ ├── CDM_refresh_cycle.png │ ├── Sepsis_to_SNOMED.png │ ├── Usagi.png │ ├── cdm54.png │ ├── cdm_wg_calendar.csv │ ├── diabetes-related_case.png │ ├── downloadJava.png │ ├── downloadR.png │ ├── downloadRStudio.png │ ├── erd.jpg │ ├── important.png │ ├── mapping_of_concepts.png │ ├── no32Bits.png │ ├── pregnancy-related_case.png │ ├── rDestination.png │ └── sign-up.png ├── index.html ├── indices-primary-foreign.html ├── leaveAsIs.html ├── localChange.html ├── networkUseCase.html ├── ohdsi16x16.png ├── ohdsi40x40.png ├── oncology.html ├── queries.html ├── reviewProposals.html ├── site_libs │ ├── bootstrap-3.3.5 │ │ ├── css │ │ │ ├── bootstrap-theme.css │ │ │ ├── bootstrap-theme.css.map │ │ │ ├── bootstrap-theme.min.css │ │ │ ├── bootstrap.css │ │ │ ├── bootstrap.css.map │ │ │ ├── bootstrap.min.css │ │ │ ├── cerulean.min.css │ │ │ ├── cosmo.min.css │ │ │ ├── darkly.min.css │ │ │ ├── flatly.min.css │ │ │ ├── fonts │ │ │ │ ├── Lato.ttf │ │ │ │ ├── LatoBold.ttf │ │ │ │ ├── LatoItalic.ttf │ │ │ │ ├── NewsCycle.ttf │ │ │ │ ├── NewsCycleBold.ttf │ │ │ │ ├── OpenSans.ttf │ │ │ │ ├── OpenSansBold.ttf │ │ │ │ ├── OpenSansBoldItalic.ttf │ │ │ │ ├── OpenSansItalic.ttf │ │ │ │ ├── OpenSansLight.ttf │ │ │ │ ├── OpenSansLightItalic.ttf │ │ │ │ ├── Raleway.ttf │ │ │ │ ├── RalewayBold.ttf │ │ │ │ ├── Roboto.ttf │ │ │ │ ├── RobotoBold.ttf │ │ │ │ ├── RobotoLight.ttf │ │ │ │ ├── RobotoMedium.ttf │ │ │ │ ├── SourceSansPro.ttf │ │ │ │ ├── SourceSansProBold.ttf │ │ │ │ ├── SourceSansProItalic.ttf │ │ │ │ ├── SourceSansProLight.ttf │ │ │ │ └── Ubuntu.ttf │ │ │ ├── journal.min.css │ │ │ ├── lumen.min.css │ │ │ ├── paper.min.css │ │ │ ├── readable.min.css │ │ │ ├── sandstone.min.css │ │ │ ├── simplex.min.css │ │ │ ├── spacelab.min.css │ │ │ ├── united.min.css │ │ │ └── yeti.min.css │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── js │ │ │ ├── bootstrap.js │ │ │ ├── bootstrap.min.js │ │ │ └── npm.js │ │ └── shim │ │ │ ├── html5shiv.min.js │ │ │ └── respond.min.js │ ├── bttn-0.2.4 │ │ └── bttn.min.css │ ├── calendar-binding-0.3.0 │ │ └── calendar.js │ ├── font-awesome-6.4.2 │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── header-attrs-2.25 │ │ └── header-attrs.js │ ├── header-attrs-2.27 │ │ └── header-attrs.js │ ├── highlightjs-9.12.0 │ │ ├── default.css │ │ ├── highlight.js │ │ └── textmate.css │ ├── htmltools-fill-0.5.8.1 │ │ └── fill.css │ ├── htmlwidgets-1.6.2 │ │ └── htmlwidgets.js │ ├── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map │ ├── jqueryui-1.13.2 │ │ ├── AUTHORS.txt │ │ ├── LICENSE.txt │ │ ├── images │ │ │ ├── ui-icons_444444_256x240.png │ │ │ ├── ui-icons_555555_256x240.png │ │ │ ├── ui-icons_777620_256x240.png │ │ │ ├── ui-icons_777777_256x240.png │ │ │ ├── ui-icons_cc0000_256x240.png │ │ │ └── ui-icons_ffffff_256x240.png │ │ ├── index.html │ │ ├── jquery-ui.css │ │ ├── jquery-ui.js │ │ ├── jquery-ui.min.css │ │ ├── jquery-ui.min.js │ │ ├── jquery-ui.structure.css │ │ ├── jquery-ui.structure.min.css │ │ ├── jquery-ui.theme.css │ │ └── jquery-ui.theme.min.css │ ├── navigation-1.1 │ │ ├── codefolding-lua.css │ │ ├── codefolding.js │ │ ├── sourceembed.js │ │ └── tabsets.js │ └── tocify-1.9.1 │ │ ├── jquery.tocify.css │ │ └── jquery.tocify.js ├── sqlScripts.html ├── style.css ├── typesOfAdditions.html ├── useCaseN.html ├── useCaseY.html ├── vocabN.html ├── vocabRequest.html ├── vocabY.html └── vocabulary.html ├── extras ├── OMOP_CDMv5.4_ER_Diagram.mmd ├── SiteMaintenance.R ├── archive │ ├── OMOP CDMv5.3.1 Specs v0.1 test.xlsx │ ├── OMOP CDMv5.3.1 Specs v0.1.xlsx │ ├── OMOP CDMv6 DQ Checks v0.1.xlsx │ ├── OMOP_CDM_PDF.Rmd │ ├── OMOP_CDM_PDF.html │ ├── OMOP_CDM_v5_3.pdf │ ├── OMOP_CDM_v6_0.pdf │ ├── OMOP_CDM_v6_0test.html │ ├── OMOP_CDM_v6_0test.pdf │ ├── test-buildRelease.R │ ├── testSpec.Rmd │ └── testSpec.html ├── codeToRun.R ├── createERDiagram.R ├── packageMaintenance.R ├── testthat.R ├── v53_v54_conversion │ ├── README.txt │ ├── bigquery_migration.sql │ ├── impala_migration.sql │ ├── netezza_migration.sql │ ├── oracle_migration.sql │ ├── postgresql_migration.sql │ ├── redshift_migration.sql │ └── sqlserver_migration.sql └── v60_v54_conversion │ ├── compare_column_attributes.sql │ ├── compare_column_names.sql │ ├── output_of_compare_column_attributes.txt │ ├── output_of_compare_column_names.txt │ └── redshift_v60_v54_migration.sql ├── inst ├── csv │ ├── OMOP_CDM_Oncology_Ex_Field_Level.csv │ ├── OMOP_CDM_Oncology_Ex_Table_Level.csv │ ├── OMOP_CDMv5.3_Field_Level.csv │ ├── OMOP_CDMv5.3_Table_Level.csv │ ├── OMOP_CDMv5.4_Field_Level.csv │ ├── OMOP_CDMv5.4_Table_Level.csv │ ├── OMOP_CDMv6.0_Field_Level.csv │ └── OMOP_CDMv6.0_Table_Level.csv ├── ddl │ ├── 5.3 │ │ ├── bigquery │ │ │ ├── OMOPCDM_bigquery_5.3_constraints.sql │ │ │ ├── OMOPCDM_bigquery_5.3_ddl.sql │ │ │ ├── OMOPCDM_bigquery_5.3_indices.sql │ │ │ └── OMOPCDM_bigquery_5.3_primary_keys.sql │ │ ├── duckdb │ │ │ ├── OMOPCDM_duckdb_5.3_constraints.sql │ │ │ ├── OMOPCDM_duckdb_5.3_ddl.sql │ │ │ ├── OMOPCDM_duckdb_5.3_indices.sql │ │ │ └── OMOPCDM_duckdb_5.3_primary_keys.sql │ │ ├── hive │ │ │ ├── OMOPCDM_hive_5.3_constraints.sql │ │ │ ├── OMOPCDM_hive_5.3_ddl.sql │ │ │ ├── OMOPCDM_hive_5.3_indices.sql │ │ │ └── OMOPCDM_hive_5.3_primary_keys.sql │ │ ├── impala │ │ │ ├── OMOPCDM_impala_5.3_constraints.sql │ │ │ ├── OMOPCDM_impala_5.3_ddl.sql │ │ │ ├── OMOPCDM_impala_5.3_indices.sql │ │ │ └── OMOPCDM_impala_5.3_primary_keys.sql │ │ ├── netezza │ │ │ ├── OMOPCDM_netezza_5.3_constraints.sql │ │ │ ├── OMOPCDM_netezza_5.3_ddl.sql │ │ │ ├── OMOPCDM_netezza_5.3_indices.sql │ │ │ └── OMOPCDM_netezza_5.3_primary_keys.sql │ │ ├── oracle │ │ │ ├── OMOPCDM_oracle_5.3_constraints.sql │ │ │ ├── OMOPCDM_oracle_5.3_ddl.sql │ │ │ ├── OMOPCDM_oracle_5.3_indices.sql │ │ │ └── OMOPCDM_oracle_5.3_primary_keys.sql │ │ ├── pdw │ │ │ ├── OMOPCDM_pdw_5.3_constraints.sql │ │ │ ├── OMOPCDM_pdw_5.3_ddl.sql │ │ │ ├── OMOPCDM_pdw_5.3_indices.sql │ │ │ └── OMOPCDM_pdw_5.3_primary_keys.sql │ │ ├── postgresql │ │ │ ├── OMOPCDM_postgresql_5.3_constraints.sql │ │ │ ├── OMOPCDM_postgresql_5.3_ddl.sql │ │ │ ├── OMOPCDM_postgresql_5.3_indices.sql │ │ │ └── OMOPCDM_postgresql_5.3_primary_keys.sql │ │ ├── redshift │ │ │ ├── OMOPCDM_redshift_5.3_constraints.sql │ │ │ ├── OMOPCDM_redshift_5.3_ddl.sql │ │ │ ├── OMOPCDM_redshift_5.3_indices.sql │ │ │ └── OMOPCDM_redshift_5.3_primary_keys.sql │ │ ├── snowflake │ │ │ ├── OMOPCDM_snowflake_5.3_constraints.sql │ │ │ ├── OMOPCDM_snowflake_5.3_ddl.sql │ │ │ ├── OMOPCDM_snowflake_5.3_indices.sql │ │ │ └── OMOPCDM_snowflake_5.3_primary_keys.sql │ │ ├── spark │ │ │ ├── OMOPCDM_spark_5.3_constraints.sql │ │ │ ├── OMOPCDM_spark_5.3_ddl.sql │ │ │ ├── OMOPCDM_spark_5.3_indices.sql │ │ │ └── OMOPCDM_spark_5.3_primary_keys.sql │ │ ├── sql_server │ │ │ ├── OMOPCDM_sql_server_5.3_constraints.sql │ │ │ ├── OMOPCDM_sql_server_5.3_ddl.sql │ │ │ ├── OMOPCDM_sql_server_5.3_indices.sql │ │ │ └── OMOPCDM_sql_server_5.3_primary_keys.sql │ │ ├── sqlite │ │ │ ├── OMOPCDM_sqlite_5.3_constraints.sql │ │ │ ├── OMOPCDM_sqlite_5.3_ddl.sql │ │ │ ├── OMOPCDM_sqlite_5.3_indices.sql │ │ │ └── OMOPCDM_sqlite_5.3_primary_keys.sql │ │ ├── sqlite_extended │ │ │ ├── OMOPCDM_sqlite_extended_5.3_constraints.sql │ │ │ ├── OMOPCDM_sqlite_extended_5.3_ddl.sql │ │ │ ├── OMOPCDM_sqlite_extended_5.3_indices.sql │ │ │ └── OMOPCDM_sqlite_extended_5.3_primary_keys.sql │ │ └── synapse │ │ │ ├── OMOPCDM_synapse_5.3_constraints.sql │ │ │ ├── OMOPCDM_synapse_5.3_ddl.sql │ │ │ ├── OMOPCDM_synapse_5.3_indices.sql │ │ │ └── OMOPCDM_synapse_5.3_primary_keys.sql │ └── 5.4 │ │ ├── bigquery │ │ ├── OMOPCDM_bigquery_5.4_constraints.sql │ │ ├── OMOPCDM_bigquery_5.4_ddl.sql │ │ ├── OMOPCDM_bigquery_5.4_indices.sql │ │ └── OMOPCDM_bigquery_5.4_primary_keys.sql │ │ ├── duckdb │ │ ├── OMOPCDM_duckdb_5.4_constraints.sql │ │ ├── OMOPCDM_duckdb_5.4_ddl.sql │ │ ├── OMOPCDM_duckdb_5.4_indices.sql │ │ └── OMOPCDM_duckdb_5.4_primary_keys.sql │ │ ├── hive │ │ ├── OMOPCDM_hive_5.4_constraints.sql │ │ ├── OMOPCDM_hive_5.4_ddl.sql │ │ ├── OMOPCDM_hive_5.4_indices.sql │ │ └── OMOPCDM_hive_5.4_primary_keys.sql │ │ ├── impala │ │ ├── OMOPCDM_impala_5.4_constraints.sql │ │ ├── OMOPCDM_impala_5.4_ddl.sql │ │ ├── OMOPCDM_impala_5.4_indices.sql │ │ └── OMOPCDM_impala_5.4_primary_keys.sql │ │ ├── netezza │ │ ├── OMOPCDM_netezza_5.4_constraints.sql │ │ ├── OMOPCDM_netezza_5.4_ddl.sql │ │ ├── OMOPCDM_netezza_5.4_indices.sql │ │ └── OMOPCDM_netezza_5.4_primary_keys.sql │ │ ├── oracle │ │ ├── OMOPCDM_oracle_5.4_constraints.sql │ │ ├── OMOPCDM_oracle_5.4_ddl.sql │ │ ├── OMOPCDM_oracle_5.4_indices.sql │ │ └── OMOPCDM_oracle_5.4_primary_keys.sql │ │ ├── pdw │ │ ├── OMOPCDM_pdw_5.4_constraints.sql │ │ ├── OMOPCDM_pdw_5.4_ddl.sql │ │ ├── OMOPCDM_pdw_5.4_indices.sql │ │ └── OMOPCDM_pdw_5.4_primary_keys.sql │ │ ├── postgresql │ │ ├── OMOPCDM_postgresql_5.4_constraints.sql │ │ ├── OMOPCDM_postgresql_5.4_ddl.sql │ │ ├── OMOPCDM_postgresql_5.4_indices.sql │ │ └── OMOPCDM_postgresql_5.4_primary_keys.sql │ │ ├── redshift │ │ ├── OMOPCDM_redshift_5.4_constraints.sql │ │ ├── OMOPCDM_redshift_5.4_ddl.sql │ │ ├── OMOPCDM_redshift_5.4_indices.sql │ │ └── OMOPCDM_redshift_5.4_primary_keys.sql │ │ ├── snowflake │ │ ├── OMOPCDM_snowflake_5.4_constraints.sql │ │ ├── OMOPCDM_snowflake_5.4_ddl.sql │ │ ├── OMOPCDM_snowflake_5.4_indices.sql │ │ └── OMOPCDM_snowflake_5.4_primary_keys.sql │ │ ├── spark │ │ ├── OMOPCDM_spark_5.4_constraints.sql │ │ ├── OMOPCDM_spark_5.4_ddl.sql │ │ ├── OMOPCDM_spark_5.4_indices.sql │ │ └── OMOPCDM_spark_5.4_primary_keys.sql │ │ ├── sql_server │ │ ├── OMOPCDM_sql_server_5.4_constraints.sql │ │ ├── OMOPCDM_sql_server_5.4_ddl.sql │ │ ├── OMOPCDM_sql_server_5.4_indices.sql │ │ └── OMOPCDM_sql_server_5.4_primary_keys.sql │ │ ├── sqlite │ │ ├── OMOPCDM_sqlite_5.4_constraints.sql │ │ ├── OMOPCDM_sqlite_5.4_ddl.sql │ │ ├── OMOPCDM_sqlite_5.4_indices.sql │ │ └── OMOPCDM_sqlite_5.4_primary_keys.sql │ │ ├── sqlite_extended │ │ ├── OMOPCDM_sqlite_extended_5.4_constraints.sql │ │ ├── OMOPCDM_sqlite_extended_5.4_ddl.sql │ │ ├── OMOPCDM_sqlite_extended_5.4_indices.sql │ │ └── OMOPCDM_sqlite_extended_5.4_primary_keys.sql │ │ └── synapse │ │ ├── OMOPCDM_synapse_5.4_constraints.sql │ │ ├── OMOPCDM_synapse_5.4_ddl.sql │ │ ├── OMOPCDM_synapse_5.4_indices.sql │ │ └── OMOPCDM_synapse_5.4_primary_keys.sql └── sql │ └── sql_server │ ├── OMOP_CDM_indices_v5.3.sql │ ├── OMOP_CDM_indices_v5.4.sql │ ├── OMOP_CDM_indices_v6.0.sql │ └── testCleanUp.sql ├── man ├── buildRelease.Rd ├── buildReleaseZip.Rd ├── createDdl.Rd ├── downloadCurrentDdl.Rd ├── executeDdl.Rd ├── listSupportedDialects.Rd ├── listSupportedVersions.Rd ├── parseWiki.Rd └── writeDdl.Rd ├── rmd ├── .Rapp.history ├── _site.yml ├── background.Rmd ├── cdm30.Rmd ├── cdm53.Rmd ├── cdm531.Rmd ├── cdm54.Rmd ├── cdm54Changes.rmd ├── cdm54ToolingSupport.RMD ├── cdm54erd.Rmd ├── cdm60.Rmd ├── cdmDecisionTree.Rmd ├── cdmPrivacy.Rmd ├── cdmRPackage.rmd ├── cdmRefreshProcess.Rmd ├── cdmRequestProcess.Rmd ├── contactVocab.Rmd ├── contribute.Rmd ├── customConcepts.Rmd ├── dataModelConventions.Rmd ├── download.Rmd ├── drug_dose.Rmd ├── ehrObsPeriods.Rmd ├── faq.Rmd ├── favicon.html ├── favicon.ico ├── images │ ├── ATLAS_Persistence_Window.png │ ├── AWS_clusters.png │ ├── Athena_download_box.png │ ├── CDM_refresh_cycle.png │ ├── Sepsis_to_SNOMED.png │ ├── Usagi.png │ ├── cdm54.png │ ├── cdm_wg_calendar.csv │ ├── diabetes-related_case.png │ ├── downloadJava.png │ ├── downloadR.png │ ├── downloadRStudio.png │ ├── erd.jpg │ ├── important.png │ ├── mapping_of_concepts.png │ ├── no32Bits.png │ ├── pregnancy-related_case.png │ ├── rDestination.png │ └── sign-up.png ├── index.Rmd ├── indices-primary-foreign.Rmd ├── leaveAsIs.Rmd ├── localChange.Rmd ├── networkUseCase.Rmd ├── ohdsi16x16.png ├── ohdsi40x40.png ├── oncology.Rmd ├── queries.Rmd ├── reviewProposals.Rmd ├── sqlScripts.Rmd ├── style.css ├── typesOfAdditions.Rmd ├── useCaseN.Rmd ├── useCaseY.Rmd ├── vocabN.Rmd ├── vocabRequest.Rmd ├── vocabY.Rmd └── vocabulary.Rmd └── tests ├── testthat.R └── testthat ├── setup.R ├── test-createDdl.R ├── test-executeDdl.R └── test-writeDdl.R /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^LICENSE\.md$ 4 | .github/* 5 | extras/* 6 | docs/* 7 | rmd/* 8 | ^CRAN-SUBMISSION$ 9 | ^cran-comments\.md$ 10 | -------------------------------------------------------------------------------- /.github/workflows/codespell.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Codespell 3 | 4 | on: 5 | push: 6 | branches: [main] 7 | pull_request: 8 | branches: [main] 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | codespell: 15 | name: Check for spelling errors 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v3 21 | - name: Codespell 22 | uses: codespell-project/actions-codespell@v2 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | extras/CodeToRun.R 6 | 7 | # OS generated files # 8 | ###################### 9 | .DS_Store 10 | .DS_Store? 11 | ._* 12 | .Spotlight-V100 13 | .Trashes 14 | ehthumbs.db 15 | Thumbs.db 16 | extras/codeToRun.R 17 | output/ 18 | -------------------------------------------------------------------------------- /CRAN-SUBMISSION: -------------------------------------------------------------------------------- 1 | Version: 1.0.1 2 | Date: 2024-10-01 17:22:58 UTC 3 | SHA: 17b2d139c7e982c33cd8abb2ea7db0cd104e756a 4 | -------------------------------------------------------------------------------- /CommonDataModel.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: XeLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: CommonDataModel 2 | Type: Package 3 | Title: OMOP CDM DDL and Documentation Generator 4 | Version: 1.0.1 5 | Authors@R: person(given = "Clair", 6 | family = "Blacketer", 7 | role = c("aut", "cre"), 8 | email = "mblacke@its.jnj.com") 9 | Maintainer: Clair Blacketer 10 | Description: Generates the scripts required to create an Observational Medical Outcomes Partnership (OMOP) Common Data Model (CDM) database and associated documentation for supported database platforms. Leverages the 'SqlRender' package to convert the Data Definition Language (DDL) script written in parameterized Structured Query Language (SQL) to the other supported dialects. 11 | License: Apache License 2.0 12 | Encoding: UTF-8 13 | LazyData: true 14 | Depends: 15 | DatabaseConnector, 16 | SqlRender, 17 | rJava 18 | Imports: 19 | rmarkdown, 20 | stringr, 21 | DBI, 22 | dplyr, 23 | readr 24 | Suggests: 25 | knitr, 26 | testthat (>= 3.0.0), 27 | RSQLite, 28 | withr 29 | NeedsCompilation: no 30 | RoxygenNote: 7.2.3 31 | Config/testthat/edition: 3 32 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(buildRelease) 4 | export(buildReleaseZip) 5 | export(createDdl) 6 | export(createForeignKeys) 7 | export(createPrimaryKeys) 8 | export(downloadCurrentDdl) 9 | export(executeDdl) 10 | export(listSupportedDialects) 11 | export(listSupportedVersions) 12 | export(parseWiki) 13 | export(writeDdl) 14 | export(writeForeignKeys) 15 | export(writeIndex) 16 | export(writePrimaryKeys) 17 | import(DatabaseConnector) 18 | import(SqlRender) 19 | import(rJava) 20 | importFrom(utils,download.file) 21 | importFrom(utils,read.csv) 22 | importFrom(utils,write.csv) 23 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | CommonDataModel v5.4.2 2 | ====================== 3 | 4 | Bigfixes: 5 | 6 | 1. Removed package test that was causing issues with downstream dependencies (test-BuildRelease.R) 7 | 8 | Documentation: 9 | 10 | 1. Updated documentation for the OMOP Common Data Model based on the April Olympians 2024 initiative. 11 | -------------------------------------------------------------------------------- /R/CommonDataModel-package.R: -------------------------------------------------------------------------------- 1 | #' @import rJava 2 | #' @import DatabaseConnector 3 | #' @import SqlRender 4 | NULL 5 | -------------------------------------------------------------------------------- /R/WikiParser.R: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Observational Health Data Sciences and Informatics 2 | # 3 | # This file is part of DDLGeneratr 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | 18 | #' Parse Wiki files 19 | #' 20 | #' @description 21 | #' Parses all .md files in the specified location (or any subfolders), extracting definitions 22 | #' of the Common Data Model. 23 | #' 24 | #' @param mdFilesLocation Path to the root folder of the Wiki repository. 25 | #' @param output_file Path to where the output CSV file should be written. 26 | #' @return CSV files with the OMOP CDM specifications. 27 | #' @importFrom utils write.csv 28 | #' @export 29 | parseWiki <- function(mdFilesLocation, output_file) { 30 | # mdFilesLocation <- "../CommonDataModel.wiki" 31 | files <- list.files(mdFilesLocation, pattern = ".*\\.md", recursive = TRUE, full.names = TRUE) 32 | file <- files[18] 33 | parseTableRow <- function(row) { 34 | cells <- stringr::str_trim(stringr::str_split(row, "\\|")[[1]]) 35 | if (substr(row, 1, 1) == "|") { 36 | cells <- cells[2:5] 37 | } 38 | return(data.frame(field = tolower(cells[1]), 39 | required = cells[2], 40 | type = toupper(cells[3]), 41 | description = cells[4])) 42 | } 43 | 44 | parseMdFile <- function(file) { 45 | text <- readChar(file, file.info(file)$size) 46 | lines <- stringr::str_split(text, "\n")[[1]] 47 | lines <- stringr::str_trim(lines) 48 | tableStart <- grep("\\s*field\\s*\\|\\s*required\\s*\\|\\s*type\\s*\\|\\s*description\\s*", tolower(lines)) 49 | if (length(tableStart) > 1) 50 | stop("More than one table definition found in ", file) 51 | 52 | if (length(tableStart) == 1) { 53 | tableName <- basename(file) 54 | tableName <- tolower(stringr::str_sub(tableName, 1, -4)) 55 | writeLines(paste("Parsing table", tableName)) 56 | tableStart <- tableStart + 2 57 | tableEnd <- c(which(lines == ""), length(lines) + 1) 58 | tableEnd <- min(tableEnd[tableEnd > tableStart]) - 1 59 | tableDefinition <- lapply(lines[tableStart:tableEnd], parseTableRow) 60 | tableDefinition <- do.call(rbind, tableDefinition) 61 | tableDefinition$table <- tableName 62 | return(tableDefinition) 63 | } else { 64 | return(NULL) 65 | } 66 | } 67 | tableDefinitions <- lapply(files, parseMdFile) 68 | tableDefinitions <- do.call(rbind, tableDefinitions) 69 | write.csv(tableDefinitions, output_file, row.names = FALSE) 70 | } 71 | -------------------------------------------------------------------------------- /R/downloadCurrentDdl.R: -------------------------------------------------------------------------------- 1 | #' Get current DDL sitting on the main branch 2 | #' 3 | #' @details 4 | #' This function gets the current ddl on the CDM main branch. It will be taken from the Sql Server folder. 5 | #' The default location is 6 | #' \code{inst/settings/currentOmopDdl.sql}. 7 | #' 8 | #' @param githubPath The path for the GitHub repo containing the package (e.g. 'OHDSI/CommonDataModel'). 9 | #' @param pathToCsv The path for the snapshot inside the package. 10 | #' @param outputFile The path where the file should be saved. 11 | #' 12 | #' @return The current DDL sitting on the main branch of the CommonDataModel repository. 13 | #' @examples 14 | #' \dontrun{ 15 | #' downloadCurrentDdl("OHDSI/CommonDataModel", 16 | #' pathToCsv="Sql%20Server/OMOP%20CDM%20sql%20server%20ddl.txt") 17 | #' } 18 | #' @importFrom utils download.file 19 | #' @export 20 | 21 | downloadCurrentDdl <- function(githubPath="OHDSI/CommonDataModel", 22 | pathToCsv="Sql%20Server/OMOP%20CDM%20sql%20server%20ddl.txt", 23 | outputFile = paste0("inst/sql/sql_server/OMOP CDM ddl ",Sys.Date(),".sql")){ 24 | 25 | parts <- strsplit(githubPath, "/")[[1]] 26 | if (length(parts) > 2) { 27 | githubPath <- paste(c(parts[1:2], "master", parts[3:length(parts)]), collapse = "/") 28 | } else { 29 | githubPath <- paste(c(parts[1:2], "master"), collapse = "/") 30 | } 31 | url <- paste(c("https://raw.githubusercontent.com", githubPath, pathToCsv), collapse = "/") 32 | download.file(url, destfile = outputFile) 33 | } 34 | -------------------------------------------------------------------------------- /R/executeDdl.R: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Observational Health Data Sciences and Informatics 2 | # 3 | # This file is part of CdmDdlBase 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | #' Generate and execute the DDL on a database 18 | #' 19 | #' This function will generate the DDL for a specific dbms and CDM version and 20 | #' then execute the DDL on a database. 21 | #' 22 | #' @param connectionDetails An object of class connectionDetails as created by the DatabaseConnector::createConnectionDetails function. 23 | #' @param cdmVersion The version of the CDM you are creating, e.g. 5.3, 5.4 24 | #' @param cdmDatabaseSchema The schema of the CDM instance where the DDL will be run. For example, this would be "ohdsi.dbo" when testing on sql server. 25 | #' @param executeDdl Should the DDL be executed? TRUE or FALSE 26 | #' @param executePrimaryKey Should the primary keys be added? TRUE or FALSE 27 | #' @param executeForeignKey Should the foreign keys be added? TRUE or FALSE 28 | #' @param ... Other arguments passed on to DatabaseConnector::executeSql. (This allows the user to set the path to errorReportFile.) 29 | #' @return Writes the fully specified DDLs, primary keys, foreign keys, and indices to a file and then executes on a database. 30 | #' @export 31 | #' 32 | #' @examples 33 | #' \dontrun{ 34 | #' executeDdl(connectionDetails = connectionDetails, 35 | #' cdmVersion = "5.4", 36 | #' cdmDatabaseSchema = "myCdm") 37 | #'} 38 | executeDdl <- function(connectionDetails, 39 | cdmVersion, 40 | cdmDatabaseSchema, 41 | executeDdl = TRUE, 42 | executePrimaryKey = TRUE, 43 | executeForeignKey = TRUE, 44 | ...) { 45 | 46 | outputfolder <- tempdir(check = TRUE) 47 | 48 | 49 | if(executeDdl) { 50 | filename <- writeDdl(targetDialect = connectionDetails$dbms, 51 | cdmVersion = cdmVersion, 52 | cdmDatabaseSchema = cdmDatabaseSchema, 53 | outputfolder = outputfolder) 54 | 55 | sql <- readr::read_file(file.path(outputfolder, filename)) 56 | } else { 57 | sql <- "" 58 | } 59 | 60 | if(executePrimaryKey) { 61 | filename <- writePrimaryKeys(targetDialect = connectionDetails$dbms, 62 | cdmVersion = cdmVersion, 63 | cdmDatabaseSchema = cdmDatabaseSchema, 64 | outputfolder = outputfolder) 65 | 66 | sql <- paste(sql, readr::read_file(file.path(outputfolder, filename)), sep = "\n") 67 | } 68 | 69 | if(executeForeignKey) { 70 | filename <- writeForeignKeys(targetDialect = connectionDetails$dbms, 71 | cdmVersion = cdmVersion, 72 | cdmDatabaseSchema = cdmDatabaseSchema, 73 | outputfolder = outputfolder) 74 | 75 | sql <- paste(sql, readr::read_file(file.path(outputfolder, filename)), sep = "\n") 76 | } 77 | 78 | con <- DatabaseConnector::connect(connectionDetails = connectionDetails) 79 | 80 | DatabaseConnector::executeSql(con, sql = sql, reportOverallTime = FALSE, progressBar = FALSE, ...) 81 | 82 | DatabaseConnector::disconnect(con) 83 | } 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /R/listSupportedVersions.R: -------------------------------------------------------------------------------- 1 | #' List CDM versions supported by this package 2 | #' 3 | #' @return A character vector containing the supported Common Data Model (CDM) versions in major.minor format. 4 | #' @export 5 | listSupportedVersions <- function() { 6 | supportedVersions <- c("5.3", "5.4") 7 | return(supportedVersions) 8 | } 9 | 10 | #' List RDBMS dialects supported by this package 11 | #' 12 | #' @return A list containing the supported Structured Query Language (SQL) dialects. 13 | #' @export 14 | 15 | listSupportedDialects <- function() { 16 | sqlRenderSupportedDialects <- SqlRender::listSupportedDialects() 17 | supportedDialects <- sqlRenderSupportedDialects$dialect 18 | return(supportedDialects) 19 | } 20 | -------------------------------------------------------------------------------- /R/utils.R: -------------------------------------------------------------------------------- 1 | # these packages are used in utilities or functions outside of check's vision 2 | # this function ensures that check is satisfied and does not report the 3 | # packages as imported but not imported from 4 | checkSatisfier <- function() { 5 | DBI::dbConnect 6 | dplyr::sql 7 | rmarkdown::draft 8 | } 9 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | One test was removed due to its restricting of downstream dependencies. 2 | 3 | ## R CMD check results 4 | 5 | There were no ERRORs or WARNINGs. 6 | 7 | 0 errors | 0 warnings | 0 notes 8 | 9 | ## Comments from reviewer 10 | 11 | Edited the author field in the DESCRIPTION file. 12 | 13 | -------------------------------------------------------------------------------- /docs/favicon.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/favicon.ico -------------------------------------------------------------------------------- /docs/images/ATLAS_Persistence_Window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/ATLAS_Persistence_Window.png -------------------------------------------------------------------------------- /docs/images/AWS_clusters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/AWS_clusters.png -------------------------------------------------------------------------------- /docs/images/Athena_download_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/Athena_download_box.png -------------------------------------------------------------------------------- /docs/images/CDM_refresh_cycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/CDM_refresh_cycle.png -------------------------------------------------------------------------------- /docs/images/Sepsis_to_SNOMED.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/Sepsis_to_SNOMED.png -------------------------------------------------------------------------------- /docs/images/Usagi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/Usagi.png -------------------------------------------------------------------------------- /docs/images/cdm54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/cdm54.png -------------------------------------------------------------------------------- /docs/images/cdm_wg_calendar.csv: -------------------------------------------------------------------------------- 1 | calendarId,title,body,recurrenceRule,start,end,category,location,bgColor,color,borderColor 2 | 1,CDM WG Meeting,,,2023-01-03 10:00:00,2023-01-03 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 3 | 2,CDM WG : Pregnancy,The Pregnancy and Maternal Medicine working group will present.,,2023-01-17 13:00:00,2023-01-17 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 4 | 1,CDM WG Meeting : NLP,The NLP working group will present some potential updates to the NOTE_NLP table.,,2023-02-07 10:00:00,2023-02-07 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 5 | 2,CDM WG Vocabulary Discussion,Anna Ostropolets will join to ask us about our experiences using the OMOP Standard Vocabulary for ETL and other purposes,,2023-02-21 13:00:00,2023-02-21 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 6 | 1,CDM WG : HADES,Martijn Schuemie will present about the HADES working group and how their work interconnects with the OMOP CDM,,2023-03-07 9:00:00,2023-03-07 10:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 7 | 2,CDM WG : Medical Imaging,Paul Nagy will talk to us about the modeling work being done in the Medical Imaging working group,,2023-03-21 13:00:00,2023-03-21 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 8 | 1,CDM WG Meeting,,,2023-04-04 10:00:00,2023-04-04 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 9 | 2,CDM WG : GIS,The GIS working group will join us to share what they are working on and how we might support them.,,2023-04-18 13:00:00,2023-04-18 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 10 | 1,CDM WG Meeting,,,2023-05-02 10:00:00,2023-05-02 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 11 | 2,CDM WG Meeting,,,2023-05-16 13:00:00,2023-05-16 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 12 | 1,CDM WG Meeting,,,2023-06-06 10:00:00,2023-06-06 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 13 | 2,CDM WG Meeting,,,2023-07-18 13:00:00,2023-07-18 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 14 | 1,CDM WG Meeting,,,2023-08-01 10:00:00,2023-08-01 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 15 | 2,CDM WG Meeting,,,2023-08-15 13:00:00,2023-08-15 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 16 | 1,CDM WG Meeting,,,2023-09-05 10:00:00,2023-09-05 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 17 | 2,CDM WG Meeting,,,2023-09-19 13:00:00,2023-09-19 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 18 | 1,CDM WG Meeting,,,2023-10-03 10:00:00,2023-10-03 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 19 | 2,CDM WG Meeting,,,2023-10-17 13:00:00,2023-10-17 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 20 | 1,CDM WG Meeting,,,2023-11-07 10:00:00,2023-11-07 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 21 | 2,CDM WG Meeting,,,2023-11-21 13:00:00,2023-11-21 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 22 | 1,CDM WG Meeting,,,2023-12-05 10:00:00,2023-12-05 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 23 | 2,CDM WG Meeting,,,2023-12-19 13:00:00,2023-12-19 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 24 | -------------------------------------------------------------------------------- /docs/images/diabetes-related_case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/diabetes-related_case.png -------------------------------------------------------------------------------- /docs/images/downloadJava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/downloadJava.png -------------------------------------------------------------------------------- /docs/images/downloadR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/downloadR.png -------------------------------------------------------------------------------- /docs/images/downloadRStudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/downloadRStudio.png -------------------------------------------------------------------------------- /docs/images/erd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/erd.jpg -------------------------------------------------------------------------------- /docs/images/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/important.png -------------------------------------------------------------------------------- /docs/images/mapping_of_concepts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/mapping_of_concepts.png -------------------------------------------------------------------------------- /docs/images/no32Bits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/no32Bits.png -------------------------------------------------------------------------------- /docs/images/pregnancy-related_case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/pregnancy-related_case.png -------------------------------------------------------------------------------- /docs/images/rDestination.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/rDestination.png -------------------------------------------------------------------------------- /docs/images/sign-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/images/sign-up.png -------------------------------------------------------------------------------- /docs/ohdsi16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/ohdsi16x16.png -------------------------------------------------------------------------------- /docs/ohdsi40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/ohdsi40x40.png -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/Lato.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/Lato.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/LatoBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/LatoBold.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/LatoItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/LatoItalic.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycle.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycle.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycleBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/NewsCycleBold.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSans.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBold.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansBoldItalic.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansItalic.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLight.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/OpenSansLightItalic.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/Raleway.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/Raleway.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/RalewayBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/RalewayBold.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/Roboto.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/Roboto.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoBold.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoLight.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoMedium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/RobotoMedium.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansPro.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansPro.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProBold.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProItalic.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/SourceSansProLight.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/css/fonts/Ubuntu.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/css/fonts/Ubuntu.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/bootstrap-3.3.5/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /docs/site_libs/bootstrap-3.3.5/shim/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | // Only run this code in IE 8 5 | if (!!window.navigator.userAgent.match("MSIE 8")) { 6 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document); 7 | }; 8 | -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/site_libs/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/font-awesome-6.4.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/site_libs/header-attrs-2.25/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/site_libs/header-attrs-2.27/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/site_libs/highlightjs-9.12.0/default.css: -------------------------------------------------------------------------------- 1 | .hljs-literal { 2 | color: #990073; 3 | } 4 | 5 | .hljs-number { 6 | color: #099; 7 | } 8 | 9 | .hljs-comment { 10 | color: #998; 11 | font-style: italic; 12 | } 13 | 14 | .hljs-keyword { 15 | color: #900; 16 | font-weight: bold; 17 | } 18 | 19 | .hljs-string { 20 | color: #d14; 21 | } 22 | -------------------------------------------------------------------------------- /docs/site_libs/highlightjs-9.12.0/textmate.css: -------------------------------------------------------------------------------- 1 | .hljs-literal { 2 | color: rgb(88, 72, 246); 3 | } 4 | 5 | .hljs-number { 6 | color: rgb(0, 0, 205); 7 | } 8 | 9 | .hljs-comment { 10 | color: rgb(76, 136, 107); 11 | } 12 | 13 | .hljs-keyword { 14 | color: rgb(0, 0, 255); 15 | } 16 | 17 | .hljs-string { 18 | color: rgb(3, 106, 7); 19 | } 20 | -------------------------------------------------------------------------------- /docs/site_libs/htmltools-fill-0.5.8.1/fill.css: -------------------------------------------------------------------------------- 1 | @layer htmltools { 2 | .html-fill-container { 3 | display: flex; 4 | flex-direction: column; 5 | /* Prevent the container from expanding vertically or horizontally beyond its 6 | parent's constraints. */ 7 | min-height: 0; 8 | min-width: 0; 9 | } 10 | .html-fill-container > .html-fill-item { 11 | /* Fill items can grow and shrink freely within 12 | available vertical space in fillable container */ 13 | flex: 1 1 auto; 14 | min-height: 0; 15 | min-width: 0; 16 | } 17 | .html-fill-container > :not(.html-fill-item) { 18 | /* Prevent shrinking or growing of non-fill items */ 19 | flex: 0 0 auto; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors, https://jquery.org/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery-ui 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | Copyright and related rights for sample code are waived via CC0. Sample 34 | code is defined as all source code contained within the demos directory. 35 | 36 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 37 | 38 | ==== 39 | 40 | All files located in the node_modules and external directories are 41 | externally maintained libraries used by this software which have their 42 | own licenses; we recommend you read them, as their terms may differ from 43 | the terms above. 44 | -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/images/ui-icons_444444_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/jqueryui-1.13.2/images/ui-icons_444444_256x240.png -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/images/ui-icons_555555_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/jqueryui-1.13.2/images/ui-icons_555555_256x240.png -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/images/ui-icons_777620_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/jqueryui-1.13.2/images/ui-icons_777620_256x240.png -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/images/ui-icons_777777_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/jqueryui-1.13.2/images/ui-icons_777777_256x240.png -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/images/ui-icons_cc0000_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/jqueryui-1.13.2/images/ui-icons_cc0000_256x240.png -------------------------------------------------------------------------------- /docs/site_libs/jqueryui-1.13.2/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/docs/site_libs/jqueryui-1.13.2/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /docs/site_libs/navigation-1.1/codefolding-lua.css: -------------------------------------------------------------------------------- 1 | detaiks.chunk-details > summary.chunk-summary { 2 | text-align: right; 3 | } 4 | details.chunk-details[open] > summary.chunk-summary::after { 5 | content: "Hide"; 6 | } 7 | details.chunk-details[open] > summary.chunk-summary > span.chunk-summary-text { 8 | display: none; 9 | } 10 | -------------------------------------------------------------------------------- /docs/site_libs/navigation-1.1/codefolding.js: -------------------------------------------------------------------------------- 1 | 2 | window.initializeCodeFolding = function(show) { 3 | 4 | // handlers for show-all and hide all 5 | $("#rmd-show-all-code").click(function() { 6 | $('div.r-code-collapse').each(function() { 7 | $(this).collapse('show'); 8 | }); 9 | }); 10 | $("#rmd-hide-all-code").click(function() { 11 | $('div.r-code-collapse').each(function() { 12 | $(this).collapse('hide'); 13 | }); 14 | }); 15 | 16 | // index for unique code element ids 17 | var currentIndex = 1; 18 | 19 | // select all R code blocks 20 | var rCodeBlocks = $('pre.r, pre.python, pre.bash, pre.sql, pre.cpp, pre.stan, pre.julia, pre.foldable'); 21 | rCodeBlocks.each(function() { 22 | // skip if the block has fold-none class 23 | if ($(this).hasClass('fold-none')) return; 24 | 25 | // create a collapsable div to wrap the code in 26 | var div = $('
'); 27 | var showThis = (show || $(this).hasClass('fold-show')) && !$(this).hasClass('fold-hide'); 28 | var id = 'rcode-643E0F36' + currentIndex++; 29 | div.attr('id', id); 30 | $(this).before(div); 31 | $(this).detach().appendTo(div); 32 | 33 | // add a show code button right above 34 | var showCodeText = $('' + (showThis ? 'Hide' : 'Show') + ''); 35 | var showCodeButton = $(''); 36 | showCodeButton.append(showCodeText); 37 | showCodeButton 38 | .attr('data-toggle', 'collapse') 39 | .attr('data-bs-toggle', 'collapse') // BS5 40 | .attr('data-target', '#' + id) 41 | .attr('data-bs-target', '#' + id) // BS5 42 | .attr('aria-expanded', showThis) 43 | .attr('aria-controls', id); 44 | 45 | var buttonRow = $('
'); 46 | var buttonCol = $('
'); 47 | 48 | buttonCol.append(showCodeButton); 49 | buttonRow.append(buttonCol); 50 | 51 | div.before(buttonRow); 52 | 53 | // show the div if necessary 54 | if (showThis) div.collapse('show'); 55 | 56 | // update state of button on show/hide 57 | // * Change text 58 | // * add a class for intermediate states styling 59 | div.on('hide.bs.collapse', function () { 60 | showCodeText.text('Show'); 61 | showCodeButton.addClass('btn-collapsing'); 62 | }); 63 | div.on('hidden.bs.collapse', function () { 64 | showCodeButton.removeClass('btn-collapsing'); 65 | }); 66 | div.on('show.bs.collapse', function () { 67 | showCodeText.text('Hide'); 68 | showCodeButton.addClass('btn-expanding'); 69 | }); 70 | div.on('shown.bs.collapse', function () { 71 | showCodeButton.removeClass('btn-expanding'); 72 | }); 73 | 74 | }); 75 | 76 | } 77 | -------------------------------------------------------------------------------- /docs/site_libs/navigation-1.1/sourceembed.js: -------------------------------------------------------------------------------- 1 | 2 | window.initializeSourceEmbed = function(filename) { 3 | $("#rmd-download-source").click(function() { 4 | var src = $("#rmd-source-code").html(); 5 | var a = document.createElement('a'); 6 | a.href = "data:text/x-r-markdown;base64," + src; 7 | a.download = filename; 8 | document.body.appendChild(a); 9 | a.click(); 10 | document.body.removeChild(a); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /docs/site_libs/tocify-1.9.1/jquery.tocify.css: -------------------------------------------------------------------------------- 1 | /* 2 | * jquery.tocify.css 1.9.1 3 | * Author: @gregfranko 4 | */ 5 | 6 | /* The Table of Contents container element */ 7 | .tocify { 8 | width: 20%; 9 | max-height: 90%; 10 | overflow: auto; 11 | margin-left: 2%; 12 | position: fixed; 13 | border: 1px solid #ccc; 14 | border-radius: 6px; 15 | } 16 | 17 | /* The Table of Contents is composed of multiple nested unordered lists. These styles remove the default styling of an unordered list because it is ugly. */ 18 | .tocify ul, .tocify li { 19 | list-style: none; 20 | margin: 0; 21 | padding: 0; 22 | border: none; 23 | line-height: 30px; 24 | } 25 | 26 | /* Top level header elements */ 27 | .tocify-header { 28 | text-indent: 10px; 29 | } 30 | 31 | /* Top level subheader elements. These are the first nested items underneath a header element. */ 32 | .tocify-subheader { 33 | text-indent: 20px; 34 | display: none; 35 | } 36 | 37 | /* Makes the font smaller for all subheader elements. */ 38 | .tocify-subheader li { 39 | font-size: 12px; 40 | } 41 | 42 | /* Further indents second level subheader elements. */ 43 | .tocify-subheader .tocify-subheader { 44 | text-indent: 30px; 45 | } 46 | .tocify-subheader .tocify-subheader .tocify-subheader { 47 | text-indent: 40px; 48 | } 49 | .tocify-subheader .tocify-subheader .tocify-subheader .tocify-subheader { 50 | text-indent: 50px; 51 | } 52 | .tocify-subheader .tocify-subheader .tocify-subheader .tocify-subheader .tocify-subheader { 53 | text-indent: 60px; 54 | } 55 | 56 | /* Twitter Bootstrap Override Style */ 57 | .tocify .tocify-item > a, .tocify .nav-list .nav-header { 58 | margin: 0px; 59 | } 60 | 61 | /* Twitter Bootstrap Override Styles */ 62 | .tocify .tocify-item a, .tocify .list-group-item { 63 | padding: 5px; 64 | } 65 | 66 | .tocify .nav-pills > li { 67 | float: none; 68 | } 69 | 70 | /* We don't override the bootstrap colors because this gives us the 71 | wrong selection colors when using bootstrap themes 72 | 73 | .tocify .list-group-item:hover, .tocify .list-group-item:focus { 74 | background-color: #f5f5f5; 75 | } 76 | 77 | .tocify .list-group-item.active:hover, .tocify .list-group-item.active:focus { 78 | background-color: #428bca; 79 | } 80 | */ 81 | 82 | /* End Twitter Bootstrap Override Styles */ 83 | -------------------------------------------------------------------------------- /docs/style.css: -------------------------------------------------------------------------------- 1 | .rmdimportant { 2 | padding: 1em 1em 1em 4em; 3 | margin-bottom: 10px; 4 | background: #f5f5f5 5px center/3em no-repeat; 5 | background-image: url("images/important.png"); 6 | } -------------------------------------------------------------------------------- /extras/SiteMaintenance.R: -------------------------------------------------------------------------------- 1 | # Generate site from markdown files -------------------------------------- 2 | 3 | # Run this in standalone R session. Runs orders of magnitude faster compared 4 | # to running in RStudio: 5 | 6 | setwd("/Users/clairblacketer/Documents/Github/CommonDataModel/rmd") 7 | rmarkdown::render_site() 8 | 9 | -------------------------------------------------------------------------------- /extras/archive/OMOP CDMv5.3.1 Specs v0.1 test.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/extras/archive/OMOP CDMv5.3.1 Specs v0.1 test.xlsx -------------------------------------------------------------------------------- /extras/archive/OMOP CDMv5.3.1 Specs v0.1.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/extras/archive/OMOP CDMv5.3.1 Specs v0.1.xlsx -------------------------------------------------------------------------------- /extras/archive/OMOP CDMv6 DQ Checks v0.1.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/extras/archive/OMOP CDMv6 DQ Checks v0.1.xlsx -------------------------------------------------------------------------------- /extras/archive/OMOP_CDM_v5_3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/extras/archive/OMOP_CDM_v5_3.pdf -------------------------------------------------------------------------------- /extras/archive/OMOP_CDM_v6_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/extras/archive/OMOP_CDM_v6_0.pdf -------------------------------------------------------------------------------- /extras/archive/OMOP_CDM_v6_0test.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/extras/archive/OMOP_CDM_v6_0test.pdf -------------------------------------------------------------------------------- /extras/archive/test-buildRelease.R: -------------------------------------------------------------------------------- 1 | test_that("buildRelease() output matches current ddl folder", { 2 | 3 | tempfolder <- tempdir(check = TRUE) 4 | generatedBaseFolder <- file.path(tempdir(check = TRUE), "ddl") 5 | currentBaseFolder <- system.file("ddl", package = "CommonDataModel", mustWork = TRUE) 6 | 7 | # build all of the releases in a temp folder 8 | buildRelease(outputfolder = generatedBaseFolder) 9 | 10 | # compare to the files in the current ddl folder of the package 11 | generatedDirectories <- list.dirs(generatedBaseFolder, full.names = F) 12 | currentDirectories <- list.dirs(currentBaseFolder, full.names = F) 13 | expect_gt(length(currentDirectories), 1) 14 | expect_setequal(generatedDirectories, currentDirectories) 15 | 16 | # compare filenames 17 | generatedFilenames <- list.files(generatedBaseFolder, recursive = TRUE) 18 | currentFilenames <- list.files(generatedBaseFolder, recursive = TRUE) 19 | expect_gt(length(currentFilenames), 1) 20 | expect_setequal(generatedFilenames, currentFilenames) 21 | 22 | # compare file contents using md5 hash 23 | # depending on build platform file contents could vary with newlines, etc 24 | # 25 | # generatedChecksums <- tools::md5sum(file.path(generatedBaseFolder, generatedFilenames)) 26 | # currentChecksums <- tools::md5sum(file.path(currentBaseFolder, currentFilenames)) 27 | # names(generatedChecksums) <- NULL 28 | # names(currentChecksums) <- NULL 29 | # expect_gt(length(currentChecksums), 1) 30 | # expect_setequal(generatedChecksums, currentChecksums) 31 | 32 | }) 33 | -------------------------------------------------------------------------------- /extras/archive/testSpec.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "omopCdmDocumentation" 3 | author: "Clair Blacketer" 4 | date: "8/16/2019" 5 | output: 6 | html_document: 7 | toc: true 8 | toc_depth: 5 9 | toc_float: true 10 | --- 11 | 12 | ```{r setup, include=FALSE, eval=TRUE} 13 | 14 | #todo figure out how to get the document dynamically without specifying the name 15 | library(rmarkdown) 16 | library(knitr) 17 | library(kableExtra) 18 | library(magrittr) 19 | library(dplyr) 20 | library(stringr) 21 | 22 | ``` 23 | 24 | ## OMOP Common Data Model Documentation 25 | 26 | ## CDM v5.3.1 27 | 28 | ```{r docLoop53, echo=FALSE, results='asis'} 29 | cdmSpecs <- readxl::read_excel("../docs/OMOP CDMv5.3.1 Specs v0.1.xlsx", sheet = "FIELD LEVEL") 30 | tableSpecs <- readxl::read_excel("../docs/OMOP CDMv5.3.1 Specs v0.1.xlsx", sheet = "TABLE LEVEL") 31 | tables <- tableSpecs$CDM_TABLE 32 | 33 | cdmSpecsClean <- cdmSpecs %>% 34 | dplyr::select(`CDM Table` = CDM_TABLE, 35 | `CDM Field` = CDM_FIELD, 36 | `User Guide` = USER_GUIDANCE, 37 | `ETL Conventions` = ETL_CONVENTIONS, 38 | `Datatype` = CDM_DATATYPE, 39 | `Is Required` = IS_REQUIRED, 40 | `Is Primary Key` = IS_PRIMARY_KEY, 41 | `Is Foreign Key (FK)` = IS_FOREIGN_KEY, 42 | `FK Table` = FK_TABLE, 43 | `FK Domain` = FK_DOMAIN, 44 | `FK Class` = FK_CLASS 45 | ) 46 | 47 | for(tb in tables) { 48 | cat("###", tb, "{.tabset .tabset-pills} \n\n") 49 | 50 | loopTable <- subset(cdmSpecsClean, `CDM Table` == tb) 51 | loopTable <- subset(loopTable, select = -c(1)) 52 | 53 | print(kable(x = loopTable, align = "l", row.names = FALSE) %>% kable_styling(bootstrap_options = c("hover", "condensed", "responsive"))) 54 | 55 | } 56 | 57 | 58 | 59 | ``` 60 | 61 | ## CDM v6.0 62 | 63 | ```{r docLoop60, echo=FALSE, results='asis'} 64 | cdmSpecs <- readxl::read_excel("C:/Git/Github/DDLgeneratr_OHDSI/docs/OMOP CDMv6 DQ Checks v0.1.xlsx", sheet = "FIELD LEVEL") 65 | tableSpecs <- readxl::read_excel("C:/Git/Github/DDLgeneratr_OHDSI/docs/OMOP CDMv6 DQ Checks v0.1.xlsx", sheet = "TABLE LEVEL") 66 | tables <- tableSpecs$CDM_TABLE 67 | 68 | cdmSpecsClean <- cdmSpecs %>% 69 | dplyr::select(`CDM Table` = CDM_TABLE, 70 | `CDM Field` = CDM_FIELD, 71 | `User Guide` = USER_GUIDANCE, 72 | `ETL Conventions` = ETL_CONVENTIONS, 73 | `Datatype` = CDM_DATATYPE, 74 | `Is Required` = IS_REQUIRED, 75 | `Is Primary Key` = IS_PRIMARY_KEY, 76 | `Is Foreign Key (FK)` = IS_FOREIGN_KEY, 77 | `FK Table` = FK_TABLE, 78 | `FK Domain` = FK_DOMAIN, 79 | `FK Class` = FK_CLASS 80 | ) 81 | 82 | for(tb in tables) { 83 | cat("###", tb, "{.tabset .tabset-pills} \n\n") 84 | 85 | loopTable <- subset(cdmSpecsClean, `CDM Table` == tb) 86 | loopTable <- subset(loopTable, select = -c(1)) 87 | 88 | print(kable(x = loopTable, align = "l", row.names = FALSE) %>% kable_styling(bootstrap_options = c("hover", "condensed", "responsive"))) 89 | 90 | } 91 | 92 | 93 | 94 | ``` 95 | -------------------------------------------------------------------------------- /extras/codeToRun.R: -------------------------------------------------------------------------------- 1 | # This script is meant to create the OMOP Common Data Model DDLs for each dialect as well as the pdf of the documentation. 2 | 3 | # For a given cdmVersion, create all ddl sql files for every sql dialect 4 | # Results are written to inst/ddl/cdm_version/dialect. 5 | cdmVersion <- "5.3" 6 | 7 | supportedVersions <- CommonDataModel::listSupportedVersions() 8 | 9 | for (cdmVersion in supportedVersions) { 10 | for (targetDialect in CommonDataModel::listSupportedDialects()) { 11 | CommonDataModel::writeDdl(targetDialect = targetDialect, 12 | cdmVersion = cdmVersion) 13 | 14 | CommonDataModel::writePrimaryKeys(targetDialect = targetDialect, 15 | cdmVersion = cdmVersion) 16 | 17 | CommonDataModel::writeForeignKeys(targetDialect = targetDialect, 18 | cdmVersion = cdmVersion) 19 | 20 | CommonDataModel::writeIndex(targetDialect = targetDialect, 21 | cdmVersion = cdmVersion) 22 | } 23 | } 24 | 25 | CommonDataModel::buildRelease("5.3") 26 | 27 | ############# 28 | # Zipping release 29 | # All dialects 30 | CommonDataModel::buildReleaseZip(cdmVersion="5.3", outputfolder="output") 31 | 32 | buildReleaseZip() 33 | 34 | # One dialect 35 | buildReleaseZip(cdmVersion="5.4", targetDialect="postgresql", outputfolder="output") 36 | 37 | ############# 38 | # BE SURE TO RUN THE EXTRAS/SITEMAINTENANCE.R BEFORE CREATING THE PDF 39 | 40 | # step 9: Run the following code to create the pdf documentation. It will be written to the reports folder. Use knit with pagedown 41 | 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 42 | 43 | # 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 44 | 45 | newdir <- "C:/Git/Github/CommonDataModel/docs" 46 | currentdir <- paste0(getwd(),"/docs/") 47 | 48 | 49 | file.copy(currentdir, newdir, recursive = TRUE, overwrite = TRUE) 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /extras/createERDiagram.R: -------------------------------------------------------------------------------- 1 | 2 | cdmVersion <- '5.4' 3 | cdmPart <- c('CDM','VOCAB', 'RESULTS') 4 | cdmTables <- NULL #c('PERSON', 'OBSERVATION_PERIOD', 'VISIT_OCCURRENCE', 'CONDITION_OCCURRENCE', 'CONCEPT') 5 | 6 | cdmTableCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Table_Level.csv")), package = "CommonDataModel", mustWork = TRUE) 7 | cdmFieldCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Field_Level.csv")), package = "CommonDataModel", mustWork = TRUE) 8 | 9 | tableSpecs <- read.csv(cdmTableCsvLoc, stringsAsFactors = FALSE) 10 | cdmSpecs <- read.csv(cdmFieldCsvLoc, stringsAsFactors = FALSE) 11 | 12 | mermaidDdlLines <- c() 13 | mermaidFkLines <- c() 14 | for (i in 1:nrow(tableSpecs)) { 15 | table <- tableSpecs[i,] 16 | tableName <- table$cdmTableName 17 | if (!(table$schema %in% cdmPart)) { 18 | next 19 | } 20 | if (!is.null(cdmTables) && !(table$cdmTableName %in% cdmTables)) { 21 | next 22 | } 23 | mermaidDdlLines <- c(mermaidDdlLines, 24 | sprintf(' %s {', tableName)) 25 | 26 | fields <- subset(cdmSpecs, cdmTableName == tableName) 27 | for (j in 1:nrow(fields)) { 28 | field <- fields[j,] 29 | cdmFieldName <- field$cdmFieldName 30 | cdmDataType <- field$cdmDatatype 31 | if (startsWith(cdmDataType, 'varchar')) { 32 | cdmDataType <- 'varchar' 33 | } 34 | if (cdmFieldName == '"offset"') { 35 | cdmFieldName <- 'offset' 36 | } 37 | mermaidDdlLines <- c(mermaidDdlLines, 38 | sprintf(' %s %s', cdmFieldName, cdmDataType)) 39 | 40 | if (field$isForeignKey == 'Yes') { 41 | fkTable <- subset(tableSpecs, cdmTableName == field$fkTableName) 42 | if (!(fkTable$schema %in% cdmPart)) { 43 | next 44 | } 45 | if (!is.null(cdmTables) && !(fkTable$cdmTableName %in% cdmTables)) { 46 | next 47 | } 48 | 49 | fkRelation <- sprintf(' %s ||--o{ %s : ""', tableName, field$fkTableName) 50 | if (fkRelation %in% mermaidFkLines) { 51 | next 52 | } 53 | mermaidFkLines <- c(mermaidFkLines, 54 | fkRelation) 55 | } 56 | } 57 | mermaidDdlLines <- c(mermaidDdlLines, ' }') 58 | } 59 | 60 | mermaidString <- paste(c('erDiagram', mermaidDdlLines, mermaidFkLines), collapse = '\n') 61 | fileName <- sprintf('OMOP_CDMv%s_ER_Diagram.mmd', cdmVersion) 62 | write(mermaidString, file.path('extras', fileName)) 63 | 64 | -------------------------------------------------------------------------------- /extras/packageMaintenance.R: -------------------------------------------------------------------------------- 1 | 2 | ## Do this to get csv files from github 3 | ## Get the url of the zipped branch or tag to get the csvs from 4 | 5 | # Set fileName variable to the name of the cdm version or branch being downloaded 6 | fileName <- "cdm_v_5_3_1_fixes" 7 | 8 | # get the url for the zip CDM files. This could be for a release or for a branch 9 | zipUrl <- "https://github.com/OHDSI/CommonDataModel/archive/v5.3.1_fixes.zip" 10 | 11 | # download the zipped files 12 | download.file(url = zipUrl, 13 | destfile = paste0("inst/zip/", fileName ,".zip")) 14 | 15 | # find the names of the csvs in the zipped file 16 | zipped_csv_names <- grep('\\.csv$', unzip(paste0("inst/zip/", fileName ,".zip"), list=TRUE)$Name, 17 | ignore.case=TRUE, value=TRUE) 18 | 19 | # unzip only the csvs and put them in inst 20 | unzip(paste0("inst/zip/", fileName ,".zip"), files=zipped_csv_names, exdir = "inst") 21 | 22 | # paste the new csvs in the csv folder 23 | zipFileList <- unzip(paste0("inst/zip/", fileName ,".zip"), list=TRUE) 24 | folderName <- dplyr::filter(zipFileList, stringr::str_ends(Name, "/", negate = FALSE) & stringr::str_count(Name,"/") ==1) 25 | 26 | newdir <- "inst/csv" 27 | currentdir <- paste0("inst/",folderName$Name,"/") 28 | listFiles <- list.files(currentdir) 29 | 30 | file.copy(file.path(currentdir,listFiles), newdir, recursive = TRUE, overwrite = TRUE) 31 | 32 | #rebuild package 33 | 34 | 35 | # CRAN testing 36 | # For info the token(s) and email(s) are stored at ~/Library/Application Support/rhub/validated_emails.csv 37 | # devtools::check_rhub() 38 | 39 | 40 | -------------------------------------------------------------------------------- /extras/v53_v54_conversion/README.txt: -------------------------------------------------------------------------------- 1 | 2 | README 3 | ------ 4 | 5 | v5.3 to v5.4 CDM conversion 6 | 7 | NOTES 8 | ----- 9 | 10 | The *_v53_to_v54_migration.sql scripts are SQL scripts that migrate a v5.3 CDM to a v5.4 CDM. 11 | The changes implemented are found here: http://ohdsi.github.io/CommonDataModel/cdm54Changes.html. 12 | Please replace @cdmDatabaseSchema with your schema name. 13 | Links to database documentation are included in each script to facilitate debugging. -------------------------------------------------------------------------------- /extras/v60_v54_conversion/compare_column_attributes.sql: -------------------------------------------------------------------------------- 1 | with cdm_v540 as ( 2 | select * 3 | from information_schema.columns 4 | where table_schema = 'cdm_v540' --> ENTER YOUR V5.4 CDM HERE 5 | and table_name not in ('cohort','cohort_attribute','cohort_definition') 6 | ), cdm_v601 as ( 7 | select * 8 | from information_schema.columns 9 | where table_schema = 'cdm_v601' --> ENTER YOUR V6.0 CDM HERE 10 | and table_name not in ('cohort','cohort_attribute','cohort_definition') 11 | ) 12 | select a.table_name, 13 | a.column_name, 14 | a.is_nullable v54_nullable, 15 | b.is_nullable v60_nullable, 16 | a.data_type v54_datatype, 17 | b.data_type v60_datatype 18 | from cdm_v540 a 19 | join cdm_v601 b 20 | on a.table_name = b.table_name 21 | and a.column_name = b.column_name 22 | and (a.is_nullable != b.is_nullable or a.data_type != b.data_type) 23 | order by 1,2; -------------------------------------------------------------------------------- /extras/v60_v54_conversion/compare_column_names.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- RETRIEVE TABLE AND COLUMN NAMES FOR V5.4 AND V6.0 CDMS. 3 | -- SUPPLY THE NAME OF EACH SCHEMA WHERE INDICATED. 4 | -- THE "STATUS" COLUMN: 5 | -- "IN BOTH": INDICATES COLUMN IS IN BOTH 5.4 AND 6.0 6 | -- "MISSING FROM v6.0.1": INDICATES COLUMN IS IN BOTH 5.4 BUT NOT 6.0 AND NEEDS TO BE ADDED OR RENAMED 7 | -- "MISSING FROM v5.4.0": INDICATES COLUMN IS IN BOTH 6.0 BUT NOT 5.4 AND NEED TO BE DROPPED OR RENAMED 8 | 9 | with cdm_v540 as ( 10 | select * 11 | from information_schema.columns 12 | where table_schema = 'cdm_v540' --> YOUR V5.4 CDM SCHEMA NAME HERE 13 | and table_name not in ('_version','cohort','cohort_attribute','cohort_definition') 14 | ), cdm_v601 as ( 15 | select * 16 | from information_schema.columns 17 | where table_schema = 'cdm_v601' --> YOUR V6.0 CDM SCHEMA NAME HERE 18 | and table_name not in ('_version','cohort','cohort_attribute','cohort_definition') 19 | ) 20 | select a.table_name, 21 | a.column_name, 22 | 'IN BOTH' status 23 | from cdm_v540 a 24 | join cdm_v601 b 25 | on a.table_name = b.table_name 26 | and a.column_name = b.column_name 27 | union all 28 | select a.table_name, 29 | a.column_name, 30 | 'MISSING FROM v6.0.1' status 31 | from cdm_v540 a 32 | left join cdm_v601 b 33 | on a.table_name = b.table_name 34 | and a.column_name = b.column_name 35 | where b.column_name is null 36 | union all 37 | select b.table_name, 38 | b.column_name, 39 | 'MISSING FROM v5.4.0' status 40 | from cdm_v540 a 41 | right join cdm_v601 b 42 | on a.table_name = b.table_name 43 | and a.column_name = b.column_name 44 | where a.column_name is null 45 | order by 1,3; -------------------------------------------------------------------------------- /inst/csv/OMOP_CDM_Oncology_Ex_Table_Level.csv: -------------------------------------------------------------------------------- 1 | cdmTableName,schema,isRequired,conceptPrefix,measurePersonCompleteness,measurePersonCompletenessThreshold,validation,tableDescription,userGuidance,etlConventions 2 | episode,CDM,No,,No,0,,"The episode table aggregates lower-level clinical events (visit_occurrence, drug_exposure, procedure_occurrence, device_exposure) into a higher-level abstraction representing clinically and analytically relevant disease phases,outcomes and treatments. The episode_event table connects qualifying clinical events (visit_occurrence, drug_exposure, procedure_occurrence, device_exposure) to the appropriate episode entry. For example cancers including their development over time, their treatment, and final resolution. ","Valid Episode Concepts belong to the 'Episode' domain. For cancer episodes please see [article], for non-cancer episodes please see [article]. If your source data does not have all episodes that are relevant to the therapeutic area, write only those you can easily derive from the data. It is understood that that table is not currently expected to be comprehensive. ", 3 | episode_event,CDM,No,,No,0,,"The episode_event table connects qualifying clinical events (such as condition_occurrence, drug_exposure, procedure_occurrence, measurement) to the appropriate episode entry. For example, linking the precise location of the metastasis (cancer modifier in measurement) to the disease episode. ",This connecting table is used instead of the fact_relationship table for linking low-level events to abstracted Episodes.,"Some episodes may not have links to any underlying clinical events. For such episodes, the episode_event table is not populated." 4 | measurement,CDM,No,measurement_,Yes,0,,"The measurement table contains records of Measurement, i.e. structured values (numerical or categorical) obtained through systematic and standardized examination or testing of a Person or Person's sample. The measurement table contains both orders and results of such Measurements as laboratory tests, vital signs, quantitative findings from pathology reports, etc. Measurements are stored as attribute value pairs, with the attribute as the Measurement Concept and the value representing the result. The value can be a Concept (stored in value_as_concept), or a numerical value (value_as_number) with a Unit (unit_concept_id).",Measurements differ from Observations in that they require a standardized test or some other activity to generate a quantitative or qualitative result. , 5 | -------------------------------------------------------------------------------- /inst/ddl/5.3/bigquery/OMOPCDM_bigquery_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --bigquery CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | alter table @cdmDatabaseSchema.person add constraint xpk_person primary key nonclustered (person_id); 3 | alter table @cdmDatabaseSchema.observation_period add constraint xpk_observation_period primary key nonclustered (observation_period_id); 4 | alter table @cdmDatabaseSchema.visit_occurrence add constraint xpk_visit_occurrence primary key nonclustered (visit_occurrence_id); 5 | alter table @cdmDatabaseSchema.visit_detail add constraint xpk_visit_detail primary key nonclustered (visit_detail_id); 6 | alter table @cdmDatabaseSchema.condition_occurrence add constraint xpk_condition_occurrence primary key nonclustered (condition_occurrence_id); 7 | alter table @cdmDatabaseSchema.drug_exposure add constraint xpk_drug_exposure primary key nonclustered (drug_exposure_id); 8 | alter table @cdmDatabaseSchema.procedure_occurrence add constraint xpk_procedure_occurrence primary key nonclustered (procedure_occurrence_id); 9 | alter table @cdmDatabaseSchema.device_exposure add constraint xpk_device_exposure primary key nonclustered (device_exposure_id); 10 | alter table @cdmDatabaseSchema.measurement add constraint xpk_measurement primary key nonclustered (measurement_id); 11 | alter table @cdmDatabaseSchema.observation add constraint xpk_observation primary key nonclustered (observation_id); 12 | alter table @cdmDatabaseSchema.note add constraint xpk_note primary key nonclustered (note_id); 13 | alter table @cdmDatabaseSchema.note_nlp add constraint xpk_note_nlp primary key nonclustered (note_nlp_id); 14 | alter table @cdmDatabaseSchema.specimen add constraint xpk_specimen primary key nonclustered (specimen_id); 15 | alter table @cdmDatabaseSchema.location add constraint xpk_location primary key nonclustered (location_id); 16 | alter table @cdmDatabaseSchema.care_site add constraint xpk_care_site primary key nonclustered (care_site_id); 17 | alter table @cdmDatabaseSchema.provider add constraint xpk_provider primary key nonclustered (provider_id); 18 | alter table @cdmDatabaseSchema.payer_plan_period add constraint xpk_payer_plan_period primary key nonclustered (payer_plan_period_id); 19 | alter table @cdmDatabaseSchema.cost add constraint xpk_cost primary key nonclustered (cost_id); 20 | alter table @cdmDatabaseSchema.drug_era add constraint xpk_drug_era primary key nonclustered (drug_era_id); 21 | alter table @cdmDatabaseSchema.dose_era add constraint xpk_dose_era primary key nonclustered (dose_era_id); 22 | alter table @cdmDatabaseSchema.condition_era add constraint xpk_condition_era primary key nonclustered (condition_era_id); 23 | alter table @cdmDatabaseSchema.concept add constraint xpk_concept primary key nonclustered (concept_id); 24 | alter table @cdmDatabaseSchema.vocabulary add constraint xpk_vocabulary primary key nonclustered (vocabulary_id); 25 | alter table @cdmDatabaseSchema.domain add constraint xpk_domain primary key nonclustered (domain_id); 26 | alter table @cdmDatabaseSchema.concept_class add constraint xpk_concept_class primary key nonclustered (concept_class_id); 27 | alter table @cdmDatabaseSchema.relationship add constraint xpk_relationship primary key nonclustered (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/duckdb/OMOPCDM_duckdb_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --duckdb CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/hive/OMOPCDM_hive_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --hive CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/impala/OMOPCDM_impala_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --impala CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.`location` ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/netezza/OMOPCDM_netezza_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --netezza CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/oracle/OMOPCDM_oracle_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --oracle CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/pdw/OMOPCDM_pdw_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --pdw CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/postgresql/OMOPCDM_postgresql_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --postgresql CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/redshift/OMOPCDM_redshift_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --redshift CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/snowflake/OMOPCDM_snowflake_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --snowflake CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/spark/OMOPCDM_spark_5.3_indices.sql: -------------------------------------------------------------------------------- 1 | -- spark does not support indexes 2 | -- spark does not support indexes 3 | -- spark does not support indexes 4 | -- spark does not support indexes 5 | -- spark does not support indexes 6 | -- spark does not support indexes 7 | -- spark does not support indexes 8 | -- spark does not support indexes 9 | -- spark does not support indexes 10 | -- spark does not support indexes 11 | -- spark does not support indexes 12 | -- spark does not support indexes 13 | -- spark does not support indexes 14 | -- spark does not support indexes 15 | -- spark does not support indexes 16 | -- spark does not support indexes 17 | -- spark does not support indexes 18 | -- spark does not support indexes 19 | -- spark does not support indexes 20 | -- spark does not support indexes 21 | -- spark does not support indexes 22 | -- spark does not support indexes 23 | -- spark does not support indexes 24 | -- spark does not support indexes 25 | -- spark does not support indexes 26 | -- spark does not support indexes 27 | -- spark does not support indexes 28 | -- spark does not support indexes 29 | -- spark does not support indexes 30 | -- spark does not support indexes 31 | -- spark does not support indexes 32 | -- spark does not support indexes 33 | -- spark does not support indexes 34 | -- spark does not support indexes 35 | -- spark does not support indexes 36 | -- spark does not support indexes 37 | -- spark does not support indexes 38 | -- spark does not support indexes -------------------------------------------------------------------------------- /inst/ddl/5.3/spark/OMOPCDM_spark_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person (person_id); 2 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period (observation_period_id); 3 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence (visit_occurrence_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail (visit_detail_id); 5 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence (condition_occurrence_id); 6 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure (drug_exposure_id); 7 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence (procedure_occurrence_id); 8 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure (device_exposure_id); 9 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement (measurement_id); 10 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation (observation_id); 11 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note (note_id); 12 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp (note_nlp_id); 13 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen (specimen_id); 14 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location (location_id); 15 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site (care_site_id); 16 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider (provider_id); 17 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period (payer_plan_period_id); 18 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost (cost_id); 19 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era (drug_era_id); 20 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era (dose_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era (condition_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept (concept_id); 23 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary (vocabulary_id); 24 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain (domain_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class (concept_class_id); 26 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship (relationship_id); -------------------------------------------------------------------------------- /inst/ddl/5.3/sql_server/OMOPCDM_sql_server_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --sql server CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/sqlite/OMOPCDM_sqlite_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --sqlite CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/sqlite_extended/OMOPCDM_sqlite_extended_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --sqlite extended CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.3/synapse/OMOPCDM_synapse_5.3_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --synapse CDM Primary Key Constraints for OMOP Common Data Model 5.3 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 24 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 25 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 26 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 27 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 28 | -------------------------------------------------------------------------------- /inst/ddl/5.4/bigquery/OMOPCDM_bigquery_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --bigquery CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | alter table @cdmDatabaseSchema.person add constraint xpk_person primary key nonclustered (person_id); 3 | alter table @cdmDatabaseSchema.observation_period add constraint xpk_observation_period primary key nonclustered (observation_period_id); 4 | alter table @cdmDatabaseSchema.visit_occurrence add constraint xpk_visit_occurrence primary key nonclustered (visit_occurrence_id); 5 | alter table @cdmDatabaseSchema.visit_detail add constraint xpk_visit_detail primary key nonclustered (visit_detail_id); 6 | alter table @cdmDatabaseSchema.condition_occurrence add constraint xpk_condition_occurrence primary key nonclustered (condition_occurrence_id); 7 | alter table @cdmDatabaseSchema.drug_exposure add constraint xpk_drug_exposure primary key nonclustered (drug_exposure_id); 8 | alter table @cdmDatabaseSchema.procedure_occurrence add constraint xpk_procedure_occurrence primary key nonclustered (procedure_occurrence_id); 9 | alter table @cdmDatabaseSchema.device_exposure add constraint xpk_device_exposure primary key nonclustered (device_exposure_id); 10 | alter table @cdmDatabaseSchema.measurement add constraint xpk_measurement primary key nonclustered (measurement_id); 11 | alter table @cdmDatabaseSchema.observation add constraint xpk_observation primary key nonclustered (observation_id); 12 | alter table @cdmDatabaseSchema.note add constraint xpk_note primary key nonclustered (note_id); 13 | alter table @cdmDatabaseSchema.note_nlp add constraint xpk_note_nlp primary key nonclustered (note_nlp_id); 14 | alter table @cdmDatabaseSchema.specimen add constraint xpk_specimen primary key nonclustered (specimen_id); 15 | alter table @cdmDatabaseSchema.location add constraint xpk_location primary key nonclustered (location_id); 16 | alter table @cdmDatabaseSchema.care_site add constraint xpk_care_site primary key nonclustered (care_site_id); 17 | alter table @cdmDatabaseSchema.provider add constraint xpk_provider primary key nonclustered (provider_id); 18 | alter table @cdmDatabaseSchema.payer_plan_period add constraint xpk_payer_plan_period primary key nonclustered (payer_plan_period_id); 19 | alter table @cdmDatabaseSchema.cost add constraint xpk_cost primary key nonclustered (cost_id); 20 | alter table @cdmDatabaseSchema.drug_era add constraint xpk_drug_era primary key nonclustered (drug_era_id); 21 | alter table @cdmDatabaseSchema.dose_era add constraint xpk_dose_era primary key nonclustered (dose_era_id); 22 | alter table @cdmDatabaseSchema.condition_era add constraint xpk_condition_era primary key nonclustered (condition_era_id); 23 | alter table @cdmDatabaseSchema.episode add constraint xpk_episode primary key nonclustered (episode_id); 24 | alter table @cdmDatabaseSchema.metadata add constraint xpk_metadata primary key nonclustered (metadata_id); 25 | alter table @cdmDatabaseSchema.concept add constraint xpk_concept primary key nonclustered (concept_id); 26 | alter table @cdmDatabaseSchema.vocabulary add constraint xpk_vocabulary primary key nonclustered (vocabulary_id); 27 | alter table @cdmDatabaseSchema.domain add constraint xpk_domain primary key nonclustered (domain_id); 28 | alter table @cdmDatabaseSchema.concept_class add constraint xpk_concept_class primary key nonclustered (concept_class_id); 29 | alter table @cdmDatabaseSchema.relationship add constraint xpk_relationship primary key nonclustered (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/duckdb/OMOPCDM_duckdb_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --duckdb CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/hive/OMOPCDM_hive_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --hive CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY NONCLUSTERED (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY NONCLUSTERED (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/impala/OMOPCDM_impala_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --impala CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.`location` ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY NONCLUSTERED (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY NONCLUSTERED (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/netezza/OMOPCDM_netezza_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --netezza CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/oracle/OMOPCDM_oracle_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --oracle CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/pdw/OMOPCDM_pdw_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --pdw CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY NONCLUSTERED (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY NONCLUSTERED (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --postgresql CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/redshift/OMOPCDM_redshift_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --redshift CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/snowflake/OMOPCDM_snowflake_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --snowflake CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/spark/OMOPCDM_spark_5.4_indices.sql: -------------------------------------------------------------------------------- 1 | -- spark does not support indexes 2 | -- spark does not support indexes 3 | -- spark does not support indexes 4 | -- spark does not support indexes 5 | -- spark does not support indexes 6 | -- spark does not support indexes 7 | -- spark does not support indexes 8 | -- spark does not support indexes 9 | -- spark does not support indexes 10 | -- spark does not support indexes 11 | -- spark does not support indexes 12 | -- spark does not support indexes 13 | -- spark does not support indexes 14 | -- spark does not support indexes 15 | -- spark does not support indexes 16 | -- spark does not support indexes 17 | -- spark does not support indexes 18 | -- spark does not support indexes 19 | -- spark does not support indexes 20 | -- spark does not support indexes 21 | -- spark does not support indexes 22 | -- spark does not support indexes 23 | -- spark does not support indexes 24 | -- spark does not support indexes 25 | -- spark does not support indexes 26 | -- spark does not support indexes 27 | -- spark does not support indexes 28 | -- spark does not support indexes 29 | -- spark does not support indexes 30 | -- spark does not support indexes 31 | -- spark does not support indexes 32 | -- spark does not support indexes 33 | -- spark does not support indexes 34 | -- spark does not support indexes 35 | -- spark does not support indexes 36 | -- spark does not support indexes 37 | -- spark does not support indexes 38 | -- spark does not support indexes -------------------------------------------------------------------------------- /inst/ddl/5.4/spark/OMOPCDM_spark_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person (person_id); 2 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period (observation_period_id); 3 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence (visit_occurrence_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail (visit_detail_id); 5 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence (condition_occurrence_id); 6 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure (drug_exposure_id); 7 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence (procedure_occurrence_id); 8 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure (device_exposure_id); 9 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement (measurement_id); 10 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation (observation_id); 11 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note (note_id); 12 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp (note_nlp_id); 13 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen (specimen_id); 14 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location (location_id); 15 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site (care_site_id); 16 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider (provider_id); 17 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period (payer_plan_period_id); 18 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost (cost_id); 19 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era (drug_era_id); 20 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era (dose_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era (condition_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode (episode_id); 23 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata (metadata_id); 24 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept (concept_id); 25 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary (vocabulary_id); 26 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain (domain_id); 27 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class (concept_class_id); 28 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship (relationship_id); -------------------------------------------------------------------------------- /inst/ddl/5.4/sql_server/OMOPCDM_sql_server_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --sql server CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY NONCLUSTERED (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY NONCLUSTERED (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/sqlite/OMOPCDM_sqlite_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --sqlite CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/sqlite_extended/OMOPCDM_sqlite_extended_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --sqlite extended CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/ddl/5.4/synapse/OMOPCDM_synapse_5.4_primary_keys.sql: -------------------------------------------------------------------------------- 1 | --synapse CDM Primary Key Constraints for OMOP Common Data Model 5.4 2 | ALTER TABLE @cdmDatabaseSchema.person ADD CONSTRAINT xpk_person PRIMARY KEY NONCLUSTERED (person_id); 3 | ALTER TABLE @cdmDatabaseSchema.observation_period ADD CONSTRAINT xpk_observation_period PRIMARY KEY NONCLUSTERED (observation_period_id); 4 | ALTER TABLE @cdmDatabaseSchema.visit_occurrence ADD CONSTRAINT xpk_visit_occurrence PRIMARY KEY NONCLUSTERED (visit_occurrence_id); 5 | ALTER TABLE @cdmDatabaseSchema.visit_detail ADD CONSTRAINT xpk_visit_detail PRIMARY KEY NONCLUSTERED (visit_detail_id); 6 | ALTER TABLE @cdmDatabaseSchema.condition_occurrence ADD CONSTRAINT xpk_condition_occurrence PRIMARY KEY NONCLUSTERED (condition_occurrence_id); 7 | ALTER TABLE @cdmDatabaseSchema.drug_exposure ADD CONSTRAINT xpk_drug_exposure PRIMARY KEY NONCLUSTERED (drug_exposure_id); 8 | ALTER TABLE @cdmDatabaseSchema.procedure_occurrence ADD CONSTRAINT xpk_procedure_occurrence PRIMARY KEY NONCLUSTERED (procedure_occurrence_id); 9 | ALTER TABLE @cdmDatabaseSchema.device_exposure ADD CONSTRAINT xpk_device_exposure PRIMARY KEY NONCLUSTERED (device_exposure_id); 10 | ALTER TABLE @cdmDatabaseSchema.measurement ADD CONSTRAINT xpk_measurement PRIMARY KEY NONCLUSTERED (measurement_id); 11 | ALTER TABLE @cdmDatabaseSchema.observation ADD CONSTRAINT xpk_observation PRIMARY KEY NONCLUSTERED (observation_id); 12 | ALTER TABLE @cdmDatabaseSchema.note ADD CONSTRAINT xpk_note PRIMARY KEY NONCLUSTERED (note_id); 13 | ALTER TABLE @cdmDatabaseSchema.note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY NONCLUSTERED (note_nlp_id); 14 | ALTER TABLE @cdmDatabaseSchema.specimen ADD CONSTRAINT xpk_specimen PRIMARY KEY NONCLUSTERED (specimen_id); 15 | ALTER TABLE @cdmDatabaseSchema.location ADD CONSTRAINT xpk_location PRIMARY KEY NONCLUSTERED (location_id); 16 | ALTER TABLE @cdmDatabaseSchema.care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY NONCLUSTERED (care_site_id); 17 | ALTER TABLE @cdmDatabaseSchema.provider ADD CONSTRAINT xpk_provider PRIMARY KEY NONCLUSTERED (provider_id); 18 | ALTER TABLE @cdmDatabaseSchema.payer_plan_period ADD CONSTRAINT xpk_payer_plan_period PRIMARY KEY NONCLUSTERED (payer_plan_period_id); 19 | ALTER TABLE @cdmDatabaseSchema.cost ADD CONSTRAINT xpk_cost PRIMARY KEY NONCLUSTERED (cost_id); 20 | ALTER TABLE @cdmDatabaseSchema.drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY NONCLUSTERED (drug_era_id); 21 | ALTER TABLE @cdmDatabaseSchema.dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY NONCLUSTERED (dose_era_id); 22 | ALTER TABLE @cdmDatabaseSchema.condition_era ADD CONSTRAINT xpk_condition_era PRIMARY KEY NONCLUSTERED (condition_era_id); 23 | ALTER TABLE @cdmDatabaseSchema.episode ADD CONSTRAINT xpk_episode PRIMARY KEY NONCLUSTERED (episode_id); 24 | ALTER TABLE @cdmDatabaseSchema.metadata ADD CONSTRAINT xpk_metadata PRIMARY KEY NONCLUSTERED (metadata_id); 25 | ALTER TABLE @cdmDatabaseSchema.concept ADD CONSTRAINT xpk_concept PRIMARY KEY NONCLUSTERED (concept_id); 26 | ALTER TABLE @cdmDatabaseSchema.vocabulary ADD CONSTRAINT xpk_vocabulary PRIMARY KEY NONCLUSTERED (vocabulary_id); 27 | ALTER TABLE @cdmDatabaseSchema.domain ADD CONSTRAINT xpk_domain PRIMARY KEY NONCLUSTERED (domain_id); 28 | ALTER TABLE @cdmDatabaseSchema.concept_class ADD CONSTRAINT xpk_concept_class PRIMARY KEY NONCLUSTERED (concept_class_id); 29 | ALTER TABLE @cdmDatabaseSchema.relationship ADD CONSTRAINT xpk_relationship PRIMARY KEY NONCLUSTERED (relationship_id); 30 | -------------------------------------------------------------------------------- /inst/sql/sql_server/testCleanUp.sql: -------------------------------------------------------------------------------- 1 | 2 | DROP TABLE IF EXISTS @cdmDatabaseSchema.concept; 3 | DROP TABLE IF EXISTS @cdmDatabaseSchema.vocabulary; 4 | DROP TABLE IF EXISTS @cdmDatabaseSchema.domain; 5 | DROP TABLE IF EXISTS @cdmDatabaseSchema.concept_class; 6 | DROP TABLE IF EXISTS @cdmDatabaseSchema.concept_relationship; 7 | DROP TABLE IF EXISTS @cdmDatabaseSchema.relationship; 8 | DROP TABLE IF EXISTS @cdmDatabaseSchema.concept_synonym; 9 | DROP TABLE IF EXISTS @cdmDatabaseSchema.concept_ancestor; 10 | DROP TABLE IF EXISTS @cdmDatabaseSchema.source_to_concept_map; 11 | DROP TABLE IF EXISTS @cdmDatabaseSchema.drug_strength; 12 | 13 | DROP TABLE IF EXISTS @cdmDatabaseSchema.cdm_source; 14 | DROP TABLE IF EXISTS @cdmDatabaseSchema.metadata; 15 | DROP TABLE IF EXISTS @cdmDatabaseSchema.person; 16 | DROP TABLE IF EXISTS @cdmDatabaseSchema.observation_period; 17 | DROP TABLE IF EXISTS @cdmDatabaseSchema.specimen; 18 | DROP TABLE IF EXISTS @cdmDatabaseSchema.visit_occurrence; 19 | DROP TABLE IF EXISTS @cdmDatabaseSchema.visit_detail; 20 | DROP TABLE IF EXISTS @cdmDatabaseSchema.procedure_occurrence; 21 | DROP TABLE IF EXISTS @cdmDatabaseSchema.drug_exposure; 22 | DROP TABLE IF EXISTS @cdmDatabaseSchema.device_exposure; 23 | DROP TABLE IF EXISTS @cdmDatabaseSchema.condition_occurrence; 24 | DROP TABLE IF EXISTS @cdmDatabaseSchema.measurement; 25 | DROP TABLE IF EXISTS @cdmDatabaseSchema.note; 26 | DROP TABLE IF EXISTS @cdmDatabaseSchema.note_nlp; 27 | DROP TABLE IF EXISTS @cdmDatabaseSchema.observation; 28 | DROP TABLE IF EXISTS @cdmDatabaseSchema.survey_conduct; 29 | DROP TABLE IF EXISTS @cdmDatabaseSchema.fact_relationship; 30 | 31 | DROP TABLE IF EXISTS @cdmDatabaseSchema.location; 32 | DROP TABLE IF EXISTS @cdmDatabaseSchema.location_history; 33 | DROP TABLE IF EXISTS @cdmDatabaseSchema.care_site; 34 | DROP TABLE IF EXISTS @cdmDatabaseSchema.provider; 35 | 36 | DROP TABLE IF EXISTS @cdmDatabaseSchema.payer_plan_period; 37 | DROP TABLE IF EXISTS @cdmDatabaseSchema.cost; 38 | 39 | DROP TABLE IF EXISTS @cdmDatabaseSchema.drug_era; 40 | DROP TABLE IF EXISTS @cdmDatabaseSchema.dose_era; 41 | DROP TABLE IF EXISTS @cdmDatabaseSchema.condition_era; 42 | 43 | DROP TABLE IF EXISTS @cdmDatabaseSchema.attribute_definition; 44 | DROP TABLE IF EXISTS @cdmDatabaseSchema.cohort_definition; 45 | -------------------------------------------------------------------------------- /man/buildRelease.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/buildRelease.R 3 | \name{buildRelease} 4 | \alias{buildRelease} 5 | \title{Create OMOP CDM SQL files} 6 | \usage{ 7 | buildRelease( 8 | cdmVersions = listSupportedVersions(), 9 | targetDialects = listSupportedDialects(), 10 | outputfolder = file.path(tempdir(), "inst", "ddl") 11 | ) 12 | } 13 | \arguments{ 14 | \item{cdmVersions}{The versions of the CDM you are creating, e.g. 5.3, 5.4. 15 | Defaults to all supported CDM versions.} 16 | 17 | \item{targetDialects}{A character vector of target dialects. 18 | Defaults to all supported dialects.} 19 | 20 | \item{outputfolder}{The base folder where the SQL files will be written. 21 | Subfolders will be created for each cdmVersion and targetDialect.} 22 | } 23 | \value{ 24 | Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion 25 | and targetDialect to the 'ddl' folder in specified output folder. 26 | } 27 | \description{ 28 | Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion 29 | and targetDialect to the 'ddl' folder in specified output folder. 30 | } 31 | -------------------------------------------------------------------------------- /man/buildReleaseZip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/buildRelease.R 3 | \name{buildReleaseZip} 4 | \alias{buildReleaseZip} 5 | \title{Create OMOP CDM release zip} 6 | \usage{ 7 | buildReleaseZip( 8 | cdmVersion, 9 | targetDialect = listSupportedDialects(), 10 | outputfolder = file.path(tempdir(), "output") 11 | ) 12 | } 13 | \arguments{ 14 | \item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4. 15 | Defaults to all supported CDM versions.} 16 | 17 | \item{targetDialect}{The target dialect. Defaults to all supported dialects.} 18 | 19 | \item{outputfolder}{The output folder. Defaults to "output"} 20 | } 21 | \value{ 22 | A character string containing the OHDSQL DDL 23 | } 24 | \description{ 25 | First calls \code{buildReleaseZips} for given cdmVersions and targetDialects. 26 | This writes the ddl sql files to the ddl folder. 27 | Then zips all written ddl files into a release zip to given output folder. 28 | } 29 | \details{ 30 | If no (or multiple) targetDialect is given, 31 | then one zip is written with the files of all supported dialects. 32 | } 33 | \examples{ 34 | \dontrun{ 35 | buildReleaseZip(cdmVersion='5.3', targetDialect='sql server', outputfolder='.') 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /man/createDdl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/createDdl.R 3 | \name{createDdl} 4 | \alias{createDdl} 5 | \alias{createPrimaryKeys} 6 | \alias{createForeignKeys} 7 | \title{Create the OHDSI-SQL Common Data Model DDL code} 8 | \usage{ 9 | createDdl(cdmVersion) 10 | 11 | createPrimaryKeys(cdmVersion) 12 | 13 | createForeignKeys(cdmVersion) 14 | } 15 | \arguments{ 16 | \item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4} 17 | } 18 | \value{ 19 | A character string containing the OHDSQL DDL 20 | 21 | A string containing the OHDSQL for creation of primary keys in the OMOP CDM. 22 | 23 | A string containing the OHDSQL for creation of foreign keys in the OMOP CDM. 24 | } 25 | \description{ 26 | The createDdl, createForeignKeys, and createPrimaryKeys functions each return a character string 27 | containing their respective DDL SQL code in OHDSQL dialect for a specific CDM version. 28 | The SQL they generate needs to be rendered and translated before it can be executed. 29 | } 30 | \details{ 31 | The DDL SQL code is created from a two csv files that detail the OMOP CDM Specifications. 32 | These files also form the basis of the CDM documentation and the Data Quality 33 | Dashboard. 34 | } 35 | \section{Functions}{ 36 | \itemize{ 37 | \item \code{createPrimaryKeys()}: createPrimaryKeys Returns a string containing the OHDSQL for creation of primary keys in the OMOP CDM. 38 | 39 | \item \code{createForeignKeys()}: createForeignKeys Returns a string containing the OHDSQL for creation of foreign keys in the OMOP CDM. 40 | 41 | }} 42 | \examples{ 43 | \dontrun{ 44 | ddl <- createDdl("5.4") 45 | pk <- createPrimaryKeys("5.4") 46 | fk <- createForeignKeys("5.4") 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /man/downloadCurrentDdl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/downloadCurrentDdl.R 3 | \name{downloadCurrentDdl} 4 | \alias{downloadCurrentDdl} 5 | \title{Get current DDL sitting on the main branch} 6 | \usage{ 7 | downloadCurrentDdl( 8 | githubPath = "OHDSI/CommonDataModel", 9 | pathToCsv = "Sql\%20Server/OMOP\%20CDM\%20sql\%20server\%20ddl.txt", 10 | outputFile = paste0("inst/sql/sql_server/OMOP CDM ddl ", Sys.Date(), ".sql") 11 | ) 12 | } 13 | \arguments{ 14 | \item{githubPath}{The path for the GitHub repo containing the package (e.g. 'OHDSI/CommonDataModel').} 15 | 16 | \item{pathToCsv}{The path for the snapshot inside the package.} 17 | 18 | \item{outputFile}{The path where the file should be saved.} 19 | } 20 | \value{ 21 | The current DDL sitting on the main branch of the CommonDataModel repository. 22 | } 23 | \description{ 24 | Get current DDL sitting on the main branch 25 | } 26 | \details{ 27 | This function gets the current ddl on the CDM main branch. It will be taken from the Sql Server folder. 28 | The default location is 29 | \code{inst/settings/currentOmopDdl.sql}. 30 | } 31 | \examples{ 32 | \dontrun{ 33 | downloadCurrentDdl("OHDSI/CommonDataModel", 34 | pathToCsv="Sql\%20Server/OMOP\%20CDM\%20sql\%20server\%20ddl.txt") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /man/executeDdl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/executeDdl.R 3 | \name{executeDdl} 4 | \alias{executeDdl} 5 | \title{Generate and execute the DDL on a database} 6 | \usage{ 7 | executeDdl( 8 | connectionDetails, 9 | cdmVersion, 10 | cdmDatabaseSchema, 11 | executeDdl = TRUE, 12 | executePrimaryKey = TRUE, 13 | executeForeignKey = TRUE, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{connectionDetails}{An object of class connectionDetails as created by the DatabaseConnector::createConnectionDetails function.} 19 | 20 | \item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4} 21 | 22 | \item{cdmDatabaseSchema}{The schema of the CDM instance where the DDL will be run. For example, this would be "ohdsi.dbo" when testing on sql server.} 23 | 24 | \item{executeDdl}{Should the DDL be executed? TRUE or FALSE} 25 | 26 | \item{executePrimaryKey}{Should the primary keys be added? TRUE or FALSE} 27 | 28 | \item{executeForeignKey}{Should the foreign keys be added? TRUE or FALSE} 29 | 30 | \item{...}{Other arguments passed on to DatabaseConnector::executeSql. (This allows the user to set the path to errorReportFile.)} 31 | } 32 | \value{ 33 | Writes the fully specified DDLs, primary keys, foreign keys, and indices to a file and then executes on a database. 34 | } 35 | \description{ 36 | This function will generate the DDL for a specific dbms and CDM version and 37 | then execute the DDL on a database. 38 | } 39 | \examples{ 40 | \dontrun{ 41 | executeDdl(connectionDetails = connectionDetails, 42 | cdmVersion = "5.4", 43 | cdmDatabaseSchema = "myCdm") 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /man/listSupportedDialects.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/listSupportedVersions.R 3 | \name{listSupportedDialects} 4 | \alias{listSupportedDialects} 5 | \title{List RDBMS dialects supported by this package} 6 | \usage{ 7 | listSupportedDialects() 8 | } 9 | \value{ 10 | A list containing the supported Structured Query Language (SQL) dialects. 11 | } 12 | \description{ 13 | List RDBMS dialects supported by this package 14 | } 15 | -------------------------------------------------------------------------------- /man/listSupportedVersions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/listSupportedVersions.R 3 | \name{listSupportedVersions} 4 | \alias{listSupportedVersions} 5 | \title{List CDM versions supported by this package} 6 | \usage{ 7 | listSupportedVersions() 8 | } 9 | \value{ 10 | A character vector containing the supported Common Data Model (CDM) versions in major.minor format. 11 | } 12 | \description{ 13 | List CDM versions supported by this package 14 | } 15 | -------------------------------------------------------------------------------- /man/parseWiki.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/WikiParser.R 3 | \name{parseWiki} 4 | \alias{parseWiki} 5 | \title{Parse Wiki files} 6 | \usage{ 7 | parseWiki(mdFilesLocation, output_file) 8 | } 9 | \arguments{ 10 | \item{mdFilesLocation}{Path to the root folder of the Wiki repository.} 11 | 12 | \item{output_file}{Path to where the output CSV file should be written.} 13 | } 14 | \value{ 15 | CSV files with the OMOP CDM specifications. 16 | } 17 | \description{ 18 | Parses all .md files in the specified location (or any subfolders), extracting definitions 19 | of the Common Data Model. 20 | } 21 | -------------------------------------------------------------------------------- /man/writeDdl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/writeDDL.R 3 | \name{writeDdl} 4 | \alias{writeDdl} 5 | \alias{writePrimaryKeys} 6 | \alias{writeForeignKeys} 7 | \alias{writeIndex} 8 | \title{Write DDL script} 9 | \usage{ 10 | writeDdl( 11 | targetDialect, 12 | cdmVersion, 13 | outputfolder, 14 | cdmDatabaseSchema = "@cdmDatabaseSchema" 15 | ) 16 | 17 | writePrimaryKeys( 18 | targetDialect, 19 | cdmVersion, 20 | outputfolder, 21 | cdmDatabaseSchema = "@cdmDatabaseSchema" 22 | ) 23 | 24 | writeForeignKeys( 25 | targetDialect, 26 | cdmVersion, 27 | outputfolder, 28 | cdmDatabaseSchema = "@cdmDatabaseSchema" 29 | ) 30 | 31 | writeIndex( 32 | targetDialect, 33 | cdmVersion, 34 | outputfolder, 35 | cdmDatabaseSchema = "@cdmDatabaseSchema" 36 | ) 37 | } 38 | \arguments{ 39 | \item{targetDialect}{The dialect of the target database. Support dialects are specified by SqlRender::listSupportedDialects} 40 | 41 | \item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4} 42 | 43 | \item{outputfolder}{The directory or folder where the SQL file should be saved.} 44 | 45 | \item{cdmDatabaseSchema}{The schema of the CDM instance where the DDL will be run. For example, this would be "ohdsi.dbo" when testing on sql server. 46 | Defaults to "@cdmDatabaseSchema"} 47 | } 48 | \value{ 49 | Writes SQL file with the OMOP CDM DDL for the specified CDM version and target dialect in the output folder. 50 | 51 | Writes a SQL file with the primary keys for the OMOP CDM based on the specified target dialect and CDM version. 52 | 53 | Writes a SQL file with the foreign keys for the OMOP CDM based on the specified target dialect and CDM version. 54 | 55 | Writes a SQL file with the indices for the OMOP CDM based on the specified target dialect and CDM version. 56 | } 57 | \description{ 58 | Write the DDL to a SQL file. The SQL will be rendered (parameters replaced) and translated to the target SQL 59 | dialect. By default the @cdmDatabaseSchema parameter is kept in the SQL file and needs to be replaced before 60 | execution. 61 | } 62 | \section{Functions}{ 63 | \itemize{ 64 | \item \code{writePrimaryKeys()}: writePrimaryKeys Write the SQL code that creates the primary keys to a file. 65 | 66 | \item \code{writeForeignKeys()}: writeForeignKeys Write the SQL code that creates the foreign keys to a file. 67 | 68 | \item \code{writeIndex()}: writeIndex Write the rendered and translated sql that creates recommended indexes to a file. 69 | 70 | }} 71 | -------------------------------------------------------------------------------- /rmd/.Rapp.history: -------------------------------------------------------------------------------- 1 | setwd("/Users/clairblacketer/Documents/Github/CommonDataModel/rmd")# 2 | rmarkdown::render_site() 3 | setwd("/Users/clairblacketer/Documents/Github/CommonDataModel/rmd")# 4 | rmarkdown::render_site() 5 | -------------------------------------------------------------------------------- /rmd/_site.yml: -------------------------------------------------------------------------------- 1 | name: "OMOP Common Data Model" 2 | output_dir: "../docs" 3 | output: 4 | html_document: 5 | theme: cosmo 6 | css: style.css 7 | includes: 8 | in_header: "favicon.html" 9 | exclude: ["extras"] 10 | navbar: 11 | title: '
OMOP Common Data Model
' 12 | right: 13 | - icon: fa-github 14 | href: https://github.com/OHDSI/CommonDataModel 15 | left: 16 | - icon: fa-house 17 | href: index.html 18 | - text: "Background" 19 | icon: fa-landmark 20 | menu: 21 | - text: "Model Background" 22 | href: background.html 23 | - text: "CDM Refresh Process" 24 | href: cdmRefreshProcess.html 25 | - text: "How the Vocabulary is Built" 26 | href: vocabulary.html 27 | - text: "Conventions" 28 | icon: fa-list-alt 29 | menu: 30 | - text: "THEMIS Convention Library" 31 | href: https://ohdsi.github.io/Themis 32 | - text: "General Conventions" 33 | href: dataModelConventions.html 34 | - text: "Patient Privacy and OMOP" 35 | href: cdmPrivacy.html 36 | - text: "Custom Concepts" 37 | href: customConcepts.html 38 | - text: "CDM Versions" 39 | icon: fa-history 40 | menu: 41 | - text: "CDM v3.0" 42 | href: cdm30.html 43 | - text: "CDM v5.3" 44 | href: cdm53.html 45 | - text: "CDM v5.4" 46 | menu: 47 | - text: "CDM v5.4" 48 | href: cdm54.html 49 | - text: "Changes from CDM v5.3" 50 | href: cdm54Changes.html 51 | - text: "Entity Relationships" 52 | href: cdm54erd.html 53 | - text: "Detailed tooling support per CDM field" 54 | href: cdm54ToolingSupport.html 55 | - text: "CDM Additions" 56 | icon: fa-plus-square 57 | menu: 58 | - text: "Types of CDM Additions" 59 | href: typesOfAdditions.html 60 | - text: "How to Propose Changes to the CDM" 61 | href: cdmRequestProcess.html 62 | - text: "Accepted Changes" 63 | menu: 64 | - text: "CDM version in development" 65 | href: https://github.com/OHDSI/CommonDataModel/tree/develop 66 | - text: "How to" 67 | icon: fa-question 68 | menu: 69 | - text: "Download the DDL" 70 | href: download.html 71 | - text: "Use the CDM R Package" 72 | href: cdmRPackage.html 73 | - text: "Calculate Drug Dose" 74 | href: drug_dose.html 75 | - text: "Support" 76 | icon: fa-life-ring 77 | menu: 78 | - text: "Help! My Data Doesn't Fit!" 79 | href: cdmDecisionTree.html 80 | - text: "FAQ" 81 | href: faq.html 82 | - text: "SQL Scripts" 83 | href: sqlScripts.html 84 | - text: "Ask a Question" 85 | href: contribute.html 86 | -------------------------------------------------------------------------------- /rmd/cdm30.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "CDM v3" 3 | output: 4 | html_document: 5 | toc: true 6 | toc_depth: 5 7 | toc_float: true 8 | --- 9 | 10 | You can find the specification for CDM v3 at this [link](https://forums.ohdsi.org/uploads/default/original/1X/2d8b44ea1ee0f9f70427dd2c7332335b8eb6a073.docx). 11 | -------------------------------------------------------------------------------- /rmd/cdm531.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: '**OMOP CDM v5.3.1**' 3 | output: 4 | html_document: 5 | toc: yes 6 | toc_depth: 5 7 | toc_float: yes 8 | --- 9 | 10 | **This documentation previously referenced v5.3.1. During the OHDSI/CommonDataModel Hack-A-Thon that occurred on August 18, 2021 the decision was made to align documentation with the minor releases. This is because only major and minor releases include changes to the model itself while bug fixes address issues with SQL incompatibility, problems in the code, etc. Hot fixes and minor.micro release can be found through the searching of tags. For the CDM v5.3 specification please see the [5.3 page](https://ohdsi.github.io/CommonDataModel/cdm53.html).** 11 | 12 | -------------------------------------------------------------------------------- /rmd/cdm54erd.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "**OMOP CDM v5.4 ERD**" 3 | output: 4 | html_document 5 | --- 6 | 7 | ```{css zoom-lib-src, echo = FALSE} 8 | script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" 9 | ``` 10 | 11 | ```{js zoom-jquery, echo = FALSE} 12 | $(document).ready(function() { 13 | $('body').prepend('
'); 14 | // onClick function for all plots (img's) 15 | $('img:not(.zoomImg)').click(function() { 16 | $('.zoomImg').attr('src', $(this).attr('src')).css({width: '100%'}); 17 | $('.zoomDiv').css({opacity: '1', width: 'auto', border: '1px solid white', borderRadius: '5px', position: 'fixed', top: '50%', left: '50%', marginRight: '-50%', transform: 'translate(-50%, -50%)', boxShadow: '0px 0px 50px #888888', zIndex: '50', overflow: 'auto', maxHeight: '100%'}); 18 | }); 19 | // onClick function for zoomImg 20 | $('img.zoomImg').click(function() { 21 | $('.zoomDiv').css({opacity: '0', width: '0%'}); 22 | }); 23 | }); 24 | ``` 25 | 26 | Late in 2022 we held a community contest to find the best entity-relationship diagram and we crowned two winners! Martijn Schuemie and Renske Los created the best printable version and Vishnu Chandrabalan created the best [interactive version](http://omop-erd.surge.sh/). 27 | 28 | ![CDM v5.4 Printable ERD - [click here to download](https://github.com/OHDSI/CommonDataModel/raw/main/rmd/images/erd.jpg)](images/erd.jpg){width=150%} 29 | -------------------------------------------------------------------------------- /rmd/cdmDecisionTree.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: '
CDM Request Decision Tree
' 3 | output: 4 | html_document 5 | --- 6 | 7 | If you have arrived to this page then you must be thinking **HELP! I have some data that doesn't fit in the CDM!** Never fear as this handy guide will point you in the right direction and all you have to do is answer a few questions. 8 | 9 | **First things first, do you think you will need to change the OMOP Common Data Model itself or are you solely looking for vocabulary support?** 10 | 11 | [I think I need to change the OMOP CDM](networkUseCase.html) 12 | 13 | [I need vocabulary support](vocabN.html) 14 | -------------------------------------------------------------------------------- /rmd/cdmRPackage.rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "**CDM R Package Demo**" 3 | output: 4 | html_document: 5 | toc: no 6 | --- 7 | 8 | Below is an example showing two different ways the CDM R package can be used to create the tables in your environment. First, it uses the `buildRelease` function to create the DDL files on your machine. Once you have these downloaded you can then run them in your SQL client to set up the empty CDM tables. Second, the script shows the `executeDdl` function that will connect up to your SQL client directly (assuming your dbms is one of the supported dialects) and instantiate the tables through R. 9 | 10 | ```{r echo=TRUE, eval=FALSE} 11 | ## First, install the package from GitHub 12 | install.packages("devtools") 13 | devtools::install_github("OHDSI/CommonDataModel") 14 | 15 | ## List the currently supported SQL dialects 16 | CommonDataModel::listSupportedDialects() 17 | 18 | ## List the currently supported CDM versions 19 | CommonDataModel::listSupportedVersions() 20 | 21 | ## There are multiple ways to generate the DDLs 22 | 23 | ## 1. Use the buildRelease function to generate the text files in the dialect you choose. 24 | ## This function will put the output files in the folder you specify 25 | 26 | CommonDataModel::buildRelease(cdmVersions = "5.4", 27 | targetDialects = "postgresql", 28 | outputfolder = "/pathToOutput") 29 | 30 | ## 2. If you have an empty schema ready to go, the package will connect and instantiate 31 | ## the tables for you. 32 | 33 | ### 2a. To start, you need to download DatabaseConnector in order to connect to your database. 34 | devtools::install_github("DatabaseConnector") 35 | 36 | cd <- DatabaseConnector::createConnectionDetails(dbms = "postgresql", 37 | server = "localhost/ohdsi", 38 | user = "postgres", 39 | password = "postgres", 40 | pathToDriver = "/pathToDriver" 41 | ) 42 | 43 | CommonDataModel::executeDdl(connectionDetails = cd, 44 | cdmVersion = "5.4", 45 | cdmDatabaseSchema = "ohdsi_demo" 46 | ) 47 | ``` 48 | -------------------------------------------------------------------------------- /rmd/contactVocab.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Contact the Vocab Team" 3 | output: html_document 4 | --- 5 | 6 | Okay so you have something you would like to add to the CDM but there is not an existing OMOP vocabulary nor an open-source vocabulary we can bring in to support it. **In this case, please contact the vocabulary team on next steps** as data elements in the CDM must have a vocabulary in place before they can be implemented. 7 | 8 | [Vocabulary Teams Channel](https://teams.microsoft.com/l/channel/19%3a31208179438d45749ff484124e7b1e5e%40thread.tacv2/Vocabulary%2520Subgroup?groupId=a6f2c516-e568-4974-8f1e-a7bdc2f997c5&tenantId=a30f0094-9120-4aab-ba4c-e5509023b2d5) 9 | 10 | Once you come to consensus with the vocabulary team regarding your needs, please follow the [CDM Request Process](cdmRequestProcess.html) to begin the steps soliciting a change or addition to the model itself. Need more guidance? Consider contacting the CDM Working Group on our [GitHub](https://github.com/OHDSI/CommonDataModel) or [Teams Channel](https://teams.microsoft.com/l/team/19%3a133f2b94b86a41a884d4a4d160610148%40thread.tacv2/conversations?groupId=a6f2c516-e568-4974-8f1e-a7bdc2f997c5&tenantId=a30f0094-9120-4aab-ba4c-e5509023b2d5). 11 | -------------------------------------------------------------------------------- /rmd/contribute.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Ask A Question" 3 | output: 4 | html_document: 5 | toc: TRUE 6 | toc_float: TRUE 7 | --- 8 | 9 | # Check the Forum 10 | 11 | Chances are someone else has already asked your question on the [forum](https:\\forums.ohdsi.org) and it has been answered. 12 | 13 | # Check the Issue Log 14 | 15 | If you think you've found a bug you can check to see if someone also had that same problem on our [issue page](https://github.com/ohdsi/commondatamodel/issues) of the Common Data Model github. If you don't see your issue feel free to open one. Try and be as specific as possible. What error message occurs? Can you provide a simple example as to why you are requesting a change to the model? 16 | 17 | # Join meetings 18 | 19 | Please come to meetings, ask your question and contribute to the discussion! All details can be found on our [home page](https://ohdsi.github.io/CommonDataModel/). 20 | 21 | -------------------------------------------------------------------------------- /rmd/download.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Download" 3 | output: 4 | html_document: 5 | toc: TRUE 6 | toc_float: TRUE 7 | --- 8 | 9 | All code for the ddls, constraints and indices are available on our [github](https://github.com/OHDSI/CommonDataModel). Each version of the Common Data Model is denoted by a [release](https://github.com/OHDSI/CommonDataModel/tags). The OHDSI community supports the database management systems (dbms) Sql Server, Postgresql, Oracle, Redshift, Parallel Data Warehouse, BigQuery, Impala, and Netezza. Included in each release is a folder for each dbms. After downloading, choose the folder for your specific system and you will see all necessary files. For example the Sql Server folder has the ddl, primary key constraints, indices, and foreign key constraints. In contrast, the redshift folder only has a ddl. 10 | 11 | These sql scripts have been fully tested on Oracle, Sql Server, and Postgresql and the rest are generated using the [SqlRender package](https://ohdsi.github.io/SqlRender/). If run into any problems please let us know by creating an issue on our github. 12 | 13 | -------------------------------------------------------------------------------- /rmd/favicon.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rmd/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/favicon.ico -------------------------------------------------------------------------------- /rmd/images/ATLAS_Persistence_Window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/ATLAS_Persistence_Window.png -------------------------------------------------------------------------------- /rmd/images/AWS_clusters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/AWS_clusters.png -------------------------------------------------------------------------------- /rmd/images/Athena_download_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/Athena_download_box.png -------------------------------------------------------------------------------- /rmd/images/CDM_refresh_cycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/CDM_refresh_cycle.png -------------------------------------------------------------------------------- /rmd/images/Sepsis_to_SNOMED.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/Sepsis_to_SNOMED.png -------------------------------------------------------------------------------- /rmd/images/Usagi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/Usagi.png -------------------------------------------------------------------------------- /rmd/images/cdm54.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/cdm54.png -------------------------------------------------------------------------------- /rmd/images/cdm_wg_calendar.csv: -------------------------------------------------------------------------------- 1 | calendarId,title,body,recurrenceRule,start,end,category,location,bgColor,color,borderColor 2 | 1,CDM WG Meeting,,,2023-01-03 10:00:00,2023-01-03 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 3 | 2,CDM WG : Pregnancy,The Pregnancy and Maternal Medicine working group will present.,,2023-01-17 13:00:00,2023-01-17 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 4 | 1,CDM WG Meeting : NLP,The NLP working group will present some potential updates to the NOTE_NLP table.,,2023-02-07 10:00:00,2023-02-07 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 5 | 2,CDM WG Vocabulary Discussion,Anna Ostropolets will join to ask us about our experiences using the OMOP Standard Vocabulary for ETL and other purposes,,2023-02-21 13:00:00,2023-02-21 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 6 | 1,CDM WG : HADES,Martijn Schuemie will present about the HADES working group and how their work interconnects with the OMOP CDM,,2023-03-07 9:00:00,2023-03-07 10:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 7 | 2,CDM WG : Medical Imaging,Paul Nagy will talk to us about the modeling work being done in the Medical Imaging working group,,2023-03-21 13:00:00,2023-03-21 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 8 | 1,CDM WG Meeting,,,2023-04-04 10:00:00,2023-04-04 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 9 | 2,CDM WG : GIS,The GIS working group will join us to share what they are working on and how we might support them.,,2023-04-18 13:00:00,2023-04-18 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 10 | 1,CDM WG Meeting,,,2023-05-02 10:00:00,2023-05-02 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 11 | 2,CDM WG Meeting,,,2023-05-16 13:00:00,2023-05-16 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 12 | 1,CDM WG Meeting,,,2023-06-06 10:00:00,2023-06-06 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 13 | 2,CDM WG Meeting,,,2023-07-18 13:00:00,2023-07-18 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 14 | 1,CDM WG Meeting,,,2023-08-01 10:00:00,2023-08-01 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 15 | 2,CDM WG Meeting,,,2023-08-15 13:00:00,2023-08-15 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 16 | 1,CDM WG Meeting,,,2023-09-05 10:00:00,2023-09-05 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 17 | 2,CDM WG Meeting,,,2023-09-19 13:00:00,2023-09-19 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 18 | 1,CDM WG Meeting,,,2023-10-03 10:00:00,2023-10-03 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 19 | 2,CDM WG Meeting,,,2023-10-17 13:00:00,2023-10-17 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 20 | 1,CDM WG Meeting,,,2023-11-07 10:00:00,2023-11-07 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 21 | 2,CDM WG Meeting,,,2023-11-21 13:00:00,2023-11-21 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 22 | 1,CDM WG Meeting,,,2023-12-05 10:00:00,2023-12-05 11:00:00,time,Teams: https://tinyurl.com/cdm1sttues,,, 23 | 2,CDM WG Meeting,,,2023-12-19 13:00:00,2023-12-19 14:00:00,time,Teams: https://tinyurl.com/cdm3rdtues,,, 24 | -------------------------------------------------------------------------------- /rmd/images/diabetes-related_case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/diabetes-related_case.png -------------------------------------------------------------------------------- /rmd/images/downloadJava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/downloadJava.png -------------------------------------------------------------------------------- /rmd/images/downloadR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/downloadR.png -------------------------------------------------------------------------------- /rmd/images/downloadRStudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/downloadRStudio.png -------------------------------------------------------------------------------- /rmd/images/erd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/erd.jpg -------------------------------------------------------------------------------- /rmd/images/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/important.png -------------------------------------------------------------------------------- /rmd/images/mapping_of_concepts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/mapping_of_concepts.png -------------------------------------------------------------------------------- /rmd/images/no32Bits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/no32Bits.png -------------------------------------------------------------------------------- /rmd/images/pregnancy-related_case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/pregnancy-related_case.png -------------------------------------------------------------------------------- /rmd/images/rDestination.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/rDestination.png -------------------------------------------------------------------------------- /rmd/images/sign-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/images/sign-up.png -------------------------------------------------------------------------------- /rmd/indices-primary-foreign.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Indices, Primary Keys and Foreign Key Constraints" 3 | output: 4 | html_document: 5 | toc: true 6 | toc_depth: 5 7 | toc_float: true 8 | --- 9 | 10 | ## Overview 11 | Database indices improve the performance of queries against a database by organizing the data in a way that increase query execution. 12 | 13 | This article was written to provide guidance on the setting of indices, primary and foreign keys for data that has been transformed into the Observational Medical Outcome Partnership (OMOP) Common Data Model (CDM). The community that supports the design and development of the OHDSI/CommonDataModel Github repository is a diverse collaborative of healthcare and technical profesisonals whom have limited data base administrative (DBA) experience. As a result, the comments below should be interpreted as suggestions and recommendations to help increase performance. Your teams needs may call for a modified configuration. 14 | 15 | ## General Recommendations 16 | Should your database of choice support indexing, the OMOP CDM Working Group recommends 17 | 18 | * Indexing on all columns containing an "_id" (e.g. condition_occurrence_id, drug_exposure_id, measurement_id, procedure_occurrence_id, etc.) 19 | * Indexing on primary and foreign keys 20 | 21 | For all databases, regardless of custom indice support, primary and foreign keys should be set. This is a step towards ensuring data integrity. Information on what table level attributes should be set as primary and foreign keys can be found within the *_Field_Level.csv file(s) located in the [INST/CSV directory](https://github.com/OHDSI/CommonDataModel/tree/v5.4/inst/csv) 22 | 23 | ## Database support 24 | The OHDSI/CommonDataModel package leverages OHDSI/SQLRender and as a result is only capable of supporting sources that are supported by OHDSI/SQLRender. The following databases are currently supported. 25 | 26 | ### Microsoft SQL Server 27 | ### Oracle 28 | ### PostgreSQL 29 | 30 | ### Amazon Redshift 31 | On AWS Redshift it is important to ensure that your data is properly distributed and sorted across nodes. Compression on certain columns may also help. The designed DDL does set DISTKEYS in an effort to optimize performance. This configuration can be seen within the [Redshift-specific DDL](https://github.com/OHDSI/CommonDataModel/blob/v5.4/ddl/5.4/redshift/OMOPCDM_redshift_5.4_ddl.sql). 32 | 33 | ### Impala 34 | ### IBM Netezza 35 | ### Google BigQuery 36 | Google BigQuery does not require manual optimization and/or sizing. Google BigQuery does massive parallel full table scans and intensive caching, all under the hood. 37 | [Reference](https://forums.ohdsi.org/t/iso-best-practices-of-cdm-indexing/10939/2) 38 | 39 | ### Microsoft Parallel Data Warehouse (PDW) 40 | ### SQLite 41 | 42 | ### Databricks 43 | 44 | ## References 45 | 46 | [ISO Best Practices of CDM Indexing](https://forums.ohdsi.org/t/iso-best-practices-of-cdm-indexing/10939/2) 47 | 48 | -------------------------------------------------------------------------------- /rmd/leaveAsIs.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Leave As Is" 3 | output: html_document 4 | --- 5 | 6 | Okay, so you do not have a network use case but multiple collaborators have access to the element you are interested in adding to the CDM. **In this circumstance, the CDM Working Group suggests leaving the model as-is.** Without a network use case there is no need to augment the data model. If this is something you need for your work, consider a [local change](localChange.html) or a model extension. 7 | -------------------------------------------------------------------------------- /rmd/localChange.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Local Change" 3 | output: html_document 4 | --- 5 | 6 | Since you do not have a network use case and this element is specific to your data source, **feel free to create a local change to your instance of the OMOP Common Data Model.** Augmenting the model at your institution for administrative purposes or other in-house needs is totally acceptable with the understanding that any local changes cannot and should not be relied upon in network studies or supported by the open-source tools. 7 | -------------------------------------------------------------------------------- /rmd/networkUseCase.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Network Use Case" 3 | output: html_document 4 | --- 5 | 6 | Alright, so you think you might need to change the OMOP Common Data Model. **Do you have a documented network use case for this data need? This could take the form of an upcoming study or a convention for how to store information.** In this scenario, at least two or more collaborators with data to contribute constitute a network need. 7 | 8 | [Yes, I have a network use case](useCaseY.html) 9 | 10 | [No, I do not have a network use case](useCaseN.html) 11 | -------------------------------------------------------------------------------- /rmd/ohdsi16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/ohdsi16x16.png -------------------------------------------------------------------------------- /rmd/ohdsi40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OHDSI/CommonDataModel/1e0360980a6df4fee8e94e52c20576b21a0803c9/rmd/ohdsi40x40.png -------------------------------------------------------------------------------- /rmd/oncology.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Oncology Extension" 3 | output: 4 | html_document: 5 | toc: true 6 | toc_depth: 5 7 | toc_float: true 8 | --- 9 | 10 | ```{r setup, include=FALSE, eval=TRUE} 11 | 12 | #todo figure out how to get the document dynamically without specifying the name 13 | library(rmarkdown) 14 | library(knitr) 15 | library(kableExtra) 16 | library(magrittr) 17 | library(dplyr) 18 | library(stringr) 19 | 20 | ``` 21 | 22 | ## OMOP Common Data Model Oncology Extension Documentation 23 | 24 | This documentation details the ratified proposal of adding an oncology extension to the OMOP CDM. These tables and fields will become part of the next release (v6.1) of the Common Data Model. Below are their descriptions; showing *additions* to the model only. For example, two fields were added to the MEASUREMENT table as part of this extension so only those two fields are listed below for MEASUREMENT instead of the entire table. For more information, please see the [OMOP Oncology wiki site](https://github.com/OHDSI/OncologyWG/wiki). 25 | 26 | The DDLs for these tables are located on the Oncology github, as detailed in the [installation instructions](https://github.com/OHDSI/OncologyWG/wiki/Oncology-CDM-Extension-Installation). 27 | 28 | 29 | ```{r docLoopOnco, echo=FALSE, results='asis'} 30 | tableSpecs <- read.csv("../inst/csv/OMOP_CDM_Oncology_Ex_Table_Level.csv", stringsAsFactors = FALSE) 31 | cdmSpecs <- read.csv("../inst/csv/OMOP_CDM_Oncology_Ex_Field_Level.csv", stringsAsFactors = FALSE) 32 | 33 | tables <- tableSpecs$cdmTableName 34 | 35 | cdmSpecsClean <- cdmSpecs %>% 36 | dplyr::select(`CDM Table` = cdmTableName, 37 | `CDM Field` = cdmFieldName, 38 | `User Guide` = userGuidance, 39 | `ETL Conventions` = etlConventions, 40 | `Datatype` = cdmDatatype, 41 | `Required` = isRequired, 42 | `Primary Key` = isPrimaryKey, 43 | `Foreign Key` = isForeignKey, 44 | `FK Table` = fkTableName, 45 | `FK Domain` = fkDomain, 46 | `FK Class` = fkClass 47 | ) 48 | 49 | cdmSpecsClean[is.na(cdmSpecsClean)] <- "" 50 | tableSpecs[is.na(tableSpecs)] <- "" 51 | 52 | for(tb in tables) { 53 | cat("###", tb, "{.tabset .tabset-pills} \n\n") 54 | 55 | tableInfo <- subset(tableSpecs, cdmTableName == tb) 56 | cat("**Table Description**\n\n",tableInfo[,"tableDescription"], "\n\n") 57 | 58 | if(!isTRUE(tableInfo[,"userGuidance"]=="")){ 59 | cat("**User Guide**\n\n",tableInfo[,"userGuidance"],"\n\n") 60 | } 61 | 62 | if(!isTRUE(tableInfo[,"etlConventions"]=="")){ 63 | cat("**ETL Conventions**\n\n",tableInfo[,"etlConventions"],"\n\n") 64 | } 65 | 66 | loopTable <- subset(cdmSpecsClean, `CDM Table` == tb) 67 | loopTable <- subset(loopTable, select = -c(1)) 68 | 69 | print(kable(x = loopTable, align = "l", row.names = FALSE, format = "html", escape = FALSE) %>% 70 | column_spec(1, bold = T) %>% 71 | # column_spec(2, width = "3in", include_thead = T) %>% 72 | # column_spec(3, width = "4in", include_thead = T) %>% 73 | # column_spec(4:9, width = "1in", include_thead = T) %>% 74 | kable_styling(c("condensed","hover"), position = "center", full_width = T, font_size = 13)) 75 | 76 | 77 | } 78 | 79 | 80 | 81 | ``` 82 | -------------------------------------------------------------------------------- /rmd/queries.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Example_Queries" 3 | author: "Clair Blacketer" 4 | date: "September 29, 2020" 5 | output: html_document 6 | --- 7 | 8 | ```{r setup, include=FALSE} 9 | knitr::opts_chunk$set(echo = TRUE) 10 | ``` 11 | 12 | The query below will find all standard concepts in the Visit domain that do not have any ancestors. These are considered "top-level" visit concepts and can be used to define categories of visits in cohort definitions. For example, the Inpatient Visit concept [9201](https://athena.ohdsi.org/search-terms/terms/9201) subsumes the concepts for Inpatient Hospital and Inpatient in Psychiatric Facility. Instead of creating a concept set with all of these terms to define an inpatient visit you can use 9201 and all of it's descendants, a concept found using the top-level query. 13 | 14 | WITH top_level 15 | AS 16 | (SELECT concept_id, concept_name 17 | FROM concept 18 | LEFT JOIN concept_ancestor ON concept_id=descendant_concept_id 19 | AND ancestor_concept_id!=descendant_concept_id 20 | WHERE domain_id='Visit' AND standard_concept='S' 21 | AND ancestor_concept_id IS NULL 22 | ) 23 | SELECT top_level.concept_id, top_level.concept_name, descendant.concept_id, descendant.concept_name 24 | FROM concept_ancestor 25 | JOIN top_level ON top_level.concept_id = ancestor_concept_id 26 | JOIN concept descendant ON descendant.concept_id = descendant_concept_id 27 | WHERE descendant.domain_id = 'Visit'; 28 | -------------------------------------------------------------------------------- /rmd/reviewProposals.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'CDM Proposals Under Review' 3 | output: html_document 4 | --- 5 | 6 | This page is still in development. For a list of all proposals currently under review please see the [github issue log](https://github.com/OHDSI/CommonDataModel/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3AProposal%20). 7 | -------------------------------------------------------------------------------- /rmd/style.css: -------------------------------------------------------------------------------- 1 | .rmdimportant { 2 | padding: 1em 1em 1em 4em; 3 | margin-bottom: 10px; 4 | background: #f5f5f5 5px center/3em no-repeat; 5 | background-image: url("images/important.png"); 6 | } -------------------------------------------------------------------------------- /rmd/typesOfAdditions.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: '
Types of OMOP CDM Additions
' 3 | output: 4 | html_document: 5 | toc: TRUE 6 | toc_float: TRUE 7 | --- 8 | 9 | While the OMOP CDM supports a diverse set of use cases and data types, we acknowledge that not all can be represented in the CDM in its current form. Based on your use case it may be necessary to modify just your database, create an expansion, or suggest changes to the model that will be incorporated into the next official version. This document describes the types of additions that can be made to the CDM and how they should be utilized by the community. 10 | 11 | ## Site - Specific Add on 12 | 13 | It is entirely within your rights as a data owner or holder to create additional columns or even tables in your own instance of your CDM that is specific to your site. However, they are not supported or recognized by OHDSI tools and not part of the canonical OMOP CDM. The Add on column or table is used for a site specific use case or data element. Examples include: privacy flags, source table identifiers or other data elements. See [this poster](https://www.ohdsi.org/wp-content/uploads/2021/09/18-Implementing-Adopting-a-Customized-OMOP-Common-Data-Model.pdf) for background information and an implementation guide. 14 | 15 | ## Expansion/Extension 16 | 17 | These are typically sets of tables created by working groups to model a specific type of data. The idea is that these tables follow the general conventions of the OMOP CDM but are not part of the canonical data model and therefore do not fall under the purview of the CDM working group. They are developed using OMOP conventions applied to domain specific datasets. It is possible they could become part of the CDM in the future (like the episode and episode_event tables) but that is not a given. If using an expansion/extension with your data they are invisible to the tools. They can be used as part of network research but you would need to ensure that all participating databases are using the extension/expansion before writing a study package that incorporates the tables. 18 | 19 | **Examples include:** 20 | 21 | - Oncology 22 | - Github: https://ohdsi.github.io/OncologyWG/ 23 | - Medical Imaging 24 | - Github: https://github.com/paulnagy/DICOM2OMOP 25 | - Paper: https://link-springer-com.ezjandj.infotrieve.com/article/10.1007/s10278-024-00982-6 26 | - GIS 27 | - Github: https://ohdsi.github.io/GIS/ 28 | 29 | ## Change to Canonical CDM 30 | 31 | Please see the [full process](/CommonDataModel/cdmRequestProcess.html) for how to request changes to the current version of the OMOP CDM. These change requests MUST be backed by network uses cases and MUST be approved by the [CDM working group](https://forms.office.com/Pages/ResponsePage.aspx?id=lAAPoyCRq0q6TOVQkCOy1ZyG6Ud_r2tKuS0HcGnqiQZUOVJFUzBFWE1aSVlLN0ozR01MUVQ4T0RGNyQlQCN0PWcu). Overall these are typically small changes or additions that make the CDM more usable from a network perspective or fulfill a clearly demonstrated need. Good examples are the recently ratified [NOTE_NLP updates](https://github.com/OHDSI/CommonDataModel/tree/NLP_Proposal_2023) and presentation by the vocabulary team to add [value_source_concept_id](https://ohdsiorg.sharepoint.com/:v:/s/Workgroup-CommonDataModel/EcMaYjUPeSVMrmSozflBsmQBNEtPpiCJ9AfZ3QQtGHIuFg?e=UnVgIh&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0%3D) to the measurement and observation tables. 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /rmd/useCaseN.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Local Data" 3 | output: html_document 4 | --- 5 | 6 | Okay, so you don't have a network use case. **Is this data element specific to your data source, or are there others in the community who might also have this data but don't yet need it for a study or data model convention?** 7 | 8 | [Yes, this element is specific to my data source](localChange.html) 9 | 10 | [No, there are others in the community who also have this data](leaveAsIs.html) 11 | -------------------------------------------------------------------------------- /rmd/useCaseY.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "OMOP Vocabulary" 3 | output: html_document 4 | --- 5 | 6 | Great, you have a network use case! 7 | 8 | Next question: **Is there an existing OMOP vocabulary to support this new element? If you are unsure, feel free to check [Athena](https://athena.ohdsi.org/search-terms/terms?query).** 9 | 10 | [Yes, I have all the required vocabulary I need](vocabY.html) 11 | 12 | [No, I there is not an existing OMOP vocabulary to support my request](vocabN.html) 13 | 14 | -------------------------------------------------------------------------------- /rmd/vocabN.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Open Source Vocabulary" 3 | output: html_document 4 | --- 5 | 6 | Okay, so you have a use case but you don't have an OMOP vocabulary to support your need. **Is there an existing open-source (not proprietary or custom) vocabulary that has not yet been incorporated into the OMOP vocabulary?** 7 | 8 | [Yes, the vocabulary exists, it just needs to be brought in](vocabRequest.html) 9 | 10 | [No, there is no open-source vocabulary for this data element](contactVocab.html) 11 | -------------------------------------------------------------------------------- /rmd/vocabRequest.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Vocabulary Request" 3 | output: html_document 4 | --- 5 | 6 | Okay so you have something you would like to add to the CDM and there is an existing OMOP vocabulary we can bring in to support it. **In this case, please open an issue on the vocabulary github with the details of what you need added** as data elements in the CDM must have a vocabulary in place before they can be implemented. The team will follow up with you should they need additional information. 7 | 8 | [Vocabulary GitHub Issue Tracker](https://github.com/OHDSI/Vocabulary-v5.0/issues) 9 | 10 | Once that request is made, please follow the [CDM Request Process](cdmRequestProcess.html) to begin the steps soliciting a change or addition to the model itself. Need more guidance? Consider contacting the CDM Working Group on our [GitHub](https://github.com/OHDSI/CommonDataModel) or [Teams Channel](https://teams.microsoft.com/l/team/19%3a133f2b94b86a41a884d4a4d160610148%40thread.tacv2/conversations?groupId=a6f2c516-e568-4974-8f1e-a7bdc2f997c5&tenantId=a30f0094-9120-4aab-ba4c-e5509023b2d5). 11 | -------------------------------------------------------------------------------- /rmd/vocabY.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Request Process" 3 | output: html_document 4 | --- 5 | 6 | Great, so you have a network use case and an existing OMOP Vocabulary! **From here, please follow the steps to formally request a change to the OMOP Common Data Model.** 7 | 8 | [CDM Request Process](cdmRequestProcess.html) 9 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(CommonDataModel) 3 | 4 | test_check("CommonDataModel") 5 | -------------------------------------------------------------------------------- /tests/testthat/test-createDdl.R: -------------------------------------------------------------------------------- 1 | test_that("createDdl works", { 2 | for (cdmVersion in listSupportedVersions()) { 3 | sql <- createDdl(cdmVersion) 4 | expect_type(sql, "character") 5 | expect_gt(nchar(sql), 10) 6 | } 7 | expect_error(createDdl(5.4)) 8 | expect_error(createDdl("blah")) 9 | }) 10 | 11 | test_that("createPrimaryKeys works", { 12 | for (cdmVersion in listSupportedVersions()) { 13 | sql <- createPrimaryKeys(cdmVersion) 14 | expect_type(sql, "character") 15 | expect_gt(nchar(sql), 10) 16 | } 17 | expect_error(createPrimaryKeys(5.4)) 18 | expect_error(createPrimaryKeys("blah")) 19 | }) 20 | 21 | test_that("createForeignKeys works", { 22 | for (cdmVersion in listSupportedVersions()) { 23 | sql <- createForeignKeys(cdmVersion) 24 | expect_type(sql, "character") 25 | expect_gt(nchar(sql), 10) 26 | } 27 | expect_error(createForeignKeys(5.4)) 28 | expect_error(createForeignKeys("blah")) 29 | }) 30 | -------------------------------------------------------------------------------- /tests/testthat/test-executeDdl.R: -------------------------------------------------------------------------------- 1 | 2 | # connection based tests required environment variables be configured 3 | test_that("CommonDataModel Execution Test", { 4 | if (Sys.getenv("CDM5_POSTGRESQL_SERVER") != "") { 5 | test_that("getConnectionDetails works", { 6 | for (dbms in testDatabases) { 7 | expect_s3_class(getConnectionDetails(dbms), "ConnectionDetails") 8 | } 9 | }) 10 | 11 | test_that("getSchema works", { 12 | for (dbms in testDatabases) { 13 | expect_type(getSchema(dbms), "character") 14 | } 15 | }) 16 | 17 | for (dbms in testDatabases) { 18 | connectionDetails <- getConnectionDetails(dbms) 19 | cdmDatabaseSchema <- getSchema(dbms) 20 | 21 | test_that(paste("Can connect to", dbms), { 22 | expect_error(con <- connect(connectionDetails), NA) 23 | expect_error(disconnect(con), NA) 24 | }) 25 | 26 | for (cdmVersion in listSupportedVersions()) { 27 | test_that(paste("DDL", cdmVersion, "runs on", dbms), { 28 | dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema) 29 | tables <- 30 | listTablesInSchema(connectionDetails, cdmDatabaseSchema) 31 | expect_equal(tables, character(0)) 32 | 33 | executeDdl( 34 | connectionDetails, 35 | cdmVersion = cdmVersion, 36 | cdmDatabaseSchema = cdmDatabaseSchema, 37 | executeDdl = TRUE, 38 | executePrimaryKey = TRUE, 39 | executeForeignKey = FALSE 40 | ) 41 | 42 | tables <- 43 | listTablesInSchema(connectionDetails, cdmDatabaseSchema) 44 | cdmTableCsvLoc <- 45 | system.file(file.path( 46 | "csv", 47 | paste0("OMOP_CDMv", cdmVersion, "_Table_Level.csv") 48 | ), 49 | package = "CommonDataModel", 50 | mustWork = TRUE) 51 | tableSpecs <- 52 | read.csv(cdmTableCsvLoc, stringsAsFactors = FALSE)$cdmTableName 53 | 54 | # check that the tables in the database match the tables in the specification 55 | expect_equal(sort(tolower(tables)), sort(tolower(tableSpecs))) 56 | dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema) 57 | }) 58 | } 59 | } 60 | } else { 61 | message("Skipping driver setup because environmental variables not set") 62 | } 63 | }) 64 | 65 | -------------------------------------------------------------------------------- /tests/testthat/test-writeDdl.R: -------------------------------------------------------------------------------- 1 | test_that("writeDdl works", { 2 | 3 | outputfolder <- tempdir(TRUE) 4 | filename <- writeDdl(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder) 5 | 6 | expect_true(file.exists(file.path(outputfolder, filename))) 7 | sql <- readr::read_file(file.path(outputfolder, filename)) 8 | 9 | expect_type(sql, "character") 10 | expect_gt(nchar(sql), 10) 11 | 12 | }) 13 | 14 | test_that("writePrimaryKeys works", { 15 | 16 | outputfolder <- tempdir(TRUE) 17 | filename <- writePrimaryKeys(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder) 18 | 19 | expect_true(file.exists(file.path(outputfolder, filename))) 20 | sql <- readr::read_file(file.path(outputfolder, filename)) 21 | 22 | expect_type(sql, "character") 23 | expect_gt(nchar(sql), 10) 24 | 25 | }) 26 | 27 | test_that("writeForeignKeys works", { 28 | 29 | outputfolder <- tempdir(TRUE) 30 | filename <- writeForeignKeys(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder) 31 | 32 | expect_true(file.exists(file.path(outputfolder, filename))) 33 | sql <- readr::read_file(file.path(outputfolder, filename)) 34 | 35 | expect_type(sql, "character") 36 | expect_gt(nchar(sql), 10) 37 | 38 | }) 39 | 40 | test_that("writeIndex works", { 41 | 42 | outputfolder <- tempdir(TRUE) 43 | filename <- writeIndex(targetDialect = "postgresql", cdmVersion = "5.4", outputfolder = outputfolder) 44 | 45 | expect_true(file.exists(file.path(outputfolder, filename))) 46 | sql <- readr::read_file(file.path(outputfolder, filename)) 47 | 48 | expect_type(sql, "character") 49 | expect_gt(nchar(sql), 10) 50 | 51 | }) 52 | --------------------------------------------------------------------------------