Added SqlRender functionality to the DDLGeneratr package and incorporated the pdf creation.
This commit is contained in:
parent
bf5ba12bcc
commit
f298b0c446
|
@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
|
||||||
BuildType: Package
|
BuildType: Package
|
||||||
PackageUseDevtools: Yes
|
PackageUseDevtools: Yes
|
||||||
PackageInstallArgs: --no-multiarch --with-keep.source
|
PackageInstallArgs: --no-multiarch --with-keep.source
|
||||||
|
PackageRoxygenize: rd,collate,namespace
|
||||||
|
|
|
@ -8,7 +8,10 @@ Description: This packages uses the SqlRender package to convert a DDL script wr
|
||||||
License: Apache License 2.0
|
License: Apache License 2.0
|
||||||
Encoding: UTF-8
|
Encoding: UTF-8
|
||||||
LazyData: true
|
LazyData: true
|
||||||
Imports: SqlRender
|
VignetteBuilder: knitr
|
||||||
|
Imports:
|
||||||
|
SqlRender,
|
||||||
|
rmarkdown
|
||||||
NeedsCompilation: no
|
NeedsCompilation: no
|
||||||
RoxygenNote: 6.0.1
|
RoxygenNote: 6.0.1
|
||||||
VignetteBuilder: knitr
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
exportPattern("^[[:alpha:]]+")
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Hello, world!
|
|
||||||
#
|
|
||||||
# This is an example function named 'hello'
|
|
||||||
# which prints 'Hello, world!'.
|
|
||||||
#
|
|
||||||
# You can learn more about package authoring with RStudio at:
|
|
||||||
#
|
|
||||||
# http://r-pkgs.had.co.nz/
|
|
||||||
#
|
|
||||||
# Some useful keyboard shortcuts for package authoring:
|
|
||||||
#
|
|
||||||
# Build and Reload Package: 'Ctrl + Shift + B'
|
|
||||||
# Check Package: 'Ctrl + Shift + E'
|
|
||||||
# Test Package: 'Ctrl + Shift + T'
|
|
||||||
|
|
||||||
hello <- function() {
|
|
||||||
print("Hello, world!")
|
|
||||||
}
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Copyright 2017 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
# This file is part of DDLGeneratr
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
#' Write DDL script
|
||||||
|
#'
|
||||||
|
#' @param targetdialect The dialect of the target database. Choices are "oracle", "postgresql", "pdw", "redshift", "impala", "netezza", "bigquery", "sql server"
|
||||||
|
#'
|
||||||
|
#' @export
|
||||||
|
writeDDL <- function(targetdialect) {
|
||||||
|
if(!dir.exists("output")){
|
||||||
|
dir.create("output")
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!dir.exists(paste0("output/",targetdialect))){
|
||||||
|
dir.create(paste0("output/",targetdialect))
|
||||||
|
}
|
||||||
|
|
||||||
|
sql <- SqlRender::loadRenderTranslateSql(sqlFilename = "OMOP CDM ddl.sql",
|
||||||
|
packageName = "DDLGeneratr",
|
||||||
|
dbms = targetdialect,
|
||||||
|
targetdialect = targetdialect)
|
||||||
|
|
||||||
|
SqlRender::writeSql(sql = sql,
|
||||||
|
targetFile = paste0("output/",targetdialect,"/OMOP CDM ",targetdialect," ddl.txt"))
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Copyright 2017 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
# This file is part of DDLGeneratr
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
#' Write PDF of CDM documentation
|
||||||
|
#'
|
||||||
|
#' @param mdFilesLocation The dialect of the target database. Choices are "oracle", "postgresql", "pdw", "redshift", "impala", "netezza", "bigquery", "sql server"
|
||||||
|
#'
|
||||||
|
#' @param cdmVersion The version of the OMOP Common Data Model for which the pdf document is being written. It should be written without a decimal so v5.3 becomes v5_3
|
||||||
|
#'
|
||||||
|
#' @export
|
||||||
|
writePDF <- function(mdFilesLocation, cdmVersion) {
|
||||||
|
|
||||||
|
sql <- SqlRender::loadRenderTranslateSql(sqlFilename = "OMOP_CDM_PDF.sql",
|
||||||
|
packageName = "DDLGeneratr",
|
||||||
|
dbms = "sql server",
|
||||||
|
mdFilesLocation = mdFilesLocation)
|
||||||
|
|
||||||
|
SqlRender::writeSql(sql = sql,
|
||||||
|
targetFile = "reports/OMOP_CDM_PDF_rendered.Rmd")
|
||||||
|
|
||||||
|
rmarkdown::render(input = "reports/OMOP_CDM_PDF_rendered.Rmd", output_format = "pdf_document", output_file = paste0("OMOP_CDM_",cdmVersion,".pdf"))
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
#This script is meant to create the OMOP Common Data Model DDLs for each dialect as well as the pdf of the documentation.
|
||||||
|
|
||||||
|
|
||||||
|
# Step 1: Update the file inst/sql/sql_server/OMOP CDM ddl.sql with the changes for the new version
|
||||||
|
|
||||||
|
# Step 2: Run the following code to create the DDLs for each dialect:
|
||||||
|
|
||||||
|
writeDDL("bigquery")
|
||||||
|
writeDDL("impala")
|
||||||
|
writeDDL("netezza")
|
||||||
|
writeDDL("oracle")
|
||||||
|
writeDDL("pdw")
|
||||||
|
writeDDL("postgresql")
|
||||||
|
writeDDL("redshift")
|
||||||
|
writeDDL("sql server")
|
||||||
|
|
||||||
|
# Step 3: Update the .md wiki files with the changes for the new version
|
||||||
|
|
||||||
|
# step 4: Run the following code to create the pdf documentation. It will be written to the reports folder.
|
||||||
|
|
||||||
|
writePDF(mdFilesLocation = "../../Documentation/CommonDataModel_Wiki_Files", cdmVersion = "v5_3")
|
|
@ -26,7 +26,7 @@
|
||||||
####### # # ####### # ##### ###### # # ## ##### ### #####
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
script to create OMOP common data model version 5.3
|
@targetdialect script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
last revised: 6-Nov-2017
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
@ -292,7 +292,6 @@ CREATE TABLE death
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE visit_occurrence
|
CREATE TABLE visit_occurrence
|
||||||
(
|
(
|
||||||
visit_occurrence_id INTEGER NOT NULL ,
|
visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
@ -316,7 +315,6 @@ CREATE TABLE visit_occurrence
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE visit_detail
|
CREATE TABLE visit_detail
|
||||||
(
|
(
|
||||||
visit_detail_id INTEGER NOT NULL ,
|
visit_detail_id INTEGER NOT NULL ,
|
||||||
|
@ -342,14 +340,13 @@ CREATE TABLE visit_detail
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE procedure_occurrence
|
CREATE TABLE procedure_occurrence
|
||||||
(
|
(
|
||||||
procedure_occurrence_id INTEGER NOT NULL ,
|
procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
person_id INTEGER NOT NULL ,
|
person_id INTEGER NOT NULL ,
|
||||||
procedure_concept_id INTEGER NOT NULL ,
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
procedure_date DATE NOT NULL ,
|
procedure_date DATE NOT NULL ,
|
||||||
procedure_datetime DATETIME2 NOT NULL ,
|
procedure_datetime DATETIME2 NULL ,
|
||||||
procedure_type_concept_id INTEGER NOT NULL ,
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
modifier_concept_id INTEGER NULL ,
|
modifier_concept_id INTEGER NULL ,
|
||||||
quantity INTEGER NULL ,
|
quantity INTEGER NULL ,
|
||||||
|
@ -363,7 +360,6 @@ CREATE TABLE procedure_occurrence
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE drug_exposure
|
CREATE TABLE drug_exposure
|
||||||
(
|
(
|
||||||
drug_exposure_id INTEGER NOT NULL ,
|
drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
@ -436,7 +432,6 @@ CREATE TABLE condition_occurrence
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE measurement
|
CREATE TABLE measurement
|
||||||
(
|
(
|
||||||
measurement_id INTEGER NOT NULL ,
|
measurement_id INTEGER NOT NULL ,
|
||||||
|
|
|
@ -0,0 +1,207 @@
|
||||||
|
---
|
||||||
|
title: "OMOP Common Data Model Specifications"
|
||||||
|
author: "Christian Reich, Patrick Ryan, Rimma Belenkaya, Karthik Natarajan and Clair Blacketer"
|
||||||
|
date: "`r Sys.Date()`"
|
||||||
|
output:
|
||||||
|
pdf_document:
|
||||||
|
number_sections: yes
|
||||||
|
toc: yes
|
||||||
|
linkcolor: blue
|
||||||
|
---
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
```{r child = '@mdFilesLocation/License.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Background
|
||||||
|
```{r child = '@mdFilesLocation/Background/Background.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## The Role of the Common Data Model
|
||||||
|
```{r child = '@mdFilesLocation/Background/The-Role-of-the-Common-Data-Model.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Design Principles
|
||||||
|
```{r child = '@mdFilesLocation/Background/Design-Principles.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Model Conventions
|
||||||
|
```{r child = '@mdFilesLocation/Background/Data-Model-Conventions.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Glossary of Terms
|
||||||
|
```{r child = '@mdFilesLocation/Glossary-of-Terms.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Vocabularies
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/Standardized-Vocabularies.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/CONCEPT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## VOCABULARY
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/VOCABULARY.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOMAIN
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/DOMAIN.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_CLASS
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/CONCEPT_CLASS.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_RELATIONSHIP
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/CONCEPT_RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## RELATIONSHIP
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_SYNONYM
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/CONCEPT_SYNONYM.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_ANCESTOR
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/CONCEPT_ANCESTOR.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SOURCE_TO_CONCEPT_MAP
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/SOURCE_TO_CONCEPT_MAP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_STRENGTH
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/DRUG_STRENGTH.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT_DEFINITION
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/COHORT_DEFINITION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## ATTRIBUTE_DEFINITION
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedVocabularies/ATTRIBUTE_DEFINITION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Metadata
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedMetadata/Standardized-Metadata.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CDM_SOURCE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedMetadata/CDM_SOURCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Clinical Data Tables
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/Standardized-clinical-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PERSON
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/PERSON.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OBSERVATION_PERIOD
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/OBSERVATION_PERIOD.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SPECIMEN
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/SPECIMEN.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DEATH
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/DEATH.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## VISIT_OCCURRENCE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/VISIT_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PROCEDURE_OCCURRENCE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/PROCEDURE_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_EXPOSURE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/DRUG_EXPOSURE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DEVICE_EXPOSURE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/DEVICE_EXPOSURE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONDITION_OCCURRENCE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/CONDITION_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## MEASUREMENT
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/MEASUREMENT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/NOTE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTE_NLP
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/NOTE_NLP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OBSERVATION
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/OBSERVATION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FACT_RELATIONSHIP
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedclinicalDataTables/FACT_RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Health System Data Tables
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthSystemDataTables/Standardized-Health-System-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## LOCATION
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthSystemDataTables/LOCATION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CARE_SITE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthSystemDataTables/CARE_SITE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PROVIDER
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthSystemDataTables/PROVIDER.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Health Economics Data Tables
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthEconomicsDataTables/Standardized-Health-Economics-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PAYER_PLAN_PERIOD
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthEconomicsDataTables/PAYER_PLAN_PERIOD.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COST
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedHealthEconomicsDataTables/COST.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Derived Elements
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedDerivedElements/Standardized-Derived-Elements.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedDerivedElements/COHORT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT_ATTRIBUTE
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedDerivedElements/COHORT_ATTRIBUTE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_ERA
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedDerivedElements/DRUG_ERA.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOSE_ERA
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedDerivedElements/DOSE_ERA.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONDITION_ERA
|
||||||
|
```{r child = '@mdFilesLocation/StandardizedDerivedElements/CONDITION_ERA.md'}
|
||||||
|
```
|
|
@ -0,0 +1,14 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/writeDDL.R
|
||||||
|
\name{writeDDL}
|
||||||
|
\alias{writeDDL}
|
||||||
|
\title{Write DDL script}
|
||||||
|
\usage{
|
||||||
|
writeDDL(targetdialect)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{targetdialect}{The dialect of the target database. Choices are "oracle", "postgresql", "pdw", "redshift", "impala", "netezza", "bigquery", "sql server"}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Write DDL script
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/writePDF.R
|
||||||
|
\name{writePDF}
|
||||||
|
\alias{writePDF}
|
||||||
|
\title{Write PDF of CDM documentation}
|
||||||
|
\usage{
|
||||||
|
writePDF(mdFilesLocation, cdmVersion)
|
||||||
|
}
|
||||||
|
\arguments{
|
||||||
|
\item{mdFilesLocation}{The dialect of the target database. Choices are "oracle", "postgresql", "pdw", "redshift", "impala", "netezza", "bigquery", "sql server"}
|
||||||
|
|
||||||
|
\item{cdmVersion}{The version of the OMOP Common Data Model for which the pdf document is being written. It should be written without a decimal so v5.3 becomes v5_3}
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
Write PDF of CDM documentation
|
||||||
|
}
|
|
@ -0,0 +1,735 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
bigquery script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
create table concept (
|
||||||
|
concept_id integer not null ,
|
||||||
|
concept_name varchar(255) not null ,
|
||||||
|
domain_id varchar(20) not null ,
|
||||||
|
vocabulary_id varchar(20) not null ,
|
||||||
|
concept_class_id varchar(20) not null ,
|
||||||
|
standard_concept varchar(1) null ,
|
||||||
|
concept_code varchar(50) not null ,
|
||||||
|
valid_start_date date not null ,
|
||||||
|
valid_end_date date not null ,
|
||||||
|
invalid_reason varchar(1) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table vocabulary (
|
||||||
|
vocabulary_id varchar(20) not null,
|
||||||
|
vocabulary_name varchar(255) not null,
|
||||||
|
vocabulary_reference varchar(255) not null,
|
||||||
|
vocabulary_version varchar(255) not null,
|
||||||
|
vocabulary_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table domain (
|
||||||
|
domain_id varchar(20) not null,
|
||||||
|
domain_name varchar(255) not null,
|
||||||
|
domain_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table concept_class (
|
||||||
|
concept_class_id varchar(20) not null,
|
||||||
|
concept_class_name varchar(255) not null,
|
||||||
|
concept_class_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table concept_relationship (
|
||||||
|
concept_id_1 integer not null,
|
||||||
|
concept_id_2 integer not null,
|
||||||
|
relationship_id varchar(20) not null,
|
||||||
|
valid_start_date date not null,
|
||||||
|
valid_end_date date not null,
|
||||||
|
invalid_reason varchar(1) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table relationship (
|
||||||
|
relationship_id varchar(20) not null,
|
||||||
|
relationship_name varchar(255) not null,
|
||||||
|
is_hierarchical varchar(1) not null,
|
||||||
|
defines_ancestry varchar(1) not null,
|
||||||
|
reverse_relationship_id varchar(20) not null,
|
||||||
|
relationship_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table concept_synonym (
|
||||||
|
concept_id integer not null,
|
||||||
|
concept_synonym_name varchar(1000) not null,
|
||||||
|
language_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table concept_ancestor (
|
||||||
|
ancestor_concept_id integer not null,
|
||||||
|
descendant_concept_id integer not null,
|
||||||
|
min_levels_of_separation integer not null,
|
||||||
|
max_levels_of_separation integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table source_to_concept_map (
|
||||||
|
source_code varchar(50) not null,
|
||||||
|
source_concept_id integer not null,
|
||||||
|
source_vocabulary_id varchar(20) not null,
|
||||||
|
source_code_description varchar(255) null,
|
||||||
|
target_concept_id integer not null,
|
||||||
|
target_vocabulary_id varchar(20) not null,
|
||||||
|
valid_start_date date not null,
|
||||||
|
valid_end_date date not null,
|
||||||
|
invalid_reason varchar(1) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table drug_strength (
|
||||||
|
drug_concept_id integer not null,
|
||||||
|
ingredient_concept_id integer not null,
|
||||||
|
amount_value float null,
|
||||||
|
amount_unit_concept_id integer null,
|
||||||
|
numerator_value float null,
|
||||||
|
numerator_unit_concept_id integer null,
|
||||||
|
denominator_value float null,
|
||||||
|
denominator_unit_concept_id integer null,
|
||||||
|
box_size integer null,
|
||||||
|
valid_start_date date not null,
|
||||||
|
valid_end_date date not null,
|
||||||
|
invalid_reason varchar(1) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table cohort_definition (
|
||||||
|
cohort_definition_id integer not null,
|
||||||
|
cohort_definition_name varchar(255) not null,
|
||||||
|
cohort_definition_description varchar(max) null,
|
||||||
|
definition_type_concept_id integer not null,
|
||||||
|
cohort_definition_syntax varchar(max) null,
|
||||||
|
subject_concept_id integer not null,
|
||||||
|
cohort_initiation_date date null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table attribute_definition (
|
||||||
|
attribute_definition_id integer not null,
|
||||||
|
attribute_name varchar(255) not null,
|
||||||
|
attribute_description varchar(max) null,
|
||||||
|
attribute_type_concept_id integer not null,
|
||||||
|
attribute_syntax varchar(max) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
create table cdm_source
|
||||||
|
(
|
||||||
|
cdm_source_name varchar(255) not null ,
|
||||||
|
cdm_source_abbreviation varchar(25) null ,
|
||||||
|
cdm_holder varchar(255) null ,
|
||||||
|
source_description varchar(max) null ,
|
||||||
|
source_documentation_reference varchar(255) null ,
|
||||||
|
cdm_etl_reference varchar(255) null ,
|
||||||
|
source_release_date date null ,
|
||||||
|
cdm_release_date date null ,
|
||||||
|
cdm_version varchar(10) null ,
|
||||||
|
vocabulary_version varchar(20) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table metadata
|
||||||
|
(
|
||||||
|
metadata_concept_id integer not null ,
|
||||||
|
metadata_type_concept_id integer not null ,
|
||||||
|
name varchar(250) not null ,
|
||||||
|
value_as_string nvarchar null ,
|
||||||
|
value_as_concept_id integer null ,
|
||||||
|
metadata_date date null ,
|
||||||
|
metadata_datetime datetime2 null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
create table person
|
||||||
|
(
|
||||||
|
person_id integer not null ,
|
||||||
|
gender_concept_id integer not null ,
|
||||||
|
year_of_birth integer not null ,
|
||||||
|
month_of_birth integer null,
|
||||||
|
day_of_birth integer null,
|
||||||
|
birth_datetime datetime2 null,
|
||||||
|
race_concept_id integer not null,
|
||||||
|
ethnicity_concept_id integer not null,
|
||||||
|
location_id integer null,
|
||||||
|
provider_id integer null,
|
||||||
|
care_site_id integer null,
|
||||||
|
person_source_value varchar(50) null,
|
||||||
|
gender_source_value varchar(50) null,
|
||||||
|
gender_source_concept_id integer null,
|
||||||
|
race_source_value varchar(50) null,
|
||||||
|
race_source_concept_id integer null,
|
||||||
|
ethnicity_source_value varchar(50) null,
|
||||||
|
ethnicity_source_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table observation_period
|
||||||
|
(
|
||||||
|
observation_period_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
observation_period_start_date date not null ,
|
||||||
|
observation_period_end_date date not null ,
|
||||||
|
period_type_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table specimen
|
||||||
|
(
|
||||||
|
specimen_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
specimen_concept_id integer not null ,
|
||||||
|
specimen_type_concept_id integer not null ,
|
||||||
|
specimen_date date not null ,
|
||||||
|
specimen_datetime datetime2 null ,
|
||||||
|
quantity float null ,
|
||||||
|
unit_concept_id integer null ,
|
||||||
|
anatomic_site_concept_id integer null ,
|
||||||
|
disease_status_concept_id integer null ,
|
||||||
|
specimen_source_id varchar(50) null ,
|
||||||
|
specimen_source_value varchar(50) null ,
|
||||||
|
unit_source_value varchar(50) null ,
|
||||||
|
anatomic_site_source_value varchar(50) null ,
|
||||||
|
disease_status_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table death
|
||||||
|
(
|
||||||
|
person_id integer not null ,
|
||||||
|
death_date date not null ,
|
||||||
|
death_datetime datetime2 null ,
|
||||||
|
death_type_concept_id integer not null ,
|
||||||
|
cause_concept_id integer null ,
|
||||||
|
cause_source_value varchar(50) null,
|
||||||
|
cause_source_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table visit_occurrence
|
||||||
|
(
|
||||||
|
visit_occurrence_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
visit_concept_id integer not null ,
|
||||||
|
visit_start_date date not null ,
|
||||||
|
visit_start_datetime datetime2 null ,
|
||||||
|
visit_end_date date not null ,
|
||||||
|
visit_end_datetime datetime2 null ,
|
||||||
|
visit_type_concept_id integer not null ,
|
||||||
|
provider_id integer null,
|
||||||
|
care_site_id integer null,
|
||||||
|
visit_source_value varchar(50) null,
|
||||||
|
visit_source_concept_id integer null
|
||||||
|
admitting_source_concept_id integer null ,
|
||||||
|
admitting_source_value varchar(50) null ,
|
||||||
|
discharge_to_concept_id integer(50) null ,
|
||||||
|
discharge_to_source_value varchar(50) null ,
|
||||||
|
preceding_visit_occurrence_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table visit_detail
|
||||||
|
(
|
||||||
|
visit_detail_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
visit_detail_concept_id integer not null ,
|
||||||
|
visit_start_date date not null ,
|
||||||
|
visit_start_datetime datetime2 null ,
|
||||||
|
visit_end_date date not null ,
|
||||||
|
visit_end_datetime datetime2 null ,
|
||||||
|
visit_type_concept_id integer not null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
care_site_id integer null ,
|
||||||
|
admitting_source_concept_id integer null ,
|
||||||
|
discharge_to_concept_id integer null ,
|
||||||
|
preceding_visit_detail_id integer null ,
|
||||||
|
visit_source_value varchar(50) null ,
|
||||||
|
visit_source_concept_id integer null ,
|
||||||
|
admitting_source_value varchar(50) null ,
|
||||||
|
discharge_to_source_value varchar(50) null ,
|
||||||
|
visit_detail_parent_id integer null ,
|
||||||
|
visit_occurrence_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table procedure_occurrence
|
||||||
|
(
|
||||||
|
procedure_occurrence_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
procedure_concept_id integer not null ,
|
||||||
|
procedure_date date not null ,
|
||||||
|
procedure_datetime datetime2 null ,
|
||||||
|
procedure_type_concept_id integer not null ,
|
||||||
|
modifier_concept_id integer null ,
|
||||||
|
quantity integer null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
procedure_source_value varchar(50) null ,
|
||||||
|
procedure_source_concept_id integer null ,
|
||||||
|
modifier_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table drug_exposure
|
||||||
|
(
|
||||||
|
drug_exposure_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
drug_concept_id integer not null ,
|
||||||
|
drug_exposure_start_date date not null ,
|
||||||
|
drug_exposure_start_datetime datetime2 null ,
|
||||||
|
drug_exposure_end_date date not null ,
|
||||||
|
drug_exposure_end_datetime datetime2 null ,
|
||||||
|
verbatim_end_date date null ,
|
||||||
|
drug_type_concept_id integer not null ,
|
||||||
|
stop_reason varchar(20) null ,
|
||||||
|
refills integer null ,
|
||||||
|
quantity float null ,
|
||||||
|
days_supply integer null ,
|
||||||
|
sig varchar(max) null ,
|
||||||
|
route_concept_id integer null ,
|
||||||
|
lot_number varchar(50) null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
drug_source_value varchar(50) null ,
|
||||||
|
drug_source_concept_id integer null ,
|
||||||
|
route_source_value varchar(50) null ,
|
||||||
|
dose_unit_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table device_exposure
|
||||||
|
(
|
||||||
|
device_exposure_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
device_concept_id integer not null ,
|
||||||
|
device_exposure_start_date date not null ,
|
||||||
|
device_exposure_start_datetime datetime2 null ,
|
||||||
|
device_exposure_end_date date null ,
|
||||||
|
device_exposure_end_datetime datetime2 null ,
|
||||||
|
device_type_concept_id integer not null ,
|
||||||
|
unique_device_id varchar(50) null ,
|
||||||
|
quantity integer null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
device_source_value varchar(100) null ,
|
||||||
|
device_source_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table condition_occurrence
|
||||||
|
(
|
||||||
|
condition_occurrence_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
condition_concept_id integer not null ,
|
||||||
|
condition_start_date date not null ,
|
||||||
|
condition_start_datetime datetime2 null ,
|
||||||
|
condition_end_date date null ,
|
||||||
|
condition_end_datetime datetime2 null ,
|
||||||
|
condition_type_concept_id integer not null ,
|
||||||
|
stop_reason varchar(20) null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
condition_source_value varchar(50) null ,
|
||||||
|
condition_source_concept_id integer null ,
|
||||||
|
condition_status_source_value varchar(50) null ,
|
||||||
|
condition_status_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table measurement
|
||||||
|
(
|
||||||
|
measurement_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
measurement_concept_id integer not null ,
|
||||||
|
measurement_date date not null ,
|
||||||
|
measurement_time varchar(10) null ,
|
||||||
|
measurement_datetime datetime2 null ,
|
||||||
|
measurement_type_concept_id integer not null ,
|
||||||
|
operator_concept_id integer null ,
|
||||||
|
value_as_number float null ,
|
||||||
|
value_as_concept_id integer null ,
|
||||||
|
unit_concept_id integer null ,
|
||||||
|
range_low float null ,
|
||||||
|
range_high float null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
measurement_source_value varchar(50) null ,
|
||||||
|
measurement_source_concept_id integer null ,
|
||||||
|
unit_source_value varchar(50) null ,
|
||||||
|
value_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table note
|
||||||
|
(
|
||||||
|
note_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
note_date date not null ,
|
||||||
|
note_datetime datetime2 null ,
|
||||||
|
note_type_concept_id integer not null ,
|
||||||
|
note_class_concept_id integer not null ,
|
||||||
|
note_title varchar(250) null ,
|
||||||
|
note_text varchar(max) null ,
|
||||||
|
encoding_concept_id integer not null ,
|
||||||
|
language_concept_id integer not null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
note_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table note_nlp
|
||||||
|
(
|
||||||
|
note_nlp_id bigint not null ,
|
||||||
|
note_id integer not null ,
|
||||||
|
section_concept_id integer null ,
|
||||||
|
snippet varchar(250) null ,
|
||||||
|
offset varchar(250) null ,
|
||||||
|
lexical_variant varchar(250) not null ,
|
||||||
|
note_nlp_concept_id integer null ,
|
||||||
|
note_nlp_source_concept_id integer null ,
|
||||||
|
nlp_system varchar(250) null ,
|
||||||
|
nlp_date date not null ,
|
||||||
|
nlp_datetime datetime2 null ,
|
||||||
|
term_exists varchar(1) null ,
|
||||||
|
term_temporal varchar(50) null ,
|
||||||
|
term_modifiers varchar(2000) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table observation
|
||||||
|
(
|
||||||
|
observation_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
observation_concept_id integer not null ,
|
||||||
|
observation_date date not null ,
|
||||||
|
observation_datetime datetime2 null ,
|
||||||
|
observation_type_concept_id integer not null ,
|
||||||
|
value_as_number float null ,
|
||||||
|
value_as_string varchar(60) null ,
|
||||||
|
value_as_concept_id integer null ,
|
||||||
|
qualifier_concept_id integer null ,
|
||||||
|
unit_concept_id integer null ,
|
||||||
|
provider_id integer null ,
|
||||||
|
visit_occurrence_id integer null ,
|
||||||
|
visit_detail_id integer null ,
|
||||||
|
observation_source_value varchar(50) null ,
|
||||||
|
observation_source_concept_id integer null ,
|
||||||
|
unit_source_value varchar(50) null ,
|
||||||
|
qualifier_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table fact_relationship
|
||||||
|
(
|
||||||
|
domain_concept_id_1 integer not null ,
|
||||||
|
fact_id_1 integer not null ,
|
||||||
|
domain_concept_id_2 integer not null ,
|
||||||
|
fact_id_2 integer not null ,
|
||||||
|
relationship_concept_id integer not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table location
|
||||||
|
(
|
||||||
|
location_id integer not null ,
|
||||||
|
address_1 varchar(50) null ,
|
||||||
|
address_2 varchar(50) null ,
|
||||||
|
city varchar(50) null ,
|
||||||
|
state varchar(2) null ,
|
||||||
|
zip varchar(9) null ,
|
||||||
|
county varchar(20) null ,
|
||||||
|
location_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table care_site
|
||||||
|
(
|
||||||
|
care_site_id integer not null ,
|
||||||
|
care_site_name varchar(255) null ,
|
||||||
|
place_of_service_concept_id integer null ,
|
||||||
|
location_id integer null ,
|
||||||
|
care_site_source_value varchar(50) null ,
|
||||||
|
place_of_service_source_value varchar(50) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table provider
|
||||||
|
(
|
||||||
|
provider_id integer not null ,
|
||||||
|
provider_name varchar(255) null ,
|
||||||
|
npi varchar(20) null ,
|
||||||
|
dea varchar(20) null ,
|
||||||
|
specialty_concept_id integer null ,
|
||||||
|
care_site_id integer null ,
|
||||||
|
year_of_birth integer null ,
|
||||||
|
gender_concept_id integer null ,
|
||||||
|
provider_source_value varchar(50) null ,
|
||||||
|
specialty_source_value varchar(50) null ,
|
||||||
|
specialty_source_concept_id integer null ,
|
||||||
|
gender_source_value varchar(50) null ,
|
||||||
|
gender_source_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
create table payer_plan_period
|
||||||
|
(
|
||||||
|
payer_plan_period_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
payer_plan_period_start_date date not null ,
|
||||||
|
payer_plan_period_end_date date not null ,
|
||||||
|
payer_concept_id integer null ,
|
||||||
|
payer_source_value varchar(50) null ,
|
||||||
|
payer_source_concept_id integer null ,
|
||||||
|
plan_concept_id integer null ,
|
||||||
|
plan_source_value varchar(50) null ,
|
||||||
|
plan_source_concept_id integer null ,
|
||||||
|
sponsor_concept_id integer null ,
|
||||||
|
sponsor_source_value varchar(50) null ,
|
||||||
|
sponsor_source_concept_id integer null ,
|
||||||
|
family_source_value varchar(50) null ,
|
||||||
|
stop_reason_concept_id integer null ,
|
||||||
|
stop_reason_source_value integer null ,
|
||||||
|
stop_reason_source_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table cost
|
||||||
|
(
|
||||||
|
cost_id integer not null ,
|
||||||
|
cost_event_id integer not null ,
|
||||||
|
cost_domain_id varchar(20) not null ,
|
||||||
|
cost_type_concept_id integer not null ,
|
||||||
|
currency_concept_id integer null ,
|
||||||
|
total_charge float null ,
|
||||||
|
total_cost float null ,
|
||||||
|
total_paid float null ,
|
||||||
|
paid_by_payer float null ,
|
||||||
|
paid_by_patient float null ,
|
||||||
|
paid_patient_copay float null ,
|
||||||
|
paid_patient_coinsurance float null ,
|
||||||
|
paid_patient_deductible float null ,
|
||||||
|
paid_by_primary float null ,
|
||||||
|
paid_ingredient_cost float null ,
|
||||||
|
paid_dispensing_fee float null ,
|
||||||
|
payer_plan_period_id integer null ,
|
||||||
|
amount_allowed float null ,
|
||||||
|
revenue_code_concept_id integer null ,
|
||||||
|
reveue_code_source_value varchar(50) null,
|
||||||
|
drg_concept_id integer null,
|
||||||
|
drg_source_value varchar(3) null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
create table cohort
|
||||||
|
(
|
||||||
|
cohort_definition_id integer not null ,
|
||||||
|
subject_id integer not null ,
|
||||||
|
cohort_start_date date not null ,
|
||||||
|
cohort_end_date date not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table cohort_attribute
|
||||||
|
(
|
||||||
|
cohort_definition_id integer not null ,
|
||||||
|
cohort_start_date date not null ,
|
||||||
|
cohort_end_date date not null ,
|
||||||
|
subject_id integer not null ,
|
||||||
|
attribute_definition_id integer not null ,
|
||||||
|
value_as_number float null ,
|
||||||
|
value_as_concept_id integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table drug_era
|
||||||
|
(
|
||||||
|
drug_era_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
drug_concept_id integer not null ,
|
||||||
|
drug_era_start_date date not null ,
|
||||||
|
drug_era_end_date date not null ,
|
||||||
|
drug_exposure_count integer null ,
|
||||||
|
gap_days integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
create table dose_era
|
||||||
|
(
|
||||||
|
dose_era_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
drug_concept_id integer not null ,
|
||||||
|
unit_concept_id integer not null ,
|
||||||
|
dose_value float not null ,
|
||||||
|
dose_era_start_date date not null ,
|
||||||
|
dose_era_end_date date not null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
create table condition_era
|
||||||
|
(
|
||||||
|
condition_era_id integer not null ,
|
||||||
|
person_id integer not null ,
|
||||||
|
condition_concept_id integer not null ,
|
||||||
|
condition_era_start_date date not null ,
|
||||||
|
condition_era_end_date date not null ,
|
||||||
|
condition_occurrence_count integer null
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,735 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
impala script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept (
|
||||||
|
concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) ,
|
||||||
|
domain_id VARCHAR(20) ,
|
||||||
|
vocabulary_id VARCHAR(20) ,
|
||||||
|
concept_class_id VARCHAR(20) ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE vocabulary (
|
||||||
|
vocabulary_id VARCHAR(20),
|
||||||
|
vocabulary_name VARCHAR(255),
|
||||||
|
vocabulary_reference VARCHAR(255),
|
||||||
|
vocabulary_version VARCHAR(255),
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE domain (
|
||||||
|
domain_id VARCHAR(20),
|
||||||
|
domain_name VARCHAR(255),
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_class (
|
||||||
|
concept_class_id VARCHAR(20),
|
||||||
|
concept_class_name VARCHAR(255),
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_relationship (
|
||||||
|
concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20),
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE relationship (
|
||||||
|
relationship_id VARCHAR(20),
|
||||||
|
relationship_name VARCHAR(255),
|
||||||
|
is_hierarchical VARCHAR(1),
|
||||||
|
defines_ancestry VARCHAR(1),
|
||||||
|
reverse_relationship_id VARCHAR(20),
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_synonym (
|
||||||
|
concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000),
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_ancestor (
|
||||||
|
ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE source_to_concept_map (
|
||||||
|
source_code VARCHAR(50),
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20),
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20),
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_strength (
|
||||||
|
drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value FLOAT NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value FLOAT NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value FLOAT NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_definition (
|
||||||
|
cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255),
|
||||||
|
cohort_definition_description VARCHAR(MAX) NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax VARCHAR(MAX) NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE attribute_definition (
|
||||||
|
attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255),
|
||||||
|
attribute_description VARCHAR(MAX) NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax VARCHAR(MAX) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cdm_source
|
||||||
|
(
|
||||||
|
cdm_source_name VARCHAR(255) ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description VARCHAR(MAX) NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE metadata
|
||||||
|
(
|
||||||
|
metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime DATETIME2 NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE person
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime DATETIME2 NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation_period
|
||||||
|
(
|
||||||
|
observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE specimen
|
||||||
|
(
|
||||||
|
specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime DATETIME2 NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE death
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime DATETIME2 NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_occurrence
|
||||||
|
(
|
||||||
|
visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_detail
|
||||||
|
(
|
||||||
|
visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE procedure_occurrence
|
||||||
|
(
|
||||||
|
procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime DATETIME2 NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_exposure
|
||||||
|
(
|
||||||
|
drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig VARCHAR(MAX) NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE device_exposure
|
||||||
|
(
|
||||||
|
device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_occurrence
|
||||||
|
(
|
||||||
|
condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime DATETIME2 NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime DATETIME2 NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE measurement
|
||||||
|
(
|
||||||
|
measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime DATETIME2 NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low FLOAT NULL ,
|
||||||
|
range_high FLOAT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note
|
||||||
|
(
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime DATETIME2 NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text VARCHAR(MAX) NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note_nlp
|
||||||
|
(
|
||||||
|
note_nlp_id BIGINT ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime DATETIME2 NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation
|
||||||
|
(
|
||||||
|
observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime DATETIME2 NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE fact_relationship
|
||||||
|
(
|
||||||
|
domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE location
|
||||||
|
(
|
||||||
|
location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE care_site
|
||||||
|
(
|
||||||
|
care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE provider
|
||||||
|
(
|
||||||
|
provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE payer_plan_period
|
||||||
|
(
|
||||||
|
payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cost
|
||||||
|
(
|
||||||
|
cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge FLOAT NULL ,
|
||||||
|
total_cost FLOAT NULL ,
|
||||||
|
total_paid FLOAT NULL ,
|
||||||
|
paid_by_payer FLOAT NULL ,
|
||||||
|
paid_by_patient FLOAT NULL ,
|
||||||
|
paid_patient_copay FLOAT NULL ,
|
||||||
|
paid_patient_coinsurance FLOAT NULL ,
|
||||||
|
paid_patient_deductible FLOAT NULL ,
|
||||||
|
paid_by_primary FLOAT NULL ,
|
||||||
|
paid_ingredient_cost FLOAT NULL ,
|
||||||
|
paid_dispensing_fee FLOAT NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed FLOAT NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
CREATE TABLE cohort
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_attribute
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_era
|
||||||
|
(
|
||||||
|
drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE dose_era
|
||||||
|
(
|
||||||
|
dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value FLOAT ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_era
|
||||||
|
(
|
||||||
|
condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,735 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
netezza script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept (
|
||||||
|
concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) NOT NULL ,
|
||||||
|
domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL ,
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) NOT NULL ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE vocabulary (
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
vocabulary_name VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_reference VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_version VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE domain (
|
||||||
|
domain_id VARCHAR(20) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) NOT NULL,
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_class (
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL,
|
||||||
|
concept_class_name VARCHAR(255) NOT NULL,
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_relationship (
|
||||||
|
concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE relationship (
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_name VARCHAR(255) NOT NULL,
|
||||||
|
is_hierarchical VARCHAR(1) NOT NULL,
|
||||||
|
defines_ancestry VARCHAR(1) NOT NULL,
|
||||||
|
reverse_relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_synonym (
|
||||||
|
concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000) NOT NULL,
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_ancestor (
|
||||||
|
ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE source_to_concept_map (
|
||||||
|
source_code VARCHAR(50) NOT NULL,
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_strength (
|
||||||
|
drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value NUMERIC NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value NUMERIC NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value NUMERIC NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_definition (
|
||||||
|
cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||||
|
cohort_definition_description VARCHAR(1000) NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax VARCHAR(1000) NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE attribute_definition (
|
||||||
|
attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255) NOT NULL,
|
||||||
|
attribute_description VARCHAR(1000) NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax VARCHAR(1000) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cdm_source
|
||||||
|
(
|
||||||
|
cdm_source_name VARCHAR(255) NOT NULL ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description VARCHAR(1000) NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE metadata
|
||||||
|
(
|
||||||
|
metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) NOT NULL ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime DATETIME2 NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE person
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime DATETIME2 NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation_period
|
||||||
|
(
|
||||||
|
observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE specimen
|
||||||
|
(
|
||||||
|
specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime DATETIME2 NULL ,
|
||||||
|
quantity NUMERIC NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE death
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime DATETIME2 NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_occurrence
|
||||||
|
(
|
||||||
|
visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_detail
|
||||||
|
(
|
||||||
|
visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE procedure_occurrence
|
||||||
|
(
|
||||||
|
procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime DATETIME2 NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_exposure
|
||||||
|
(
|
||||||
|
drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity NUMERIC NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig VARCHAR(1000) NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE device_exposure
|
||||||
|
(
|
||||||
|
device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_occurrence
|
||||||
|
(
|
||||||
|
condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime DATETIME2 NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime DATETIME2 NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE measurement
|
||||||
|
(
|
||||||
|
measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime DATETIME2 NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number NUMERIC NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low NUMERIC NULL ,
|
||||||
|
range_high NUMERIC NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note
|
||||||
|
(
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime DATETIME2 NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text VARCHAR(1000) NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note_nlp
|
||||||
|
(
|
||||||
|
note_nlp_id BIGINT NOT NULL ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) NOT NULL ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime DATETIME2 NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation
|
||||||
|
(
|
||||||
|
observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime DATETIME2 NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number NUMERIC NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE fact_relationship
|
||||||
|
(
|
||||||
|
domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE location
|
||||||
|
(
|
||||||
|
location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE care_site
|
||||||
|
(
|
||||||
|
care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE provider
|
||||||
|
(
|
||||||
|
provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE payer_plan_period
|
||||||
|
(
|
||||||
|
payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cost
|
||||||
|
(
|
||||||
|
cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge NUMERIC NULL ,
|
||||||
|
total_cost NUMERIC NULL ,
|
||||||
|
total_paid NUMERIC NULL ,
|
||||||
|
paid_by_payer NUMERIC NULL ,
|
||||||
|
paid_by_patient NUMERIC NULL ,
|
||||||
|
paid_patient_copay NUMERIC NULL ,
|
||||||
|
paid_patient_coinsurance NUMERIC NULL ,
|
||||||
|
paid_patient_deductible NUMERIC NULL ,
|
||||||
|
paid_by_primary NUMERIC NULL ,
|
||||||
|
paid_ingredient_cost NUMERIC NULL ,
|
||||||
|
paid_dispensing_fee NUMERIC NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed NUMERIC NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
CREATE TABLE cohort
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_attribute
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number NUMERIC NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_era
|
||||||
|
(
|
||||||
|
drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE dose_era
|
||||||
|
(
|
||||||
|
dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value NUMERIC NOT NULL ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_era
|
||||||
|
(
|
||||||
|
condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,735 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
oracle script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept (
|
||||||
|
concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) NOT NULL ,
|
||||||
|
domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL ,
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) NOT NULL ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE vocabulary (
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
vocabulary_name VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_reference VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_version VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE domain (
|
||||||
|
domain_id VARCHAR(20) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) NOT NULL,
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_class (
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL,
|
||||||
|
concept_class_name VARCHAR(255) NOT NULL,
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_relationship (
|
||||||
|
concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE relationship (
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_name VARCHAR(255) NOT NULL,
|
||||||
|
is_hierarchical VARCHAR(1) NOT NULL,
|
||||||
|
defines_ancestry VARCHAR(1) NOT NULL,
|
||||||
|
reverse_relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_synonym (
|
||||||
|
concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000) NOT NULL,
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_ancestor (
|
||||||
|
ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE source_to_concept_map (
|
||||||
|
source_code VARCHAR(50) NOT NULL,
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_strength (
|
||||||
|
drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value FLOAT NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value FLOAT NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value FLOAT NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_definition (
|
||||||
|
cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||||
|
cohort_definition_description CLOB NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax CLOB NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE attribute_definition (
|
||||||
|
attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255) NOT NULL,
|
||||||
|
attribute_description CLOB NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax CLOB NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cdm_source
|
||||||
|
(
|
||||||
|
cdm_source_name VARCHAR(255) NOT NULL ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description CLOB NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE metadata
|
||||||
|
(
|
||||||
|
metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) NOT NULL ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime DATETIME2 NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE person
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime DATETIME2 NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation_period
|
||||||
|
(
|
||||||
|
observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE specimen
|
||||||
|
(
|
||||||
|
specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime DATETIME2 NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE death
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime DATETIME2 NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_occurrence
|
||||||
|
(
|
||||||
|
visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_detail
|
||||||
|
(
|
||||||
|
visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE procedure_occurrence
|
||||||
|
(
|
||||||
|
procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime DATETIME2 NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_exposure
|
||||||
|
(
|
||||||
|
drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig CLOB NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE device_exposure
|
||||||
|
(
|
||||||
|
device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_occurrence
|
||||||
|
(
|
||||||
|
condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime DATETIME2 NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime DATETIME2 NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE measurement
|
||||||
|
(
|
||||||
|
measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime DATETIME2 NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low FLOAT NULL ,
|
||||||
|
range_high FLOAT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note
|
||||||
|
(
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime DATETIME2 NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text CLOB NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note_nlp
|
||||||
|
(
|
||||||
|
note_nlp_id NUMBER(19) NOT NULL ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) NOT NULL ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime DATETIME2 NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation
|
||||||
|
(
|
||||||
|
observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime DATETIME2 NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE fact_relationship
|
||||||
|
(
|
||||||
|
domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE location
|
||||||
|
(
|
||||||
|
location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE care_site
|
||||||
|
(
|
||||||
|
care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE provider
|
||||||
|
(
|
||||||
|
provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE payer_plan_period
|
||||||
|
(
|
||||||
|
payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cost
|
||||||
|
(
|
||||||
|
cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge FLOAT NULL ,
|
||||||
|
total_cost FLOAT NULL ,
|
||||||
|
total_paid FLOAT NULL ,
|
||||||
|
paid_by_payer FLOAT NULL ,
|
||||||
|
paid_by_patient FLOAT NULL ,
|
||||||
|
paid_patient_copay FLOAT NULL ,
|
||||||
|
paid_patient_coinsurance FLOAT NULL ,
|
||||||
|
paid_patient_deductible FLOAT NULL ,
|
||||||
|
paid_by_primary FLOAT NULL ,
|
||||||
|
paid_ingredient_cost FLOAT NULL ,
|
||||||
|
paid_dispensing_fee FLOAT NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed FLOAT NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
CREATE TABLE cohort
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_attribute
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_era
|
||||||
|
(
|
||||||
|
drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE dose_era
|
||||||
|
(
|
||||||
|
dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value FLOAT NOT NULL ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_era
|
||||||
|
(
|
||||||
|
condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,696 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
pdw script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE concept (concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) NOT NULL ,
|
||||||
|
domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL ,
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) NOT NULL ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE vocabulary (vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
vocabulary_name VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_reference VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_version VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE domain (domain_id VARCHAR(20) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) NOT NULL,
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE concept_class (concept_class_id VARCHAR(20) NOT NULL,
|
||||||
|
concept_class_name VARCHAR(255) NOT NULL,
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE concept_relationship (concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE relationship (relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_name VARCHAR(255) NOT NULL,
|
||||||
|
is_hierarchical VARCHAR(1) NOT NULL,
|
||||||
|
defines_ancestry VARCHAR(1) NOT NULL,
|
||||||
|
reverse_relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE concept_synonym (concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000) NOT NULL,
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE concept_ancestor (ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE source_to_concept_map (source_code VARCHAR(50) NOT NULL,
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_strength (drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value FLOAT NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value FLOAT NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value FLOAT NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort_definition (cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||||
|
cohort_definition_description VARCHAR(1000) NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax VARCHAR(1000) NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE attribute_definition (attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255) NOT NULL,
|
||||||
|
attribute_description VARCHAR(1000) NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax VARCHAR(1000) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cdm_source
|
||||||
|
(cdm_source_name VARCHAR(255) NOT NULL ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description VARCHAR(1000) NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE metadata
|
||||||
|
(metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) NOT NULL ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime DATETIME2 NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE person
|
||||||
|
( person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime DATETIME2 NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation_period
|
||||||
|
(observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE specimen
|
||||||
|
(specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime DATETIME2 NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE death
|
||||||
|
( person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime DATETIME2 NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_occurrence
|
||||||
|
(visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_detail
|
||||||
|
(visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE procedure_occurrence
|
||||||
|
(procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime DATETIME2 NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_exposure
|
||||||
|
(drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig VARCHAR(1000) NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE device_exposure
|
||||||
|
(device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_occurrence
|
||||||
|
(condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime DATETIME2 NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime DATETIME2 NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE measurement
|
||||||
|
(measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime DATETIME2 NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low FLOAT NULL ,
|
||||||
|
range_high FLOAT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE note
|
||||||
|
(note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime DATETIME2 NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text VARCHAR(1000) NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE note_nlp
|
||||||
|
(note_nlp_id BIGINT NOT NULL ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) NOT NULL ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime DATETIME2 NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation
|
||||||
|
(observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime DATETIME2 NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE fact_relationship
|
||||||
|
(domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE location
|
||||||
|
(location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE care_site
|
||||||
|
(care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE provider
|
||||||
|
(provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE payer_plan_period
|
||||||
|
(payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cost
|
||||||
|
(cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge FLOAT NULL ,
|
||||||
|
total_cost FLOAT NULL ,
|
||||||
|
total_paid FLOAT NULL ,
|
||||||
|
paid_by_payer FLOAT NULL ,
|
||||||
|
paid_by_patient FLOAT NULL ,
|
||||||
|
paid_patient_copay FLOAT NULL ,
|
||||||
|
paid_patient_coinsurance FLOAT NULL ,
|
||||||
|
paid_patient_deductible FLOAT NULL ,
|
||||||
|
paid_by_primary FLOAT NULL ,
|
||||||
|
paid_ingredient_cost FLOAT NULL ,
|
||||||
|
paid_dispensing_fee FLOAT NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed FLOAT NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = REPLICATE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort
|
||||||
|
(cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(subject_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort_attribute
|
||||||
|
(cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(subject_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_era
|
||||||
|
(drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE dose_era
|
||||||
|
(dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value FLOAT NOT NULL ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_era
|
||||||
|
(condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
WITH (DISTRIBUTION = HASH(person_id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,735 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
postgresql script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept (
|
||||||
|
concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) NOT NULL ,
|
||||||
|
domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL ,
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) NOT NULL ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE vocabulary (
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
vocabulary_name VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_reference VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_version VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE domain (
|
||||||
|
domain_id VARCHAR(20) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) NOT NULL,
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_class (
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL,
|
||||||
|
concept_class_name VARCHAR(255) NOT NULL,
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_relationship (
|
||||||
|
concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE relationship (
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_name VARCHAR(255) NOT NULL,
|
||||||
|
is_hierarchical VARCHAR(1) NOT NULL,
|
||||||
|
defines_ancestry VARCHAR(1) NOT NULL,
|
||||||
|
reverse_relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_synonym (
|
||||||
|
concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000) NOT NULL,
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_ancestor (
|
||||||
|
ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE source_to_concept_map (
|
||||||
|
source_code VARCHAR(50) NOT NULL,
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_strength (
|
||||||
|
drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value NUMERIC NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value NUMERIC NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value NUMERIC NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_definition (
|
||||||
|
cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||||
|
cohort_definition_description TEXT NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax TEXT NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE attribute_definition (
|
||||||
|
attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255) NOT NULL,
|
||||||
|
attribute_description TEXT NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax TEXT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cdm_source
|
||||||
|
(
|
||||||
|
cdm_source_name VARCHAR(255) NOT NULL ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description TEXT NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE metadata
|
||||||
|
(
|
||||||
|
metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) NOT NULL ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime DATETIME2 NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE person
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime DATETIME2 NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation_period
|
||||||
|
(
|
||||||
|
observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE specimen
|
||||||
|
(
|
||||||
|
specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime DATETIME2 NULL ,
|
||||||
|
quantity NUMERIC NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE death
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime DATETIME2 NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_occurrence
|
||||||
|
(
|
||||||
|
visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_detail
|
||||||
|
(
|
||||||
|
visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE procedure_occurrence
|
||||||
|
(
|
||||||
|
procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime DATETIME2 NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_exposure
|
||||||
|
(
|
||||||
|
drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity NUMERIC NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig TEXT NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE device_exposure
|
||||||
|
(
|
||||||
|
device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_occurrence
|
||||||
|
(
|
||||||
|
condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime DATETIME2 NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime DATETIME2 NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE measurement
|
||||||
|
(
|
||||||
|
measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime DATETIME2 NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number NUMERIC NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low NUMERIC NULL ,
|
||||||
|
range_high NUMERIC NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note
|
||||||
|
(
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime DATETIME2 NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text TEXT NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note_nlp
|
||||||
|
(
|
||||||
|
note_nlp_id BIGINT NOT NULL ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) NOT NULL ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime DATETIME2 NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation
|
||||||
|
(
|
||||||
|
observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime DATETIME2 NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number NUMERIC NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE fact_relationship
|
||||||
|
(
|
||||||
|
domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE location
|
||||||
|
(
|
||||||
|
location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE care_site
|
||||||
|
(
|
||||||
|
care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE provider
|
||||||
|
(
|
||||||
|
provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE payer_plan_period
|
||||||
|
(
|
||||||
|
payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cost
|
||||||
|
(
|
||||||
|
cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge NUMERIC NULL ,
|
||||||
|
total_cost NUMERIC NULL ,
|
||||||
|
total_paid NUMERIC NULL ,
|
||||||
|
paid_by_payer NUMERIC NULL ,
|
||||||
|
paid_by_patient NUMERIC NULL ,
|
||||||
|
paid_patient_copay NUMERIC NULL ,
|
||||||
|
paid_patient_coinsurance NUMERIC NULL ,
|
||||||
|
paid_patient_deductible NUMERIC NULL ,
|
||||||
|
paid_by_primary NUMERIC NULL ,
|
||||||
|
paid_ingredient_cost NUMERIC NULL ,
|
||||||
|
paid_dispensing_fee NUMERIC NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed NUMERIC NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
CREATE TABLE cohort
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_attribute
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number NUMERIC NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_era
|
||||||
|
(
|
||||||
|
drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE dose_era
|
||||||
|
(
|
||||||
|
dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value NUMERIC NOT NULL ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_era
|
||||||
|
(
|
||||||
|
condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,696 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
redshift script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept (concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) NOT NULL ,
|
||||||
|
domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL ,
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) NOT NULL ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE vocabulary (vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
vocabulary_name VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_reference VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_version VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE domain (domain_id VARCHAR(20) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) NOT NULL,
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_class (concept_class_id VARCHAR(20) NOT NULL,
|
||||||
|
concept_class_name VARCHAR(255) NOT NULL,
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_relationship (concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE relationship (relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_name VARCHAR(255) NOT NULL,
|
||||||
|
is_hierarchical VARCHAR(1) NOT NULL,
|
||||||
|
defines_ancestry VARCHAR(1) NOT NULL,
|
||||||
|
reverse_relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_synonym (concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000) NOT NULL,
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_ancestor (ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE source_to_concept_map (source_code VARCHAR(50) NOT NULL,
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_strength (drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value FLOAT NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value FLOAT NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value FLOAT NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_definition (cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||||
|
cohort_definition_description VARCHAR(MAX) NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax VARCHAR(MAX) NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE attribute_definition (attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255) NOT NULL,
|
||||||
|
attribute_description VARCHAR(MAX) NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax VARCHAR(MAX) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cdm_source
|
||||||
|
(cdm_source_name VARCHAR(255) NOT NULL ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description VARCHAR(MAX) NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE metadata
|
||||||
|
(metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) NOT NULL ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime TIMESTAMP NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE person
|
||||||
|
( person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime TIMESTAMP NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation_period
|
||||||
|
(observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE specimen
|
||||||
|
(specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime TIMESTAMP NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE death
|
||||||
|
( person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime TIMESTAMP NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_occurrence
|
||||||
|
(visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime TIMESTAMP NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime TIMESTAMP NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_detail
|
||||||
|
(visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime TIMESTAMP NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime TIMESTAMP NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE procedure_occurrence
|
||||||
|
(procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime TIMESTAMP NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_exposure
|
||||||
|
(drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime TIMESTAMP NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime TIMESTAMP NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig VARCHAR(MAX) NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE device_exposure
|
||||||
|
(device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime TIMESTAMP NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime TIMESTAMP NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_occurrence
|
||||||
|
(condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime TIMESTAMP NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime TIMESTAMP NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE measurement
|
||||||
|
(measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime TIMESTAMP NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low FLOAT NULL ,
|
||||||
|
range_high FLOAT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note
|
||||||
|
(note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime TIMESTAMP NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text VARCHAR(MAX) NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note_nlp
|
||||||
|
(note_nlp_id BIGINT NOT NULL ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) NOT NULL ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime TIMESTAMP NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation
|
||||||
|
(observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime TIMESTAMP NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE fact_relationship
|
||||||
|
(domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE location
|
||||||
|
(location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE care_site
|
||||||
|
(care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE provider
|
||||||
|
(provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE payer_plan_period
|
||||||
|
(payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cost
|
||||||
|
(cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge FLOAT NULL ,
|
||||||
|
total_cost FLOAT NULL ,
|
||||||
|
total_paid FLOAT NULL ,
|
||||||
|
paid_by_payer FLOAT NULL ,
|
||||||
|
paid_by_patient FLOAT NULL ,
|
||||||
|
paid_patient_copay FLOAT NULL ,
|
||||||
|
paid_patient_coinsurance FLOAT NULL ,
|
||||||
|
paid_patient_deductible FLOAT NULL ,
|
||||||
|
paid_by_primary FLOAT NULL ,
|
||||||
|
paid_ingredient_cost FLOAT NULL ,
|
||||||
|
paid_dispensing_fee FLOAT NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed FLOAT NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
DISTSTYLE ALL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
CREATE TABLE cohort
|
||||||
|
(cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
DISTKEY(subject_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_attribute
|
||||||
|
(cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(subject_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_era
|
||||||
|
(drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE dose_era
|
||||||
|
(dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value FLOAT NOT NULL ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_era
|
||||||
|
(condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
DISTKEY(person_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,735 @@
|
||||||
|
/*********************************************************************************
|
||||||
|
# Copyright 2017-11 Observational Health Data Sciences and Informatics
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
####### # # ####### ###### ##### ###### # # ####### #####
|
||||||
|
# # ## ## # # # # # # # # ## ## # # # # #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# # # # # # # ###### # # # # # # # # ###### #####
|
||||||
|
# # # # # # # # # # # # # # # ### #
|
||||||
|
# # # # # # # # # # # # # # # # # ### # #
|
||||||
|
####### # # ####### # ##### ###### # # ## ##### ### #####
|
||||||
|
|
||||||
|
|
||||||
|
sql server script to create OMOP common data model version 5.3
|
||||||
|
|
||||||
|
last revised: 6-Nov-2017
|
||||||
|
|
||||||
|
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
|
||||||
|
|
||||||
|
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized vocabulary
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept (
|
||||||
|
concept_id INTEGER NOT NULL ,
|
||||||
|
concept_name VARCHAR(255) NOT NULL ,
|
||||||
|
domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL ,
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL ,
|
||||||
|
standard_concept VARCHAR(1) NULL ,
|
||||||
|
concept_code VARCHAR(50) NOT NULL ,
|
||||||
|
valid_start_date DATE NOT NULL ,
|
||||||
|
valid_end_date DATE NOT NULL ,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE vocabulary (
|
||||||
|
vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
vocabulary_name VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_reference VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_version VARCHAR(255) NOT NULL,
|
||||||
|
vocabulary_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE domain (
|
||||||
|
domain_id VARCHAR(20) NOT NULL,
|
||||||
|
domain_name VARCHAR(255) NOT NULL,
|
||||||
|
domain_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_class (
|
||||||
|
concept_class_id VARCHAR(20) NOT NULL,
|
||||||
|
concept_class_name VARCHAR(255) NOT NULL,
|
||||||
|
concept_class_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_relationship (
|
||||||
|
concept_id_1 INTEGER NOT NULL,
|
||||||
|
concept_id_2 INTEGER NOT NULL,
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE relationship (
|
||||||
|
relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_name VARCHAR(255) NOT NULL,
|
||||||
|
is_hierarchical VARCHAR(1) NOT NULL,
|
||||||
|
defines_ancestry VARCHAR(1) NOT NULL,
|
||||||
|
reverse_relationship_id VARCHAR(20) NOT NULL,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_synonym (
|
||||||
|
concept_id INTEGER NOT NULL,
|
||||||
|
concept_synonym_name VARCHAR(1000) NOT NULL,
|
||||||
|
language_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE concept_ancestor (
|
||||||
|
ancestor_concept_id INTEGER NOT NULL,
|
||||||
|
descendant_concept_id INTEGER NOT NULL,
|
||||||
|
min_levels_of_separation INTEGER NOT NULL,
|
||||||
|
max_levels_of_separation INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE source_to_concept_map (
|
||||||
|
source_code VARCHAR(50) NOT NULL,
|
||||||
|
source_concept_id INTEGER NOT NULL,
|
||||||
|
source_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
source_code_description VARCHAR(255) NULL,
|
||||||
|
target_concept_id INTEGER NOT NULL,
|
||||||
|
target_vocabulary_id VARCHAR(20) NOT NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_strength (
|
||||||
|
drug_concept_id INTEGER NOT NULL,
|
||||||
|
ingredient_concept_id INTEGER NOT NULL,
|
||||||
|
amount_value FLOAT NULL,
|
||||||
|
amount_unit_concept_id INTEGER NULL,
|
||||||
|
numerator_value FLOAT NULL,
|
||||||
|
numerator_unit_concept_id INTEGER NULL,
|
||||||
|
denominator_value FLOAT NULL,
|
||||||
|
denominator_unit_concept_id INTEGER NULL,
|
||||||
|
box_size INTEGER NULL,
|
||||||
|
valid_start_date DATE NOT NULL,
|
||||||
|
valid_end_date DATE NOT NULL,
|
||||||
|
invalid_reason VARCHAR(1) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_definition (
|
||||||
|
cohort_definition_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_name VARCHAR(255) NOT NULL,
|
||||||
|
cohort_definition_description VARCHAR(MAX) NULL,
|
||||||
|
definition_type_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_definition_syntax VARCHAR(MAX) NULL,
|
||||||
|
subject_concept_id INTEGER NOT NULL,
|
||||||
|
cohort_initiation_date DATE NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE attribute_definition (
|
||||||
|
attribute_definition_id INTEGER NOT NULL,
|
||||||
|
attribute_name VARCHAR(255) NOT NULL,
|
||||||
|
attribute_description VARCHAR(MAX) NULL,
|
||||||
|
attribute_type_concept_id INTEGER NOT NULL,
|
||||||
|
attribute_syntax VARCHAR(MAX) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
|
||||||
|
Standardized meta-data
|
||||||
|
|
||||||
|
***************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cdm_source
|
||||||
|
(
|
||||||
|
cdm_source_name VARCHAR(255) NOT NULL ,
|
||||||
|
cdm_source_abbreviation VARCHAR(25) NULL ,
|
||||||
|
cdm_holder VARCHAR(255) NULL ,
|
||||||
|
source_description VARCHAR(MAX) NULL ,
|
||||||
|
source_documentation_reference VARCHAR(255) NULL ,
|
||||||
|
cdm_etl_reference VARCHAR(255) NULL ,
|
||||||
|
source_release_date DATE NULL ,
|
||||||
|
cdm_release_date DATE NULL ,
|
||||||
|
cdm_version VARCHAR(10) NULL ,
|
||||||
|
vocabulary_version VARCHAR(20) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE metadata
|
||||||
|
(
|
||||||
|
metadata_concept_id INTEGER NOT NULL ,
|
||||||
|
metadata_type_concept_id INTEGER NOT NULL ,
|
||||||
|
name VARCHAR(250) NOT NULL ,
|
||||||
|
value_as_string NVARCHAR NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
metadata_date DATE NULL ,
|
||||||
|
metadata_datetime DATETIME2 NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized clinical data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE person
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
gender_concept_id INTEGER NOT NULL ,
|
||||||
|
year_of_birth INTEGER NOT NULL ,
|
||||||
|
month_of_birth INTEGER NULL,
|
||||||
|
day_of_birth INTEGER NULL,
|
||||||
|
birth_datetime DATETIME2 NULL,
|
||||||
|
race_concept_id INTEGER NOT NULL,
|
||||||
|
ethnicity_concept_id INTEGER NOT NULL,
|
||||||
|
location_id INTEGER NULL,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
person_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_value VARCHAR(50) NULL,
|
||||||
|
gender_source_concept_id INTEGER NULL,
|
||||||
|
race_source_value VARCHAR(50) NULL,
|
||||||
|
race_source_concept_id INTEGER NULL,
|
||||||
|
ethnicity_source_value VARCHAR(50) NULL,
|
||||||
|
ethnicity_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation_period
|
||||||
|
(
|
||||||
|
observation_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_period_start_date DATE NOT NULL ,
|
||||||
|
observation_period_end_date DATE NOT NULL ,
|
||||||
|
period_type_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE specimen
|
||||||
|
(
|
||||||
|
specimen_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
specimen_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_type_concept_id INTEGER NOT NULL ,
|
||||||
|
specimen_date DATE NOT NULL ,
|
||||||
|
specimen_datetime DATETIME2 NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
anatomic_site_concept_id INTEGER NULL ,
|
||||||
|
disease_status_concept_id INTEGER NULL ,
|
||||||
|
specimen_source_id VARCHAR(50) NULL ,
|
||||||
|
specimen_source_value VARCHAR(50) NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
anatomic_site_source_value VARCHAR(50) NULL ,
|
||||||
|
disease_status_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE death
|
||||||
|
(
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
death_date DATE NOT NULL ,
|
||||||
|
death_datetime DATETIME2 NULL ,
|
||||||
|
death_type_concept_id INTEGER NOT NULL ,
|
||||||
|
cause_concept_id INTEGER NULL ,
|
||||||
|
cause_source_value VARCHAR(50) NULL,
|
||||||
|
cause_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_occurrence
|
||||||
|
(
|
||||||
|
visit_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL,
|
||||||
|
care_site_id INTEGER NULL,
|
||||||
|
visit_source_value VARCHAR(50) NULL,
|
||||||
|
visit_source_concept_id INTEGER NULL
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_concept_id INTEGER(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
preceding_visit_occurrence_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE visit_detail
|
||||||
|
(
|
||||||
|
visit_detail_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
visit_detail_concept_id INTEGER NOT NULL ,
|
||||||
|
visit_start_date DATE NOT NULL ,
|
||||||
|
visit_start_datetime DATETIME2 NULL ,
|
||||||
|
visit_end_date DATE NOT NULL ,
|
||||||
|
visit_end_datetime DATETIME2 NULL ,
|
||||||
|
visit_type_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
admitting_source_concept_id INTEGER NULL ,
|
||||||
|
discharge_to_concept_id INTEGER NULL ,
|
||||||
|
preceding_visit_detail_id INTEGER NULL ,
|
||||||
|
visit_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_source_concept_id INTEGER NULL ,
|
||||||
|
admitting_source_value VARCHAR(50) NULL ,
|
||||||
|
discharge_to_source_value VARCHAR(50) NULL ,
|
||||||
|
visit_detail_parent_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE procedure_occurrence
|
||||||
|
(
|
||||||
|
procedure_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
procedure_concept_id INTEGER NOT NULL ,
|
||||||
|
procedure_date DATE NOT NULL ,
|
||||||
|
procedure_datetime DATETIME2 NULL ,
|
||||||
|
procedure_type_concept_id INTEGER NOT NULL ,
|
||||||
|
modifier_concept_id INTEGER NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
procedure_source_value VARCHAR(50) NULL ,
|
||||||
|
procedure_source_concept_id INTEGER NULL ,
|
||||||
|
modifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_exposure
|
||||||
|
(
|
||||||
|
drug_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_exposure_start_date DATE NOT NULL ,
|
||||||
|
drug_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
drug_exposure_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
verbatim_end_date DATE NULL ,
|
||||||
|
drug_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
refills INTEGER NULL ,
|
||||||
|
quantity FLOAT NULL ,
|
||||||
|
days_supply INTEGER NULL ,
|
||||||
|
sig VARCHAR(MAX) NULL ,
|
||||||
|
route_concept_id INTEGER NULL ,
|
||||||
|
lot_number VARCHAR(50) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
drug_source_value VARCHAR(50) NULL ,
|
||||||
|
drug_source_concept_id INTEGER NULL ,
|
||||||
|
route_source_value VARCHAR(50) NULL ,
|
||||||
|
dose_unit_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE device_exposure
|
||||||
|
(
|
||||||
|
device_exposure_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
device_concept_id INTEGER NOT NULL ,
|
||||||
|
device_exposure_start_date DATE NOT NULL ,
|
||||||
|
device_exposure_start_datetime DATETIME2 NULL ,
|
||||||
|
device_exposure_end_date DATE NULL ,
|
||||||
|
device_exposure_end_datetime DATETIME2 NULL ,
|
||||||
|
device_type_concept_id INTEGER NOT NULL ,
|
||||||
|
unique_device_id VARCHAR(50) NULL ,
|
||||||
|
quantity INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
device_source_value VARCHAR(100) NULL ,
|
||||||
|
device_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_occurrence
|
||||||
|
(
|
||||||
|
condition_occurrence_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_start_date DATE NOT NULL ,
|
||||||
|
condition_start_datetime DATETIME2 NULL ,
|
||||||
|
condition_end_date DATE NULL ,
|
||||||
|
condition_end_datetime DATETIME2 NULL ,
|
||||||
|
condition_type_concept_id INTEGER NOT NULL ,
|
||||||
|
stop_reason VARCHAR(20) NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
condition_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_source_concept_id INTEGER NULL ,
|
||||||
|
condition_status_source_value VARCHAR(50) NULL ,
|
||||||
|
condition_status_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE measurement
|
||||||
|
(
|
||||||
|
measurement_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
measurement_concept_id INTEGER NOT NULL ,
|
||||||
|
measurement_date DATE NOT NULL ,
|
||||||
|
measurement_time VARCHAR(10) NULL ,
|
||||||
|
measurement_datetime DATETIME2 NULL ,
|
||||||
|
measurement_type_concept_id INTEGER NOT NULL ,
|
||||||
|
operator_concept_id INTEGER NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
range_low FLOAT NULL ,
|
||||||
|
range_high FLOAT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
measurement_source_value VARCHAR(50) NULL ,
|
||||||
|
measurement_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
value_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note
|
||||||
|
(
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
note_date DATE NOT NULL ,
|
||||||
|
note_datetime DATETIME2 NULL ,
|
||||||
|
note_type_concept_id INTEGER NOT NULL ,
|
||||||
|
note_class_concept_id INTEGER NOT NULL ,
|
||||||
|
note_title VARCHAR(250) NULL ,
|
||||||
|
note_text VARCHAR(MAX) NULL ,
|
||||||
|
encoding_concept_id INTEGER NOT NULL ,
|
||||||
|
language_concept_id INTEGER NOT NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
note_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE note_nlp
|
||||||
|
(
|
||||||
|
note_nlp_id BIGINT NOT NULL ,
|
||||||
|
note_id INTEGER NOT NULL ,
|
||||||
|
section_concept_id INTEGER NULL ,
|
||||||
|
snippet VARCHAR(250) NULL ,
|
||||||
|
offset VARCHAR(250) NULL ,
|
||||||
|
lexical_variant VARCHAR(250) NOT NULL ,
|
||||||
|
note_nlp_concept_id INTEGER NULL ,
|
||||||
|
note_nlp_source_concept_id INTEGER NULL ,
|
||||||
|
nlp_system VARCHAR(250) NULL ,
|
||||||
|
nlp_date DATE NOT NULL ,
|
||||||
|
nlp_datetime DATETIME2 NULL ,
|
||||||
|
term_exists VARCHAR(1) NULL ,
|
||||||
|
term_temporal VARCHAR(50) NULL ,
|
||||||
|
term_modifiers VARCHAR(2000) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE observation
|
||||||
|
(
|
||||||
|
observation_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
observation_concept_id INTEGER NOT NULL ,
|
||||||
|
observation_date DATE NOT NULL ,
|
||||||
|
observation_datetime DATETIME2 NULL ,
|
||||||
|
observation_type_concept_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_string VARCHAR(60) NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL ,
|
||||||
|
qualifier_concept_id INTEGER NULL ,
|
||||||
|
unit_concept_id INTEGER NULL ,
|
||||||
|
provider_id INTEGER NULL ,
|
||||||
|
visit_occurrence_id INTEGER NULL ,
|
||||||
|
visit_detail_id INTEGER NULL ,
|
||||||
|
observation_source_value VARCHAR(50) NULL ,
|
||||||
|
observation_source_concept_id INTEGER NULL ,
|
||||||
|
unit_source_value VARCHAR(50) NULL ,
|
||||||
|
qualifier_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE fact_relationship
|
||||||
|
(
|
||||||
|
domain_concept_id_1 INTEGER NOT NULL ,
|
||||||
|
fact_id_1 INTEGER NOT NULL ,
|
||||||
|
domain_concept_id_2 INTEGER NOT NULL ,
|
||||||
|
fact_id_2 INTEGER NOT NULL ,
|
||||||
|
relationship_concept_id INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health system data
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE location
|
||||||
|
(
|
||||||
|
location_id INTEGER NOT NULL ,
|
||||||
|
address_1 VARCHAR(50) NULL ,
|
||||||
|
address_2 VARCHAR(50) NULL ,
|
||||||
|
city VARCHAR(50) NULL ,
|
||||||
|
state VARCHAR(2) NULL ,
|
||||||
|
zip VARCHAR(9) NULL ,
|
||||||
|
county VARCHAR(20) NULL ,
|
||||||
|
location_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE care_site
|
||||||
|
(
|
||||||
|
care_site_id INTEGER NOT NULL ,
|
||||||
|
care_site_name VARCHAR(255) NULL ,
|
||||||
|
place_of_service_concept_id INTEGER NULL ,
|
||||||
|
location_id INTEGER NULL ,
|
||||||
|
care_site_source_value VARCHAR(50) NULL ,
|
||||||
|
place_of_service_source_value VARCHAR(50) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE provider
|
||||||
|
(
|
||||||
|
provider_id INTEGER NOT NULL ,
|
||||||
|
provider_name VARCHAR(255) NULL ,
|
||||||
|
NPI VARCHAR(20) NULL ,
|
||||||
|
DEA VARCHAR(20) NULL ,
|
||||||
|
specialty_concept_id INTEGER NULL ,
|
||||||
|
care_site_id INTEGER NULL ,
|
||||||
|
year_of_birth INTEGER NULL ,
|
||||||
|
gender_concept_id INTEGER NULL ,
|
||||||
|
provider_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_value VARCHAR(50) NULL ,
|
||||||
|
specialty_source_concept_id INTEGER NULL ,
|
||||||
|
gender_source_value VARCHAR(50) NULL ,
|
||||||
|
gender_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized health economics
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE payer_plan_period
|
||||||
|
(
|
||||||
|
payer_plan_period_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
payer_plan_period_start_date DATE NOT NULL ,
|
||||||
|
payer_plan_period_end_date DATE NOT NULL ,
|
||||||
|
payer_concept_id INTEGER NULL ,
|
||||||
|
payer_source_value VARCHAR(50) NULL ,
|
||||||
|
payer_source_concept_id INTEGER NULL ,
|
||||||
|
plan_concept_id INTEGER NULL ,
|
||||||
|
plan_source_value VARCHAR(50) NULL ,
|
||||||
|
plan_source_concept_id INTEGER NULL ,
|
||||||
|
sponsor_concept_id INTEGER NULL ,
|
||||||
|
sponsor_source_value VARCHAR(50) NULL ,
|
||||||
|
sponsor_source_concept_id INTEGER NULL ,
|
||||||
|
family_source_value VARCHAR(50) NULL ,
|
||||||
|
stop_reason_concept_id INTEGER NULL ,
|
||||||
|
stop_reason_source_value INTEGER NULL ,
|
||||||
|
stop_reason_source_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cost
|
||||||
|
(
|
||||||
|
cost_id INTEGER NOT NULL ,
|
||||||
|
cost_event_id INTEGER NOT NULL ,
|
||||||
|
cost_domain_id VARCHAR(20) NOT NULL ,
|
||||||
|
cost_type_concept_id INTEGER NOT NULL ,
|
||||||
|
currency_concept_id INTEGER NULL ,
|
||||||
|
total_charge FLOAT NULL ,
|
||||||
|
total_cost FLOAT NULL ,
|
||||||
|
total_paid FLOAT NULL ,
|
||||||
|
paid_by_payer FLOAT NULL ,
|
||||||
|
paid_by_patient FLOAT NULL ,
|
||||||
|
paid_patient_copay FLOAT NULL ,
|
||||||
|
paid_patient_coinsurance FLOAT NULL ,
|
||||||
|
paid_patient_deductible FLOAT NULL ,
|
||||||
|
paid_by_primary FLOAT NULL ,
|
||||||
|
paid_ingredient_cost FLOAT NULL ,
|
||||||
|
paid_dispensing_fee FLOAT NULL ,
|
||||||
|
payer_plan_period_id INTEGER NULL ,
|
||||||
|
amount_allowed FLOAT NULL ,
|
||||||
|
revenue_code_concept_id INTEGER NULL ,
|
||||||
|
reveue_code_source_value VARCHAR(50) NULL,
|
||||||
|
drg_concept_id INTEGER NULL,
|
||||||
|
drg_source_value VARCHAR(3) NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************
|
||||||
|
|
||||||
|
Standardized derived elements
|
||||||
|
|
||||||
|
************************/
|
||||||
|
|
||||||
|
CREATE TABLE cohort
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE cohort_attribute
|
||||||
|
(
|
||||||
|
cohort_definition_id INTEGER NOT NULL ,
|
||||||
|
cohort_start_date DATE NOT NULL ,
|
||||||
|
cohort_end_date DATE NOT NULL ,
|
||||||
|
subject_id INTEGER NOT NULL ,
|
||||||
|
attribute_definition_id INTEGER NOT NULL ,
|
||||||
|
value_as_number FLOAT NULL ,
|
||||||
|
value_as_concept_id INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE drug_era
|
||||||
|
(
|
||||||
|
drug_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
drug_era_start_date DATE NOT NULL ,
|
||||||
|
drug_era_end_date DATE NOT NULL ,
|
||||||
|
drug_exposure_count INTEGER NULL ,
|
||||||
|
gap_days INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE dose_era
|
||||||
|
(
|
||||||
|
dose_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
drug_concept_id INTEGER NOT NULL ,
|
||||||
|
unit_concept_id INTEGER NOT NULL ,
|
||||||
|
dose_value FLOAT NOT NULL ,
|
||||||
|
dose_era_start_date DATE NOT NULL ,
|
||||||
|
dose_era_end_date DATE NOT NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE condition_era
|
||||||
|
(
|
||||||
|
condition_era_id INTEGER NOT NULL ,
|
||||||
|
person_id INTEGER NOT NULL ,
|
||||||
|
condition_concept_id INTEGER NOT NULL ,
|
||||||
|
condition_era_start_date DATE NOT NULL ,
|
||||||
|
condition_era_end_date DATE NOT NULL ,
|
||||||
|
condition_occurrence_count INTEGER NULL
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,207 @@
|
||||||
|
---
|
||||||
|
title: "OMOP Common Data Model Specifications"
|
||||||
|
author: "Christian Reich, Patrick Ryan, Rimma Belenkaya, Karthik Natarajan and Clair Blacketer"
|
||||||
|
date: "`r Sys.Date()`"
|
||||||
|
output:
|
||||||
|
pdf_document:
|
||||||
|
number_sections: yes
|
||||||
|
toc: yes
|
||||||
|
linkcolor: blue
|
||||||
|
---
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/License.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Background
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/Background/Background.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## The Role of the Common Data Model
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/Background/The-Role-of-the-Common-Data-Model.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Design Principles
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/Background/Design-Principles.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Model Conventions
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/Background/Data-Model-Conventions.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Glossary of Terms
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/Glossary-of-Terms.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Vocabularies
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/Standardized-Vocabularies.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## VOCABULARY
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/VOCABULARY.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOMAIN
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/DOMAIN.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_CLASS
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_CLASS.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_RELATIONSHIP
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## RELATIONSHIP
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_SYNONYM
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_SYNONYM.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_ANCESTOR
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_ANCESTOR.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SOURCE_TO_CONCEPT_MAP
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/SOURCE_TO_CONCEPT_MAP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_STRENGTH
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/DRUG_STRENGTH.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT_DEFINITION
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/COHORT_DEFINITION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## ATTRIBUTE_DEFINITION
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedVocabularies/ATTRIBUTE_DEFINITION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Metadata
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedMetadata/Standardized-Metadata.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CDM_SOURCE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedMetadata/CDM_SOURCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Clinical Data Tables
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/Standardized-clinical-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PERSON
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/PERSON.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OBSERVATION_PERIOD
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/OBSERVATION_PERIOD.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SPECIMEN
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/SPECIMEN.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DEATH
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/DEATH.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## VISIT_OCCURRENCE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/VISIT_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PROCEDURE_OCCURRENCE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/PROCEDURE_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_EXPOSURE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/DRUG_EXPOSURE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DEVICE_EXPOSURE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/DEVICE_EXPOSURE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONDITION_OCCURRENCE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/CONDITION_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## MEASUREMENT
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/MEASUREMENT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/NOTE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTE_NLP
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/NOTE_NLP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OBSERVATION
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/OBSERVATION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FACT_RELATIONSHIP
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/FACT_RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Health System Data Tables
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/Standardized-Health-System-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## LOCATION
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/LOCATION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CARE_SITE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/CARE_SITE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PROVIDER
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/PROVIDER.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Health Economics Data Tables
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthEconomicsDataTables/Standardized-Health-Economics-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PAYER_PLAN_PERIOD
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthEconomicsDataTables/PAYER_PLAN_PERIOD.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COST
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedHealthEconomicsDataTables/COST.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Derived Elements
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedDerivedElements/Standardized-Derived-Elements.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedDerivedElements/COHORT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT_ATTRIBUTE
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedDerivedElements/COHORT_ATTRIBUTE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_ERA
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedDerivedElements/DRUG_ERA.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOSE_ERA
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedDerivedElements/DOSE_ERA.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONDITION_ERA
|
||||||
|
```{r child = '../CommonDataModel_Wiki_Files/StandardizedDerivedElements/CONDITION_ERA.md'}
|
||||||
|
```
|
|
@ -0,0 +1,207 @@
|
||||||
|
---
|
||||||
|
title: "OMOP Common Data Model Specifications"
|
||||||
|
author: "Christian Reich, Patrick Ryan, Rimma Belenkaya, Karthik Natarajan and Clair Blacketer"
|
||||||
|
date: "`r Sys.Date()`"
|
||||||
|
output:
|
||||||
|
pdf_document:
|
||||||
|
number_sections: yes
|
||||||
|
toc: yes
|
||||||
|
linkcolor: blue
|
||||||
|
---
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/License.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Background
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/Background/Background.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## The Role of the Common Data Model
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/Background/The-Role-of-the-Common-Data-Model.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Design Principles
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/Background/Design-Principles.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Model Conventions
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/Background/Data-Model-Conventions.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Glossary of Terms
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/Glossary-of-Terms.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Vocabularies
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/Standardized-Vocabularies.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## VOCABULARY
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/VOCABULARY.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOMAIN
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/DOMAIN.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_CLASS
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_CLASS.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_RELATIONSHIP
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## RELATIONSHIP
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_SYNONYM
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_SYNONYM.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONCEPT_ANCESTOR
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/CONCEPT_ANCESTOR.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SOURCE_TO_CONCEPT_MAP
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/SOURCE_TO_CONCEPT_MAP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_STRENGTH
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/DRUG_STRENGTH.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT_DEFINITION
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/COHORT_DEFINITION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## ATTRIBUTE_DEFINITION
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedVocabularies/ATTRIBUTE_DEFINITION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Metadata
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedMetadata/Standardized-Metadata.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CDM_SOURCE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedMetadata/CDM_SOURCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Clinical Data Tables
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/Standardized-clinical-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PERSON
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/PERSON.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OBSERVATION_PERIOD
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/OBSERVATION_PERIOD.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## SPECIMEN
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/SPECIMEN.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DEATH
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/DEATH.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## VISIT_OCCURRENCE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/VISIT_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PROCEDURE_OCCURRENCE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/PROCEDURE_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_EXPOSURE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/DRUG_EXPOSURE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DEVICE_EXPOSURE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/DEVICE_EXPOSURE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONDITION_OCCURRENCE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/CONDITION_OCCURRENCE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## MEASUREMENT
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/MEASUREMENT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/NOTE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## NOTE_NLP
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/NOTE_NLP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## OBSERVATION
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/OBSERVATION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## FACT_RELATIONSHIP
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedclinicalDataTables/FACT_RELATIONSHIP.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Health System Data Tables
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/Standardized-Health-System-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## LOCATION
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/LOCATION.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CARE_SITE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/CARE_SITE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PROVIDER
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthSystemDataTables/PROVIDER.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Health Economics Data Tables
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthEconomicsDataTables/Standardized-Health-Economics-Data-Tables.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## PAYER_PLAN_PERIOD
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthEconomicsDataTables/PAYER_PLAN_PERIOD.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COST
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedHealthEconomicsDataTables/COST.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Standardized Derived Elements
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedDerivedElements/Standardized-Derived-Elements.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedDerivedElements/COHORT.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## COHORT_ATTRIBUTE
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedDerivedElements/COHORT_ATTRIBUTE.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DRUG_ERA
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedDerivedElements/DRUG_ERA.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## DOSE_ERA
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedDerivedElements/DOSE_ERA.md'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## CONDITION_ERA
|
||||||
|
```{r child = '../../Documentation/CommonDataModel_Wiki_Files/StandardizedDerivedElements/CONDITION_ERA.md'}
|
||||||
|
```
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@ Field|Required|Type|Description
|
||||||
| condition_source_value | No | varchar(50) | The source code for the condition 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. |
|
| condition_source_value | No | varchar(50) | The source code for the condition 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. |
|
||||||
| condition_source_concept_id | No | integer | A foreign key to a Condition Concept that refers to the code used in the source. |
|
| condition_source_concept_id | No | integer | A foreign key to a Condition Concept that refers to the code used in the source. |
|
||||||
| condition_status_source_value | No | varchar(50) | The source code for the condition status as it appears in the source data. |
|
| condition_status_source_value | No | varchar(50) | The source code for the condition status as it appears in the source data. |
|
||||||
| condition_status_concept_id | No | integer | A foreign key to the predefined concept in the standard vocabulary reflecting the condition status | |
|
| condition_status_concept_id | No | integer | A foreign key to the predefined Concept in the Standard Vocabulary reflecting the condition status | |
|
||||||
|
|
||||||
### Conventions
|
### Conventions
|
||||||
|
|
||||||
|
@ -37,5 +37,5 @@ Field|Required|Type|Description
|
||||||
* Condition source codes are typically ICD-9-CM, Read or ICD-10 diagnosis codes from medical claims or discharge status/visit diagnosis codes from EHRs.
|
* Condition source codes are typically ICD-9-CM, Read or ICD-10 diagnosis codes from medical claims or discharge status/visit diagnosis codes from EHRs.
|
||||||
* Presently, there is no designated vocabulary, domain, or class that represents condition status. The following concepts from SNOMED are recommended:
|
* Presently, there is no designated vocabulary, domain, or class that represents condition status. The following concepts from SNOMED are recommended:
|
||||||
* Admitting diagnosis: 4203942
|
* Admitting diagnosis: 4203942
|
||||||
* Final diagnosis: 4230359 <EFBFBD> should also be used for <20>Discharge diagnosis<69>
|
* Final diagnosis: 4230359 (should also be used for discharge diagnosis)
|
||||||
* Preliminary diagnosis: 4033240
|
* Preliminary diagnosis: 4033240
|
||||||
|
|
|
@ -13,10 +13,10 @@ Field|Required|Type|Description
|
||||||
|unique_device_id |No|varchar(50)|A UDI or equivalent identifying the instance of the Device used in the Person.|
|
|unique_device_id |No|varchar(50)|A UDI or equivalent identifying the instance of the Device used in the Person.|
|
||||||
|quantity|No|integer|The number of individual Devices used for the exposure.|
|
|quantity|No|integer|The number of individual Devices used for the exposure.|
|
||||||
|provider_id|No|integer|A foreign key to the provider in the PROVIDER table who initiated of administered the Device.|
|
|provider_id|No|integer|A foreign key to the provider in the PROVIDER table who initiated of administered the Device.|
|
||||||
|visit_occurrence_id|No|integer|A foreign key to the visit in the VISIT table during which the device was used.|
|
|visit_occurrence_id|No|integer|A foreign key to the visit in the VISIT_OCCURRENCE table during which the device was used.|
|
||||||
|
|visit_detail_id|No|integer|A foreign key to the visit detail in the VISIT_DETAIL table during which the Drug Exposure was initiated.|
|
||||||
|device_source_value|No|varchar(50)|The source code for the Device as it appears in the source data. This code is mapped to a standard Device Concept in the Standardized Vocabularies and the original code is stored here for reference.|
|
|device_source_value|No|varchar(50)|The source code for the Device as it appears in the source data. This code is mapped to a standard Device Concept in the Standardized Vocabularies and the original code is stored here for reference.|
|
||||||
|device_source_ concept_id|No|integer|A foreign key to a Device Concept that refers to the code used in the source.|
|
|device_source_ concept_id|No|integer|A foreign key to a Device Concept that refers to the code used in the source.|
|
||||||
|visit_detail_id|No|integer|A foreign key to the visit in the visit-detail table during which the Drug Exposure was initiated.|
|
|
||||||
|
|
||||||
### Conventions
|
### Conventions
|
||||||
|
|
||||||
|
@ -25,4 +25,5 @@ Field|Required|Type|Description
|
||||||
* Valid Device Concepts belong to the "Device" domain. The Concepts of this domain are derived from the DI portion of a UDI or based on other source vocabularies, like HCPCS.
|
* Valid Device Concepts belong to the "Device" domain. The Concepts of this domain are derived from the DI portion of a UDI or based on other source vocabularies, like HCPCS.
|
||||||
* A Device Type is assigned to each Device Exposure to track from what source the information was drawn or inferred. The valid domain_id for these Concepts is "Device Type".
|
* A Device Type is assigned to each Device Exposure to track from what source the information was drawn or inferred. The valid domain_id for these Concepts is "Device Type".
|
||||||
* The Visit during which the Device was first used is recorded through a reference to the VISIT_OCCURRENCE table. This information is not always available.
|
* The Visit during which the Device was first used is recorded through a reference to the VISIT_OCCURRENCE table. This information is not always available.
|
||||||
|
* The Visit Detail during which the Device was first used is recorded through a reference to the VISIT_DETAIL table. This information is not always available.
|
||||||
* The Provider exposing the patient to the Device is recorded through a reference to the PROVIDER table. This information is not always available.
|
* The Provider exposing the patient to the Device is recorded through a reference to the PROVIDER table. This information is not always available.
|
||||||
|
|
|
@ -22,16 +22,16 @@ Field|Required|Type|Description
|
||||||
|refills|No|integer|The number of refills after the initial prescription. The initial prescription is not counted, values start with 0.|
|
|refills|No|integer|The number of refills after the initial prescription. The initial prescription is not counted, values start with 0.|
|
||||||
|quantity |No|float|The quantity of drug as recorded in the original prescription or dispensing record.|
|
|quantity |No|float|The quantity of drug as recorded in the original prescription or dispensing record.|
|
||||||
|days_supply|No|integer|The number of days of supply of the medication as recorded in the original prescription or dispensing record.|
|
|days_supply|No|integer|The number of days of supply of the medication as recorded in the original prescription or dispensing record.|
|
||||||
|sig|No|clob|The directions ("signetur") on the Drug prescription as recorded in the original prescription (and printed on the container) or dispensing record.|
|
|sig|No|varchar(MAX)|The directions ("signetur") on the Drug prescription as recorded in the original prescription (and printed on the container) or dispensing record.|
|
||||||
|route_concept_id|No|integer|A foreign key to a predefined concept in the Standardized Vocabularies reflecting the route of administration.|
|
|route_concept_id|No|integer|A foreign key to a predefined concept in the Standardized Vocabularies reflecting the route of administration.|
|
||||||
|lot_number|No|varchar(50)|An identifier assigned to a particular quantity or lot of Drug product from the manufacturer.|
|
|lot_number|No|varchar(50)|An identifier assigned to a particular quantity or lot of Drug product from the manufacturer.|
|
||||||
|provider_id|No|integer|A foreign key to the provider in the provider table who initiated (prescribed or administered) the Drug Exposure.|
|
|provider_id|No|integer|A foreign key to the provider in the PROVIDER table who initiated (prescribed or administered) the Drug Exposure.|
|
||||||
|visit_occurrence_id|No|integer|A foreign key to the visit in the visit table during which the Drug Exposure was initiated.|
|
|visit_occurrence_id|No|integer|A foreign key to the Visit in the VISIT_OCCURRENCE table during which the Drug Exposure was initiated.|
|
||||||
|
|visit_detail_id|No|integer|A foreign key to the Visit Detail in the VISIT_DETAIL table during which the Drug Exposure was initiated.|
|
||||||
|drug_source_value|No|varchar(50)|The source code for the Drug as it appears in the source data. This code is mapped to a Standard Drug concept in the Standardized Vocabularies and the original code is, stored here for reference.|
|
|drug_source_value|No|varchar(50)|The source code for the Drug as it appears in the source data. This code is mapped to a Standard Drug concept in the Standardized Vocabularies and the original code is, stored here for reference.|
|
||||||
|drug_source_concept_id|No|integer|A foreign key to a Drug Concept that refers to the code used in the source.|
|
|drug_source_concept_id|No|integer|A foreign key to a Drug Concept that refers to the code used in the source.|
|
||||||
|route_source_value|No|varchar(50)|The information about the route of administration as detailed in the source.|
|
|route_source_value|No|varchar(50)|The information about the route of administration as detailed in the source.|
|
||||||
|dose_unit_source_value|No|varchar(50)|The information about the dose unit as detailed in the source.|
|
|dose_unit_source_value|No|varchar(50)|The information about the dose unit as detailed in the source.|
|
||||||
|visit_detail_id|No|integer|A foreign key to the visit in the VISIT_DETAIL table during which the Drug Exposure was initiated.|
|
|
||||||
|
|
||||||
### Conventions
|
### Conventions
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ Field|Required|Type|Description
|
||||||
|range_high|No|float|The upper limit of the normal range of the Measurement. The upper range is assumed to be of the same unit of measure as the Measurement value.|
|
|range_high|No|float|The upper limit of the normal range of the Measurement. The upper range is assumed to be of the same unit of measure as the Measurement value.|
|
||||||
|provider_id|No|integer|A foreign key to the provider in the PROVIDER table who was responsible for initiating or obtaining the measurement.|
|
|provider_id|No|integer|A foreign key to the provider in the PROVIDER table who was responsible for initiating or obtaining the measurement.|
|
||||||
|visit_occurrence_id|No|integer|A foreign key to the Visit in the VISIT_OCCURRENCE table during which the Measurement was recorded.|
|
|visit_occurrence_id|No|integer|A foreign key to the Visit in the VISIT_OCCURRENCE table during which the Measurement was recorded.|
|
||||||
|visit_detail_id|No|integer|A foreign key to the Visit in the VISIT_DETAIL table during which the Measurement was recorded. |
|
|visit_detail_id|No|integer|A foreign key to the Visit Detail in the VISIT_DETAIL table during which the Measurement was recorded. |
|
||||||
|measurement_source_value|No|varchar(50)|The Measurement name as it appears in the source data. This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference.|
|
|measurement_source_value|No|varchar(50)|The Measurement name as it appears in the source data. This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference.|
|
||||||
|measurement_source_concept_id|No|integer|A foreign key to a Concept in the Standard Vocabularies that refers to the code used in the source.|
|
|measurement_source_concept_id|No|integer|A foreign key to a Concept in the Standard Vocabularies that refers to the code used in the source.|
|
||||||
|unit_source_value|No|varchar(50)|The source code for the unit as it appears in the source data. This code is mapped to a standard unit concept in the Standardized Vocabularies and the original code is stored here for reference.|
|
|unit_source_value|No|varchar(50)|The source code for the unit as it appears in the source data. This code is mapped to a standard unit concept in the Standardized Vocabularies and the original code is stored here for reference.|
|
||||||
|
|
|
@ -13,12 +13,12 @@ Field|Required|Type|Description
|
||||||
|procedure_type_concept_id|Yes|integer|A foreign key to the predefined Concept identifier in the Standardized Vocabularies reflecting the type of source data from which the procedure record is derived.|
|
|procedure_type_concept_id|Yes|integer|A foreign key to the predefined Concept identifier in the Standardized Vocabularies reflecting the type of source data from which the procedure record is derived.|
|
||||||
|modifier_concept_id|No|integer|A foreign key to a Standard Concept identifier for a modifier to the Procedure (e.g. bilateral)|
|
|modifier_concept_id|No|integer|A foreign key to a Standard Concept identifier for a modifier to the Procedure (e.g. bilateral)|
|
||||||
|quantity|No|integer|The quantity of procedures ordered or administered.|
|
|quantity|No|integer|The quantity of procedures ordered or administered.|
|
||||||
|provider_id|No|integer|A foreign key to the provider in the provider table who was responsible for carrying out the procedure.|
|
|provider_id|No|integer|A foreign key to the provider in the PROVIDER table who was responsible for carrying out the procedure.|
|
||||||
|visit_occurrence_id|No|integer|A foreign key to the visit in the visit table during which the Procedure was carried out.|
|
|visit_occurrence_id|No|integer|A foreign key to the Visit in the VISIT_OCCURRENCE table during which the Procedure was carried out.|
|
||||||
|
|visit_detail_id|No|integer|A foreign key to the Visit Detail in the VISIT_DETAIL table during which the Procedure was carried out.|
|
||||||
|procedure_source_value|No|varchar(50)|The source code for the Procedure as it appears in the source data. This code is mapped to a standard procedure Concept in the Standardized Vocabularies and the original code is, stored here for reference. Procedure source codes are typically ICD-9-Proc, CPT-4, HCPCS or OPCS-4 codes.|
|
|procedure_source_value|No|varchar(50)|The source code for the Procedure as it appears in the source data. This code is mapped to a standard procedure Concept in the Standardized Vocabularies and the original code is, stored here for reference. Procedure source codes are typically ICD-9-Proc, CPT-4, HCPCS or OPCS-4 codes.|
|
||||||
|procedure_source_concept_id|No|integer|A foreign key to a Procedure Concept that refers to the code used in the source.|
|
|procedure_source_concept_id|No|integer|A foreign key to a Procedure Concept that refers to the code used in the source.|
|
||||||
|qualifier_source_value|No|varchar(50)|The source code for the qualifier as it appears in the source data.|
|
|modifier_source_value|No|varchar(50)|The source code for the qualifier as it appears in the source data.|
|
||||||
|visit_detail_id|No|integer|A foreign key to the visit in the visit table during which the Procedure was carried out.|
|
|
||||||
|
|
||||||
### Conventions
|
### Conventions
|
||||||
|
|
||||||
|
@ -28,4 +28,5 @@ Field|Required|Type|Description
|
||||||
* If the quantity value is omitted, a single procedure is assumed.
|
* If the quantity value is omitted, a single procedure is assumed.
|
||||||
* The Procedure Type defines from where the Procedure Occurrence is drawn or inferred. For administrative claims records the type indicates whether a Procedure was primary or secondary and their relative positioning within a claim.
|
* The Procedure Type defines from where the Procedure Occurrence is drawn or inferred. For administrative claims records the type indicates whether a Procedure was primary or secondary and their relative positioning within a claim.
|
||||||
* The Visit during which the procedure was performed is recorded through a reference to the VISIT_OCCURRENCE table. This information is not always available.
|
* The Visit during which the procedure was performed is recorded through a reference to the VISIT_OCCURRENCE table. This information is not always available.
|
||||||
|
* The Visit Detail during with the procedure was performed is recorded through a reference to the VISIT_DETAIL table. This information is not always available.
|
||||||
* The Provider carrying out the procedure is recorded through a reference to the PROVIDER table. This information is not always available.
|
* The Provider carrying out the procedure is recorded through a reference to the PROVIDER table. This information is not always available.
|
||||||
|
|
|
@ -25,22 +25,24 @@ Field|Required|Type|Description
|
||||||
|
|
||||||
### Conventions
|
### Conventions
|
||||||
|
|
||||||
* All conventions used in Visit occurrence apply to visit detail, some notable exceptions:
|
* All conventions used in VISIT_OCCURRENCE apply to VISIT_DETAIL, some notable exceptions:
|
||||||
* A Visit Detail is an optional detail record for each visit-occurrence to a healthcare facility. For every record in visit_detail there has to be a parent visit_occurrence record.
|
* A Visit Detail is an optional detail record for each Visit Occurrence to a healthcare facility. For every record in VISIT_DETAIL there has to be a parent VISIT_OCCURRENCE record.
|
||||||
* One record in visit_detail can only have one visit_occurrence parent.
|
* One record in VISIT_DETAIL can only have one VISIT_OCCURRENCE parent.
|
||||||
* A single visit_occurrence record may have many child visit_detail records.
|
* A single VISIT_OCCURRENCE record may have many child VISIT_DETAIL records.
|
||||||
* Valid Visit Concepts belong to the "Visit" domain. Standard Visit Concepts are yet to be defined, but will represent a detail of the standard visit concept in visit-occurrence.
|
* Valid Visit Concepts belong to the "Visit" domain. Standard Visit Concepts are yet to be defined, but will represent a detail of the Standard Visit Concept in VISIT_OCCURRENCE.
|
||||||
* Handling of death: Is same as visit_occurrence
|
* Handling of death: In the case when a patient died during admission (VISIT_OCCURRENCE.DISCHARGE_DISPOSITION_CONCEPT_ID = 4216643 'Patient died'), a record in the Death table should be created with DEATH_TYPE_CONCEPT_ID = 44818516 (EHR discharge status "Expired").
|
||||||
* Source Concepts from place of service vocabularies are mapped into these standard visit Concepts in the Standardized Vocabularies.
|
* Source Concepts from place of service vocabularies are mapped into these Standard Visit Concepts in the Standardized Vocabularies.
|
||||||
* At any one day, there could be more than one visit. Visit_occurrence allows for more than one visit within single day. Visit_detail is to be used to only capture details within the visit_occurrence.
|
* At any one day, there could be more than one visit. VISIT_OCCURRENCE allows for more than one visit within a single day. VISIT_DETAIL is to be used to only capture details within the visit.
|
||||||
* One visit may involve multiple providers, in which case, in visit_occurrence, the ETL must specify how a single provider id is selected or leave the provider_id field null. Visit_detail allows for ETL to speicify multiple child records per visit_occurrence - and each of these child may represent different provider_ids.
|
* One visit may involve multiple providers, in which case, in VISIT_OCCURRENCE, the ETL must specify how a single provider id is selected or leave the provider_id field null. VISIT_DETAIL allows for ETL to speicify multiple child records per visit occurrence - and each of these child records may represent different provider_ids.
|
||||||
* One visit may involve multiple Care Sites, in which case, in visit_occurrence, the ETL must specify how a single care_site id is selected or leave the care_site_id field null. Visit_detail allows for ETL to speicify multiple child records per visit_occurrence - and each of these child may represent different care_sites.
|
* One visit may involve multiple Care Sites, in which case, in VISIT_OCCURRENCE, the ETL must specify how a single care_site id is selected or leave the care_site_id field null. VISIT_DETAIL allows for ETL to speicify multiple child records per visit occurrence - and each of these child records may represent different care_sites.
|
||||||
* Just like in visit_occurrence, records in visit_detail may be sequentially related to each. These sequential relations are represented using preceding_visit_detail_id
|
* Just like in VISIT_OCCURRENCE, records in VISIT_DETAIL may be sequentially related to each. These sequential relations are represented using preceding_visit_detail_id
|
||||||
* Unlike visit_occurrence, visit_detail may have nested visits with hierarchial relationships to each other.
|
* Unlike VISIT_OCCURRENCE, VISIT_DETAIL may have nested visits with hierarchial relationships to each other.
|
||||||
* Representation of US claim data: US claims data generally has two-levels. Header/summary data that summarizes the entire claim; Line/detail that details a claim. Detail is thus a child of the summary, and for every record in summary there is one or more records in detail. i.e. there will be atleast one FK link from visit_detail to visit_occurrence.
|
* Representation of US claim data: US claims data generally has two-levels. Header/summary data that summarizes the entire claim; Line/detail that details a claim. Detail is thus a child of the summary, and for every record in summary there is one or more records in detail. i.e. there will be atleast one FK link from VISIT_DETAIL to VISIT_OCCURRENCE.
|
||||||
|
|
||||||
Example: an entire inpatient stay maybe one record in visit_occurrence table. This may have one or more detail information such as ER, ICU, medical floor, rehabilitation floor etc. Each of these visit_details may have different start/end date-times, different concept_id's and fact_id's - that would be separate record in visit_detail with a FK link to visit_occurrence. Each record within visit_detail maybe related to each other, sequentially –> ER leading to ICU leading to medical floor, leading to rehabilitation, or in hierarchical parent-child visit –> a visit for dialysis while in ICU.
|
Example: an entire inpatient stay maybe one record in the VISIT_OCCURRENCE table. This may have one or more detail records such as ER, ICU, medical floor, rehabilitation floor etc. Each of these visit details may have different start/end date-times, different concept_ids and fact_ids. These would become separate records in VISIT_DETAIL with a FK link to VISIT_OCCURRENCE.
|
||||||
|
|
||||||
Note the concept-id for visits is 9, and is shared between visit_occurrence and visit_detail in OMOP CDM. The key deviation from visit_occurrence is
|
Each record within VISIT_DETAIL may be related to each other, sequentially –> ER leading to ICU leading to medical floor, leading to rehabilitation, or in hierarchical parent-child visit –> a visit for dialysis while in ICU.
|
||||||
|
|
||||||
|
Note the CONCEPT_ID for visits is 8, and is shared between VISIT_OCCURRENCE and VISIT_DETAIL in OMOP CDM. The key deviation from VISIT_OCCURRENCE is
|
||||||
- self-referencing key: a new foreign key visit_detail_parent_id allows self referencing for nested visits.
|
- self-referencing key: a new foreign key visit_detail_parent_id allows self referencing for nested visits.
|
||||||
- visit_detail points to its parent record in visit_occurrence table (visit_occurrence_id)
|
- VISIT_DETAIL points to its parent record in the VISIT_OCCURRENCE table (visit_occurrence_id)
|
||||||
|
|
|
@ -25,7 +25,7 @@ Field|Required|Type|Description
|
||||||
* A Visit Occurrence is recorded for each visit to a healthcare facility.
|
* A Visit Occurrence is recorded for each visit to a healthcare facility.
|
||||||
* Valid Visit Concepts belong to the "Visit" domain.
|
* Valid Visit Concepts belong to the "Visit" domain.
|
||||||
* Standard Visit Concepts are defined as Inpatient Visit, Outpatient Visit, Emergency Room Visit, Long Term Care Visit and combined ER and Inpatient Visit. The latter is necessary because it is close to impossible to separate the two in many EHR system, treating them interchangeably. To annotate this correctly, the visit concept "Emergency Room and Inpatient Visit" (concept_id=262) should be used.
|
* Standard Visit Concepts are defined as Inpatient Visit, Outpatient Visit, Emergency Room Visit, Long Term Care Visit and combined ER and Inpatient Visit. The latter is necessary because it is close to impossible to separate the two in many EHR system, treating them interchangeably. To annotate this correctly, the visit concept "Emergency Room and Inpatient Visit" (concept_id=262) should be used.
|
||||||
* Handling of death: In case when patient died during admission (Visit_Occurrence. discharge_disposition_concept_id = 4216643 'Patient died'), a record in the Death table should be created with death_type_concept_id = 44818516 (EHR discharge status "Expired").
|
* Handling of death: In the case when a patient died during admission (Visit_Occurrence. discharge_disposition_concept_id = 4216643 'Patient died'), a record in the Death table should be created with death_type_concept_id = 44818516 (EHR discharge status "Expired").
|
||||||
* Source Concepts from place of service vocabularies are mapped into these standard visit Concepts in the Standardized Vocabularies.
|
* Source Concepts from place of service vocabularies are mapped into these standard visit Concepts in the Standardized Vocabularies.
|
||||||
* At any one day, there could be more than one visit.
|
* At any one day, there could be more than one visit.
|
||||||
* One visit may involve multiple providers, in which case the ETL must specify how a single provider id is selected or leave the provider_id field null.
|
* One visit may involve multiple providers, in which case the ETL must specify how a single provider id is selected or leave the provider_id field null.
|
||||||
|
|
Loading…
Reference in New Issue