Merge in Maxims changes. update documentation

This commit is contained in:
Adam Black 2021-08-19 16:00:24 -04:00
commit 63ba979509
24 changed files with 1116 additions and 243 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -1,10 +1,12 @@
# Generated by roxygen2: do not edit by hand
export(buildReleaseZip)
export(createDdl)
export(createForeignKeys)
export(createPrimaryKeys)
export(downloadCurrentDdl)
export(executeDdl)
export(listSupportedDialects)
export(listSupportedVersions)
export(parseWiki)
export(writeDdl)

88
R/buildRelease.R Normal file
View File

@ -0,0 +1,88 @@
# Copyright 2019 Observational Health Data Sciences and Informatics
#
# This file is part of CdmDdlBase
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#' Create OMOP CDM SQL files
#'
#' Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion
#' and targetDialect to the 'ddl' folder in current working directory.
#'
#' @param cdmVersion The version of the CDM you are creating, e.g. 5.3, 5.4.
#' Defaults to all supported CDM versions.
#' @param targetDialect The target dialect
#'
buildRelease <- function(cdmVersion = listSupportedVersions(),
targetDialect = listSupportedDialects()){
for (cdmVersion in cdmVersion) {
for (targetDialect in targetDialect) {
writeDdl(targetDialect = targetDialect,
cdmVersion = cdmVersion)
writePrimaryKeys(targetDialect = targetDialect,
cdmVersion = cdmVersion)
writeForeignKeys(targetDialect = targetDialect,
cdmVersion = cdmVersion)
writeIndex(targetDialect = targetDialect,
cdmVersion = cdmVersion)
}
}
}
#' Create OMOP CDM release zip
#'
#' First calls \code{buildReleaseZips} for given cdmVersions and targetDialects.
#' This writes the ddl sql files to the ddl folder.
#' Then zips all written ddl files into a release zip to given output folder.
#'
#' If no (or multiple) targetDialect is given,
#' then one zip is written with the files of all supported dialects.
#'
#' @param cdmVersion The version of the CDM you are creating, e.g. 5.3, 5.4.
#' Defaults to all supported CDM versions.
#' @param targetDialect The target dialect. Defaults to all supported dialects.
#' @param outputfolder The output folder. Defaults to "output"
#' @return A character string containing the OHDSQL DDL
#' @export
#' @examples
#' buildReleaseZip(cdmVersion='5.3', targetDialect='sql server', outputfolder='.')
#'
buildReleaseZip <- function(cdmVersion,
targetDialect = listSupportedDialects(),
outputfolder = "output"){
# argument checks
stopifnot(is.character(cdmVersion), length(cdmVersion) == 1, cdmVersion %in% listSupportedVersions())
if (!dir.exists(outputfolder)) {
dir.create(outputfolder)
}
files <- c()
for (dialect in targetDialect) {
buildRelease(cdmVersion, dialect)
files <- c(files, list.files(file.path('ddl', cdmVersion, gsub(" ", "_", dialect)),
pattern = ".*\\.sql$",
full.names = TRUE))
}
if (length(targetDialect) == 1) {
zipName <- file.path(outputfolder, paste0("OMOPCDM", "_", gsub(" ", "_", targetDialect), "_", cdmVersion, '.zip'))
} else {
zipName <- file.path(outputfolder, paste0("OMOPCDM", "_", cdmVersion, '.zip'))
}
DatabaseConnector::createZipFile(zipFile = zipName, files = files)
}

View File

@ -6,3 +6,12 @@ listSupportedVersions <- function() {
supportedVersions <- c("5.3", "5.4")
return(supportedVersions)
}
#' List RDBMS dialects supported by this package
#'
#' @export
listSupportedDialects <- function() {
supportedDialects <- c("oracle", "postgresql", "pdw", "redshift", "impala", "netezza", "bigquery", "sql server")
return(supportedDialects)
}

View File

@ -0,0 +1,603 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title>Indices, Primary Keys and Foreign Key Constraints</title>
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<style>h1 {font-size: 34px;}
h1.title {font-size: 38px;}
h2 {font-size: 30px;}
h3 {font-size: 24px;}
h4 {font-size: 18px;}
h5 {font-size: 16px;}
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">code{white-space: pre;}</style>
<script type="text/javascript">
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() { hljs.initHighlighting(); }, 0);
}
}
</script>
<link rel="stylesheet" href="style.css" type="text/css" />
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
img {
max-width:100%;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
summary {
display: list-item;
}
pre code {
padding: 0;
}
</style>
<style type="text/css">
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #cccccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #adb5bd;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
border-radius: 6px 0 6px 6px;
}
</style>
<script type="text/javascript">
// manage active state of menu based on current page
$(document).ready(function () {
// active menu anchor
href = window.location.pathname
href = href.substr(href.lastIndexOf('/') + 1)
if (href === "")
href = "index.html";
var menuAnchor = $('a[href="' + href + '"]');
// mark it active
menuAnchor.tab('show');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
// Navbar adjustments
var navHeight = $(".navbar").first().height() + 15;
var style = document.createElement('style');
var pt = "padding-top: " + navHeight + "px; ";
var mt = "margin-top: -" + navHeight + "px; ";
var css = "";
// offset scroll position for anchor links (for fixed navbar)
for (var i = 1; i <= 6; i++) {
css += ".section h" + i + "{ " + pt + mt + "}\n";
}
style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css;
document.head.appendChild(style);
});
</script>
<!-- tabsets -->
<style type="text/css">
.tabset-dropdown > .nav-tabs {
display: inline-table;
max-height: 500px;
min-height: 44px;
overflow-y: auto;
border: 1px solid #ddd;
border-radius: 4px;
}
.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "&#xe258;";
border: none;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}
.tabset-dropdown > .nav-tabs > li.active {
display: block;
}
.tabset-dropdown > .nav-tabs > li > a,
.tabset-dropdown > .nav-tabs > li > a:focus,
.tabset-dropdown > .nav-tabs > li > a:hover {
border: none;
display: inline-block;
border-radius: 4px;
background-color: transparent;
}
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
display: block;
float: none;
}
.tabset-dropdown > .nav-tabs > li {
display: none;
}
</style>
<!-- code folding -->
<style type="text/css">
#TOC {
margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
position: relative;
width: 100%;
}
}
@media print {
.toc-content {
/* see https://github.com/w3c/csswg-drafts/issues/4434 */
float: right;
}
}
.toc-content {
padding-left: 30px;
padding-right: 40px;
}
div.main-container {
max-width: 1200px;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 85%;
}
@media (min-width: 768px) and (max-width: 991px) {
div.tocify {
width: 25%;
}
}
@media (max-width: 767px) {
div.tocify {
width: 100%;
max-width: none;
}
}
.tocify ul, .tocify li {
line-height: 20px;
}
.tocify-subheader .tocify-item {
font-size: 0.90em;
}
.tocify .list-group-item {
border-radius: 0px;
}
</style>
</head>
<body>
<div class="container-fluid main-container">
<!-- setup 3col/9col grid for toc_float and main content -->
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><div><img src="ohdsi16x16.png"></img> OMOP Common Data Model </div></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.html">
<span class="fa fa-home"></span>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-landmark"></span>
Background
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="background.html">Model Background</a>
</li>
<li>
<a href="vocabulary.html">How the Vocabulary is Built</a>
</li>
</ul>
</li>
<li>
<a href="dataModelConventions.html">
<span class="fa fa-list-alt"></span>
Conventions
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-history"></span>
CDM Versions
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="cdm30.html">CDM v3.0</a>
</li>
<li>
<a href="cdm531.html">CDM v5.3.1</a>
</li>
<li>
<a href="cdm531.html">CDM v5.4</a>
</li>
<li>
<a href="cdm60.html">CDM v6.0</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-plus-square"></span>
Proposals
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="reviewProposals.html">Under Review</a>
</li>
<li class="dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Accepted</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="oncology.html">Oncology CDM Proposal</a>
</li>
<li>
<a href="https://github.com/OHDSI/CommonDataModel/issues/252">Region_concept_id</a>
</li>
<li>
<a href="https://github.com/OHDSI/CommonDataModel/issues/264">Units in Device Table</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-question"></span>
Help
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="faq.html">FAQ</a>
</li>
<li>
<a href="contribute.html">Ask a Question</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="fa fa-wrench"></span>
How to
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="sqlScripts.html">SQL Scripts</a>
</li>
<li>
<a href="download.html">Download the DDL</a>
</li>
<li>
<a href="drug_dose.html">Calculate Drug Dose</a>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/OHDSI/CommonDataModel">
<span class="fa fa-github fa-lg"></span>
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div id="header">
<h1 class="title toc-ignore">Indices, Primary Keys and Foreign Key Constraints</h1>
</div>
<div id="to-do" class="section level3">
<h3>To Do</h3>
<ul>
<li>Need something for hashing</li>
<li>What about constraints that arent foreign keys</li>
</ul>
</div>
<div id="overview" class="section level2">
<h2>Overview</h2>
<p>Database indices improve the performance of queries against a database by organizing the data in a way that increase query execution.</p>
<p>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 adminstrative (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.</p>
</div>
<div id="general-recommendations" class="section level2">
<h2>General Recommendations</h2>
<p>Should your database of choice support indexing, the OMOP CDM Working Group recommends</p>
<ul>
<li>Indexing on all columns containing an "_id" (e.g. condition_occurrence_id, drug_exposure_id, measurement_id, procedure_occurrence_id, etc.)</li>
<li>Indexing on primary and foreign keys</li>
</ul>
<p>For all databases, regardless of custom indice support, primary and foreign keys should be set. This is a step towards ensuring data integrity.</p>
</div>
<div id="database-support" class="section level2">
<h2>Database support</h2>
<p>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.</p>
<div id="microsoft-sql-server" class="section level3">
<h3>Microsoft SQL Server</h3>
</div>
<div id="oracle" class="section level3">
<h3>Oracle</h3>
</div>
<div id="postgresql" class="section level3">
<h3>PostgreSQL</h3>
</div>
<div id="amazon-redshift" class="section level3">
<h3>Amazon Redshift</h3>
<p>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 <a href="https://github.com/OHDSI/CommonDataModel/blob/v5.4/ddl/5.4/redshift/OMOPCDM_redshift_5.4_ddl.sql">Redshift-specific DDL</a>.</p>
</div>
<div id="impala" class="section level3">
<h3>Impala</h3>
</div>
<div id="ibm-netezza" class="section level3">
<h3>IBM Netezza</h3>
</div>
<div id="google-bigquery" class="section level3">
<h3>Google BigQuery</h3>
<p>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. <a href="https://forums.ohdsi.org/t/iso-best-practices-of-cdm-indexing/10939/2">Reference</a></p>
</div>
<div id="microsoft-parallel-data-warehouse-pdw" class="section level3">
<h3>Microsoft Parallel Data Warehouse (PDW)</h3>
</div>
<div id="sqlite" class="section level3">
<h3>SQLite</h3>
</div>
<div id="databricks" class="section level3">
<h3>Databricks</h3>
<p>This database type is not yet supported but is actively being worked on by a number of collaborators. For more informtion, please contact Ajit Londhe of Amgen.</p>
</div>
</div>
<div id="references" class="section level2">
<h2>References</h2>
<p><a href="https://forums.ohdsi.org/t/iso-best-practices-of-cdm-indexing/10939/2">ISO Best Practices of CDM Indexing</a></p>
</div>
</div>
</div>
</div>
<script>
// add bootstrap table styles to pandoc tables
function bootstrapStylePandocTables() {
$('tr.odd').parent('tbody').parent('table').addClass('table table-condensed');
}
$(document).ready(function () {
bootstrapStylePandocTables();
});
</script>
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
$(document).ready(function () {
$('.tabset-dropdown > .nav-tabs > li').click(function () {
$(this).parent().toggleClass('nav-tabs-open');
});
});
</script>
<!-- code folding -->
<script>
$(document).ready(function () {
// temporarily add toc-ignore selector to headers for the consistency with Pandoc
$('.unlisted.unnumbered').addClass('toc-ignore')
// move toc-ignore selectors from section div to header
$('div.section.toc-ignore')
.removeClass('toc-ignore')
.children('h1,h2,h3,h4,h5').addClass('toc-ignore');
// establish options
var options = {
selectors: "h1,h2,h3,h4,h5",
theme: "bootstrap3",
context: '.toc-content',
hashGenerator: function (text) {
return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_');
},
ignoreSelector: ".toc-ignore",
scrollTo: 0
};
options.showAndHide = true;
options.smoothScroll = true;
// tocify
var toc = $("#TOC").tocify(options).data("toc-tocify");
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>

View File

@ -23,7 +23,6 @@ window.initializeCodeFolding = function(show) {
// create a collapsable div to wrap the code in
var div = $('<div class="collapse r-code-collapse"></div>');
var showThis = (show || $(this).hasClass('fold-show')) && !$(this).hasClass('fold-hide');
if (showThis) div.addClass('in');
var id = 'rcode-643E0F36' + currentIndex++;
div.attr('id', id);
$(this).before(div);
@ -31,7 +30,7 @@ window.initializeCodeFolding = function(show) {
// add a show code button right above
var showCodeText = $('<span>' + (showThis ? 'Hide' : 'Code') + '</span>');
var showCodeButton = $('<button type="button" class="btn btn-default btn-xs code-folding-btn pull-right"></button>');
var showCodeButton = $('<button type="button" class="btn btn-default btn-xs btn-secondary btn-sm code-folding-btn pull-right float-right"></button>');
showCodeButton.append(showCodeText);
showCodeButton
.attr('data-toggle', 'collapse')
@ -47,13 +46,27 @@ window.initializeCodeFolding = function(show) {
div.before(buttonRow);
// show the div if necessary
if (showThis) div.collapse('show');
// update state of button on show/hide
div.on('hidden.bs.collapse', function () {
// * Change text
// * add a class for intermediate states styling
div.on('hide.bs.collapse', function () {
showCodeText.text('Code');
showCodeButton.addClass('btn-collapsing');
});
div.on('hidden.bs.collapse', function () {
showCodeButton.removeClass('btn-collapsing');
});
div.on('show.bs.collapse', function () {
showCodeText.text('Hide');
showCodeButton.addClass('btn-expanding');
});
div.on('shown.bs.collapse', function () {
showCodeButton.removeClass('btn-expanding');
});
});
}

View File

@ -176,7 +176,7 @@
self._setEventHandlers();
// Binding to the Window load event to make sure the correct scrollTop is calculated
$(window).load(function() {
$(window).on("load", function() {
// Sets the active TOC item
self._setActiveElement(true);

View File

@ -22,6 +22,14 @@ for (cdmVersion in supportedVersions) {
}
}
#############
# Zipping release
# All dialects
buildReleaseZip(cdmVersion="5.3", outputfolder="output")
# One dialect
buildReleaseZip(cdmVersion="5.4", targetDialect="postgresql", outputfolder="output")
#############
# BE SURE TO RUN THE EXTRAS/SITEMAINTENANCE.R BEFORE CREATING THE PDF

View File

@ -1,21 +1,19 @@
cdmTableName,cdmFieldName,isRequired,cdmDatatype,userGuidance,etlConventions,isPrimaryKey,isForeignKey,fkTableName,fkFieldName,fkDomain,fkClass
EPISODE,episode_id,Yes,bigint,A unique identifier for each Episode event.,,Yes,No,,,,
EPISODE,person_id,Yes,bigint,A foreign key identifier to the Person who is experiencing the episdoe. The demographic details of that Person are stored in the PERSON table.,,No,Yes,PERSON,PERSON_ID,,
EPISODE,episode_concept_id,Yes,integer,A foreign key that refers to a Standard Concept identifier in the Standardized Vocabularies belonging to the 'Episode' domain.,,No,Yes,,,Episode,
EPISODE,episode_start_datetime,Yes,datetime,The date and time when the Episode begins.,,No,No,,,,
EPISODE,episode_id,Yes,bigint,A unique identifier for each Episode.,,Yes,No,,,,
EPISODE,person_id,Yes,bigint,The PERSON_ID of the PERSON for whom the episode is recorded.,,No,Yes,PERSON,PERSON_ID,,
EPISODE,episode_concept_id,Yes,integer,"The EPISODE_CONCEPT_ID represents the kind abstraction related to the disease phase, outcome or treatment.","Choose a concept in the Episode domain that best represents the ongoing disease phase, outcome, or treatment. Please see [article] for cancers and [article] for non-cancers describing how these are defined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Episode&page=1&pageSize=15&query=)",No,Yes,,,Episode,
EPISODE,episode_start_date,Yes,date,The date when the Episode beings. ,Please see [article] for how to define an Episode start date.,No,No,,,,
EPISODE,episode_start_datetime,No,datetime,The date and time when the Episode begins.,,No,No,,,,
EPISODE,episode_end_date,No,date,The date when the instance of the Episode is considered to have ended.,Please see [article] for how to define an Episode end date.,,,,,,
EPISODE,episode_end_datetime,No,datetime,The date when the instance of the Episode is considered to have ended.,,No,No,,,,
EPISODE,episode_parent_id,No,bigint,A foreign key that refers to a parent Episode entry representing an entire episode if the episode spans multiple cycles.,,No,No,,,,
EPISODE,episode_number,No,integer,An ordinal count for an Episode that spans multiple times.,,No,No,,,,
EPISODE,episode_object_concept_id,Yes,integer,"A foreign key that refers to a concept identifier in the Standardized Vocabularies describing the disease, treatment, or other abstraction that the episode describes. Episode entries from the 'Disease Episode' concept class should have an episode_object_concept_id that comes from the Condition domain. Episode entries from the 'Treatment Episode' concept class should have an episode_object_concept_id that scome from the 'Procedure' or 'Regimen' domain.",,No,Yes,CONCEPT,CONCEPT_ID,"Procedure, Regimen",
EPISODE,episode_type_concept_id,Yes,integer,"A foreign key to the predefined Concept identifier in the Standardized Vocabularies reflecting the source data from which the Episode was recorded, the level of standardization, and the type of occurrence. These belong to the 'Episode Type' vocabulary",,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,
EPISODE,episode_parent_id,No,bigint,Use this field to find the Episode that subsumes the given Episode record. This is used in the case that an Episode are nested into each other.,"If there are multiple nested levels to how Episodes are represented, the EPISODE_PARENT_ID can be used to record this relationship. ",No,No,,,,
EPISODE,episode_number,No,integer,"For sequences of episodes, this is used to indicate the order the episodes occurred. For example, lines of treatment could be indicated here. ",Please see [article] for the details of how to count episodes.,No,No,,,,
EPISODE,episode_object_concept_id,Yes,integer,"A Standard Concept representing the disease phase, outcome, or other abstraction of which the episode consists. For example, if the EPISODE_CONCEPT_ID is [treatment regimen](https://athena.ohdsi.org/search-terms/terms/32531) then the EPISODE_OBJECT_CONCEPT_ID should contain the chemotherapy regimen concept, like [Afatinib monotherapy](https://athena.ohdsi.org/search-terms/terms/35804392). ",Episode entries from the 'Disease Episode' concept class should have an episode_object_concept_id that comes from the Condition domain. Episode entries from the 'Treatment Episode' concept class should have an episode_object_concept_id that scome from the 'Procedure' domain or 'Regimen' concept class.,No,Yes,CONCEPT,CONCEPT_ID,"Procedure, Regimen",
EPISODE,episode_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Episode record, as in whether the episode was from an EHR system, insurance claim, registry, or other sources.",Choose the EPISODE_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,
EPISODE,episode_source_value,No,varchar(50),The source code for the Episdoe as it appears in the source data. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,,No,No,,,,
EPISODE,episode_source_concept_id,No,integer,A foreign key to a Episdoe Concept that refers to the code used in the source.,,No,Yes,CONCEPT,CONCEPT_ID,,
EPISODE_EVENT,episode_id,Yes,bigint,A foreign key identifier to the Episode that the Episode Event belongs to.,,No,Yes,EPISODE,EPISODE_ID,Episode,
EPISODE_EVENT,event_id,Yes,bigint,"A foreign key identifier to the underlying event (condition, procedure, measurement, etc.) record in a respective table for which an episode is recorded.",,No,No,,,,
EPISODE_EVENT,episode_event_field_concept_id,Yes,integer,"A foreign key identifier to the standardized concept corresponding to the table primary key column (condition_occurrence.condition_occurrence_id, procedure_occurrence.procedure_occurrence_id, measurment.measurment_id etc.) where the underlying event is stored.",,No,Yes,CONCEPT,CONCEPT_ID,Metadata,
MEASUREMENT,modifier_of_event_id,No,bigint,"A foreign key identifier to the event (e.g. condition, procedure, episode) record for which the modifier is recorded.",,No,No,,,,
MEASUREMENT,modifier_of_field_concept_id,No,integer,The concept representing the table field concept that contains the value of the event id for which the modifier is recorded (e.g. CONDITION_OCCURRENCE.condition_occurre nce_id).,,No,Yes,CONCEPT,CONCEPT_ID,Metadata,
CONCEPT_NUMERIC,concept_id,Yes,integer,A foreign key that refers to a respective concept in the Standardized Vocabularies.,,No,Yes,CONCEPT,CONCEPT_ID,,
CONCEPT_NUMERIC,value_as_number,Yes,float,A value of the concept expressed as a numeric value.,,No,No,,,,
CONCEPT_NUMERIC,unit_concept_id,No,integer,A foreign key to a Standard Concept ID of the concept units in the Standardized Vocabularies that belong to the 'Unit' domain.,,No,Yes,CONCEPT,CONCEPT_ID,,
CONCEPT_NUMERIC,operator_concept_id,yes,float,"A foreign key identifier to the predefined Concept in the Standardized Vocabularies reflecting the mathematical operator that is applied to the value_as_number. Operators are <, <=, =, >=, > and these concepts belong to the 'Meas Value Operator' domain.",,No,Yes,CONCEPT,CONCEPT_ID,,
EPISODE,episode_source_concept_id,No,integer,A foreign key to a Episode Concept that refers to the code used in the source.,Given that the Episodes are user-defined it is unlikely that there will be a Source Concept available. If that is the case then set this field to zero. ,No,Yes,CONCEPT,CONCEPT_ID,,
EPISODE_EVENT,episode_id,Yes,bigint,Use this field to link the EPISODE_EVENT record to its EPISODE.,Put the EPISODE_ID that subsumes the EPISODE_EVENT record here.,No,Yes,EPISODE,EPISODE_ID,,
EPISODE_EVENT,event_id,Yes,bigint,"This field is the primary key of the linked record in the database. For example, if the Episode Event is a Condition Occurrence, then the CONDITION_OCCURRENCE_ID of the linked record goes in this field. ",Put the primary key of the linked record here. ,No,No,,,,
EPISODE_EVENT,episode_event_field_concept_id,Yes,integer,This field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ,Put the CONCEPT_ID that identifies which table and field the EVENT_ID came from. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?vocabulary=CDM&conceptClass=Field&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Metadata,
MEASUREMENT,modifier_of_event_id,No,bigint,"If the Measurement record is related to another record in the database, this field is the primary key of the linked record. ","Put the primary key of the linked record, if applicable, here. ",No,No,,,,
MEASUREMENT,modifier_of_field_concept_id,No,integer,"If the Measurement record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ",Put the CONCEPT_ID that identifies which table and field the MODIFIER_OF_EVENT_ID came from. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?vocabulary=CDM&conceptClass=Field&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Metadata,
1 cdmTableName cdmFieldName isRequired cdmDatatype userGuidance etlConventions isPrimaryKey isForeignKey fkTableName fkFieldName fkDomain fkClass
2 EPISODE episode_id Yes bigint A unique identifier for each Episode event. A unique identifier for each Episode. Yes No
3 EPISODE person_id Yes bigint A foreign key identifier to the Person who is experiencing the episdoe. The demographic details of that Person are stored in the PERSON table. The PERSON_ID of the PERSON for whom the episode is recorded. No Yes PERSON PERSON_ID
4 EPISODE episode_concept_id Yes integer A foreign key that refers to a Standard Concept identifier in the Standardized Vocabularies belonging to the 'Episode' domain. The EPISODE_CONCEPT_ID represents the kind abstraction related to the disease phase, outcome or treatment. Choose a concept in the Episode domain that best represents the ongoing disease phase, outcome, or treatment. Please see [article] for cancers and [article] for non-cancers describing how these are defined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Episode&page=1&pageSize=15&query=) No Yes Episode
5 EPISODE episode_start_datetime episode_start_date Yes datetime date The date and time when the Episode begins. The date when the Episode beings. Please see [article] for how to define an Episode start date. No No
6 EPISODE episode_start_datetime No datetime The date and time when the Episode begins. No No
7 EPISODE episode_end_date No date The date when the instance of the Episode is considered to have ended. Please see [article] for how to define an Episode end date.
8 EPISODE episode_end_datetime No datetime The date when the instance of the Episode is considered to have ended. No No
9 EPISODE episode_parent_id No bigint A foreign key that refers to a parent Episode entry representing an entire episode if the episode spans multiple cycles. Use this field to find the Episode that subsumes the given Episode record. This is used in the case that an Episode are nested into each other. If there are multiple nested levels to how Episodes are represented, the EPISODE_PARENT_ID can be used to record this relationship. No No
10 EPISODE episode_number No integer An ordinal count for an Episode that spans multiple times. For sequences of episodes, this is used to indicate the order the episodes occurred. For example, lines of treatment could be indicated here. Please see [article] for the details of how to count episodes. No No
11 EPISODE episode_object_concept_id Yes integer A foreign key that refers to a concept identifier in the Standardized Vocabularies describing the disease, treatment, or other abstraction that the episode describes. Episode entries from the 'Disease Episode' concept class should have an episode_object_concept_id that comes from the Condition domain. Episode entries from the 'Treatment Episode' concept class should have an episode_object_concept_id that scome from the 'Procedure' or 'Regimen' domain. A Standard Concept representing the disease phase, outcome, or other abstraction of which the episode consists. For example, if the EPISODE_CONCEPT_ID is [treatment regimen](https://athena.ohdsi.org/search-terms/terms/32531) then the EPISODE_OBJECT_CONCEPT_ID should contain the chemotherapy regimen concept, like [Afatinib monotherapy](https://athena.ohdsi.org/search-terms/terms/35804392). Episode entries from the 'Disease Episode' concept class should have an episode_object_concept_id that comes from the Condition domain. Episode entries from the 'Treatment Episode' concept class should have an episode_object_concept_id that scome from the 'Procedure' domain or 'Regimen' concept class. No Yes CONCEPT CONCEPT_ID Procedure, Regimen
12 EPISODE episode_type_concept_id Yes integer A foreign key to the predefined Concept identifier in the Standardized Vocabularies reflecting the source data from which the Episode was recorded, the level of standardization, and the type of occurrence. These belong to the 'Episode Type' vocabulary This field can be used to determine the provenance of the Episode record, as in whether the episode was from an EHR system, insurance claim, registry, or other sources. Choose the EPISODE_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
13 EPISODE episode_source_value No varchar(50) The source code for the Episdoe as it appears in the source data. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
14 EPISODE episode_source_concept_id No integer A foreign key to a Episdoe Concept that refers to the code used in the source. A foreign key to a Episode Concept that refers to the code used in the source. Given that the Episodes are user-defined it is unlikely that there will be a Source Concept available. If that is the case then set this field to zero. No Yes CONCEPT CONCEPT_ID
15 EPISODE_EVENT episode_id Yes bigint A foreign key identifier to the Episode that the Episode Event belongs to. Use this field to link the EPISODE_EVENT record to its EPISODE. Put the EPISODE_ID that subsumes the EPISODE_EVENT record here. No Yes EPISODE EPISODE_ID Episode
16 EPISODE_EVENT event_id Yes bigint A foreign key identifier to the underlying event (condition, procedure, measurement, etc.) record in a respective table for which an episode is recorded. This field is the primary key of the linked record in the database. For example, if the Episode Event is a Condition Occurrence, then the CONDITION_OCCURRENCE_ID of the linked record goes in this field. Put the primary key of the linked record here. No No
17 EPISODE_EVENT episode_event_field_concept_id Yes integer A foreign key identifier to the standardized concept corresponding to the table primary key column (condition_occurrence.condition_occurrence_id, procedure_occurrence.procedure_occurrence_id, measurment.measurment_id etc.) where the underlying event is stored. This field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. Put the CONCEPT_ID that identifies which table and field the EVENT_ID came from. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?vocabulary=CDM&conceptClass=Field&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID Metadata
18 MEASUREMENT modifier_of_event_id No bigint A foreign key identifier to the event (e.g. condition, procedure, episode) record for which the modifier is recorded. If the Measurement record is related to another record in the database, this field is the primary key of the linked record. Put the primary key of the linked record, if applicable, here. No No
19 MEASUREMENT modifier_of_field_concept_id No integer The concept representing the table field concept that contains the value of the event id for which the modifier is recorded (e.g. CONDITION_OCCURRENCE.condition_occurre nce_id). If the Measurement record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. Put the CONCEPT_ID that identifies which table and field the MODIFIER_OF_EVENT_ID came from. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?vocabulary=CDM&conceptClass=Field&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID Metadata
CONCEPT_NUMERIC concept_id Yes integer A foreign key that refers to a respective concept in the Standardized Vocabularies. No Yes CONCEPT CONCEPT_ID
CONCEPT_NUMERIC value_as_number Yes float A value of the concept expressed as a numeric value. No No
CONCEPT_NUMERIC unit_concept_id No integer A foreign key to a Standard Concept ID of the concept units in the Standardized Vocabularies that belong to the 'Unit' domain. No Yes CONCEPT CONCEPT_ID
CONCEPT_NUMERIC operator_concept_id yes float A foreign key identifier to the predefined Concept in the Standardized Vocabularies reflecting the mathematical operator that is applied to the value_as_number. Operators are <, <=, =, >=, > and these concepts belong to the 'Meas Value Operator' domain. No Yes CONCEPT CONCEPT_ID

View File

@ -1,19 +1,4 @@
cdmTableName,schema,isRequired,conceptPrefix,measurePersonCompleteness,measurePersonCompletenessThreshold,validation,tableDescription,userGuidance,etlConventions
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.",,"Valid Episode Concepts belong to the 'Episode' domain.<br><br>
Standard Episode Concepts are categorized by concept class:<br>
Disease Episode<br>
&emsp;32528 ""Disease First Occurrence""<br>
&emsp;32529 ""Disease Recurrence""<br>
&emsp;32530 ""Disease Remission""<br>
&emsp;32677 ""Disease Progression""<br>
Treatment Episode
&emsp;32531 ""Treatment Regimen""<br>
&emsp;32532 ""Treatment Cycle""<br>
Episode of Care
&emsp;32533 ""Episode of Care""<br><br>
The relationship between a disease episode and treatment episodes can be represented by the self-referencing foreign key column EPISODE.episode_parent_id.<br><br>
A treatment EPISODE can be delivered at regular intervals, cycles or fractions. The parent-child relationship between a treatment episode and its constituent treatment cycles can be represented by the self-referencing foreign key column EPISODE.episode_parent_id.
5 Some episodes may not have links to any underlying clinical events. For such episodes, the EPISODE_EVENT table is not populated."
EPISODE_EVENT,CDM,No,,No,0,,"The EPISODE_EVENT table connects qualifying clinical events (VISIT_OCCURRENCE, DRUG_EXPOSURE, PROCEDURE_OCCURRENCE, DEVICE_EXPOSURE) to the appropriate EPISODE entry. The EPISODE_EVENT table supports the linkage of an EPISODE abstraction to the low-level clinical events that implement the EPISODE abstraction.",,"Some episodes may not have links to any underlying clinical events. For such episodes, the EPISODE_EVENT table is not populated."
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. ",
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."
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. ,
CONCEPT_NUMERIC,VOCAB,No,,No,0,,"In this table, numeric values, units and math operators indicating range limits (less than) corresponding to ""numeric"" concepts will be stored. It is an extension of the OMOP CDM and vocabulary that supports formal representation of concepts containing numeric values or ranges. This proposal has not yet been ratified by a larger CDM Workgroup. However, it plays a critical role in supporting ETL from tumor registries. NAACCR vocabulary includes concepts representing numeric values or numeric ranges. Often, these concepts also contain measurement units. For example, ""Described as less than 1 centimeter (cm)"". In OMOP CDM, these concepts are normally used in Measurement and Observation tables to store value_as_concept_id. Analysis of these data is currently possible only if the user knows exactly which concepts are used to represent range or value, including their respective units. It is not possible to perform analysis on numeric values of these data, nor is it possible to differentiate numeric values by units. ",,

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. 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. Valid Episode Concepts belong to the 'Episode' domain.<br><br> Standard Episode Concepts are categorized by concept class:<br> Disease Episode<br> &emsp;32528 "Disease First Occurrence"<br> &emsp;32529 "Disease Recurrence"<br> &emsp;32530 "Disease Remission"<br> &emsp;32677 "Disease Progression"<br> Treatment Episode &emsp;32531 "Treatment Regimen"<br> &emsp;32532 "Treatment Cycle"<br> Episode of Care &emsp;32533 "Episode of Care"<br><br> The relationship between a disease episode and treatment episodes can be represented by the self-referencing foreign key column EPISODE.episode_parent_id.<br><br> A treatment EPISODE can be delivered at regular intervals, cycles or fractions. The parent-child relationship between a treatment episode and its constituent treatment cycles can be represented by the self-referencing foreign key column EPISODE.episode_parent_id. 5 Some episodes may not have links to any underlying clinical events. For such episodes, the EPISODE_EVENT table is not populated.
3 EPISODE_EVENT CDM No No 0 The EPISODE_EVENT table connects qualifying clinical events (VISIT_OCCURRENCE, DRUG_EXPOSURE, PROCEDURE_OCCURRENCE, DEVICE_EXPOSURE) to the appropriate EPISODE entry. The EPISODE_EVENT table supports the linkage of an EPISODE abstraction to the low-level clinical events that implement the EPISODE abstraction. 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.
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.
CONCEPT_NUMERIC VOCAB No No 0 In this table, numeric values, units and math operators indicating range limits (less than) corresponding to "numeric" concepts will be stored. It is an extension of the OMOP CDM and vocabulary that supports formal representation of concepts containing numeric values or ranges. This proposal has not yet been ratified by a larger CDM Workgroup. However, it plays a critical role in supporting ETL from tumor registries. NAACCR vocabulary includes concepts representing numeric values or numeric ranges. Often, these concepts also contain measurement units. For example, "Described as less than 1 centimeter (cm)". In OMOP CDM, these concepts are normally used in Measurement and Observation tables to store value_as_concept_id. Analysis of these data is currently possible only if the user knows exactly which concepts are used to represent range or value, including their respective units. It is not possible to perform analysis on numeric values of these data, nor is it possible to differentiate numeric values by units.
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.

View File

@ -40,10 +40,10 @@ VISIT_OCCURRENCE,provider_id,No,integer,"There will only be one provider per vis
VISIT_OCCURRENCE,care_site_id,No,integer,This field provides information about the Care Site where the Visit took place.,There should only be one Care Site associated with a Visit.,No,Yes,CARE_SITE,CARE_SITE_ID,,,
VISIT_OCCURRENCE,visit_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the kind of visit that took place (inpatient, outpatient, emergency, etc.)","If there is information about the kind of visit in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the visit source value, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created.",No,No,,,,,
VISIT_OCCURRENCE,visit_source_concept_id,No,integer,,If the visit source value is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
VISIT_OCCURRENCE,admitted_from_concept_id,No,integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example. If patient is admitted from home, set this field to zero.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,admitted_from_concept_id,No,integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,admitted_from_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits.",No,No,,,,,
VISIT_OCCURRENCE,discharge_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example. If patient is discharged to home, set this field to zero.","If available, map the discharge_to_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,discharge_to_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_OCCURRENCE,discharged_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example.","If available, map the discharge_to_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,discharged_to_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_OCCURRENCE,preceding_visit_occurrence_id,No,integer,Use this field to find the visit that occurred for the person prior to the given visit. There could be a few days or a few years in between.,"This field can be used to link a visit immediately preceding the current visit. Note this is not symmetrical, and there is no such thing as a ""following_visit_id"".",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
VISIT_DETAIL,visit_detail_id,Yes,integer,Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit detail.,This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time.,Yes,No,,,,,
VISIT_DETAIL,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
@ -63,12 +63,12 @@ VISIT_DETAIL,provider_id,No,integer,"There will only be one provider per **visi
VISIT_DETAIL,care_site_id,No,integer,This field provides information about the Care Site where the Visit Detail took place.,There should only be one Care Site associated with a Visit Detail.,No,Yes,CARE_SITE,CARE_SITE_ID,,,
VISIT_DETAIL,visit_detail_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the kind of visit detail that took place (inpatient, outpatient, emergency, etc.)","If there is information about the kind of visit detail in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the VISIT_DETAIL_SOURCE_VALUE, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created.",No,No,,,,,
VISIT_DETAIL,visit_detail_source_concept_id,No,Integer,,If the VISIT_DETAIL_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
VISIT_DETAIL,admitted_from_concept_id,No,Integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,admitted_from_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits.",No,No,,,,,
VISIT_DETAIL,admitted_from_concept_id,No,Integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example. If patient is admitted from home, set this field to zero.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,discharge_to_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_DETAIL,discharge_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit detail record. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example. If patient is discharged to home, set this field to zero.","If available, map the DISCHARGE_TO_SOURCE_VALUE to a Standard Concept in the Visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,discharged_to_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_DETAIL,discharged_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit detail record. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example.","If available, map the DISCHARGE_TO_SOURCE_VALUE to a Standard Concept in the Visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,preceding_visit_detail_id,No,integer,Use this field to find the visit detail that occurred for the person prior to the given visit detail record. There could be a few days or a few years in between.,"The PRECEDING_VISIT_DETAIL_ID can be used to link a visit immediately preceding the current Visit Detail. Note this is not symmetrical, and there is no such thing as a ""following_visit_id"".",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,visit_detail_parent_id,No,integer,Use this field to find the visit detail that subsumes the given visit detail record. This is used in the case that a visit detail record needs to be nested beyond the VISIT_OCCURRENCE/VISIT_DETAIL relationship.,"If there are multiple nested levels to how Visits are represented in the source, the VISIT_DETAIL_PARENT_ID can be used to record this relationship. ",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,parent_visit_detail_id,No,integer,Use this field to find the visit detail that subsumes the given visit detail record. This is used in the case that a visit detail record needs to be nested beyond the VISIT_OCCURRENCE/VISIT_DETAIL relationship.,"If there are multiple nested levels to how Visits are represented in the source, the VISIT_DETAIL_PARENT_ID can be used to record this relationship. ",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,visit_occurrence_id,Yes,integer,Use this field to link the VISIT_DETAIL record to its VISIT_OCCURRENCE.,Put the VISIT_OCCURRENCE_ID that subsumes the VISIT_DETAIL record here.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
CONDITION_OCCURRENCE,condition_occurrence_id,Yes,integer,The unique key given to a condition record for a person. Refer to the ETL for how duplicate conditions during the same visit were handled.,"Each instance of a condition present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same condition within the same visit. It is valid to keep these duplicates and assign them individual, unique, CONDITION_OCCURRENCE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
CONDITION_OCCURRENCE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the condition is recorded.,,No,Yes,PERSON,PERSON_ID,,,
@ -165,6 +165,7 @@ MEASUREMENT,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the
MEASUREMENT,measurement_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the Measurement that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Measurement Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
MEASUREMENT,measurement_source_concept_id,No,integer,"This is the concept representing the MEASUREMENT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using MEASUREMENT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the MEASUREMENT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the unit of the Measurement that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
MEASUREMENT,unit_source_concept_id,No,integer,"""This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.""",If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,value_source_value,No,varchar(50),This field houses the verbatim result value of the Measurement from the source data . ,"If both a continuous and categorical result are given in the source data such that both VALUE_AS_NUMBER and VALUE_AS_CONCEPT_ID are both included, store the verbatim value that was mapped to VALUE_AS_CONCEPT_ID here.",No,No,,,,,
OBSERVATION,observation_id,Yes,integer,The unique key given to an Observation record for a Person. Refer to the ETL for how duplicate Observations during the same Visit were handled.,Each instance of an observation present in the source data should be assigned this unique key. ,Yes,No,,,,,
OBSERVATION,person_id,Yes,integer,The PERSON_ID of the Person for whom the Observation is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
@ -360,11 +361,13 @@ Condition.",,No,No,,,,,
CONDITION_ERA,condition_occurrence_count,No,integer,"The number of individual Condition
Occurrences used to construct the
condition era.",,No,No,,,,,
METADATA,metadata_id,Yes,integer,The unique key given to a Metadata record.,Attribute value is auto-generated,Yes,No,,,,,
METADATA,metadata_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,metadata_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,name,Yes,varchar(250),,,No,No,,,,,
METADATA,value_as_string,No,varchar(250),,,No,No,,,,,
METADATA,value_as_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,value_as_number,No,float,"This is the numerical value of the Result of the Metadata, if applicable and available. It is not expected that all Metadata will have numeric results, rather, this field is here to house values should they exist. ",,No,No,,,,,
METADATA,metadata_date,No,date,,,No,No,,,,,
METADATA,metadata_datetime,No,datetime,,,No,No,,,,,
CDM_SOURCE,cdm_source_name,Yes,varchar(255),The name of the CDM instance.,,No,No,,,,,
@ -513,15 +516,14 @@ recorded. The default value is
1-Jan-1970.",,No,No,,,,,
DRUG_STRENGTH,valid_end_date,Yes,date,The date when then Concept became invalid.,,No,No,,,,,
DRUG_STRENGTH,invalid_reason,No,varchar(1),"Reason the concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value.",,No,No,,,,,
COHORT_DEFINITION,cohort_definition_id,Yes,integer,"This is the identifier given to the cohort, usually by the ATLAS application",,No,No,,,,,
COHORT,cohort_definition_id,Yes,integer,,,No,No,,,,,
COHORT,subject_id,Yes,integer,,,No,No,,,,,
COHORT,cohort_start_date,Yes,date,,,No,No,,,,,
COHORT,cohort_end_date,Yes,date,,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_id,Yes,integer,"This is the identifier given to the cohort, usually by the ATLAS application",,No,No,COHORT,COHORT_DEFINITION_ID,,,
COHORT_DEFINITION,cohort_definition_name,Yes,varchar(255),A short description of the cohort,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_description,No,varchar(MAX),A complete description of the cohort.,,No,No,,,,,
COHORT_DEFINITION,definition_type_concept_id,Yes,integer,Type defining what kind of Cohort Definition the record represents and how the syntax may be executed.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_definition_syntax,No,varchar(MAX),Syntax or code to operationalize the Cohort Definition.,,No,No,,,,,
COHORT_DEFINITION,subject_concept_id,Yes,integer,"This field contains a Concept that represents the domain of the subjects that are members of the cohort (e.g., Person, Provider, Visit).",,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_initiation_date,No,date,A date to indicate when the Cohort was initiated in the COHORT table.,,No,No,,,,,
ATTRIBUTE_DEFINITION,attribute_definition_id,Yes,integer,,,No,No,,,,,
ATTRIBUTE_DEFINITION,attribute_name,Yes,varchar(255),,,No,No,,,,,
ATTRIBUTE_DEFINITION,attribute_description,No,varchar(MAX),,,No,No,,,,,
ATTRIBUTE_DEFINITION,attribute_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
ATTRIBUTE_DEFINITION,attribute_syntax,No,varchar(MAX),,,No,No,,,,,

1 cdmTableName cdmFieldName isRequired cdmDatatype userGuidance etlConventions isPrimaryKey isForeignKey fkTableName fkFieldName fkDomain fkClass unique DQ identifiers
40 VISIT_OCCURRENCE discharge_to_source_value discharged_to_source_value No varchar(50) This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more. No No
41 VISIT_OCCURRENCE preceding_visit_occurrence_id No integer Use this field to find the visit that occurred for the person prior to the given visit. There could be a few days or a few years in between. This field can be used to link a visit immediately preceding the current visit. Note this is not symmetrical, and there is no such thing as a "following_visit_id". No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
42 VISIT_DETAIL visit_detail_id Yes integer Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit detail. This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time. Yes No
43 VISIT_DETAIL person_id Yes integer No Yes PERSON PERSON_ID
44 VISIT_DETAIL visit_detail_concept_id Yes integer This field contains a concept id representing the kind of visit detail, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain. Populate this field based on the kind of visit that took place for the person. For example this could be "Inpatient Visit", "Outpatient Visit", "Ambulatory Visit", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
45 VISIT_DETAIL visit_detail_start_date Yes date This is the date of the start of the encounter. This may or may not be equal to the date of the Visit the Visit Detail is associated with. When populating VISIT_DETAIL_START_DATE, you should think about the patient experience to make decisions on how to define visits. Most likely this should be the date of the patient-provider interaction. No No
46 VISIT_DETAIL visit_detail_start_datetime No datetime If no time is given for the start date of a visit, set it to midnight (00:00:0000). No No
47 VISIT_DETAIL visit_detail_end_date Yes date This the end date of the patient-provider interaction. Visit Detail end dates are mandatory. If end dates are not provided in the source there are three ways in which to derive them:<br> - Outpatient Visit Detail: visit_detail_end_datetime = visit_detail_start_datetime - Emergency Room Visit Detail: visit_detail_end_datetime = visit_detail_start_datetime - Inpatient Visit Detail: Usually there is information about discharge. If not, you should be able to derive the end date from the sudden decline of activity or from the absence of inpatient procedures/drugs. - Non-hospital institution Visit Details: Particularly for claims data, if end dates are not provided assume the visit is for the duration of month that it occurs.<br> For Inpatient Visit Details ongoing at the date of ETL, put date of processing the data into visit_detai_end_datetime and visit_detail_type_concept_id with 32220 "Still patient" to identify the visit as incomplete. All other Visits Details: visit_detail_end_datetime = visit_detail_start_datetime. No No
48 VISIT_DETAIL visit_detail_end_datetime No datetime If no time is given for the end date of a visit, set it to midnight (00:00:0000). No No
49 VISIT_DETAIL visit_detail_type_concept_id Yes integer Use this field to understand the provenance of the visit detail record, or where the record comes from. Populate this field based on the provenance of the visit detail record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
63 CONDITION_OCCURRENCE condition_concept_id Yes integer The CONDITION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a condition The CONCEPT_ID that the CONDITION_SOURCE_VALUE maps to. Only records whose source values map to concepts with a domain of "Condition" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Condition
64 CONDITION_OCCURRENCE condition_start_date Yes date Use this date to determine the start date of the condition Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE. No No
65 CONDITION_OCCURRENCE condition_start_datetime No datetime If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
66 CONDITION_OCCURRENCE condition_end_date No date Use this date to determine the end date of the condition Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE. No No
67 CONDITION_OCCURRENCE condition_end_date condition_end_datetime No date datetime Use this date to determine the end date of the condition Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
68 CONDITION_OCCURRENCE condition_end_datetime condition_type_concept_id No Yes datetime integer This field can be used to determine the provenance of the Condition record, as in whether the condition was from an EHR system, insurance claim, registry, or other sources. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) Choose the CONDITION_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No No Yes CONCEPT CONCEPT_ID Type Concept
69 CONDITION_OCCURRENCE condition_type_concept_id condition_status_concept_id Yes No integer This field can be used to determine the provenance of the Condition record, as in whether the condition was from an EHR system, insurance claim, registry, or other sources. This concept represents the point during the visit the diagnosis was given (admitting diagnosis, final diagnosis), whether the diagnosis was determined due to laboratory findings, if the diagnosis was exclusionary, or if it was a preliminary diagnosis, among others. Choose the CONDITION_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). Choose the Concept in the Condition Status domain that best represents the point during the visit when the diagnosis was given. These can include admitting diagnosis, principal diagnosis, and secondary diagnosis. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept Condition Status
CONDITION_OCCURRENCE condition_status_concept_id No integer This concept represents the point during the visit the diagnosis was given (admitting diagnosis, final diagnosis), whether the diagnosis was determined due to laboratory findings, if the diagnosis was exclusionary, or if it was a preliminary diagnosis, among others. Choose the Concept in the Condition Status domain that best represents the point during the visit when the diagnosis was given. These can include admitting diagnosis, principal diagnosis, and secondary diagnosis. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Condition Status
70 CONDITION_OCCURRENCE stop_reason No varchar(20) The Stop Reason indicates why a Condition is no longer valid with respect to the purpose within the source data. Note that a Stop Reason does not necessarily imply that the condition is no longer occurring. This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist. No No
71 CONDITION_OCCURRENCE provider_id No integer The provider associated with condition record, e.g. the provider who made the diagnosis or the provider who recorded the symptom. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record. No Yes PROVIDER PROVIDER_ID
72 CONDITION_OCCURRENCE visit_occurrence_id No integer The visit during which the condition occurred. Depending on the structure of the source data, this may have to be determined based on dates. If a CONDITION_START_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the CONDITION_OCCURRENCE record. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
73 CONDITION_OCCURRENCE visit_detail_id No integer The VISIT_DETAIL record during which the condition occurred. For example, if the person was in the ICU at the time of the diagnosis the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. Same rules apply as for the VISIT_OCCURRENCE_ID. No Yes VISIT_DETAIL VISIT_DETAIL_ID
74 CONDITION_OCCURRENCE condition_source_value No varchar(50) This field houses the verbatim value from the source data representing the condition that occurred. For example, this could be an ICD10 or Read code. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
165 OBSERVATION unit_concept_id qualifier_concept_id No integer There is currently no recommended unit for individual observation concepts. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. This field contains all attributes specifying the clinical fact further, such as as degrees, severities, drug-drug interaction alerts etc. There is no standardization requirement for units associated with OBSERVATION_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. Use your best judgement as to what Concepts to use here and if they are necessary to accurately represent the clinical record. There is no restriction on the domain of these Concepts, they just need to be Standard. No Yes CONCEPT CONCEPT_ID Unit
166 OBSERVATION provider_id unit_concept_id No integer The provider associated with the observation record, e.g. the provider who ordered the test or the provider who recorded the result. There is currently no recommended unit for individual observation concepts. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record. There is no standardization requirement for units associated with OBSERVATION_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. No Yes PROVIDER CONCEPT PROVIDER_ID CONCEPT_ID Unit
167 OBSERVATION visit_occurrence_id provider_id No integer The visit during which the Observation occurred. The provider associated with the observation record, e.g. the provider who ordered the test or the provider who recorded the result. Depending on the structure of the source data, this may have to be determined based on dates. If an OBSERVATION_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the observation record. If an observation is related to a visit explicitly in the source data, it is possible that the result date of the Observation falls outside of the bounds of the Visit dates. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record. No Yes VISIT_OCCURRENCE PROVIDER VISIT_OCCURRENCE_ID PROVIDER_ID
168 OBSERVATION visit_occurrence_id No integer The visit during which the Observation occurred. Depending on the structure of the source data, this may have to be determined based on dates. If an OBSERVATION_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the observation record. If an observation is related to a visit explicitly in the source data, it is possible that the result date of the Observation falls outside of the bounds of the Visit dates. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
169 OBSERVATION visit_detail_id No integer The VISIT_DETAIL record during which the Observation occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. Same rules apply as for the VISIT_OCCURRENCE_ID. No Yes VISIT_DETAIL VISIT_DETAIL_ID
170 OBSERVATION observation_source_value No varchar(50) This field houses the verbatim value from the source data representing the Observation that occurred. For example, this could be an ICD10 or Read code. This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
171 OBSERVATION observation_source_concept_id No integer This is the concept representing the OBSERVATION_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Observation necessary for a given analytic use case. Consider using OBSERVATION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the OBSERVATION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
361 CONCEPT_RELATIONSHIP relationship_id concept_id_1 Yes varchar(20) integer The relationship between CONCEPT_ID_1 and CONCEPT_ID_2. Please see the [Vocabulary Conventions](https://ohdsi.github.io/CommonDataModel/dataModelConventions.html#concept_relationships). for more information. No Yes RELATIONSHIP CONCEPT RELATIONSHIP_ID CONCEPT_ID
362 CONCEPT_RELATIONSHIP valid_start_date concept_id_2 Yes date integer The date when the relationship is first recorded. No No Yes CONCEPT CONCEPT_ID
363 CONCEPT_RELATIONSHIP valid_end_date relationship_id Yes date varchar(20) The date when the relationship is invalidated. The relationship between CONCEPT_ID_1 and CONCEPT_ID_2. Please see the [Vocabulary Conventions](https://ohdsi.github.io/CommonDataModel/dataModelConventions.html#concept_relationships). for more information. No No Yes RELATIONSHIP RELATIONSHIP_ID
364 CONCEPT_RELATIONSHIP valid_start_date Yes date The date when the relationship is first recorded. No No
365 CONCEPT_RELATIONSHIP invalid_reason valid_end_date No Yes varchar(1) date Reason the relationship was invalidated. Possible values are 'D' (deleted), 'U' (updated) or NULL. The date when the relationship is invalidated. No No
366 RELATIONSHIP CONCEPT_RELATIONSHIP relationship_id invalid_reason Yes No varchar(20) varchar(1) The type of relationship captured by the relationship record. Reason the relationship was invalidated. Possible values are 'D' (deleted), 'U' (updated) or NULL. Yes No No
367 RELATIONSHIP relationship_name relationship_id Yes varchar(255) varchar(20) The type of relationship captured by the relationship record. No Yes No
368 RELATIONSHIP is_hierarchical relationship_name Yes varchar(1) varchar(255) Defines whether a relationship defines concepts into classes or hierarchies. Values are 1 for hierarchical relationship or 0 if not. No No
369 RELATIONSHIP defines_ancestry is_hierarchical Yes varchar(1) Defines whether a hierarchical relationship contributes to the concept_ancestor table. These are subsets of the hierarchical relationships. Valid values are 1 or 0. Defines whether a relationship defines concepts into classes or hierarchies. Values are 1 for hierarchical relationship or 0 if not. No No
370 RELATIONSHIP defines_ancestry Yes varchar(1) Defines whether a hierarchical relationship contributes to the concept_ancestor table. These are subsets of the hierarchical relationships. Valid values are 1 or 0. No No
371 RELATIONSHIP reverse_relationship_id Yes varchar(20) The identifier for the relationship used to define the reverse relationship between two concepts. No No
372 RELATIONSHIP relationship_concept_id Yes integer A foreign key that refers to an identifier in the [CONCEPT](https://ohdsi.github.io/CommonDataModel/cdm531.html#concept) table for the unique relationship concept. No Yes CONCEPT CONCEPT_ID
373 CONCEPT_SYNONYM concept_id Yes integer No Yes CONCEPT CONCEPT_ID
516
517
518
519
520
521
522
523
524
525
526
527
528
529

View File

@ -57,6 +57,8 @@ For example, consider a Person who visits her Primary Care Physician (PCP) and w
The condition_concept_id field contains Concepts that are identical to those of the CONDITION_OCCURRENCE table records that make up the Condition Era. In contrast to Drug Eras, Condition Eras are not aggregated to contain Conditions of different hierarchical layers. The SQl Script for generating CONDITION_ERA records can be found [here](https://ohdsi.github.io/CommonDataModel/sqlScripts.html#condition_eras)
The Condition Era Start Date is the start date of the first Condition Occurrence.
The Condition Era End Date is the end date of the last Condition Occurrence. Condition Eras are built with a Persistence Window of 30 days, meaning, if no occurrence of the same condition_concept_id happens within 30 days of any one occurrence, it will be considered the condition_era_end_date."
EPISODE,CDM,No,,No,,,"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. ",
EPISODE_EVENT,CDM,No,,No,,,"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."
METADATA,CDM,No,,No,,,The METADATA table contains metadata information about a dataset that has been transformed to the OMOP Common Data Model.,,
CDM_SOURCE,CDM,No,,No,,,The CDM_SOURCE table contains detail about the source database and the process used to transform the data into the OMOP Common Data Model.,,
CONCEPT,VOCAB,No,,No,,,"The Standardized Vocabularies contains records, or Concepts, that uniquely identify each fundamental unit of meaning used to express clinical information in all domain tables of the CDM. Concepts are derived from vocabularies, which represent clinical information across a domain (e.g. conditions, drugs, procedures) through the use of codes and associated descriptions. Some Concepts are designated Standard Concepts, meaning these Concepts can be used as normative expressions of a clinical entity within the OMOP Common Data Model and within standardized analytics. Each Standard Concept belongs to one domain, which defines the location where the Concept would be expected to occur within data tables of the CDM.
@ -75,11 +77,5 @@ CONCEPT_ANCESTOR,VOCAB,No,,No,,,"The CONCEPT_ANCESTOR table is designed to simpl
This table is entirely derived from the CONCEPT, CONCEPT_RELATIONSHIP and RELATIONSHIP tables.",,
SOURCE_TO_CONCEPT_MAP,VOCAB,No,,No,,,"The source to concept map table is a legacy data structure within the OMOP Common Data Model, recommended for use in ETL processes to maintain local source codes which are not available as Concepts in the Standardized Vocabularies, and to establish mappings for each source code into a Standard Concept as target_concept_ids that can be used to populate the Common Data Model tables. The SOURCE_TO_CONCEPT_MAP table is no longer populated with content within the Standardized Vocabularies published to the OMOP community.",,
DRUG_STRENGTH,VOCAB,No,,No,,,The DRUG_STRENGTH table contains structured content about the amount or concentration and associated units of a specific ingredient contained within a particular drug product. This table is supplemental information to support standardized analysis of drug utilization.,,
COHORT_DEFINITION,VOCAB,No,,No,,,"The COHORT_DEFINITION table contains records defining a Cohort derived from the data through the associated description and syntax and upon instantiation (execution of the algorithm) placed into the COHORT table. Cohorts are a set of subjects that satisfy a given combination of inclusion criteria for a duration of time. The COHORT_DEFINITION table provides a standardized structure for maintaining the rules governing the inclusion of a subject into a cohort, and can store operational programming code to instantiate the cohort within the OMOP Common Data Model.",,
ATTRIBUTE_DEFINITION,VOCAB,No,,No,,,"The ATTRIBUTE_DEFINITION table contains records to define each attribute
through an associated description and syntax. Attributes are derived elements
that can be selected or calculated for a subject within a cohort. The
ATTRIBUTE_DEFINITION table provides a standardized structure for
maintaining the rules governing the calculation of covariates for a subject in a
cohort, and can store operational programming code to instantiate the
attributes for a given cohort within the OMOP Common Data Model.",,
COHORT,RESULTS,No,,No,,,The COHORT table contains records of subjects that satisfy a given set of criteria for a duration of time. The definition of the cohort is contained within the COHORT_DEFINITION table. It is listed as part of the RESULTS schema because it is a table that users of the database as well as tools such as ATLAS need to be able to write to. The CDM and Vocabulary tables are all read-only so it is suggested that the COHORT and COHORT_DEFINTION tables are kept in a separate schema to alleviate confusion.,,"Cohorts typically include patients diagnosed with a specific condition, patients exposed to a particular drug, but can also be Providers who have performed a specific Procedure. Cohort records must have a Start Date and an End Date, but the End Date may be set to Start Date or could have an applied censor date using the Observation Period Start Date. Cohort records must contain a Subject Id, which can refer to the Person, Provider, Visit record or Care Site though they are most often Person Ids. The Cohort Definition will define the type of subject through the subject concept id. A subject can belong (or not belong) to a cohort at any moment in time. A subject can only have one record in the cohort table for any moment of time, i.e. it is not possible for a person to contain multiple records indicating cohort membership that are overlapping in time"
COHORT_DEFINITION,RESULTS,No,,No,,,"The COHORT_DEFINITION table contains records defining a Cohort derived from the data through the associated description and syntax and upon instantiation (execution of the algorithm) placed into the COHORT table. Cohorts are a set of subjects that satisfy a given combination of inclusion criteria for a duration of time. The COHORT_DEFINITION table provides a standardized structure for maintaining the rules governing the inclusion of a subject into a cohort, and can store operational programming code to instantiate the cohort within the OMOP Common Data Model.",,
1 cdmTableName schema isRequired conceptPrefix measurePersonCompleteness measurePersonCompletenessThreshold validation tableDescription userGuidance etlConventions
57
58
59
60
61
62
63
64
77
78
79
80
81

21
man/buildRelease.Rd Normal file
View File

@ -0,0 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/buildRelease.R
\name{buildRelease}
\alias{buildRelease}
\title{Create OMOP CDM SQL files}
\usage{
buildRelease(
cdmVersion = listSupportedVersions(),
targetDialect = listSupportedDialects()
)
}
\arguments{
\item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4.
Defaults to all supported CDM versions.}
\item{targetDialect}{The target dialect}
}
\description{
Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion
and targetDialect to the 'ddl' folder in current working directory.
}

36
man/buildReleaseZip.Rd Normal file
View File

@ -0,0 +1,36 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/buildRelease.R
\name{buildReleaseZip}
\alias{buildReleaseZip}
\title{Create OMOP CDM release zip}
\usage{
buildReleaseZip(
cdmVersion,
targetDialect = listSupportedDialects(),
outputfolder = "output"
)
}
\arguments{
\item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4.
Defaults to all supported CDM versions.}
\item{targetDialect}{The target dialect. Defaults to all supported dialects.}
\item{outputfolder}{The output folder. Defaults to "output"}
}
\value{
A character string containing the OHDSQL DDL
}
\description{
First calls \code{buildReleaseZips} for given cdmVersions and targetDialects.
This writes the ddl sql files to the ddl folder.
Then zips all written ddl files into a release zip to given output folder.
}
\details{
If no (or multiple) targetDialect is given,
then one zip is written with the files of all supported dialects.
}
\examples{
buildReleaseZip(cdmVersion='5.3', targetDialect='sql server', outputfolder='.')
}

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/createdDdl.R
% Please edit documentation in R/createDdl.R
\name{createDdl}
\alias{createDdl}
\alias{createPrimaryKeys}
@ -30,9 +30,9 @@ Dashboard.
}
\section{Functions}{
\itemize{
\item \code{createPrimaryKeys}: createPrimaryKeys asdfladsfj
\item \code{createPrimaryKeys}: createPrimaryKeys Returns a string containing the OHDSQL for creation of primary keys in the OMOP CDM.
\item \code{createForeignKeys}: createForeignKeys asdfladsf
\item \code{createForeignKeys}: createForeignKeys Returns a string containing the OHDSQL for creation of foreign keys in the OMOP CDM.
}}
\examples{

View File

@ -0,0 +1,11 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/listSupportedVersions.R
\name{listSupportedDialects}
\alias{listSupportedDialects}
\title{List RDBMS dialects supported by this package}
\usage{
listSupportedDialects()
}
\description{
List RDBMS dialects supported by this package
}

View File

@ -6,6 +6,9 @@
\usage{
listSupportedVersions()
}
\value{
A character vector containing the support CDM versions in {major}.{minor} format.
}
\description{
List CDM versions supported by this package
}

View File

@ -1,61 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/writeDdl.R
\name{writeDdl}
\alias{writeDdl}
\alias{writePrimaryKeys}
\alias{writeForeignKeys}
\alias{writeIndex}
\title{Write DDL script}
\usage{
writeDdl(
targetDialect,
cdmVersion,
outputpath,
cdmDatabaseSchema = "@cdmDatabaseSchema"
)
writePrimaryKeys(
targetDialect,
cdmVersion,
outputpath,
cdmDatabaseSchema = "@cdmDatabaseSchema"
)
writeForeignKeys(
targetDialect,
cdmVersion,
outputpath,
cdmDatabaseSchema = "@cdmDatabaseSchema"
)
writeIndex(
targetDialect,
cdmVersion,
outputpath,
cdmDatabaseSchema = "@cdmDatabaseSchema"
)
}
\arguments{
\item{targetDialect}{The dialect of the target database. Choices are "oracle", "postgresql", "pdw", "redshift", "impala", "netezza", "bigquery", "sql server"}
\item{cdmVersion}{The version of the CDM you are creating, e.g. 5.3, 5.4}
\item{outputpath}{The directory or folder where the SQL file should be saved.}
\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.
Defaults to "@cdmDatabaseSchema"}
}
\description{
Write the DDL to a SQL file. The SQL will be rendered (parameters replaced) and translated to the target SQL
dialect. By default the @cdmDatabaseSchema parameter is kept in the SQL file and needs to be replaced before
execution.
}
\section{Functions}{
\itemize{
\item \code{writePrimaryKeys}: writePrimaryKeys Write the SQL code that creates the primary keys to a file.
\item \code{writeForeignKeys}: writeForeignKeys Write the SQL code that creates the foreign keys to a file.
\item \code{writeIndex}: writeIndex Write the rendered and translated sql that creates recommended indexes to a file.
}}

View File

@ -27,10 +27,10 @@ navbar:
menu:
- text: "CDM v3.0"
href: cdm30.html
- text: "CDM v5.3.1"
href: cdm531.html
- text: "CDM v5.3"
href: cdm53.html
- text: "CDM v5.4"
href: cdm531.html
href: cdm54.html
- text: "CDM v6.0"
href: cdm60.html
- text: "Proposals"

109
rmd/cdm53.Rmd Normal file
View File

@ -0,0 +1,109 @@
---
output:
# pdf_document:
# toc: yes
# toc_depth: '5'
html_document:
toc: yes
toc_depth: 5
toc_float: yes
---
```{r setup, include=FALSE, eval=TRUE}
#todo figure out how to get the document dynamically without specifying the name
library(rmarkdown)
library(knitr)
library(kableExtra)
library(magrittr)
library(dplyr)
library(stringr)
```
# **OMOP CDM v5.3**
Below is the specification document for the OMOP Common Data Model, v5.3 (previously v5.3.1). Each table is represented with a high-level description and ETL conventions that should be followed. This is continued with a discussion of each field in each table, any conventions related to the field, and constraints that should be followed (like primary key, foreign key, etc). Should you have questions please feel free to visit the [forums](https://forums.ohdsi.org/) or the [github issue](https://github.com/ohdsi/CommonDataModel/issues) page.
*__Special Note__ 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. Hot fixes and minor.minor release can be found through the searching of tags.*
--after regeneration of DDLs
link to csv of cdm
link to pdf of cdm documentation
link to forum on doc page
```{r docLoop53, echo=FALSE, results='asis'}
tableSpecs <- read.csv("../inst/csv/OMOP_CDMv5.3_Table_Level.csv", stringsAsFactors = FALSE)
cdmSpecs <- read.csv("../inst/csv/OMOP_CDMv5.3_Field_Level.csv", stringsAsFactors = FALSE)
tables <- tableSpecs$cdmTableName
cdmSpecsClean <- cdmSpecs %>%
dplyr::select(`CDM Table` = cdmTableName,
`CDM Field` = cdmFieldName,
`User Guide` = userGuidance,
`ETL Conventions` = etlConventions,
`Datatype` = cdmDatatype,
`Required` = isRequired,
`Primary Key` = isPrimaryKey,
`Foreign Key` = isForeignKey,
`FK Table` = fkTableName,
`FK Domain` = fkDomain
)
cdmSpecsClean[is.na(cdmSpecsClean)] <- ""
for(tb in tables) {
if(tb == 'PERSON'){
cat("## **Clinical Data Tables**\n\n")
}
if(tb == 'LOCATION'){
cat("## **Health System Data Tables**\n\n")
}
if(tb == 'PAYER_PLAN_PERIOD'){
cat("## **Health Economics Data Tables**\n\n")
}
if(tb == 'DRUG_ERA'){
cat("## **Standardized Derived Elements**\n\n")
}
if(tb == 'METADATA'){
cat("## **Metadata Tables**\n\n")
}
if(tb == 'CONCEPT'){
cat("## **Vocabulary Tables**\n\n")
}
cat("###", tb, "{.tabset .tabset-pills} \n\n")
tableInfo <- subset(tableSpecs, cdmTableName == tb)
cat("**Table Description**\n\n",tableInfo[,"tableDescription"], "\n\n")
if(!isTRUE(tableInfo[,"userGuidance"]=="")){
cat("**User Guide**\n\n",tableInfo[,"userGuidance"],"\n\n")
}
if(!isTRUE(tableInfo[,"etlConventions"]=="")){
cat("**ETL Conventions**\n\n",tableInfo[,"etlConventions"],"\n\n")
}
loopTable <- subset(cdmSpecsClean, `CDM Table` == tb)
loopTable <- subset(loopTable, select = -c(1))
print(kable(x = loopTable, align = "l", row.names = FALSE, format = "html", escape = FALSE) %>%
column_spec(1, bold = T) %>%
column_spec(2, width = "3in", include_thead = T) %>%
column_spec(3, width = "4in", include_thead = T) %>%
column_spec(4:9, width = "1in", include_thead = T) %>%
kable_styling(c("condensed","hover"), position = "center", full_width = T, font_size = 13))
}
```

View File

@ -21,9 +21,9 @@ library(stringr)
```
# **OMOP CDM v5.3.1**
# **OMOP CDM v5.4**
Below is the specification document for the OMOP Common Data Model, v5.3.1. Each table is represented with a high-level description and ETL conventions that should be followed. This is continued with a discussion of each field in each table, any conventions related to the field, and constraints that should be followed (like primary key, foreign key, etc). Should you have questions please feel free to visit the [forums](https://forums.ohdsi.org/) or the [github issue](https://github.com/ohdsi/CommonDataModel/issues) page.
Below is the specification document for the OMOP Common Data Model, v5.4. Each table is represented with a high-level description and ETL conventions that should be followed. This is continued with a discussion of each field in each table, any conventions related to the field, and constraints that should be followed (like primary key, foreign key, etc). Should you have questions please feel free to visit the [forums](https://forums.ohdsi.org/) or the [github issue](https://github.com/ohdsi/CommonDataModel/issues) page.
--after regeneration of DDLs
link to csv of cdm
@ -31,8 +31,8 @@ link to pdf of cdm documentation
link to forum on doc page
```{r docLoop53, echo=FALSE, results='asis'}
tableSpecs <- read.csv("../inst/csv/OMOP_CDMv5.3.1_Table_Level.csv", stringsAsFactors = FALSE)
cdmSpecs <- read.csv("../inst/csv/OMOP_CDMv5.3.1_Field_Level.csv", stringsAsFactors = FALSE)
tableSpecs <- read.csv("../inst/csv/OMOP_CDMv5.4_Table_Level.csv", stringsAsFactors = FALSE)
cdmSpecs <- read.csv("../inst/csv/OMOP_CDMv5.4_Field_Level.csv", stringsAsFactors = FALSE)
tables <- tableSpecs$cdmTableName

View File

@ -0,0 +1,48 @@
---
title: "Indices, Primary Keys and Foreign Key Constraints"
output:
html_document:
toc: true
toc_depth: 5
toc_float: true
---
## Overview
Database indices improve the performance of queries against a database by organizing the data in a way that increase query execution.
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 adminstrative (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.
## General Recommendations
Should your database of choice support indexing, the OMOP CDM Working Group recommends
* Indexing on all columns containing an "_id" (e.g. condition_occurrence_id, drug_exposure_id, measurement_id, procedure_occurrence_id, etc.)
* Indexing on primary and foreign keys
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)
## Database support
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.
### Microsoft SQL Server
### Oracle
### PostgreSQL
### Amazon Redshift
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).
### Impala
### IBM Netezza
### Google BigQuery
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.
[Reference](https://forums.ohdsi.org/t/iso-best-practices-of-cdm-indexing/10939/2)
### Microsoft Parallel Data Warehouse (PDW)
### SQLite
### Databricks
This database type is not yet supported but is actively being worked on by a number of collaborators. For more informtion, please contact Ajit Londhe of Amgen.
## References
[ISO Best Practices of CDM Indexing](https://forums.ohdsi.org/t/iso-best-practices-of-cdm-indexing/10939/2)

View File

@ -6,4 +6,3 @@ if(!dir.exists(driverPath)) dir.create(driverPath)
if(!Sys.getenv("LOCAL_TEST" == "TRUE")) {
DatabaseConnector::downloadJdbcDrivers("all", pathToDriver = driverPath)
}

View File

@ -4,6 +4,7 @@ library(DatabaseConnector)
.listTablesInSchema <- function(connectionDetails, schema) {
con <- DatabaseConnector::connect(connectionDetails)
tables <- DBI::dbListObjects(con, prefix = schema)
DatabaseConnector::disconnect(con)
tables <- subset(tables, is_prefix == FALSE)
tables <- subset(tables, grepl("table", table))$table
@ -15,6 +16,7 @@ library(DatabaseConnector)
tables <- .listTablesInSchema(connectionDetails, schema)
con <- DatabaseConnector::connect(connectionDetails)
for(table in tables) {
DBI::dbRemoveTable(con, name = DBI::SQL(paste(schema, table, sep = ".")))
}
@ -120,4 +122,5 @@ test_that("Execute DDL on Redshift", {
# clear schema
.dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema)
}
})