Add unit tests for all databases and DDLs (#431)

* Add github actions workflow to build package and run tests.

* update Description file

* rename .Rproj file.

* Consolidate 'create' functions into one file.

* Add tests for create functions.

* update description

* removed spaces in file and folder names. Regenerated ddl output. Tried to fix Field_Level.csv file.

* consolidate write functions into one file. Add execute function.

* update docs

* add tests for write and execute functions

* update documentation

* Add windows and linux runners in github actions.

* update github actions

* download drivers before running tests

* fix small error in setup test file.

* debug github actions

* debug github actions

* debug github actions

* debug github actions

* fix tiny bug

* comment out execute ddl test

* fix bug in test

* Add execute test back in

* revert accidental change in description

* add print statement for debugging schema error on github actions.

* Fix schema environment variable name

* Add comment to github actions workflow file.

* remove placeholder text in function documentation.

* Rename createdDdl.R to createDdl.R

* Hack-a-thon updates

Closes #81, #387, #239, #412, #391, #330, #408, #365, #306, #264

* Changed bigint to integer for consistency

* Updated DDLs

* Add tests for redshift. Clean up test setup file.

* Foreign key fixes

* Add imports and update docs.

* Fix bug in setup test script.

* update setup file

* Add tests for oracle and sql server. Move setup.R file.

* fix bug in setup

* debug tests on github

* debug github actions

* debug actions.

* debug actions

* debug actions.

* Add missing secrets to yaml!!

* debug actions

* test connection on all platforms

* add ddl execution

* add windows and linux runners

Co-authored-by: Adam Black <adam.black@odysseusinc.com>
Co-authored-by: Clair Blacketer <mblacke@its.jnj.com>
This commit is contained in:
Adam Black 2021-08-20 07:59:29 -04:00 committed by GitHub
parent b3fddfbb85
commit 532be98c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 1253 additions and 724 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -2,3 +2,4 @@
^\.Rproj\.user$
^LICENSE\.md$
.github/*
extras/*

View File

@ -33,6 +33,18 @@ jobs:
CDMDDLBASE_POSTGRESQL_PASSWORD: ${{ secrets.CDMDDLBASE_POSTGRESQL_PASSWORD }}
CDMDDLBASE_POSTGRESQL_SERVER: ${{ secrets.CDMDDLBASE_POSTGRESQL_SERVER }}
CDMDDLBASE_POSTGRESQL_SCHEMA: ${{ secrets.CDMDDLBASE_POSTGRESQL_SCHEMA }}
CDMDDLBASE_REDSHIFT_USER: ${{ secrets.CDMDDLBASE_REDSHIFT_USER }}
CDMDDLBASE_REDSHIFT_PASSWORD: ${{ secrets.CDMDDLBASE_REDSHIFT_PASSWORD }}
CDMDDLBASE_REDSHIFT_SERVER: ${{ secrets.CDMDDLBASE_REDSHIFT_SERVER }}
CDMDDLBASE_REDSHIFT_SCHEMA: ${{ secrets.CDMDDLBASE_REDSHIFT_SCHEMA }}
CDMDDLBASE_SQL_SERVER_USER: ${{ secrets.CDMDDLBASE_SQL_SERVER_USER }}
CDMDDLBASE_SQL_SERVER_PASSWORD: ${{ secrets.CDMDDLBASE_SQL_SERVER_PASSWORD }}
CDMDDLBASE_SQL_SERVER_SERVER: ${{ secrets.CDMDDLBASE_SQL_SERVER_SERVER }}
CDMDDLBASE_SQL_SERVER_CDM_SCHEMA: ${{ secrets.CDMDDLBASE_SQL_SERVER_CDM_SCHEMA }}
CDMDDLBASE_ORACLE_USER: ${{ secrets.CDMDDLBASE_ORACLE_USER }}
CDMDDLBASE_ORACLE_PASSWORD: ${{ secrets.CDMDDLBASE_ORACLE_PASSWORD }}
CDMDDLBASE_ORACLE_SERVER: ${{ secrets.CDMDDLBASE_ORACLE_SERVER }}
CDMDDLBASE_ORACLE_CDM_SCHEMA: ${{ secrets.CDMDDLBASE_ORACLE_CDM_SCHEMA }}
steps:
- uses: actions/checkout@v2

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.Rhistory
.RData
.Ruserdata
extras/CodeToRun.R

View File

@ -13,3 +13,6 @@ export(writeDdl)
export(writeForeignKeys)
export(writeIndex)
export(writePrimaryKeys)
importFrom(utils,download.file)
importFrom(utils,read.csv)
importFrom(utils,write.csv)

View File

@ -23,7 +23,7 @@
#'
#' @param mdFilesLocation Path to the root folder of the Wiki repository.
#' @param output_file Path to where the output CSV file should be written.
#'
#' @importFrom utils write.csv
#' @export
parseWiki <- function(mdFilesLocation, output_file) {
# mdFilesLocation <- "../CommonDataModel.wiki"

View File

@ -26,6 +26,7 @@
#'
#' @param cdmVersion The version of the CDM you are creating, e.g. 5.3, 5.4
#' @return A character string containing the OHDSQL DDL
#' @importFrom utils read.csv
#' @export
#' @examples
#' ddl <- createDdl("5.4")

View File

@ -14,7 +14,7 @@
#' downloadCurrentDdl("OHDSI/CommonDataModel",
#' pathToCsv="Sql%20Server/OMOP%20CDM%20sql%20server%20ddl.txt")
#' }
#'
#' @importFrom utils download.file
#' @export
downloadCurrentDdl <- function(githubPath="OHDSI/CommonDataModel",

View File

@ -1,7 +1,7 @@
#' List CDM versions supported by this package
#'
#' @return A character vector containing the support CDM versions in {major}.{minor} format.
#' @export
listSupportedVersions <- function() {
supportedVersions <- c("5.3", "5.4")
return(supportedVersions)

View File

@ -36,7 +36,7 @@ alter table @cdmDatabaseSchema.visit_occurrence add constraint fpk_visit_occurre
alter table @cdmDatabaseSchema.visit_occurrence add constraint fpk_visit_occurrence_admitted_from_concept_id foreign key (admitted_from_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.visit_occurrence add constraint fpk_visit_occurrence_discharge_to_concept_id foreign key (discharge_to_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.visit_occurrence add constraint fpk_visit_occurrence_discharged_to_concept_id foreign key (discharged_to_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.visit_occurrence add constraint fpk_visit_occurrence_preceding_visit_occurrence_id foreign key (preceding_visit_occurrence_id) references @cdmDatabaseSchema.visit_occurrence (visit_occurrence_id);
@ -54,11 +54,11 @@ alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_visi
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_admitted_from_concept_id foreign key (admitted_from_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_discharge_to_concept_id foreign key (discharge_to_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_discharged_to_concept_id foreign key (discharged_to_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_preceding_visit_detail_id foreign key (preceding_visit_detail_id) references @cdmDatabaseSchema.visit_detail (visit_detail_id);
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_visit_detail_parent_id foreign key (visit_detail_parent_id) references @cdmDatabaseSchema.visit_detail (visit_detail_id);
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_parent_visit_detail_id foreign key (parent_visit_detail_id) references @cdmDatabaseSchema.visit_detail (visit_detail_id);
alter table @cdmDatabaseSchema.visit_detail add constraint fpk_visit_detail_visit_occurrence_id foreign key (visit_occurrence_id) references @cdmDatabaseSchema.visit_occurrence (visit_occurrence_id);
@ -136,6 +136,10 @@ alter table @cdmDatabaseSchema.measurement add constraint fpk_measurement_visit_
alter table @cdmDatabaseSchema.measurement add constraint fpk_measurement_measurement_source_concept_id foreign key (measurement_source_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.measurement add constraint fpk_measurement_unit_source_concept_id foreign key (unit_source_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.measurement add constraint fpk_measurement_meas_event_field_concept_id foreign key (meas_event_field_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.observation add constraint fpk_observation_person_id foreign key (person_id) references @cdmDatabaseSchema.person (person_id);
alter table @cdmDatabaseSchema.observation add constraint fpk_observation_observation_concept_id foreign key (observation_concept_id) references @cdmDatabaseSchema.concept (concept_id);
@ -156,6 +160,8 @@ alter table @cdmDatabaseSchema.observation add constraint fpk_observation_visit_
alter table @cdmDatabaseSchema.observation add constraint fpk_observation_observation_source_concept_id foreign key (observation_source_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.observation add constraint fpk_observation_obs_event_field_concept_id foreign key (obs_event_field_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.death add constraint fpk_death_person_id foreign key (person_id) references @cdmDatabaseSchema.person (person_id);
alter table @cdmDatabaseSchema.death add constraint fpk_death_death_type_concept_id foreign key (death_type_concept_id) references @cdmDatabaseSchema.concept (concept_id);
@ -166,6 +172,8 @@ alter table @cdmDatabaseSchema.death add constraint fpk_death_cause_source_conce
alter table @cdmDatabaseSchema.note add constraint fpk_note_person_id foreign key (person_id) references @cdmDatabaseSchema.person (person_id);
alter table @cdmDatabaseSchema.note add constraint fpk_note_note_event_field_concept_id foreign key (note_event_field_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.note add constraint fpk_note_note_type_concept_id foreign key (note_type_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.note add constraint fpk_note_note_class_concept_id foreign key (note_class_concept_id) references @cdmDatabaseSchema.concept (concept_id);
@ -260,6 +268,20 @@ alter table @cdmDatabaseSchema.dose_era add constraint fpk_dose_era_unit_concept
alter table @cdmDatabaseSchema.condition_era add constraint fpk_condition_era_condition_concept_id foreign key (condition_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.episode add constraint fpk_episode_person_id foreign key (person_id) references @cdmDatabaseSchema.person (person_id);
alter table @cdmDatabaseSchema.episode add constraint fpk_episode_episode_concept_id foreign key (episode_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.episode add constraint fpk_episode_episode_object_concept_id foreign key (episode_object_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.episode add constraint fpk_episode_episode_type_concept_id foreign key (episode_type_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.episode add constraint fpk_episode_episode_source_concept_id foreign key (episode_source_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.episode_event add constraint fpk_episode_event_episode_id foreign key (episode_id) references @cdmDatabaseSchema.episode (episode_id);
alter table @cdmDatabaseSchema.episode_event add constraint fpk_episode_event_episode_event_field_concept_id foreign key (episode_event_field_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.metadata add constraint fpk_metadata_metadata_concept_id foreign key (metadata_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.metadata add constraint fpk_metadata_metadata_type_concept_id foreign key (metadata_type_concept_id) references @cdmDatabaseSchema.concept (concept_id);
@ -313,5 +335,3 @@ alter table @cdmDatabaseSchema.drug_strength add constraint fpk_drug_strength_de
alter table @cdmDatabaseSchema.cohort_definition add constraint fpk_cohort_definition_definition_type_concept_id foreign key (definition_type_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.cohort_definition add constraint fpk_cohort_definition_subject_concept_id foreign key (subject_concept_id) references @cdmDatabaseSchema.concept (concept_id);
alter table @cdmDatabaseSchema.attribute_definition add constraint fpk_attribute_definition_attribute_type_concept_id foreign key (attribute_type_concept_id) references @cdmDatabaseSchema.concept (concept_id);

View File

@ -45,8 +45,8 @@ create table @cdmDatabaseSchema.visit_occurrence (
visit_source_concept_id INT64,
admitted_from_concept_id INT64,
admitted_from_source_value STRING,
discharge_to_concept_id INT64,
discharge_to_source_value STRING,
discharged_to_concept_id INT64,
discharged_to_source_value STRING,
preceding_visit_occurrence_id INT64 );
--HINT DISTRIBUTE ON KEY (person_id)
@ -63,12 +63,12 @@ create table @cdmDatabaseSchema.visit_detail (
care_site_id INT64,
visit_detail_source_value STRING,
visit_detail_source_concept_id INT64,
admitted_from_source_value STRING,
admitted_from_concept_id INT64,
discharge_to_source_value STRING,
discharge_to_concept_id INT64,
admitted_from_source_value STRING,
discharged_to_source_value STRING,
discharged_to_concept_id INT64,
preceding_visit_detail_id INT64,
visit_detail_parent_id INT64,
parent_visit_detail_id INT64,
visit_occurrence_id INT64 not null );
--HINT DISTRIBUTE ON KEY (person_id)
@ -178,7 +178,10 @@ create table @cdmDatabaseSchema.measurement (
measurement_source_value STRING,
measurement_source_concept_id INT64,
unit_source_value STRING,
value_source_value STRING );
unit_source_concept_id INT64,
value_source_value STRING,
measurement_event_id INT64,
meas_event_field_concept_id INT64 );
--HINT DISTRIBUTE ON KEY (person_id)
create table @cdmDatabaseSchema.observation (
@ -200,7 +203,9 @@ create table @cdmDatabaseSchema.observation (
observation_source_concept_id INT64,
unit_source_value STRING,
qualifier_source_value STRING,
value_source_value STRING );
value_source_value STRING,
observation_event_id INT64,
obs_event_field_concept_id INT64 );
--HINT DISTRIBUTE ON KEY (person_id)
create table @cdmDatabaseSchema.death (
@ -216,6 +221,8 @@ create table @cdmDatabaseSchema.death (
create table @cdmDatabaseSchema.note (
note_id INT64 not null,
person_id INT64 not null,
note_event_id INT64,
note_event_field_concept_id INT64,
note_date date not null,
note_datetime datetime null,
note_type_concept_id INT64 not null,
@ -386,13 +393,37 @@ create table @cdmDatabaseSchema.condition_era (
condition_era_end_date datetime not null,
condition_occurrence_count INT64 );
--HINT DISTRIBUTE ON KEY (person_id)
create table @cdmDatabaseSchema.episode (
episode_id INT64 not null,
person_id INT64 not null,
episode_concept_id INT64 not null,
episode_start_date date not null,
episode_start_datetime datetime null,
episode_end_date date null,
episode_end_datetime datetime null,
episode_parent_id INT64,
episode_number INT64,
episode_object_concept_id INT64 not null,
episode_type_concept_id INT64 not null,
episode_source_value STRING,
episode_source_concept_id INT64 );
--HINT DISTRIBUTE ON RANDOM
create table @cdmDatabaseSchema.episode_event (
episode_id INT64 not null,
event_id INT64 not null,
episode_event_field_concept_id INT64 not null );
--HINT DISTRIBUTE ON RANDOM
create table @cdmDatabaseSchema.metadata (
metadata_id INT64 not null,
metadata_concept_id INT64 not null,
metadata_type_concept_id INT64 not null,
name STRING not null,
value_as_string STRING,
value_as_concept_id INT64,
value_as_number FLOAT64 null,
metadata_date date null,
metadata_datetime datetime null );
@ -501,6 +532,13 @@ create table @cdmDatabaseSchema.drug_strength (
valid_end_date date not null,
invalid_reason STRING );
--HINT DISTRIBUTE ON RANDOM
create table @cdmDatabaseSchema.cohort (
cohort_definition_id INT64 not null,
subject_id INT64 not null,
cohort_start_date date not null,
cohort_end_date date not null );
--HINT DISTRIBUTE ON RANDOM
create table @cdmDatabaseSchema.cohort_definition (
cohort_definition_id INT64 not null,
@ -509,12 +547,4 @@ create table @cdmDatabaseSchema.cohort_definition (
definition_type_concept_id INT64 not null,
cohort_definition_syntax STRING,
subject_concept_id INT64 not null,
cohort_initiation_date date null );
--HINT DISTRIBUTE ON RANDOM
create table @cdmDatabaseSchema.attribute_definition (
attribute_definition_id INT64 not null,
attribute_name STRING not null,
attribute_description STRING,
attribute_type_concept_id INT64 not null,
attribute_syntax STRING );
cohort_initiation_date date null );

View File

@ -42,6 +42,10 @@ alter table @cdmDatabaseSchema.dose_era add constraint xpk_dose_era primary key
alter table @cdmDatabaseSchema.condition_era add constraint xpk_condition_era primary key nonclustered (condition_era_id);
alter table @cdmDatabaseSchema.episode add constraint xpk_episode primary key nonclustered (episode_id);
alter table @cdmDatabaseSchema.metadata add constraint xpk_metadata primary key nonclustered (metadata_id);
alter table @cdmDatabaseSchema.concept add constraint xpk_concept primary key nonclustered (concept_id);
alter table @cdmDatabaseSchema.vocabulary add constraint xpk_vocabulary primary key nonclustered (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -45,8 +45,8 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value VARCHAR(50),
discharge_to_concept_id integer NULL,
discharge_to_source_value VARCHAR(50),
discharged_to_concept_id integer NULL,
discharged_to_source_value VARCHAR(50),
preceding_visit_occurrence_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -63,12 +63,12 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (
care_site_id integer NULL,
visit_detail_source_value VARCHAR(50),
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value VARCHAR(50),
admitted_from_concept_id Integer NULL,
discharge_to_source_value VARCHAR(50),
discharge_to_concept_id integer NULL,
admitted_from_source_value VARCHAR(50),
discharged_to_source_value VARCHAR(50),
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id INT );
--HINT DISTRIBUTE ON KEY (person_id)
@ -178,7 +178,10 @@ CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (
measurement_source_value VARCHAR(50),
measurement_source_concept_id integer NULL,
unit_source_value VARCHAR(50),
value_source_value VARCHAR(50) );
unit_source_concept_id integer NULL,
value_source_value VARCHAR(50),
measurement_event_id BIGINT,
meas_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
@ -200,7 +203,9 @@ CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
observation_source_concept_id integer NULL,
unit_source_value VARCHAR(50),
qualifier_source_value VARCHAR(50),
value_source_value VARCHAR(50) );
value_source_value VARCHAR(50),
observation_event_id BIGINT,
obs_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.DEATH (
@ -216,6 +221,8 @@ CREATE TABLE @cdmDatabaseSchema.DEATH (
CREATE TABLE @cdmDatabaseSchema.NOTE (
note_id INT,
person_id INT,
note_event_id BIGINT,
note_event_field_concept_id integer NULL,
note_date TIMESTAMP,
note_datetime TIMESTAMP,
note_type_concept_id INT,
@ -386,13 +393,37 @@ CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (
condition_era_end_date TIMESTAMP,
condition_occurrence_count integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.EPISODE (
episode_id INT,
person_id INT,
episode_concept_id INT,
episode_start_date TIMESTAMP,
episode_start_datetime TIMESTAMP,
episode_end_date TIMESTAMP,
episode_end_datetime TIMESTAMP,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id INT,
episode_type_concept_id INT,
episode_source_value VARCHAR(50),
episode_source_concept_id integer NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (
episode_id INT,
event_id INT,
episode_event_field_concept_id INT );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (
metadata_id INT,
metadata_concept_id INT,
metadata_type_concept_id INT,
name VARCHAR(250),
value_as_string VARCHAR(250),
value_as_concept_id integer NULL,
value_as_number FLOAT,
metadata_date TIMESTAMP,
metadata_datetime TIMESTAMP );
@ -501,6 +532,13 @@ CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (
valid_end_date TIMESTAMP,
invalid_reason VARCHAR(1) );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT (
cohort_definition_id INT,
subject_id INT,
cohort_start_date TIMESTAMP,
cohort_end_date TIMESTAMP );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
cohort_definition_id INT,
@ -509,12 +547,4 @@ CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
definition_type_concept_id INT,
cohort_definition_syntax VARCHAR(MAX),
subject_concept_id INT,
cohort_initiation_date TIMESTAMP );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION (
attribute_definition_id INT,
attribute_name VARCHAR(255),
attribute_description VARCHAR(MAX),
attribute_type_concept_id INT,
attribute_syntax VARCHAR(MAX) );
cohort_initiation_date TIMESTAMP );

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY NONCLUSTERED (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY NONCLUSTERED (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY NONCLUSTERED (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY NONCLUSTERED (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY NONCLUSTERED (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -45,8 +45,8 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharge_to_concept_id integer NULL,
discharge_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -63,12 +63,12 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value Varchar(50) NULL,
admitted_from_concept_id Integer NULL,
discharge_to_source_value Varchar(50) NULL,
discharge_to_concept_id integer NULL,
admitted_from_source_value Varchar(50) NULL,
discharged_to_source_value Varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -178,7 +178,10 @@ CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (
measurement_source_value varchar(50) NULL,
measurement_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id bigint NULL,
meas_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
@ -200,7 +203,9 @@ CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
value_source_value varchar(50) NULL,
observation_event_id bigint NULL,
obs_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.DEATH (
@ -216,6 +221,8 @@ CREATE TABLE @cdmDatabaseSchema.DEATH (
CREATE TABLE @cdmDatabaseSchema.NOTE (
note_id integer NOT NULL,
person_id integer NOT NULL,
note_event_id bigint NULL,
note_event_field_concept_id integer NULL,
note_date date NOT NULL,
note_datetime TIMESTAMP NULL,
note_type_concept_id integer NOT NULL,
@ -386,13 +393,37 @@ CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (
condition_era_end_date TIMESTAMP NOT NULL,
condition_occurrence_count integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.EPISODE (
episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime TIMESTAMP NULL,
episode_end_date date NULL,
episode_end_datetime TIMESTAMP NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (
episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (
metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number FLOAT(6) NULL,
metadata_date date NULL,
metadata_datetime TIMESTAMP NULL );
@ -501,6 +532,13 @@ CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT (
cohort_definition_id integer NOT NULL,
subject_id integer NOT NULL,
cohort_start_date date NOT NULL,
cohort_end_date date NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
cohort_definition_id integer NOT NULL,
@ -509,12 +547,4 @@ CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
definition_type_concept_id integer NOT NULL,
cohort_definition_syntax VARCHAR(1000) NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.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 );
cohort_initiation_date date NULL );

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -45,8 +45,8 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharge_to_concept_id integer NULL,
discharge_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -63,12 +63,12 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value Varchar(50) NULL,
admitted_from_concept_id Integer NULL,
discharge_to_source_value Varchar(50) NULL,
discharge_to_concept_id integer NULL,
admitted_from_source_value Varchar(50) NULL,
discharged_to_source_value Varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -178,7 +178,10 @@ CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (
measurement_source_value varchar(50) NULL,
measurement_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id NUMBER(19) NULL,
meas_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
@ -200,7 +203,9 @@ CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
value_source_value varchar(50) NULL,
observation_event_id NUMBER(19) NULL,
obs_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.DEATH (
@ -216,6 +221,8 @@ CREATE TABLE @cdmDatabaseSchema.DEATH (
CREATE TABLE @cdmDatabaseSchema.NOTE (
note_id integer NOT NULL,
person_id integer NOT NULL,
note_event_id NUMBER(19) NULL,
note_event_field_concept_id integer NULL,
note_date date NOT NULL,
note_datetime TIMESTAMP NULL,
note_type_concept_id integer NOT NULL,
@ -386,13 +393,37 @@ CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (
condition_era_end_date TIMESTAMP NOT NULL,
condition_occurrence_count integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.EPISODE (
episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime TIMESTAMP NULL,
episode_end_date date NULL,
episode_end_datetime TIMESTAMP NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (
episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (
metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number float NULL,
metadata_date date NULL,
metadata_datetime TIMESTAMP NULL );
@ -501,6 +532,13 @@ CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT (
cohort_definition_id integer NOT NULL,
subject_id integer NOT NULL,
cohort_start_date date NOT NULL,
cohort_end_date date NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
cohort_definition_id integer NOT NULL,
@ -509,12 +547,4 @@ CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
definition_type_concept_id integer NOT NULL,
cohort_definition_syntax CLOB NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.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 );
cohort_initiation_date date NULL );

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -44,8 +44,8 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharge_to_concept_id integer NULL,
discharge_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL )
WITH (DISTRIBUTION = HASH(person_id));
@ -62,12 +62,12 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (visi
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value Varchar(50) NULL,
admitted_from_concept_id Integer NULL,
discharge_to_source_value Varchar(50) NULL,
discharge_to_concept_id integer NULL,
admitted_from_source_value Varchar(50) NULL,
discharged_to_source_value Varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL )
WITH (DISTRIBUTION = HASH(person_id));
@ -177,7 +177,10 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (measu
measurement_source_value varchar(50) NULL,
measurement_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
value_source_value varchar(50) NULL )
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id bigint NULL,
meas_event_field_concept_id integer NULL )
WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE ON KEY (person_id)
@ -199,7 +202,9 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.OBSERVATION (obser
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL )
value_source_value varchar(50) NULL,
observation_event_id bigint NULL,
obs_event_field_concept_id integer NULL )
WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE ON KEY (person_id)
@ -215,6 +220,8 @@ WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE ON KEY (person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.NOTE (note_id integer NOT NULL,
person_id integer NOT NULL,
note_event_id bigint NULL,
note_event_field_concept_id integer NULL,
note_date date NOT NULL,
note_datetime datetime NULL,
note_type_concept_id integer NOT NULL,
@ -386,12 +393,36 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (con
condition_occurrence_count integer NULL )
WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE ON KEY (person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.EPISODE (episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime datetime NULL,
episode_end_date date NULL,
episode_end_datetime datetime NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL )
WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE ON RANDOM
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.METADATA (metadata_concept_id integer NOT NULL,
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL )
WITH (DISTRIBUTION = REPLICATE);
--HINT DISTRIBUTE ON RANDOM
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.METADATA (metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number float NULL,
metadata_date date NULL,
metadata_datetime datetime NULL )
WITH (DISTRIBUTION = REPLICATE);
@ -501,6 +532,13 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (dru
invalid_reason varchar(1) NULL )
WITH (DISTRIBUTION = REPLICATE);
--HINT DISTRIBUTE ON RANDOM
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.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));
--HINT DISTRIBUTE ON RANDOM
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (cohort_definition_id integer NOT NULL,
cohort_definition_name varchar(255) NOT NULL,
@ -509,12 +547,4 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION
cohort_definition_syntax VARCHAR(1000) NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL )
WITH (DISTRIBUTION = REPLICATE);
--HINT DISTRIBUTE ON RANDOM
IF XACT_STATE() = 1 COMMIT; CREATE TABLE @cdmDatabaseSchema.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);

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY NONCLUSTERED (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY NONCLUSTERED (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY NONCLUSTERED (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY NONCLUSTERED (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY NONCLUSTERED (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -45,8 +45,8 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharge_to_concept_id integer NULL,
discharge_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -63,12 +63,12 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value Varchar(50) NULL,
admitted_from_concept_id Integer NULL,
discharge_to_source_value Varchar(50) NULL,
discharge_to_concept_id integer NULL,
admitted_from_source_value Varchar(50) NULL,
discharged_to_source_value Varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -178,7 +178,10 @@ CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (
measurement_source_value varchar(50) NULL,
measurement_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id bigint NULL,
meas_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
@ -200,7 +203,9 @@ CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
value_source_value varchar(50) NULL,
observation_event_id bigint NULL,
obs_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.DEATH (
@ -216,6 +221,8 @@ CREATE TABLE @cdmDatabaseSchema.DEATH (
CREATE TABLE @cdmDatabaseSchema.NOTE (
note_id integer NOT NULL,
person_id integer NOT NULL,
note_event_id bigint NULL,
note_event_field_concept_id integer NULL,
note_date date NOT NULL,
note_datetime TIMESTAMP NULL,
note_type_concept_id integer NOT NULL,
@ -386,13 +393,37 @@ CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (
condition_era_end_date TIMESTAMP NOT NULL,
condition_occurrence_count integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.EPISODE (
episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime TIMESTAMP NULL,
episode_end_date date NULL,
episode_end_datetime TIMESTAMP NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (
episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (
metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number NUMERIC NULL,
metadata_date date NULL,
metadata_datetime TIMESTAMP NULL );
@ -501,6 +532,13 @@ CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT (
cohort_definition_id integer NOT NULL,
subject_id integer NOT NULL,
cohort_start_date date NOT NULL,
cohort_end_date date NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
cohort_definition_id integer NOT NULL,
@ -509,12 +547,4 @@ CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
definition_type_concept_id integer NOT NULL,
cohort_definition_syntax TEXT NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.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 );
cohort_initiation_date date NULL );

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -44,8 +44,8 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (visit_occurrence_id integer N
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharge_to_concept_id integer NULL,
discharge_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL )
DISTKEY(person_id);
@ -62,12 +62,12 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (visit_detail_id integer NOT NULL,
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value Varchar(50) NULL,
admitted_from_concept_id Integer NULL,
discharge_to_source_value Varchar(50) NULL,
discharge_to_concept_id integer NULL,
admitted_from_source_value Varchar(50) NULL,
discharged_to_source_value Varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL )
DISTKEY(person_id);
@ -177,7 +177,10 @@ CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (measurement_id integer NOT 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 )
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id bigint NULL,
meas_event_field_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
@ -199,7 +202,9 @@ CREATE TABLE @cdmDatabaseSchema.OBSERVATION (observation_id integer NOT NULL,
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL )
value_source_value varchar(50) NULL,
observation_event_id bigint NULL,
obs_event_field_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
@ -215,6 +220,8 @@ DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.NOTE (note_id integer NOT NULL,
person_id integer NOT NULL,
note_event_id bigint NULL,
note_event_field_concept_id integer NULL,
note_date date NOT NULL,
note_datetime TIMESTAMP NULL,
note_type_concept_id integer NOT NULL,
@ -386,12 +393,36 @@ CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (condition_era_id integer NOT NUL
condition_occurrence_count integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.EPISODE (episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime TIMESTAMP NULL,
episode_end_date date NULL,
episode_end_datetime TIMESTAMP NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL )
DISTKEY(person_id);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (metadata_concept_id integer NOT NULL,
CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number float NULL,
metadata_date date NULL,
metadata_datetime TIMESTAMP NULL )
DISTSTYLE ALL;
@ -501,6 +532,13 @@ CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (drug_concept_id integer NOT NULL
invalid_reason varchar(1) NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.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);
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (cohort_definition_id integer NOT NULL,
cohort_definition_name varchar(255) NOT NULL,
@ -509,12 +547,4 @@ CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (cohort_definition_id integer
cohort_definition_syntax varchar(MAX) NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL )
DISTSTYLE ALL;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.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;

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY (vocabulary_id);

View File

@ -36,7 +36,7 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRE
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE ADD CONSTRAINT fpk_VISIT_OCCURRENCE_preceding_visit_occurrence_id FOREIGN KEY (preceding_visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -54,11 +54,11 @@ ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visi
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_admitted_from_concept_id FOREIGN KEY (admitted_from_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharge_to_concept_id FOREIGN KEY (discharge_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_discharged_to_concept_id FOREIGN KEY (discharged_to_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_preceding_visit_detail_id FOREIGN KEY (preceding_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_detail_parent_id FOREIGN KEY (visit_detail_parent_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_parent_visit_detail_id FOREIGN KEY (parent_visit_detail_id) REFERENCES @cdmDatabaseSchema.VISIT_DETAIL (VISIT_DETAIL_ID);
ALTER TABLE @cdmDatabaseSchema.VISIT_DETAIL ADD CONSTRAINT fpk_VISIT_DETAIL_visit_occurrence_id FOREIGN KEY (visit_occurrence_id) REFERENCES @cdmDatabaseSchema.VISIT_OCCURRENCE (VISIT_OCCURRENCE_ID);
@ -136,6 +136,10 @@ ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_visit_
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_measurement_source_concept_id FOREIGN KEY (measurement_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_unit_source_concept_id FOREIGN KEY (unit_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.MEASUREMENT ADD CONSTRAINT fpk_MEASUREMENT_meas_event_field_concept_id FOREIGN KEY (meas_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_concept_id FOREIGN KEY (observation_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -156,6 +160,8 @@ ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_visit_
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_observation_source_concept_id FOREIGN KEY (observation_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.OBSERVATION ADD CONSTRAINT fpk_OBSERVATION_obs_event_field_concept_id FOREIGN KEY (obs_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_death_type_concept_id FOREIGN KEY (death_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -166,6 +172,8 @@ ALTER TABLE @cdmDatabaseSchema.DEATH ADD CONSTRAINT fpk_DEATH_cause_source_conce
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_event_field_concept_id FOREIGN KEY (note_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_type_concept_id FOREIGN KEY (note_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.NOTE ADD CONSTRAINT fpk_NOTE_note_class_concept_id FOREIGN KEY (note_class_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -260,6 +268,20 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT fpk_DOSE_ERA_unit_concept
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT fpk_CONDITION_ERA_condition_concept_id FOREIGN KEY (condition_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_person_id FOREIGN KEY (person_id) REFERENCES @cdmDatabaseSchema.PERSON (PERSON_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_concept_id FOREIGN KEY (episode_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_object_concept_id FOREIGN KEY (episode_object_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_type_concept_id FOREIGN KEY (episode_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT fpk_EPISODE_episode_source_concept_id FOREIGN KEY (episode_source_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_id FOREIGN KEY (episode_id) REFERENCES @cdmDatabaseSchema.EPISODE (EPISODE_ID);
ALTER TABLE @cdmDatabaseSchema.EPISODE_EVENT ADD CONSTRAINT fpk_EPISODE_EVENT_episode_event_field_concept_id FOREIGN KEY (episode_event_field_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_concept_id FOREIGN KEY (metadata_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT fpk_METADATA_metadata_type_concept_id FOREIGN KEY (metadata_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
@ -313,5 +335,3 @@ ALTER TABLE @cdmDatabaseSchema.DRUG_STRENGTH ADD CONSTRAINT fpk_DRUG_STRENGTH_de
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_definition_type_concept_id FOREIGN KEY (definition_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.COHORT_DEFINITION ADD CONSTRAINT fpk_COHORT_DEFINITION_subject_concept_id FOREIGN KEY (subject_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);
ALTER TABLE @cdmDatabaseSchema.ATTRIBUTE_DEFINITION ADD CONSTRAINT fpk_ATTRIBUTE_DEFINITION_attribute_type_concept_id FOREIGN KEY (attribute_type_concept_id) REFERENCES @cdmDatabaseSchema.CONCEPT (CONCEPT_ID);

View File

@ -45,8 +45,8 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_OCCURRENCE (
visit_source_concept_id integer NULL,
admitted_from_concept_id integer NULL,
admitted_from_source_value varchar(50) NULL,
discharge_to_concept_id integer NULL,
discharge_to_source_value varchar(50) NULL,
discharged_to_concept_id integer NULL,
discharged_to_source_value varchar(50) NULL,
preceding_visit_occurrence_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -63,12 +63,12 @@ CREATE TABLE @cdmDatabaseSchema.VISIT_DETAIL (
care_site_id integer NULL,
visit_detail_source_value varchar(50) NULL,
visit_detail_source_concept_id Integer NULL,
admitted_from_source_value Varchar(50) NULL,
admitted_from_concept_id Integer NULL,
discharge_to_source_value Varchar(50) NULL,
discharge_to_concept_id integer NULL,
admitted_from_source_value Varchar(50) NULL,
discharged_to_source_value Varchar(50) NULL,
discharged_to_concept_id integer NULL,
preceding_visit_detail_id integer NULL,
visit_detail_parent_id integer NULL,
parent_visit_detail_id integer NULL,
visit_occurrence_id integer NOT NULL );
--HINT DISTRIBUTE ON KEY (person_id)
@ -178,7 +178,10 @@ CREATE TABLE @cdmDatabaseSchema.MEASUREMENT (
measurement_source_value varchar(50) NULL,
measurement_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
unit_source_concept_id integer NULL,
value_source_value varchar(50) NULL,
measurement_event_id bigint NULL,
meas_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
@ -200,7 +203,9 @@ CREATE TABLE @cdmDatabaseSchema.OBSERVATION (
observation_source_concept_id integer NULL,
unit_source_value varchar(50) NULL,
qualifier_source_value varchar(50) NULL,
value_source_value varchar(50) NULL );
value_source_value varchar(50) NULL,
observation_event_id bigint NULL,
obs_event_field_concept_id integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.DEATH (
@ -216,6 +221,8 @@ CREATE TABLE @cdmDatabaseSchema.DEATH (
CREATE TABLE @cdmDatabaseSchema.NOTE (
note_id integer NOT NULL,
person_id integer NOT NULL,
note_event_id bigint NULL,
note_event_field_concept_id integer NULL,
note_date date NOT NULL,
note_datetime datetime NULL,
note_type_concept_id integer NOT NULL,
@ -386,13 +393,37 @@ CREATE TABLE @cdmDatabaseSchema.CONDITION_ERA (
condition_era_end_date datetime NOT NULL,
condition_occurrence_count integer NULL );
--HINT DISTRIBUTE ON KEY (person_id)
CREATE TABLE @cdmDatabaseSchema.EPISODE (
episode_id integer NOT NULL,
person_id integer NOT NULL,
episode_concept_id integer NOT NULL,
episode_start_date date NOT NULL,
episode_start_datetime datetime NULL,
episode_end_date date NULL,
episode_end_datetime datetime NULL,
episode_parent_id integer NULL,
episode_number integer NULL,
episode_object_concept_id integer NOT NULL,
episode_type_concept_id integer NOT NULL,
episode_source_value varchar(50) NULL,
episode_source_concept_id integer NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.EPISODE_EVENT (
episode_id integer NOT NULL,
event_id integer NOT NULL,
episode_event_field_concept_id integer NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.METADATA (
metadata_id integer NOT NULL,
metadata_concept_id integer NOT NULL,
metadata_type_concept_id integer NOT NULL,
name varchar(250) NOT NULL,
value_as_string varchar(250) NULL,
value_as_concept_id integer NULL,
value_as_number float NULL,
metadata_date date NULL,
metadata_datetime datetime NULL );
@ -501,6 +532,13 @@ CREATE TABLE @cdmDatabaseSchema.DRUG_STRENGTH (
valid_end_date date NOT NULL,
invalid_reason varchar(1) NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT (
cohort_definition_id integer NOT NULL,
subject_id integer NOT NULL,
cohort_start_date date NOT NULL,
cohort_end_date date NOT NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
cohort_definition_id integer NOT NULL,
@ -509,12 +547,4 @@ CREATE TABLE @cdmDatabaseSchema.COHORT_DEFINITION (
definition_type_concept_id integer NOT NULL,
cohort_definition_syntax varchar(MAX) NULL,
subject_concept_id integer NOT NULL,
cohort_initiation_date date NULL );
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE @cdmDatabaseSchema.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 );
cohort_initiation_date date NULL );

View File

@ -42,6 +42,10 @@ ALTER TABLE @cdmDatabaseSchema.DOSE_ERA ADD CONSTRAINT xpk_DOSE_ERA PRIMARY KEY
ALTER TABLE @cdmDatabaseSchema.CONDITION_ERA ADD CONSTRAINT xpk_CONDITION_ERA PRIMARY KEY NONCLUSTERED (condition_era_id);
ALTER TABLE @cdmDatabaseSchema.EPISODE ADD CONSTRAINT xpk_EPISODE PRIMARY KEY NONCLUSTERED (episode_id);
ALTER TABLE @cdmDatabaseSchema.METADATA ADD CONSTRAINT xpk_METADATA PRIMARY KEY NONCLUSTERED (metadata_id);
ALTER TABLE @cdmDatabaseSchema.CONCEPT ADD CONSTRAINT xpk_CONCEPT PRIMARY KEY NONCLUSTERED (concept_id);
ALTER TABLE @cdmDatabaseSchema.VOCABULARY ADD CONSTRAINT xpk_VOCABULARY PRIMARY KEY NONCLUSTERED (vocabulary_id);

View File

@ -1,224 +1,230 @@
cdmTableName,cdmFieldName,isRequired,cdmDatatype,userGuidance,etlConventions,isPrimaryKey,isForeignKey,fkTableName,fkFieldName,fkDomain,fkClass,unique DQ identifiers
PERSON,person_id,Yes,integer,It is assumed that every person with a different unique identifier is in fact a different person and should be treated independently.,"Any person linkage that needs to occur to uniquely identify Persons ought to be done prior to writing this table. This identifier can be the original id from the source data provided if it is an integer, otherwise it can be an autogenerated number.",Yes,No,,,,,
PERSON,gender_concept_id,Yes,integer,This field is meant to capture the biological sex at birth of the Person. This field should not be used to study gender identity issues.,Use the gender or sex value present in the data under the assumption that it is the biological sex at birth. If the source data captures gender identity it should be stored in the [OBSERVATION](https://ohdsi.github.io/CommonDataModel/cdm531.html#observation) table. [Accepted gender concepts](http://athena.ohdsi.org/search-terms/terms?domain=Gender&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Gender,,
PERSON,year_of_birth,Yes,integer,Compute age using year_of_birth.,"For data sources with date of birth, the year should be extracted. For data sources where the year of birth is not available, the approximate year of birth could be derived based on age group categorization, if available.",No,No,,,,,
PERSON,month_of_birth,No,integer,,"For data sources that provide the precise date of birth, the month should be extracted and stored in this field.",No,No,,,,,
PERSON,day_of_birth,No,integer,,"For data sources that provide the precise date of birth, the day should be extracted and stored in this field.",No,No,,,,,
PERSON,birth_datetime,No,datetime,,"This field is not required but highly encouraged. For data sources that provide the precise datetime of birth, that value should be stored in this field. If birth_datetime is not provided in the source, use the following logic to infer the date: If day_of_birth is null and month_of_birth is not null then use the first of the month in that year. If month_of_birth is null or if day_of_birth AND month_of_birth are both null and the person has records during their year of birth then use the date of the earliest record, otherwise use the 15th of June of that year. If time of birth is not given use midnight (00:00:0000).",No,No,,,,,
PERSON,race_concept_id,Yes,integer,This field captures race or ethnic background of the person.,"Only use this field if you have information about race or ethnic background. The Vocabulary contains Concepts about the main races and ethnic backgrounds in a hierarchical system. Due to the imprecise nature of human races and ethnic backgrounds, this is not a perfect system. Mixed races are not supported. If a clear race or ethnic background cannot be established, use Concept_Id 0. [Accepted Race Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Race&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Race,,
PERSON,ethnicity_concept_id,Yes,integer,"This field captures Ethnicity as defined by the Office of Management and Budget (OMB) of the US Government: it distinguishes only between ""Hispanic"" and ""Not Hispanic"". Races and ethnic backgrounds are not stored here.",Only use this field if you have US-based data and a source of this information. Do not attempt to infer Ethnicity from the race or ethnic background of the Person. [Accepted ethnicity concepts](http://athena.ohdsi.org/search-terms/terms?domain=Ethnicity&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Ethnicity,,
PERSON,location_id,No,integer,The location refers to the physical address of the person. This field should capture the last known location of the person. ,"Put the location_id from the [LOCATION](https://ohdsi.github.io/CommonDataModel/cdm531.html#location) table here that represents the most granular location information for the person. This could represent anything from postal code or parts thereof, state, or county for example. Since many databases contain deidentified data, it is common that the precision of the location is reduced to prevent re-identification. This field should capture the last known location. ",No,Yes,LOCATION,LOCATION_ID,,,
PERSON,provider_id,No,integer,The Provider refers to the last known primary care provider (General Practitioner).,"Put the provider_id from the [PROVIDER](https://ohdsi.github.io/CommonDataModel/cdm531.html#provider) table of the last known general practitioner of the person. If there are multiple providers, it is up to the ETL to decide which to put here.",No,Yes,PROVIDER,PROVIDER_ID,,,
PERSON,care_site_id,No,integer,The Care Site refers to where the Provider typically provides the primary care.,,No,Yes,CARE_SITE,CARE_SITE_ID,,,
PERSON,person_source_value,No,varchar(50),Use this field to link back to persons in the source data. This is typically used for error checking of ETL logic.,Some use cases require the ability to link back to persons in the source data. This field allows for the storing of the person value as it appears in the source. This field is not required but strongly recommended.,No,No,,,,,
PERSON,gender_source_value,No,varchar(50),This field is used to store the biological sex of the person from the source data. It is not intended for use in standard analytics but for reference only.,Put the biological sex of the person as it appears in the source data.,No,No,,,,,
PERSON,gender_source_concept_id,No,integer,"Due to the small number of options, this tends to be zero.","If the source data codes biological sex in a non-standard vocabulary, store the concept_id here.",No,Yes,CONCEPT,CONCEPT_ID,,,
PERSON,race_source_value,No,varchar(50),This field is used to store the race of the person from the source data. It is not intended for use in standard analytics but for reference only.,Put the race of the person as it appears in the source data.,No,No,,,,,
PERSON,race_source_concept_id,No,integer,"Due to the small number of options, this tends to be zero.",If the source data codes race in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PERSON,ethnicity_source_value,No,varchar(50),This field is used to store the ethnicity of the person from the source data. It is not intended for use in standard analytics but for reference only.,"If the person has an ethnicity other than the OMB standard of ""Hispanic"" or ""Not Hispanic"" store that value from the source data here.",No,No,,,,,
PERSON,ethnicity_source_concept_id,No,integer,"Due to the small number of options, this tends to be zero.","If the source data codes ethnicity in an OMOP supported vocabulary, store the concept_id here.",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION_PERIOD,observation_period_id,Yes,integer,A Person can have multiple discrete Observation Periods which are identified by the Observation_Period_Id.,Assign a unique observation_period_id to each discrete Observation Period for a Person.,Yes,No,,,,,
OBSERVATION_PERIOD,person_id,Yes,integer,The Person ID of the PERSON record for which the Observation Period is recorded.,,No,Yes,PERSON,PERSON_ID,,,
OBSERVATION_PERIOD,observation_period_start_date,Yes,date,Use this date to determine the start date of the Observation Period.,"It is often the case that the idea of Observation Periods does not exist in source data. In those cases, the observation_period_start_date can be inferred as the earliest Event date available for the Person. In insurance claim data, the Observation Period can be considered as the time period the Person is enrolled with a payer. If a Person switches plans but stays with the same payer, and therefore capturing of data continues, that change would be captured in [PAYER_PLAN_PERIOD](https://ohdsi.github.io/CommonDataModel/cdm531.html#payer_plan_period).",No,No,,,,,
OBSERVATION_PERIOD,observation_period_end_date,Yes,date,Use this date to determine the end date of the period for which we can assume that all events for a Person are recorded.,"It is often the case that the idea of Observation Periods does not exist in source data. In those cases, the observation_period_end_date can be inferred as the last Event date available for the Person. In insurance claim data, the Observation Period can be considered as the time period the Person is enrolled with a payer.",No,No,,,,,
OBSERVATION_PERIOD,period_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Observation Period as in whether the period was determined from an insurance enrollment file, EHR healthcare encounters, or other sources.",Choose the observation_period_type_concept_id that best represents how the period was determined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
VISIT_OCCURRENCE,visit_occurrence_id,Yes,integer,Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit.,This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time.,Yes,No,,,,,
VISIT_OCCURRENCE,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
VISIT_OCCURRENCE,visit_concept_id,Yes,integer,"This field contains a concept id representing the kind of visit, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain.","Populate this field based on the kind of visit that took place for the person. For example this could be ""Inpatient Visit"", ""Outpatient Visit"", ""Ambulatory Visit"", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,visit_start_date,Yes,date,"For inpatient visits, the start date is typically the admission date. For outpatient visits the start date and end date will be the same.","When populating VISIT_START_DATE, you should think about the patient experience to make decisions on how to define visits. In the case of an inpatient visit this should be the date the patient was admitted to the hospital or institution. In all other cases this should be the date of the patient-provider interaction.",No,No,,,,,
VISIT_OCCURRENCE,visit_start_datetime,No,datetime,,"If no time is given for the start date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
cdmTableName,cdmFieldName,isRequired,cdmDatatype,userGuidance,etlConventions,isPrimaryKey,isForeignKey,fkTableName,fkFieldName,fkDomain,fkClass,unique DQ identifiers
PERSON,person_id,Yes,integer,It is assumed that every person with a different unique identifier is in fact a different person and should be treated independently.,"Any person linkage that needs to occur to uniquely identify Persons ought to be done prior to writing this table. This identifier can be the original id from the source data provided if it is an integer, otherwise it can be an autogenerated number.",Yes,No,,,,,
PERSON,gender_concept_id,Yes,integer,This field is meant to capture the biological sex at birth of the Person. This field should not be used to study gender identity issues.,Use the gender or sex value present in the data under the assumption that it is the biological sex at birth. If the source data captures gender identity it should be stored in the [OBSERVATION](https://ohdsi.github.io/CommonDataModel/cdm531.html#observation) table. [Accepted gender concepts](http://athena.ohdsi.org/search-terms/terms?domain=Gender&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Gender,,
PERSON,year_of_birth,Yes,integer,Compute age using year_of_birth.,"For data sources with date of birth, the year should be extracted. For data sources where the year of birth is not available, the approximate year of birth could be derived based on age group categorization, if available.",No,No,,,,,
PERSON,month_of_birth,No,integer,,"For data sources that provide the precise date of birth, the month should be extracted and stored in this field.",No,No,,,,,
PERSON,day_of_birth,No,integer,,"For data sources that provide the precise date of birth, the day should be extracted and stored in this field.",No,No,,,,,
PERSON,birth_datetime,No,datetime,,"This field is not required but highly encouraged. For data sources that provide the precise datetime of birth, that value should be stored in this field. If birth_datetime is not provided in the source, use the following logic to infer the date: If day_of_birth is null and month_of_birth is not null then use the first of the month in that year. If month_of_birth is null or if day_of_birth AND month_of_birth are both null and the person has records during their year of birth then use the date of the earliest record, otherwise use the 15th of June of that year. If time of birth is not given use midnight (00:00:0000).",No,No,,,,,
PERSON,race_concept_id,Yes,integer,This field captures race or ethnic background of the person.,"Only use this field if you have information about race or ethnic background. The Vocabulary contains Concepts about the main races and ethnic backgrounds in a hierarchical system. Due to the imprecise nature of human races and ethnic backgrounds, this is not a perfect system. Mixed races are not supported. If a clear race or ethnic background cannot be established, use Concept_Id 0. [Accepted Race Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Race&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Race,,
PERSON,ethnicity_concept_id,Yes,integer,"This field captures Ethnicity as defined by the Office of Management and Budget (OMB) of the US Government: it distinguishes only between ""Hispanic"" and ""Not Hispanic"". Races and ethnic backgrounds are not stored here.",Only use this field if you have US-based data and a source of this information. Do not attempt to infer Ethnicity from the race or ethnic background of the Person. [Accepted ethnicity concepts](http://athena.ohdsi.org/search-terms/terms?domain=Ethnicity&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Ethnicity,,
PERSON,location_id,No,integer,The location refers to the physical address of the person. This field should capture the last known location of the person. ,"Put the location_id from the [LOCATION](https://ohdsi.github.io/CommonDataModel/cdm531.html#location) table here that represents the most granular location information for the person. This could represent anything from postal code or parts thereof, state, or county for example. Since many databases contain deidentified data, it is common that the precision of the location is reduced to prevent re-identification. This field should capture the last known location. ",No,Yes,LOCATION,LOCATION_ID,,,
PERSON,provider_id,No,integer,The Provider refers to the last known primary care provider (General Practitioner).,"Put the provider_id from the [PROVIDER](https://ohdsi.github.io/CommonDataModel/cdm531.html#provider) table of the last known general practitioner of the person. If there are multiple providers, it is up to the ETL to decide which to put here.",No,Yes,PROVIDER,PROVIDER_ID,,,
PERSON,care_site_id,No,integer,The Care Site refers to where the Provider typically provides the primary care.,,No,Yes,CARE_SITE,CARE_SITE_ID,,,
PERSON,person_source_value,No,varchar(50),Use this field to link back to persons in the source data. This is typically used for error checking of ETL logic.,Some use cases require the ability to link back to persons in the source data. This field allows for the storing of the person value as it appears in the source. This field is not required but strongly recommended.,No,No,,,,,
PERSON,gender_source_value,No,varchar(50),This field is used to store the biological sex of the person from the source data. It is not intended for use in standard analytics but for reference only.,Put the biological sex of the person as it appears in the source data.,No,No,,,,,
PERSON,gender_source_concept_id,No,integer,"Due to the small number of options, this tends to be zero.","If the source data codes biological sex in a non-standard vocabulary, store the concept_id here.",No,Yes,CONCEPT,CONCEPT_ID,,,
PERSON,race_source_value,No,varchar(50),This field is used to store the race of the person from the source data. It is not intended for use in standard analytics but for reference only.,Put the race of the person as it appears in the source data.,No,No,,,,,
PERSON,race_source_concept_id,No,integer,"Due to the small number of options, this tends to be zero.",If the source data codes race in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PERSON,ethnicity_source_value,No,varchar(50),This field is used to store the ethnicity of the person from the source data. It is not intended for use in standard analytics but for reference only.,"If the person has an ethnicity other than the OMB standard of ""Hispanic"" or ""Not Hispanic"" store that value from the source data here.",No,No,,,,,
PERSON,ethnicity_source_concept_id,No,integer,"Due to the small number of options, this tends to be zero.","If the source data codes ethnicity in an OMOP supported vocabulary, store the concept_id here.",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION_PERIOD,observation_period_id,Yes,integer,A Person can have multiple discrete Observation Periods which are identified by the Observation_Period_Id.,Assign a unique observation_period_id to each discrete Observation Period for a Person.,Yes,No,,,,,
OBSERVATION_PERIOD,person_id,Yes,integer,The Person ID of the PERSON record for which the Observation Period is recorded.,,No,Yes,PERSON,PERSON_ID,,,
OBSERVATION_PERIOD,observation_period_start_date,Yes,date,Use this date to determine the start date of the Observation Period.,"It is often the case that the idea of Observation Periods does not exist in source data. In those cases, the observation_period_start_date can be inferred as the earliest Event date available for the Person. In insurance claim data, the Observation Period can be considered as the time period the Person is enrolled with a payer. If a Person switches plans but stays with the same payer, and therefore capturing of data continues, that change would be captured in [PAYER_PLAN_PERIOD](https://ohdsi.github.io/CommonDataModel/cdm531.html#payer_plan_period).",No,No,,,,,
OBSERVATION_PERIOD,observation_period_end_date,Yes,date,Use this date to determine the end date of the period for which we can assume that all events for a Person are recorded.,"It is often the case that the idea of Observation Periods does not exist in source data. In those cases, the observation_period_end_date can be inferred as the last Event date available for the Person. In insurance claim data, the Observation Period can be considered as the time period the Person is enrolled with a payer.",No,No,,,,,
OBSERVATION_PERIOD,period_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Observation Period as in whether the period was determined from an insurance enrollment file, EHR healthcare encounters, or other sources.",Choose the observation_period_type_concept_id that best represents how the period was determined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
VISIT_OCCURRENCE,visit_occurrence_id,Yes,integer,Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit.,This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time.,Yes,No,,,,,
VISIT_OCCURRENCE,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
VISIT_OCCURRENCE,visit_concept_id,Yes,integer,"This field contains a concept id representing the kind of visit, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain.","Populate this field based on the kind of visit that took place for the person. For example this could be ""Inpatient Visit"", ""Outpatient Visit"", ""Ambulatory Visit"", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,visit_start_date,Yes,date,"For inpatient visits, the start date is typically the admission date. For outpatient visits the start date and end date will be the same.","When populating VISIT_START_DATE, you should think about the patient experience to make decisions on how to define visits. In the case of an inpatient visit this should be the date the patient was admitted to the hospital or institution. In all other cases this should be the date of the patient-provider interaction.",No,No,,,,,
VISIT_OCCURRENCE,visit_start_datetime,No,datetime,,"If no time is given for the start date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
VISIT_OCCURRENCE,visit_end_date,Yes,date,For inpatient visits the end date is typically the discharge date.,"Visit end dates are mandatory. If end dates are not provided in the source there are three ways in which to derive them:
- Outpatient Visit: visit_end_datetime = visit_start_datetime
- Emergency Room Visit: visit_end_datetime = visit_start_datetime
- Inpatient Visit: Usually there is information about discharge. If not, you should be able to derive the end date from the sudden decline of activity or from the absence of inpatient procedures/drugs.
- Non-hospital institution Visits: Particularly for claims data, if end dates are not provided assume the visit is for the duration of month that it occurs.
For Inpatient Visits ongoing at the date of ETL, put date of processing the data into visit_end_datetime and visit_type_concept_id with 32220 ""Still patient"" to identify the visit as incomplete.
- All other Visits: visit_end_datetime = visit_start_datetime. If this is a one-day visit the end date should match the start date.",No,No,,,,,
VISIT_OCCURRENCE,visit_end_datetime,No,datetime,,"If no time is given for the end date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
VISIT_OCCURRENCE,visit_type_concept_id,Yes,Integer,"Use this field to understand the provenance of the visit record, or where the record comes from.","Populate this field based on the provenance of the visit record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
VISIT_OCCURRENCE,provider_id,No,integer,"There will only be one provider per visit record and the ETL document should clearly state how they were chosen (attending, admitting, etc.). If there are multiple providers associated with a visit in the source, this can be reflected in the event tables (CONDITION_OCCURRENCE, PROCEDURE_OCCURRENCE, etc.) or in the VISIT_DETAIL table.","If there are multiple providers associated with a visit, you will need to choose which one to put here. The additional providers can be stored in the [VISIT_DETAIL](https://ohdsi.github.io/CommonDataModel/cdm531.html#visit_detail) table.",No,Yes,PROVIDER,PROVIDER_ID,,,
VISIT_OCCURRENCE,care_site_id,No,integer,This field provides information about the Care Site where the Visit took place.,There should only be one Care Site associated with a Visit.,No,Yes,CARE_SITE,CARE_SITE_ID,,,
VISIT_OCCURRENCE,visit_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the kind of visit that took place (inpatient, outpatient, emergency, etc.)","If there is information about the kind of visit in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the visit source value, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created.",No,No,,,,,
VISIT_OCCURRENCE,visit_source_concept_id,No,integer,,If the visit source value is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
VISIT_OCCURRENCE,admitted_from_concept_id,No,integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,admitted_from_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits.",No,No,,,,,
VISIT_OCCURRENCE,discharged_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example.","If available, map the discharge_to_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,discharged_to_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_OCCURRENCE,preceding_visit_occurrence_id,No,integer,Use this field to find the visit that occurred for the person prior to the given visit. There could be a few days or a few years in between.,"This field can be used to link a visit immediately preceding the current visit. Note this is not symmetrical, and there is no such thing as a ""following_visit_id"".",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
VISIT_DETAIL,visit_detail_id,Yes,integer,Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit detail.,This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time.,Yes,No,,,,,
VISIT_DETAIL,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
VISIT_DETAIL,visit_detail_concept_id,Yes,integer,"This field contains a concept id representing the kind of visit detail, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain.","Populate this field based on the kind of visit that took place for the person. For example this could be ""Inpatient Visit"", ""Outpatient Visit"", ""Ambulatory Visit"", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,visit_detail_start_date,Yes,date,This is the date of the start of the encounter. This may or may not be equal to the date of the Visit the Visit Detail is associated with.,"When populating VISIT_DETAIL_START_DATE, you should think about the patient experience to make decisions on how to define visits. Most likely this should be the date of the patient-provider interaction.",No,No,,,,,
VISIT_DETAIL,visit_detail_start_datetime,No,datetime,,"If no time is given for the start date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
- All other Visits: visit_end_datetime = visit_start_datetime. If this is a one-day visit the end date should match the start date.",No,No,,,,,
VISIT_OCCURRENCE,visit_end_datetime,No,datetime,,"If no time is given for the end date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
VISIT_OCCURRENCE,visit_type_concept_id,Yes,Integer,"Use this field to understand the provenance of the visit record, or where the record comes from.","Populate this field based on the provenance of the visit record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
VISIT_OCCURRENCE,provider_id,No,integer,"There will only be one provider per visit record and the ETL document should clearly state how they were chosen (attending, admitting, etc.). If there are multiple providers associated with a visit in the source, this can be reflected in the event tables (CONDITION_OCCURRENCE, PROCEDURE_OCCURRENCE, etc.) or in the VISIT_DETAIL table.","If there are multiple providers associated with a visit, you will need to choose which one to put here. The additional providers can be stored in the [VISIT_DETAIL](https://ohdsi.github.io/CommonDataModel/cdm531.html#visit_detail) table.",No,Yes,PROVIDER,PROVIDER_ID,,,
VISIT_OCCURRENCE,care_site_id,No,integer,This field provides information about the Care Site where the Visit took place.,There should only be one Care Site associated with a Visit.,No,Yes,CARE_SITE,CARE_SITE_ID,,,
VISIT_OCCURRENCE,visit_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the kind of visit that took place (inpatient, outpatient, emergency, etc.)","If there is information about the kind of visit in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the visit source value, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created.",No,No,,,,,
VISIT_OCCURRENCE,visit_source_concept_id,No,integer,,If the visit source value is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
VISIT_OCCURRENCE,admitted_from_concept_id,No,integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,admitted_from_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits.",No,No,,,,,
VISIT_OCCURRENCE,discharged_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example.","If available, map the discharge_to_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_OCCURRENCE,discharged_to_source_value,No,varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_OCCURRENCE,preceding_visit_occurrence_id,No,integer,Use this field to find the visit that occurred for the person prior to the given visit. There could be a few days or a few years in between.,"This field can be used to link a visit immediately preceding the current visit. Note this is not symmetrical, and there is no such thing as a ""following_visit_id"".",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
VISIT_DETAIL,visit_detail_id,Yes,integer,Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit detail.,This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time.,Yes,No,,,,,
VISIT_DETAIL,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
VISIT_DETAIL,visit_detail_concept_id,Yes,integer,"This field contains a concept id representing the kind of visit detail, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain.","Populate this field based on the kind of visit that took place for the person. For example this could be ""Inpatient Visit"", ""Outpatient Visit"", ""Ambulatory Visit"", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,visit_detail_start_date,Yes,date,This is the date of the start of the encounter. This may or may not be equal to the date of the Visit the Visit Detail is associated with.,"When populating VISIT_DETAIL_START_DATE, you should think about the patient experience to make decisions on how to define visits. Most likely this should be the date of the patient-provider interaction.",No,No,,,,,
VISIT_DETAIL,visit_detail_start_datetime,No,datetime,,"If no time is given for the start date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
VISIT_DETAIL,visit_detail_end_date,Yes,date,This the end date of the patient-provider interaction.,"Visit Detail end dates are mandatory. If end dates are not provided in the source there are three ways in which to derive them:<br>
- Outpatient Visit Detail: visit_detail_end_datetime = visit_detail_start_datetime
- Emergency Room Visit Detail: visit_detail_end_datetime = visit_detail_start_datetime
- Inpatient Visit Detail: Usually there is information about discharge. If not, you should be able to derive the end date from the sudden decline of activity or from the absence of inpatient procedures/drugs.
- Non-hospital institution Visit Details: Particularly for claims data, if end dates are not provided assume the visit is for the duration of month that it occurs.<br>
For Inpatient Visit Details ongoing at the date of ETL, put date of processing the data into visit_detai_end_datetime and visit_detail_type_concept_id with 32220 ""Still patient"" to identify the visit as incomplete.
All other Visits Details: visit_detail_end_datetime = visit_detail_start_datetime. ",No,No,,,,,
VISIT_DETAIL,visit_detail_end_datetime,No,datetime,,"If no time is given for the end date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
VISIT_DETAIL,visit_detail_type_concept_id,Yes,integer,"Use this field to understand the provenance of the visit detail record, or where the record comes from.","Populate this field based on the provenance of the visit detail record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
VISIT_DETAIL,provider_id,No,integer,"There will only be one provider per **visit** record and the ETL document should clearly state how they were chosen (attending, admitting, etc.). This is a typical reason for leveraging the VISIT_DETAIL table as even though each VISIT_DETAIL record can only have one provider, there is no limit to the number of VISIT_DETAIL records that can be associated to a VISIT_OCCURRENCE record.",The additional providers associated to a Visit can be stored in this table where each VISIT_DETAIL record represents a different provider.,No,Yes,PROVIDER,PROVIDER_ID,,,
VISIT_DETAIL,care_site_id,No,integer,This field provides information about the Care Site where the Visit Detail took place.,There should only be one Care Site associated with a Visit Detail.,No,Yes,CARE_SITE,CARE_SITE_ID,,,
VISIT_DETAIL,visit_detail_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the kind of visit detail that took place (inpatient, outpatient, emergency, etc.)","If there is information about the kind of visit detail in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the VISIT_DETAIL_SOURCE_VALUE, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created.",No,No,,,,,
VISIT_DETAIL,visit_detail_source_concept_id,No,Integer,,If the VISIT_DETAIL_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
VISIT_DETAIL,admitted_from_concept_id,No,Integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,admitted_from_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits.",No,No,,,,,
VISIT_DETAIL,discharged_to_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_DETAIL,discharged_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit detail record. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example.","If available, map the DISCHARGE_TO_SOURCE_VALUE to a Standard Concept in the Visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,preceding_visit_detail_id,No,integer,Use this field to find the visit detail that occurred for the person prior to the given visit detail record. There could be a few days or a few years in between.,"The PRECEDING_VISIT_DETAIL_ID can be used to link a visit immediately preceding the current Visit Detail. Note this is not symmetrical, and there is no such thing as a ""following_visit_id"".",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,parent_visit_detail_id,No,integer,Use this field to find the visit detail that subsumes the given visit detail record. This is used in the case that a visit detail record needs to be nested beyond the VISIT_OCCURRENCE/VISIT_DETAIL relationship.,"If there are multiple nested levels to how Visits are represented in the source, the VISIT_DETAIL_PARENT_ID can be used to record this relationship. ",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,visit_occurrence_id,Yes,integer,Use this field to link the VISIT_DETAIL record to its VISIT_OCCURRENCE.,Put the VISIT_OCCURRENCE_ID that subsumes the VISIT_DETAIL record here.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
CONDITION_OCCURRENCE,condition_occurrence_id,Yes,integer,The unique key given to a condition record for a person. Refer to the ETL for how duplicate conditions during the same visit were handled.,"Each instance of a condition present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same condition within the same visit. It is valid to keep these duplicates and assign them individual, unique, CONDITION_OCCURRENCE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
CONDITION_OCCURRENCE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the condition is recorded.,,No,Yes,PERSON,PERSON_ID,,,
CONDITION_OCCURRENCE,condition_concept_id,Yes,integer,"The CONDITION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a condition","The CONCEPT_ID that the CONDITION_SOURCE_VALUE maps to. Only records whose source values map to concepts with a domain of ""Condition"" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Condition,,
CONDITION_OCCURRENCE,condition_start_date,Yes,date,Use this date to determine the start date of the condition,"Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE.",No,No,,,,,
CONDITION_OCCURRENCE,condition_start_datetime,No,datetime,,If a source does not specify datetime the convention is to set the time to midnight (00:00:0000),No,No,,,,,
CONDITION_OCCURRENCE,condition_end_date,No,date,Use this date to determine the end date of the condition,"Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE.",No,No,,,,,
CONDITION_OCCURRENCE,condition_end_datetime,No,datetime,,If a source does not specify datetime the convention is to set the time to midnight (00:00:0000),No,No,,,,,
CONDITION_OCCURRENCE,condition_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Condition record, as in whether the condition was from an EHR system, insurance claim, registry, or other sources.",Choose the CONDITION_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
CONDITION_OCCURRENCE,condition_status_concept_id,No,integer,"This concept represents the point during the visit the diagnosis was given (admitting diagnosis, final diagnosis), whether the diagnosis was determined due to laboratory findings, if the diagnosis was exclusionary, or if it was a preliminary diagnosis, among others. ","Choose the Concept in the Condition Status domain that best represents the point during the visit when the diagnosis was given. These can include admitting diagnosis, principal diagnosis, and secondary diagnosis. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Condition Status,,
CONDITION_OCCURRENCE,stop_reason,No,varchar(20),The Stop Reason indicates why a Condition is no longer valid with respect to the purpose within the source data. Note that a Stop Reason does not necessarily imply that the condition is no longer occurring.,This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist.,No,No,,,,,
CONDITION_OCCURRENCE,provider_id,No,integer,"The provider associated with condition record, e.g. the provider who made the diagnosis or the provider who recorded the symptom.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record.",No,Yes,PROVIDER,PROVIDER_ID,,,
CONDITION_OCCURRENCE,visit_occurrence_id,No,integer,The visit during which the condition occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a CONDITION_START_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the CONDITION_OCCURRENCE record.",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
CONDITION_OCCURRENCE,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the condition occurred. For example, if the person was in the ICU at the time of the diagnosis the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
CONDITION_OCCURRENCE,condition_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the condition that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
CONDITION_OCCURRENCE,condition_source_concept_id,No,integer,"This is the concept representing the condition source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Condition necessary for a given analytic use case. Consider using CONDITION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the CONDITION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
CONDITION_OCCURRENCE,condition_status_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the condition status.,This information may be called something different in the source data but the field is meant to contain a value indicating when and how a diagnosis was given to a patient. This source value is mapped to a standard concept which is stored in the CONDITION_STATUS_CONCEPT_ID field.,No,No,,,,,
DRUG_EXPOSURE,drug_exposure_id,Yes,integer,The unique key given to records of drug dispensings or administrations for a person. Refer to the ETL for how duplicate drugs during the same visit were handled.,"Each instance of a drug dispensing or administration present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same drug within the same visit. It is valid to keep these duplicates and assign them individual, unique, DRUG_EXPOSURE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
DRUG_EXPOSURE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the drug dispensing or administration is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
DRUG_EXPOSURE,drug_concept_id,Yes,integer,"The DRUG_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source concept id which represents a drug product or molecule otherwise introduced to the body. The drug concepts can have a varying degree of information about drug strength and dose. This information is relevant in the context of quantity and administration information in the subsequent fields plus strength information from the DRUG_STRENGTH table, provided as part of the standard vocabulary download.","The CONCEPT_ID that the DRUG_SOURCE_VALUE maps to. The concept id should be derived either from mapping from the source concept id or by picking the drug concept representing the most amount of detail you have. Records whose source values map to standard concepts with a domain of Drug should go in this table. When the Drug Source Value of the code cannot be translated into Standard Drug Concept IDs, a Drug exposure entry is stored with only the corresponding SOURCE_CONCEPT_ID and DRUG_SOURCE_VALUE and a DRUG_CONCEPT_ID of 0. The Drug Concept with the most detailed content of information is preferred during the mapping process. These are indicated in the CONCEPT_CLASS_ID field of the Concept and are recorded in the following order of precedence: 'Branded Pack', 'Clinical Pack', 'Branded Drug', 'Clinical Drug', 'Branded Drug Component', 'Clinical Drug Component', 'Branded Drug Form', 'Clinical Drug Form', and only if no other information is available 'Ingredient'. Note: If only the drug class is known, the DRUG_CONCEPT_ID field should contain 0. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Drug&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Drug,,
DRUG_EXPOSURE,drug_exposure_start_date,Yes,date,Use this date to determine the start date of the drug record.,"Valid entries include a start date of a prescription, the date a prescription was filled, or the date on which a Drug administration was recorded. It is a valid ETL choice to use the date the drug was ordered as the DRUG_EXPOSURE_START_DATE.",No,No,,,,,
DRUG_EXPOSURE,drug_exposure_start_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
DRUG_EXPOSURE,drug_exposure_end_date,Yes,date,The DRUG_EXPOSURE_END_DATE denotes the day the drug exposure ended for the patient.,"If this information is not explicitly available in the data, infer the end date using the following methods:<br><br> 1. Start first with duration or days supply using the calculation drug start date + days supply -1 day. 2. Use quantity divided by daily dose that you may obtain from the sig or a source field (or assumed daily dose of 1) for solid, indivisibile, drug products. If quantity represents ingredient amount, quantity divided by daily dose * concentration (from drug_strength) drug concept id tells you the dose form. 3. If it is an administration record, set drug end date equal to drug start date. If the record is a written prescription then set end date to start date + 29. If the record is a mail-order prescription set end date to start date + 89. The end date must be equal to or greater than the start date. Ibuprofen 20mg/mL oral solution concept tells us this is oral solution. Calculate duration as quantity (200 example) * daily dose (5mL) /concentration (20mg/mL) 200*5/20 = 50 days. [Examples by dose form](https://ohdsi.github.io/CommonDataModel/drug_dose.html)",No,No,,,,,
DRUG_EXPOSURE,drug_exposure_end_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
DRUG_EXPOSURE,verbatim_end_date,No,date,"This is the end date of the drug exposure as it appears in the source data, if it is given",Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable.,No,No,,,,,
DRUG_EXPOSURE,drug_type_concept_id,Yes,integer,"You can use the TYPE_CONCEPT_ID to delineate between prescriptions written vs. prescriptions dispensed vs. medication history vs. patient-reported exposure, etc.","Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
DRUG_EXPOSURE,stop_reason,No,varchar(20),"The reason a person stopped a medication as it is represented in the source. Reasons include regimen completed, changed, removed, etc. This field will be retired in v6.0.",This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist.,No,No,,,,,
DRUG_EXPOSURE,refills,No,integer,This is only filled in when the record is coming from a prescription written this field is meant to represent intended refills at time of the prescription.,,No,No,,,,,
All other Visits Details: visit_detail_end_datetime = visit_detail_start_datetime. ",No,No,,,,,
VISIT_DETAIL,visit_detail_end_datetime,No,datetime,,"If no time is given for the end date of a visit, set it to midnight (00:00:0000).",No,No,,,,,
VISIT_DETAIL,visit_detail_type_concept_id,Yes,integer,"Use this field to understand the provenance of the visit detail record, or where the record comes from.","Populate this field based on the provenance of the visit detail record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
VISIT_DETAIL,provider_id,No,integer,"There will only be one provider per **visit** record and the ETL document should clearly state how they were chosen (attending, admitting, etc.). This is a typical reason for leveraging the VISIT_DETAIL table as even though each VISIT_DETAIL record can only have one provider, there is no limit to the number of VISIT_DETAIL records that can be associated to a VISIT_OCCURRENCE record.",The additional providers associated to a Visit can be stored in this table where each VISIT_DETAIL record represents a different provider.,No,Yes,PROVIDER,PROVIDER_ID,,,
VISIT_DETAIL,care_site_id,No,integer,This field provides information about the Care Site where the Visit Detail took place.,There should only be one Care Site associated with a Visit Detail.,No,Yes,CARE_SITE,CARE_SITE_ID,,,
VISIT_DETAIL,visit_detail_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the kind of visit detail that took place (inpatient, outpatient, emergency, etc.)","If there is information about the kind of visit detail in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the VISIT_DETAIL_SOURCE_VALUE, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created.",No,No,,,,,
VISIT_DETAIL,visit_detail_source_concept_id,No,Integer,,If the VISIT_DETAIL_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
VISIT_DETAIL,admitted_from_concept_id,No,Integer,"Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example.","If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,admitted_from_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits.",No,No,,,,,
VISIT_DETAIL,discharged_to_source_value,No,Varchar(50),,"This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more.",No,No,,,,,
VISIT_DETAIL,discharged_to_concept_id,No,integer,"Use this field to determine where the patient was discharged to after a visit detail record. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example.","If available, map the DISCHARGE_TO_SOURCE_VALUE to a Standard Concept in the Visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Visit,,
VISIT_DETAIL,preceding_visit_detail_id,No,integer,Use this field to find the visit detail that occurred for the person prior to the given visit detail record. There could be a few days or a few years in between.,"The PRECEDING_VISIT_DETAIL_ID can be used to link a visit immediately preceding the current Visit Detail. Note this is not symmetrical, and there is no such thing as a ""following_visit_id"".",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,parent_visit_detail_id,No,integer,Use this field to find the visit detail that subsumes the given visit detail record. This is used in the case that a visit detail record needs to be nested beyond the VISIT_OCCURRENCE/VISIT_DETAIL relationship.,"If there are multiple nested levels to how Visits are represented in the source, the VISIT_DETAIL_PARENT_ID can be used to record this relationship. ",No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
VISIT_DETAIL,visit_occurrence_id,Yes,integer,Use this field to link the VISIT_DETAIL record to its VISIT_OCCURRENCE.,Put the VISIT_OCCURRENCE_ID that subsumes the VISIT_DETAIL record here.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
CONDITION_OCCURRENCE,condition_occurrence_id,Yes,integer,The unique key given to a condition record for a person. Refer to the ETL for how duplicate conditions during the same visit were handled.,"Each instance of a condition present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same condition within the same visit. It is valid to keep these duplicates and assign them individual, unique, CONDITION_OCCURRENCE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
CONDITION_OCCURRENCE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the condition is recorded.,,No,Yes,PERSON,PERSON_ID,,,
CONDITION_OCCURRENCE,condition_concept_id,Yes,integer,"The CONDITION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a condition","The CONCEPT_ID that the CONDITION_SOURCE_VALUE maps to. Only records whose source values map to concepts with a domain of ""Condition"" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Condition,,
CONDITION_OCCURRENCE,condition_start_date,Yes,date,Use this date to determine the start date of the condition,"Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE.",No,No,,,,,
CONDITION_OCCURRENCE,condition_start_datetime,No,datetime,,If a source does not specify datetime the convention is to set the time to midnight (00:00:0000),No,No,,,,,
CONDITION_OCCURRENCE,condition_end_date,No,date,Use this date to determine the end date of the condition,"Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE.",No,No,,,,,
CONDITION_OCCURRENCE,condition_end_datetime,No,datetime,,If a source does not specify datetime the convention is to set the time to midnight (00:00:0000),No,No,,,,,
CONDITION_OCCURRENCE,condition_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Condition record, as in whether the condition was from an EHR system, insurance claim, registry, or other sources.",Choose the CONDITION_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
CONDITION_OCCURRENCE,condition_status_concept_id,No,integer,"This concept represents the point during the visit the diagnosis was given (admitting diagnosis, final diagnosis), whether the diagnosis was determined due to laboratory findings, if the diagnosis was exclusionary, or if it was a preliminary diagnosis, among others. ","Choose the Concept in the Condition Status domain that best represents the point during the visit when the diagnosis was given. These can include admitting diagnosis, principal diagnosis, and secondary diagnosis. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Condition Status,,
CONDITION_OCCURRENCE,stop_reason,No,varchar(20),The Stop Reason indicates why a Condition is no longer valid with respect to the purpose within the source data. Note that a Stop Reason does not necessarily imply that the condition is no longer occurring.,This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist.,No,No,,,,,
CONDITION_OCCURRENCE,provider_id,No,integer,"The provider associated with condition record, e.g. the provider who made the diagnosis or the provider who recorded the symptom.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record.",No,Yes,PROVIDER,PROVIDER_ID,,,
CONDITION_OCCURRENCE,visit_occurrence_id,No,integer,The visit during which the condition occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a CONDITION_START_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the CONDITION_OCCURRENCE record.",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
CONDITION_OCCURRENCE,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the condition occurred. For example, if the person was in the ICU at the time of the diagnosis the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
CONDITION_OCCURRENCE,condition_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the condition that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
CONDITION_OCCURRENCE,condition_source_concept_id,No,integer,"This is the concept representing the condition source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Condition necessary for a given analytic use case. Consider using CONDITION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the CONDITION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
CONDITION_OCCURRENCE,condition_status_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the condition status.,This information may be called something different in the source data but the field is meant to contain a value indicating when and how a diagnosis was given to a patient. This source value is mapped to a standard concept which is stored in the CONDITION_STATUS_CONCEPT_ID field.,No,No,,,,,
DRUG_EXPOSURE,drug_exposure_id,Yes,integer,The unique key given to records of drug dispensings or administrations for a person. Refer to the ETL for how duplicate drugs during the same visit were handled.,"Each instance of a drug dispensing or administration present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same drug within the same visit. It is valid to keep these duplicates and assign them individual, unique, DRUG_EXPOSURE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
DRUG_EXPOSURE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the drug dispensing or administration is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
DRUG_EXPOSURE,drug_concept_id,Yes,integer,"The DRUG_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source concept id which represents a drug product or molecule otherwise introduced to the body. The drug concepts can have a varying degree of information about drug strength and dose. This information is relevant in the context of quantity and administration information in the subsequent fields plus strength information from the DRUG_STRENGTH table, provided as part of the standard vocabulary download.","The CONCEPT_ID that the DRUG_SOURCE_VALUE maps to. The concept id should be derived either from mapping from the source concept id or by picking the drug concept representing the most amount of detail you have. Records whose source values map to standard concepts with a domain of Drug should go in this table. When the Drug Source Value of the code cannot be translated into Standard Drug Concept IDs, a Drug exposure entry is stored with only the corresponding SOURCE_CONCEPT_ID and DRUG_SOURCE_VALUE and a DRUG_CONCEPT_ID of 0. The Drug Concept with the most detailed content of information is preferred during the mapping process. These are indicated in the CONCEPT_CLASS_ID field of the Concept and are recorded in the following order of precedence: 'Branded Pack', 'Clinical Pack', 'Branded Drug', 'Clinical Drug', 'Branded Drug Component', 'Clinical Drug Component', 'Branded Drug Form', 'Clinical Drug Form', and only if no other information is available 'Ingredient'. Note: If only the drug class is known, the DRUG_CONCEPT_ID field should contain 0. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Drug&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Drug,,
DRUG_EXPOSURE,drug_exposure_start_date,Yes,date,Use this date to determine the start date of the drug record.,"Valid entries include a start date of a prescription, the date a prescription was filled, or the date on which a Drug administration was recorded. It is a valid ETL choice to use the date the drug was ordered as the DRUG_EXPOSURE_START_DATE.",No,No,,,,,
DRUG_EXPOSURE,drug_exposure_start_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
DRUG_EXPOSURE,drug_exposure_end_date,Yes,date,The DRUG_EXPOSURE_END_DATE denotes the day the drug exposure ended for the patient.,"If this information is not explicitly available in the data, infer the end date using the following methods:<br><br> 1. Start first with duration or days supply using the calculation drug start date + days supply -1 day. 2. Use quantity divided by daily dose that you may obtain from the sig or a source field (or assumed daily dose of 1) for solid, indivisibile, drug products. If quantity represents ingredient amount, quantity divided by daily dose * concentration (from drug_strength) drug concept id tells you the dose form. 3. If it is an administration record, set drug end date equal to drug start date. If the record is a written prescription then set end date to start date + 29. If the record is a mail-order prescription set end date to start date + 89. The end date must be equal to or greater than the start date. Ibuprofen 20mg/mL oral solution concept tells us this is oral solution. Calculate duration as quantity (200 example) * daily dose (5mL) /concentration (20mg/mL) 200*5/20 = 50 days. [Examples by dose form](https://ohdsi.github.io/CommonDataModel/drug_dose.html)",No,No,,,,,
DRUG_EXPOSURE,drug_exposure_end_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
DRUG_EXPOSURE,verbatim_end_date,No,date,"This is the end date of the drug exposure as it appears in the source data, if it is given",Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable.,No,No,,,,,
DRUG_EXPOSURE,drug_type_concept_id,Yes,integer,"You can use the TYPE_CONCEPT_ID to delineate between prescriptions written vs. prescriptions dispensed vs. medication history vs. patient-reported exposure, etc.","Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
DRUG_EXPOSURE,stop_reason,No,varchar(20),"The reason a person stopped a medication as it is represented in the source. Reasons include regimen completed, changed, removed, etc. This field will be retired in v6.0.",This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist.,No,No,,,,,
DRUG_EXPOSURE,refills,No,integer,This is only filled in when the record is coming from a prescription written this field is meant to represent intended refills at time of the prescription.,,No,No,,,,,
DRUG_EXPOSURE,quantity,No,float,,"To find the dose form of a drug the RELATIONSHIP table can be used where the relationship_id is 'Has dose form'. If liquid, quantity stands for the total amount dispensed or ordered of ingredient in the units given by the drug_strength table. If the unit from the source data does not align with the unit in the DRUG_STRENGTH table the quantity should be converted to the correct unit given in DRUG_STRENGTH. For clinical drugs with fixed dose forms (tablets etc.) the quantity is the number of units/tablets/capsules prescribed or dispensed (can be partial, but then only 1/2 or 1/3, not 0.01). Clinical drugs with divisible dose forms (injections) the quantity is the amount of ingredient the patient got. For example, if the injection is 2mg/mL but the patient got 80mL then quantity is reported as 160.
Quantified clinical drugs with divisible dose forms (prefilled syringes), the quantity is the amount of ingredient similar to clinical drugs. Please see [how to calculate drug dose](https://ohdsi.github.io/CommonDataModel/drug_dose.html) for more information.
",No,No,,,,,
DRUG_EXPOSURE,days_supply,No,integer,,Days supply of the drug. This should be the verbatim days_supply as given on the prescription. If the drug is physician administered use duration end date if given or set to 1 as default if duration is not available.,No,No,,,,,
DRUG_EXPOSURE,sig,No,varchar(MAX),This is the verbatim instruction for the drug as written by the provider.,"Put the written out instructions for the drug as it is verbatim in the source, if available.",No,No,,,,,
DRUG_EXPOSURE,route_concept_id,No,integer,,The standard CONCEPT_ID that the ROUTE_SOURCE_VALUE maps to in the route domain.,No,Yes,CONCEPT,CONCEPT_ID,Route,,
DRUG_EXPOSURE,lot_number,No,varchar(50),,,No,No,,,,,
DRUG_EXPOSURE,provider_id,No,integer,"The Provider associated with drug record, e.g. the provider who wrote the prescription or the provider who administered the drug.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the ordering vs administering physician on an EHR record.",No,Yes,PROVIDER,PROVIDER_ID,,,
DRUG_EXPOSURE,visit_occurrence_id,No,integer,"The Visit during which the drug was prescribed, administered or dispensed.",To populate this field drug exposures must be explicitly initiated in the visit.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
DRUG_EXPOSURE,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the drug exposure occurred. For example, if the person was in the ICU at the time of the drug administration the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
DRUG_EXPOSURE,drug_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the drug exposure that occurred. For example, this could be an NDC or Gemscript code.",This code is mapped to a Standard Drug Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
DRUG_EXPOSURE,drug_source_concept_id,No,integer,"This is the concept representing the drug source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Drug necessary for a given analytic use case. Consider using DRUG_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the DRUG_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_EXPOSURE,route_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the drug route.,This information may be called something different in the source data but the field is meant to contain a value indicating when and how a drug was given to a patient. This source value is mapped to a standard concept which is stored in the ROUTE_CONCEPT_ID field.,No,No,,,,,
DRUG_EXPOSURE,dose_unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the dose unit of the drug given.,This information may be called something different in the source data but the field is meant to contain a value indicating the unit of dosage of drug given to the patient. This is an older column and will be deprecated in an upcoming version.,No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_occurrence_id,Yes,integer,The unique key given to a procedure record for a person. Refer to the ETL for how duplicate procedures during the same visit were handled.,"Each instance of a procedure occurrence in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same procedure within the same visit. It is valid to keep these duplicates and assign them individual, unique, PROCEDURE_OCCURRENCE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
PROCEDURE_OCCURRENCE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the procedure is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
PROCEDURE_OCCURRENCE,procedure_concept_id,Yes,integer,"The PROCEDURE_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a procedure","The CONCEPT_ID that the PROCEDURE_SOURCE_VALUE maps to. Only records whose source values map to standard concepts with a domain of ""Procedure"" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Procedure&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Procedure,,
PROCEDURE_OCCURRENCE,procedure_date,Yes,date,Use this date to determine the date the procedure occurred.,"If a procedure lasts more than a day, then it should be recorded as a separate record for each day the procedure occurred, this logic is in lieu of the procedure_end_date, which will be added in a future version of the CDM.",No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Procedure record, as in whether the procedure was from an EHR system, insurance claim, registry, or other sources.","Choose the PROCEDURE_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. If a procedure is recorded as an EHR encounter, the PROCEDURE_TYPE_CONCEPT would be 'EHR encounter record'. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
PROCEDURE_OCCURRENCE,modifier_concept_id,No,integer,The modifiers are intended to give additional information about the procedure but as of now the vocabulary is under review.,"It is up to the ETL to choose how to map modifiers if they exist in source data. These concepts are typically distinguished by 'Modifier' concept classes (e.g., 'CPT4 Modifier' as part of the 'CPT4' vocabulary). If there is more than one modifier on a record, one should be chosen that pertains to the procedure rather than provider. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?conceptClass=CPT4+Modifier&conceptClass=HCPCS+Modifier&vocabulary=CPT4&vocabulary=HCPCS&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PROCEDURE_OCCURRENCE,quantity,No,integer,"If the quantity value is omitted, a single procedure is assumed.","If a Procedure has a quantity of '0' in the source, this should default to '1' in the ETL. If there is a record in the source it can be assumed the exposure occurred at least once",No,No,,,,,
PROCEDURE_OCCURRENCE,provider_id,No,integer,"The provider associated with the procedure record, e.g. the provider who performed the Procedure.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record.",No,No,PROVIDER,PROVIDER_ID,,,
PROCEDURE_OCCURRENCE,visit_occurrence_id,No,integer,The visit during which the procedure occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a PROCEDURE_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the PROCEDURE_OCCURRENCE record.",No,No,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
PROCEDURE_OCCURRENCE,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the Procedure occurred. For example, if the Person was in the ICU at the time of the Procedure the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,No,VISIT_DETAIL,VISIT_DETAIL_ID,,,
PROCEDURE_OCCURRENCE,procedure_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the procedure that occurred. For example, this could be an CPT4 or OPCS4 code.",Use this value to look up the source concept id and then map the source concept id to a standard concept id.,No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_source_concept_id,No,integer,"This is the concept representing the procedure source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Procedure necessary for a given analytic use case. Consider using PROCEDURE_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the PROCEDURE_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,No,CONCEPT,CONCEPT_ID,,,
PROCEDURE_OCCURRENCE,modifier_source_value,No,varchar(50),,The original modifier code from the source is stored here for reference.,No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_status_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the procedure status (primary or secondary).,"This information may be called something different in the source data but the field is meant to contain a value indicating whether the procedure was the primary reason for performing a surgical operation, infusion, etc. This source value is mapped to a standard concept which is stored in the PROCEDURE_STATUS_CONCEPT_ID field.",,,,,,,
PROCEDURE_OCCURRENCE,procedure_status_concept_id,Yes,integer,"This concept represents if the procedure was the primary reason for the surgical operation, infusion, etc . ",Choose the Concept in the Procedure Status domain that best represents the status ( [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=).,,,,,,,
DEVICE_EXPOSURE,device_exposure_id,Yes,integer,The unique key given to records a person's exposure to a foreign physical object or instrument.,Each instance of an exposure to a foreign object or device present in the source data should be assigned this unique key. ,Yes,No,,,,,
DEVICE_EXPOSURE,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DEVICE_EXPOSURE,device_concept_id,Yes,integer,"The DEVICE_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source concept id which represents a foreign object or instrument the person was exposed to. ",The CONCEPT_ID that the DEVICE_SOURCE_VALUE maps to. ,No,Yes,CONCEPT,CONCEPT_ID,Device,,
DEVICE_EXPOSURE,device_exposure_start_date,Yes,date,Use this date to determine the start date of the device record.,"Valid entries include a start date of a procedure to implant a device, the date of a prescription for a device, or the date of device administration. ",No,No,,,,,
DEVICE_EXPOSURE,device_exposure_start_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
DEVICE_EXPOSURE,device_exposure_end_date,No,date,"The DEVICE_EXPOSURE_END_DATE denotes the day the device exposure ended for the patient, if given.",Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable.,No,No,,,,,
DEVICE_EXPOSURE,device_exposure_end_datetime,No,datetime,,If a source does not specify datetime the convention is to set the time to midnight (00:00:0000),No,No,,,,,
DEVICE_EXPOSURE,device_type_concept_id,Yes,integer,"You can use the TYPE_CONCEPT_ID to denote the provenance of the record, as in whether the record is from administrative claims or EHR. ","Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
DEVICE_EXPOSURE,unique_device_id,No,varchar(255),"This is the Unique Device Identification (UDI-DI) number for devices regulated by the FDA, if given. ","For medical devices that are regulated by the FDA, a Unique Device Identification (UDI) is provided if available in the data source and is recorded in the UNIQUE_DEVICE_ID field.",No,No,,,,,
DEVICE_EXPOSURE,production_id,No,varchar(255),This is the Production Identifier (UDI-PI) portion of the Unique Device Identification.,,,,,,,,
DEVICE_EXPOSURE,quantity,No,integer,,,No,No,,,,,
DEVICE_EXPOSURE,provider_id,No,integer,"The Provider associated with device record, e.g. the provider who wrote the prescription or the provider who implanted the device.",The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record.,No,Yes,PROVIDER,PROVIDER_ID,,,
DEVICE_EXPOSURE,visit_occurrence_id,No,integer,The Visit during which the device was prescribed or given.,To populate this field device exposures must be explicitly initiated in the visit.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
DEVICE_EXPOSURE,visit_detail_id,No,integer,The Visit Detail during which the device was prescribed or given.,To populate this field device exposures must be explicitly initiated in the visit detail record.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
DEVICE_EXPOSURE,device_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the device exposure that occurred. For example, this could be an NDC or Gemscript code.",This code is mapped to a Standard Device Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
DEVICE_EXPOSURE,device_source_concept_id,No,integer,"This is the concept representing the device source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Device necessary for a given analytic use case. Consider using DEVICE_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the DEVICE_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
DEVICE_EXPOSURE,unit_concept_id,No,integer,UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. ,"There is no standardization requirement for units associated with DEVICE_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. If there is no unit associated with a Device record, set to NULL.",,,,,,,
DEVICE_EXPOSURE,unit_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the unit of the Device. For example, blood transfusions are considered devices and can be given in mL quantities. ","This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. Using the blood transfusion example, blood transfusion is represented by the DEVICE_CONCEPT_ID and the unit (mL) would be housed in the UNIT_SOURCE_VALUE and mapped to a standard concept in the unit domain. ",,,,,,,
DEVICE_EXPOSURE,unit_source_concept_id,No,integer,"This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Unit necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. ,,,,,,,
MEASUREMENT,measurement_id,Yes,integer,The unique key given to a Measurement record for a Person. Refer to the ETL for how duplicate Measurements during the same Visit were handled.,"Each instance of a measurement present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same measurement within the same visit. It is valid to keep these duplicates and assign them individual, unique, MEASUREMENT_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
MEASUREMENT,person_id,Yes,integer,The PERSON_ID of the Person for whom the Measurement is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
MEASUREMENT,measurement_concept_id,Yes,integer,"The MEASUREMENT_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies.","The CONCEPT_ID that the MEASUREMENT_SOURCE_CONCEPT_ID maps to. Only records whose SOURCE_CONCEPT_IDs map to Standard Concepts with a domain of ""Measurement"" should go in this table.",No,Yes,CONCEPT,CONCEPT_ID,Measurement,,
MEASUREMENT,measurement_date,Yes,date,Use this date to determine the date of the measurement.,"If there are multiple dates in the source data associated with a record such as order_date, draw_date, and result_date, choose the one that is closest to the date the sample was drawn from the patient.",No,No,,,,,
MEASUREMENT,measurement_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
MEASUREMENT,measurement_time,No,varchar(10),,This is present for backwards compatibility and will be deprecated in an upcoming version.,No,No,,,,,
MEASUREMENT,measurement_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Measurement record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources.","Choose the MEASUREMENT_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
MEASUREMENT,operator_concept_id,No,integer,"The meaning of Concept [4172703](https://athena.ohdsi.org/search-terms/terms/4172703) for '=' is identical to omission of a OPERATOR_CONCEPT_ID value. Since the use of this field is rare, it's important when devising analyses to not to forget testing for the content of this field for values different from =.","Operators are <, <=, =, >=, > and these concepts belong to the 'Meas Value Operator' domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Meas+Value+Operator&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,value_as_number,No,float,"This is the numerical value of the Result of the Measurement, if available. Note that measurements such as blood pressures will be split into their component parts i.e. one record for systolic, one record for diastolic.","If there is a negative value coming from the source, set the VALUE_AS_NUMBER to NULL, with the exception of the following Measurements (listed as LOINC codes):<br>- [1925-7](https://athena.ohdsi.org/search-terms/terms/3003396) Base excess in Arterial blood by calculation - [1927-3](https://athena.ohdsi.org/search-terms/terms/3002032) Base excess in Venous blood by calculation - [8632-2](https://athena.ohdsi.org/search-terms/terms/3006277) QRS-Axis - [11555-0](https://athena.ohdsi.org/search-terms/terms/3012501) Base excess in Blood by calculation - [1926-5](https://athena.ohdsi.org/search-terms/terms/3003129) Base excess in Capillary blood by calculation - [28638-5](https://athena.ohdsi.org/search-terms/terms/3004959) Base excess in Arterial cord blood by calculation [28639-3](https://athena.ohdsi.org/search-terms/terms/3007435) Base excess in Venous cord blood by calculation",No,No,,,,,
MEASUREMENT,value_as_concept_id,No,integer,If the raw data gives a categorial result for measurements those values are captured and mapped to standard concepts in the 'Meas Value' domain.,"If the raw data provides categorial results as well as continuous results for measurements, it is a valid ETL choice to preserve both values. The continuous value should go in the VALUE_AS_NUMBER field and the categorical value should be mapped to a standard concept in the 'Meas Value' domain and put in the VALUE_AS_CONCEPT_ID field. This is also the destination for the 'Maps to value' relationship.",No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,unit_concept_id,No,integer,"There is currently no recommended unit for individual measurements, i.e. it is not mandatory to represent Hemoglobin a1C measurements as a percentage. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data.","There is no standardization requirement for units associated with MEASUREMENT_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit.",No,Yes,CONCEPT,CONCEPT_ID,Unit,,
MEASUREMENT,range_low,No,float,Ranges have the same unit as the VALUE_AS_NUMBER. These ranges are provided by the source and should remain NULL if not given.,If reference ranges for upper and lower limit of normal as provided (typically by a laboratory) these are stored in the RANGE_HIGH and RANGE_LOW fields. This should be set to NULL if not provided.,No,No,,,,,
MEASUREMENT,range_high,No,float,Ranges have the same unit as the VALUE_AS_NUMBER. These ranges are provided by the source and should remain NULL if not given.,If reference ranges for upper and lower limit of normal as provided (typically by a laboratory) these are stored in the RANGE_HIGH and RANGE_LOW fields. This should be set to NULL if not provided.,No,No,,,,,
MEASUREMENT,provider_id,No,integer,"The provider associated with measurement record, e.g. the provider who ordered the test or the provider who recorded the result.",The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record.,No,Yes,PROVIDER,PROVIDER_ID,,,
MEASUREMENT,visit_occurrence_id,No,integer,The visit during which the Measurement occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a MEASUREMENT_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the measurement record. If a measurement is related to a visit explicitly in the source data, it is possible that the result date of the Measurement falls outside of the bounds of the Visit dates.",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
MEASUREMENT,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the Measurement occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
MEASUREMENT,measurement_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the Measurement that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Measurement Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
MEASUREMENT,measurement_source_concept_id,No,integer,"This is the concept representing the MEASUREMENT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using MEASUREMENT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the MEASUREMENT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the unit of the Measurement that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
MEASUREMENT,unit_source_concept_id,No,integer,"""This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.""",If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,value_source_value,No,varchar(50),This field houses the verbatim result value of the Measurement from the source data . ,"If both a continuous and categorical result are given in the source data such that both VALUE_AS_NUMBER and VALUE_AS_CONCEPT_ID are both included, store the verbatim value that was mapped to VALUE_AS_CONCEPT_ID here.",No,No,,,,,
OBSERVATION,observation_id,Yes,integer,The unique key given to an Observation record for a Person. Refer to the ETL for how duplicate Observations during the same Visit were handled.,Each instance of an observation present in the source data should be assigned this unique key. ,Yes,No,,,,,
OBSERVATION,person_id,Yes,integer,The PERSON_ID of the Person for whom the Observation is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
OBSERVATION,observation_concept_id,Yes,integer,"The OBSERVATION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies.","The CONCEPT_ID that the OBSERVATION_SOURCE_CONCEPT_ID maps to. There is no specified domain that the Concepts in this table must adhere to. The only rule is that records with Concepts in the Condition, Procedure, Drug, Measurement, or Device domains MUST go to the corresponding table. ",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,observation_date,Yes,date,"The date of the Observation. Depending on what the Observation represents this could be the date of a lab test, the date of a survey, or the date a patient's family history was taken. ",For some observations the ETL may need to make a choice as to which date to choose.,No,No,,,,,
OBSERVATION,observation_datetime,No,datetime,,If no time is given set to midnight (00:00:00).,No,No,,,,,
OBSERVATION,observation_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Observation record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources.","Choose the OBSERVATION_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
OBSERVATION,value_as_number,No,float,"This is the numerical value of the Result of the Observation, if applicable and available. It is not expected that all Observations will have numeric results, rather, this field is here to house values should they exist. ",,No,No,,,,,
OBSERVATION,value_as_string,No,varchar(60),"This is the categorical value of the Result of the Observation, if applicable and available. ",,No,No,,,,,
OBSERVATION,value_as_concept_id,No,Integer,"It is possible that some records destined for the Observation table have two clinical ideas represented in one source code. This is common with ICD10 codes that describe a family history of some Condition, for example. In OMOP the Vocabulary breaks these two clinical ideas into two codes; one becomes the OBSERVATION_CONCEPT_ID and the other becomes the VALUE_AS_CONCEPT_ID. It is important when using the Observation table to keep this possibility in mind and to examine the VALUE_AS_CONCEPT_ID field for relevant information. ","Note that the value of VALUE_AS_CONCEPT_ID may be provided through mapping from a source Concept which contains the content of the Observation. In those situations, the CONCEPT_RELATIONSHIP table in addition to the 'Maps to' record contains a second record with the relationship_id set to 'Maps to value'. For example, ICD10 [Z82.4](https://athena.ohdsi.org/search-terms/terms/45581076) 'Family history of ischaemic heart disease and other diseases of the circulatory system' has a 'Maps to' relationship to [4167217](https://athena.ohdsi.org/search-terms/terms/4167217) 'Family history of clinical finding' as well as a 'Maps to value' record to [134057](https://athena.ohdsi.org/search-terms/terms/134057) 'Disorder of cardiovascular system'.",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,qualifier_concept_id,No,integer,"This field contains all attributes specifying the clinical fact further, such as as degrees, severities, drug-drug interaction alerts etc.","Use your best judgement as to what Concepts to use here and if they are necessary to accurately represent the clinical record. There is no restriction on the domain of these Concepts, they just need to be Standard.",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,unit_concept_id,No,integer,There is currently no recommended unit for individual observation concepts. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data.,"There is no standardization requirement for units associated with OBSERVATION_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit.",No,Yes,CONCEPT,CONCEPT_ID,Unit,,
OBSERVATION,provider_id,No,integer,"The provider associated with the observation record, e.g. the provider who ordered the test or the provider who recorded the result.",The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record.,No,Yes,PROVIDER,PROVIDER_ID,,,
OBSERVATION,visit_occurrence_id,No,integer,The visit during which the Observation occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If an OBSERVATION_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the observation record. If an observation is related to a visit explicitly in the source data, it is possible that the result date of the Observation falls outside of the bounds of the Visit dates.",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
OBSERVATION,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the Observation occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
OBSERVATION,observation_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the Observation that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
OBSERVATION,observation_source_concept_id,No,integer,"This is the concept representing the OBSERVATION_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Observation necessary for a given analytic use case. Consider using OBSERVATION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the OBSERVATION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the unit of the Observation that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
OBSERVATION,qualifier_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the qualifier of the Observation that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
OBSERVATION,value_source_value,No,varchar(50),This field houses the verbatim result value of the Observation from the source data. Do not get confused with the Observation_source_value which captures source value of the observation mapped to observation_concept_id. This field is the observation result value from the source.," If the observation_source_value was a question, for example, or an observation that requires a result then this field is the answer/ result from the source data. Store the verbatim value that represents the result of the observation_source_value. ",No,No,,,,,
DEATH,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DEATH,death_date,Yes,date,The date the person was deceased.,"If the precise date include day or month is not known or not allowed, December is used as the default month, and the last day of the month the default day.",No,No,,,,,
DEATH,death_datetime,No,datetime,,If not available set time to midnight (00:00:00),No,No,,,,,
DEATH,death_type_concept_id,No,integer,"This is the provenance of the death record, i.e., where it came from. It is possible that an administrative claims database would source death information from a government file so do not assume the Death Type is the same as the Visit Type, etc.",Use the type concept that be reflects the source of the death record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
DEATH,cause_concept_id,No,integer,"This is the Standard Concept representing the Person's cause of death, if available.","There is no specified domain for this concept, just choose the Standard Concept Id that best represents the person's cause of death.",No,Yes,CONCEPT,CONCEPT_ID,,,
DEATH,cause_source_value,No,varchar(50),,"If available, put the source code representing the cause of death here. ",No,No,,,,,
DEATH,cause_source_concept_id,No,integer,,If the cause of death was coded using a Vocabulary present in the OMOP Vocabularies put the CONCEPT_ID representing the cause of death here.,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,note_id,Yes,integer,A unique identifier for each note.,,Yes,No,,,,,
NOTE,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
NOTE,note_date,Yes,date,The date the note was recorded.,,No,No,,,,,
NOTE,note_datetime,No,datetime,,If time is not given set the time to midnight.,No,No,,,,,
NOTE,note_type_concept_id,Yes,integer,The provenance of the note. Most likely this will be EHR. ,"Put the source system of the note, as in EHR record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
",No,No,,,,,
DRUG_EXPOSURE,days_supply,No,integer,,Days supply of the drug. This should be the verbatim days_supply as given on the prescription. If the drug is physician administered use duration end date if given or set to 1 as default if duration is not available.,No,No,,,,,
DRUG_EXPOSURE,sig,No,varchar(MAX),This is the verbatim instruction for the drug as written by the provider.,"Put the written out instructions for the drug as it is verbatim in the source, if available.",No,No,,,,,
DRUG_EXPOSURE,route_concept_id,No,integer,,The standard CONCEPT_ID that the ROUTE_SOURCE_VALUE maps to in the route domain.,No,Yes,CONCEPT,CONCEPT_ID,Route,,
DRUG_EXPOSURE,lot_number,No,varchar(50),,,No,No,,,,,
DRUG_EXPOSURE,provider_id,No,integer,"The Provider associated with drug record, e.g. the provider who wrote the prescription or the provider who administered the drug.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the ordering vs administering physician on an EHR record.",No,Yes,PROVIDER,PROVIDER_ID,,,
DRUG_EXPOSURE,visit_occurrence_id,No,integer,"The Visit during which the drug was prescribed, administered or dispensed.",To populate this field drug exposures must be explicitly initiated in the visit.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
DRUG_EXPOSURE,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the drug exposure occurred. For example, if the person was in the ICU at the time of the drug administration the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
DRUG_EXPOSURE,drug_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the drug exposure that occurred. For example, this could be an NDC or Gemscript code.",This code is mapped to a Standard Drug Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
DRUG_EXPOSURE,drug_source_concept_id,No,integer,"This is the concept representing the drug source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Drug necessary for a given analytic use case. Consider using DRUG_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the DRUG_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_EXPOSURE,route_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the drug route.,This information may be called something different in the source data but the field is meant to contain a value indicating when and how a drug was given to a patient. This source value is mapped to a standard concept which is stored in the ROUTE_CONCEPT_ID field.,No,No,,,,,
DRUG_EXPOSURE,dose_unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the dose unit of the drug given.,This information may be called something different in the source data but the field is meant to contain a value indicating the unit of dosage of drug given to the patient. This is an older column and will be deprecated in an upcoming version.,No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_occurrence_id,Yes,integer,The unique key given to a procedure record for a person. Refer to the ETL for how duplicate procedures during the same visit were handled.,"Each instance of a procedure occurrence in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same procedure within the same visit. It is valid to keep these duplicates and assign them individual, unique, PROCEDURE_OCCURRENCE_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
PROCEDURE_OCCURRENCE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the procedure is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
PROCEDURE_OCCURRENCE,procedure_concept_id,Yes,integer,"The PROCEDURE_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a procedure","The CONCEPT_ID that the PROCEDURE_SOURCE_VALUE maps to. Only records whose source values map to standard concepts with a domain of ""Procedure"" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Procedure&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Procedure,,
PROCEDURE_OCCURRENCE,procedure_date,Yes,date,Use this date to determine the date the procedure occurred.,"If a procedure lasts more than a day, then it should be recorded as a separate record for each day the procedure occurred, this logic is in lieu of the procedure_end_date, which will be added in a future version of the CDM.",No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Procedure record, as in whether the procedure was from an EHR system, insurance claim, registry, or other sources.","Choose the PROCEDURE_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. If a procedure is recorded as an EHR encounter, the PROCEDURE_TYPE_CONCEPT would be 'EHR encounter record'. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
PROCEDURE_OCCURRENCE,modifier_concept_id,No,integer,The modifiers are intended to give additional information about the procedure but as of now the vocabulary is under review.,"It is up to the ETL to choose how to map modifiers if they exist in source data. These concepts are typically distinguished by 'Modifier' concept classes (e.g., 'CPT4 Modifier' as part of the 'CPT4' vocabulary). If there is more than one modifier on a record, one should be chosen that pertains to the procedure rather than provider. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?conceptClass=CPT4+Modifier&conceptClass=HCPCS+Modifier&vocabulary=CPT4&vocabulary=HCPCS&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PROCEDURE_OCCURRENCE,quantity,No,integer,"If the quantity value is omitted, a single procedure is assumed.","If a Procedure has a quantity of '0' in the source, this should default to '1' in the ETL. If there is a record in the source it can be assumed the exposure occurred at least once",No,No,,,,,
PROCEDURE_OCCURRENCE,provider_id,No,integer,"The provider associated with the procedure record, e.g. the provider who performed the Procedure.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record.",No,No,PROVIDER,PROVIDER_ID,,,
PROCEDURE_OCCURRENCE,visit_occurrence_id,No,integer,The visit during which the procedure occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a PROCEDURE_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the PROCEDURE_OCCURRENCE record.",No,No,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
PROCEDURE_OCCURRENCE,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the Procedure occurred. For example, if the Person was in the ICU at the time of the Procedure the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,No,VISIT_DETAIL,VISIT_DETAIL_ID,,,
PROCEDURE_OCCURRENCE,procedure_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the procedure that occurred. For example, this could be an CPT4 or OPCS4 code.",Use this value to look up the source concept id and then map the source concept id to a standard concept id.,No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_source_concept_id,No,integer,"This is the concept representing the procedure source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Procedure necessary for a given analytic use case. Consider using PROCEDURE_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the PROCEDURE_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,No,CONCEPT,CONCEPT_ID,,,
PROCEDURE_OCCURRENCE,modifier_source_value,No,varchar(50),,The original modifier code from the source is stored here for reference.,No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_status_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the procedure status (primary or secondary).,"This information may be called something different in the source data but the field is meant to contain a value indicating whether the procedure was the primary reason for performing a surgical operation, infusion, etc. This source value is mapped to a standard concept which is stored in the PROCEDURE_STATUS_CONCEPT_ID field.",,,,,,,
PROCEDURE_OCCURRENCE,procedure_status_concept_id,Yes,integer,"This concept represents if the procedure was the primary reason for the surgical operation, infusion, etc . ",Choose the Concept in the Procedure Status domain that best represents the status ( [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=).,,,,,,,
DEVICE_EXPOSURE,device_exposure_id,Yes,integer,The unique key given to records a person's exposure to a foreign physical object or instrument.,Each instance of an exposure to a foreign object or device present in the source data should be assigned this unique key. ,Yes,No,,,,,
DEVICE_EXPOSURE,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DEVICE_EXPOSURE,device_concept_id,Yes,integer,"The DEVICE_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source concept id which represents a foreign object or instrument the person was exposed to. ",The CONCEPT_ID that the DEVICE_SOURCE_VALUE maps to. ,No,Yes,CONCEPT,CONCEPT_ID,Device,,
DEVICE_EXPOSURE,device_exposure_start_date,Yes,date,Use this date to determine the start date of the device record.,"Valid entries include a start date of a procedure to implant a device, the date of a prescription for a device, or the date of device administration. ",No,No,,,,,
DEVICE_EXPOSURE,device_exposure_start_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
DEVICE_EXPOSURE,device_exposure_end_date,No,date,"The DEVICE_EXPOSURE_END_DATE denotes the day the device exposure ended for the patient, if given.",Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable.,No,No,,,,,
DEVICE_EXPOSURE,device_exposure_end_datetime,No,datetime,,If a source does not specify datetime the convention is to set the time to midnight (00:00:0000),No,No,,,,,
DEVICE_EXPOSURE,device_type_concept_id,Yes,integer,"You can use the TYPE_CONCEPT_ID to denote the provenance of the record, as in whether the record is from administrative claims or EHR. ","Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
DEVICE_EXPOSURE,unique_device_id,No,varchar(255),"This is the Unique Device Identification (UDI-DI) number for devices regulated by the FDA, if given. ","For medical devices that are regulated by the FDA, a Unique Device Identification (UDI) is provided if available in the data source and is recorded in the UNIQUE_DEVICE_ID field.",No,No,,,,,
DEVICE_EXPOSURE,production_id,No,varchar(255),This is the Production Identifier (UDI-PI) portion of the Unique Device Identification.,,,,,,,,
DEVICE_EXPOSURE,quantity,No,integer,,,No,No,,,,,
DEVICE_EXPOSURE,provider_id,No,integer,"The Provider associated with device record, e.g. the provider who wrote the prescription or the provider who implanted the device.",The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record.,No,Yes,PROVIDER,PROVIDER_ID,,,
DEVICE_EXPOSURE,visit_occurrence_id,No,integer,The Visit during which the device was prescribed or given.,To populate this field device exposures must be explicitly initiated in the visit.,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
DEVICE_EXPOSURE,visit_detail_id,No,integer,The Visit Detail during which the device was prescribed or given.,To populate this field device exposures must be explicitly initiated in the visit detail record.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
DEVICE_EXPOSURE,device_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the device exposure that occurred. For example, this could be an NDC or Gemscript code.",This code is mapped to a Standard Device Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
DEVICE_EXPOSURE,device_source_concept_id,No,integer,"This is the concept representing the device source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Device necessary for a given analytic use case. Consider using DEVICE_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the DEVICE_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
DEVICE_EXPOSURE,unit_concept_id,No,integer,UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. ,"There is no standardization requirement for units associated with DEVICE_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. If there is no unit associated with a Device record, set to NULL.",,,,,,,
DEVICE_EXPOSURE,unit_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the unit of the Device. For example, blood transfusions are considered devices and can be given in mL quantities. ","This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. Using the blood transfusion example, blood transfusion is represented by the DEVICE_CONCEPT_ID and the unit (mL) would be housed in the UNIT_SOURCE_VALUE and mapped to a standard concept in the unit domain. ",,,,,,,
DEVICE_EXPOSURE,unit_source_concept_id,No,integer,"This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Unit necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. ,,,,,,,
MEASUREMENT,measurement_id,Yes,integer,The unique key given to a Measurement record for a Person. Refer to the ETL for how duplicate Measurements during the same Visit were handled.,"Each instance of a measurement present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same measurement within the same visit. It is valid to keep these duplicates and assign them individual, unique, MEASUREMENT_IDs, though it is up to the ETL how they should be handled.",Yes,No,,,,,
MEASUREMENT,person_id,Yes,integer,The PERSON_ID of the Person for whom the Measurement is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
MEASUREMENT,measurement_concept_id,Yes,integer,"The MEASUREMENT_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies.","The CONCEPT_ID that the MEASUREMENT_SOURCE_CONCEPT_ID maps to. Only records whose SOURCE_CONCEPT_IDs map to Standard Concepts with a domain of ""Measurement"" should go in this table.",No,Yes,CONCEPT,CONCEPT_ID,Measurement,,
MEASUREMENT,measurement_date,Yes,date,Use this date to determine the date of the measurement.,"If there are multiple dates in the source data associated with a record such as order_date, draw_date, and result_date, choose the one that is closest to the date the sample was drawn from the patient.",No,No,,,,,
MEASUREMENT,measurement_datetime,No,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
MEASUREMENT,measurement_time,No,varchar(10),,This is present for backwards compatibility and will be deprecated in an upcoming version.,No,No,,,,,
MEASUREMENT,measurement_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Measurement record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources.","Choose the MEASUREMENT_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
MEASUREMENT,operator_concept_id,No,integer,"The meaning of Concept [4172703](https://athena.ohdsi.org/search-terms/terms/4172703) for '=' is identical to omission of a OPERATOR_CONCEPT_ID value. Since the use of this field is rare, it's important when devising analyses to not to forget testing for the content of this field for values different from =.","Operators are <, <=, =, >=, > and these concepts belong to the 'Meas Value Operator' domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Meas+Value+Operator&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,value_as_number,No,float,"This is the numerical value of the Result of the Measurement, if available. Note that measurements such as blood pressures will be split into their component parts i.e. one record for systolic, one record for diastolic.","If there is a negative value coming from the source, set the VALUE_AS_NUMBER to NULL, with the exception of the following Measurements (listed as LOINC codes):<br>- [1925-7](https://athena.ohdsi.org/search-terms/terms/3003396) Base excess in Arterial blood by calculation - [1927-3](https://athena.ohdsi.org/search-terms/terms/3002032) Base excess in Venous blood by calculation - [8632-2](https://athena.ohdsi.org/search-terms/terms/3006277) QRS-Axis - [11555-0](https://athena.ohdsi.org/search-terms/terms/3012501) Base excess in Blood by calculation - [1926-5](https://athena.ohdsi.org/search-terms/terms/3003129) Base excess in Capillary blood by calculation - [28638-5](https://athena.ohdsi.org/search-terms/terms/3004959) Base excess in Arterial cord blood by calculation [28639-3](https://athena.ohdsi.org/search-terms/terms/3007435) Base excess in Venous cord blood by calculation",No,No,,,,,
MEASUREMENT,value_as_concept_id,No,integer,If the raw data gives a categorial result for measurements those values are captured and mapped to standard concepts in the 'Meas Value' domain.,"If the raw data provides categorial results as well as continuous results for measurements, it is a valid ETL choice to preserve both values. The continuous value should go in the VALUE_AS_NUMBER field and the categorical value should be mapped to a standard concept in the 'Meas Value' domain and put in the VALUE_AS_CONCEPT_ID field. This is also the destination for the 'Maps to value' relationship.",No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,unit_concept_id,No,integer,"There is currently no recommended unit for individual measurements, i.e. it is not mandatory to represent Hemoglobin a1C measurements as a percentage. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data.","There is no standardization requirement for units associated with MEASUREMENT_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit.",No,Yes,CONCEPT,CONCEPT_ID,Unit,,
MEASUREMENT,range_low,No,float,Ranges have the same unit as the VALUE_AS_NUMBER. These ranges are provided by the source and should remain NULL if not given.,If reference ranges for upper and lower limit of normal as provided (typically by a laboratory) these are stored in the RANGE_HIGH and RANGE_LOW fields. This should be set to NULL if not provided.,No,No,,,,,
MEASUREMENT,range_high,No,float,Ranges have the same unit as the VALUE_AS_NUMBER. These ranges are provided by the source and should remain NULL if not given.,If reference ranges for upper and lower limit of normal as provided (typically by a laboratory) these are stored in the RANGE_HIGH and RANGE_LOW fields. This should be set to NULL if not provided.,No,No,,,,,
MEASUREMENT,provider_id,No,integer,"The provider associated with measurement record, e.g. the provider who ordered the test or the provider who recorded the result.",The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record.,No,Yes,PROVIDER,PROVIDER_ID,,,
MEASUREMENT,visit_occurrence_id,No,integer,The visit during which the Measurement occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a MEASUREMENT_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the measurement record. If a measurement is related to a visit explicitly in the source data, it is possible that the result date of the Measurement falls outside of the bounds of the Visit dates.",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
MEASUREMENT,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the Measurement occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
MEASUREMENT,measurement_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the Measurement that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Measurement Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
MEASUREMENT,measurement_source_concept_id,No,integer,"This is the concept representing the MEASUREMENT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using MEASUREMENT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the MEASUREMENT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the unit of the Measurement that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
MEASUREMENT,unit_source_concept_id,No,integer,"""This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.""",If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
MEASUREMENT,value_source_value,No,varchar(50),This field houses the verbatim result value of the Measurement from the source data . ,"If both a continuous and categorical result are given in the source data such that both VALUE_AS_NUMBER and VALUE_AS_CONCEPT_ID are both included, store the verbatim value that was mapped to VALUE_AS_CONCEPT_ID here.",No,No,,,,,
MEASUREMENT,measurement_event_id,No,bigint,"If the Measurement record is related to another record in the database, this field is the primary key of the linked record. ","Put the primary key of the linked record, if applicable, here. ",No,No,,,,,
MEASUREMENT,meas_event_field_concept_id,No,integer,"If the Measurement record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ",Put the CONCEPT_ID that identifies which table and field the MEASUREMENT_EVENT_ID came from.,No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,observation_id,Yes,integer,The unique key given to an Observation record for a Person. Refer to the ETL for how duplicate Observations during the same Visit were handled.,Each instance of an observation present in the source data should be assigned this unique key. ,Yes,No,,,,,
OBSERVATION,person_id,Yes,integer,The PERSON_ID of the Person for whom the Observation is recorded. This may be a system generated code.,,No,Yes,PERSON,PERSON_ID,,,
OBSERVATION,observation_concept_id,Yes,integer,"The OBSERVATION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies.","The CONCEPT_ID that the OBSERVATION_SOURCE_CONCEPT_ID maps to. There is no specified domain that the Concepts in this table must adhere to. The only rule is that records with Concepts in the Condition, Procedure, Drug, Measurement, or Device domains MUST go to the corresponding table. ",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,observation_date,Yes,date,"The date of the Observation. Depending on what the Observation represents this could be the date of a lab test, the date of a survey, or the date a patient's family history was taken. ",For some observations the ETL may need to make a choice as to which date to choose.,No,No,,,,,
OBSERVATION,observation_datetime,No,datetime,,If no time is given set to midnight (00:00:00).,No,No,,,,,
OBSERVATION,observation_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Observation record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources.","Choose the OBSERVATION_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
OBSERVATION,value_as_number,No,float,"This is the numerical value of the Result of the Observation, if applicable and available. It is not expected that all Observations will have numeric results, rather, this field is here to house values should they exist. ",,No,No,,,,,
OBSERVATION,value_as_string,No,varchar(60),"This is the categorical value of the Result of the Observation, if applicable and available. ",,No,No,,,,,
OBSERVATION,value_as_concept_id,No,Integer,"It is possible that some records destined for the Observation table have two clinical ideas represented in one source code. This is common with ICD10 codes that describe a family history of some Condition, for example. In OMOP the Vocabulary breaks these two clinical ideas into two codes; one becomes the OBSERVATION_CONCEPT_ID and the other becomes the VALUE_AS_CONCEPT_ID. It is important when using the Observation table to keep this possibility in mind and to examine the VALUE_AS_CONCEPT_ID field for relevant information. ","Note that the value of VALUE_AS_CONCEPT_ID may be provided through mapping from a source Concept which contains the content of the Observation. In those situations, the CONCEPT_RELATIONSHIP table in addition to the 'Maps to' record contains a second record with the relationship_id set to 'Maps to value'. For example, ICD10 [Z82.4](https://athena.ohdsi.org/search-terms/terms/45581076) 'Family history of ischaemic heart disease and other diseases of the circulatory system' has a 'Maps to' relationship to [4167217](https://athena.ohdsi.org/search-terms/terms/4167217) 'Family history of clinical finding' as well as a 'Maps to value' record to [134057](https://athena.ohdsi.org/search-terms/terms/134057) 'Disorder of cardiovascular system'.",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,qualifier_concept_id,No,integer,"This field contains all attributes specifying the clinical fact further, such as as degrees, severities, drug-drug interaction alerts etc.","Use your best judgement as to what Concepts to use here and if they are necessary to accurately represent the clinical record. There is no restriction on the domain of these Concepts, they just need to be Standard.",No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,unit_concept_id,No,integer,There is currently no recommended unit for individual observation concepts. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data.,"There is no standardization requirement for units associated with OBSERVATION_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit.",No,Yes,CONCEPT,CONCEPT_ID,Unit,,
OBSERVATION,provider_id,No,integer,"The provider associated with the observation record, e.g. the provider who ordered the test or the provider who recorded the result.",The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record.,No,Yes,PROVIDER,PROVIDER_ID,,,
OBSERVATION,visit_occurrence_id,No,integer,The visit during which the Observation occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If an OBSERVATION_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the observation record. If an observation is related to a visit explicitly in the source data, it is possible that the result date of the Observation falls outside of the bounds of the Visit dates.",No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
OBSERVATION,visit_detail_id,No,integer,"The VISIT_DETAIL record during which the Observation occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit.",Same rules apply as for the VISIT_OCCURRENCE_ID.,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
OBSERVATION,observation_source_value,No,varchar(50),"This field houses the verbatim value from the source data representing the Observation that occurred. For example, this could be an ICD10 or Read code.",This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
OBSERVATION,observation_source_concept_id,No,integer,"This is the concept representing the OBSERVATION_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Observation necessary for a given analytic use case. Consider using OBSERVATION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network.",If the OBSERVATION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.,No,Yes,CONCEPT,CONCEPT_ID,,,
OBSERVATION,unit_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the unit of the Observation that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
OBSERVATION,qualifier_source_value,No,varchar(50),This field houses the verbatim value from the source data representing the qualifier of the Observation that occurred. ,This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,No,No,,,,,
OBSERVATION,value_source_value,No,varchar(50),This field houses the verbatim result value of the Observation from the source data. Do not get confused with the Observation_source_value which captures source value of the observation mapped to observation_concept_id. This field is the observation result value from the source.," If the observation_source_value was a question, for example, or an observation that requires a result then this field is the answer/ result from the source data. Store the verbatim value that represents the result of the observation_source_value. ",No,No,,,,,
OBSERVATION,observation_event_id,No,bigint,"If the Observation record is related to another record in the database, this field is the primary key of the linked record. ","Put the primary key of the linked record, if applicable, here. See the [ETL Conventions for the OBSERVATION](https://ohdsi.github.io/CommonDataModel/cdm60.html#observation) table for more details.",No,No,,,,,
OBSERVATION,obs_event_field_concept_id,No,integer,"If the Observation record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ",Put the CONCEPT_ID that identifies which table and field the OBSERVATION_EVENT_ID came from.,No,Yes,CONCEPT,CONCEPT_ID,,,
DEATH,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DEATH,death_date,Yes,date,The date the person was deceased.,"If the precise date include day or month is not known or not allowed, December is used as the default month, and the last day of the month the default day.",No,No,,,,,
DEATH,death_datetime,No,datetime,,If not available set time to midnight (00:00:00),No,No,,,,,
DEATH,death_type_concept_id,No,integer,"This is the provenance of the death record, i.e., where it came from. It is possible that an administrative claims database would source death information from a government file so do not assume the Death Type is the same as the Visit Type, etc.",Use the type concept that be reflects the source of the death record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
DEATH,cause_concept_id,No,integer,"This is the Standard Concept representing the Person's cause of death, if available.","There is no specified domain for this concept, just choose the Standard Concept Id that best represents the person's cause of death.",No,Yes,CONCEPT,CONCEPT_ID,,,
DEATH,cause_source_value,No,varchar(50),,"If available, put the source code representing the cause of death here. ",No,No,,,,,
DEATH,cause_source_concept_id,No,integer,,If the cause of death was coded using a Vocabulary present in the OMOP Vocabularies put the CONCEPT_ID representing the cause of death here.,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,note_id,Yes,integer,A unique identifier for each note.,,Yes,No,,,,,
NOTE,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
NOTE,note_event_id,No,bigint,"If the Note record is related to another record in the database, this field is the primary key of the linked record. ","Put the primary key of the linked record, if applicable, here.",No,No,,,,,
NOTE,note_event_field_concept_id,No,integer,"If the Note record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ",Put the CONCEPT_ID that identifies which table and field the NOTE_EVENT_ID came from.,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,note_date,Yes,date,The date the note was recorded.,,No,No,,,,,
NOTE,note_datetime,No,datetime,,If time is not given set the time to midnight.,No,No,,,,,
NOTE,note_type_concept_id,Yes,integer,The provenance of the note. Most likely this will be EHR. ,"Put the source system of the note, as in EHR record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
NOTE,note_class_concept_id,Yes,integer,"A Standard Concept Id representing the HL7 LOINC
Document Type Vocabulary classification of the note.",Map the note classification to a Standard Concept. For more information see the ETL Conventions in the description of the NOTE table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&conceptClass=Doc+Kind&conceptClass=Doc+Role&conceptClass=Doc+Setting&conceptClass=Doc+Subject+Matter&conceptClass=Doc+Type+of+Service&domain=Meas+Value&page=1&pageSize=15&query=). This Concept can alternatively be represented by concepts with the relationship 'Kind of (LOINC)' to [706391](https://athena.ohdsi.org/search-terms/terms/706391) (Note).,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,note_title,No,varchar(250),The title of the note.,,No,No,,,,,
NOTE,note_text,Yes,varchar(MAX),The content of the note.,,No,No,,,,,
NOTE,encoding_concept_id,Yes,integer,This is the Concept representing the character encoding type. ,"Put the Concept Id that represents the encoding character type here. Currently the only option is UTF-8 ([32678](https://athena.ohdsi.org/search-terms/terms/32678)). It the note is encoded in any other type, like ASCII then put 0. ",No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,language_concept_id,Yes,integer,The language of the note. ,Use Concepts that are descendants of the concept [4182347](https://athena.ohdsi.org/search-terms/terms/4182347) (World Languages).,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,provider_id,No,integer,The Provider who wrote the note.,The ETL may need to make a determination on which provider to put here.,No,Yes,PROVIDER,PROVIDER_ID,,,
NOTE,visit_occurrence_id,No,integer,The Visit during which the note was written. ,,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
NOTE,visit_detail_id,No,integer,The Visit Detail during which the note was written.,,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
NOTE,note_source_value,No,varchar(50),,The source value mapped to the NOTE_CLASS_CONCEPT_ID.,No,No,,,,,
NOTE_NLP,note_nlp_id,Yes,integer,A unique identifier for the NLP record.,,Yes,No,,,,,
NOTE_NLP,note_id,Yes,integer,This is the NOTE_ID for the NOTE record the NLP record is associated to.,,No,No,,,,,
NOTE_NLP,section_concept_id,No,integer,,"The SECTION_CONCEPT_ID should be used to represent the note section contained in the NOTE_NLP record. These concepts can be found as parts of document panels and are based on the type of note written, i.e. a discharge summary. These panels can be found as concepts with the relationship 'Subsumes' to CONCEPT_ID [45875957](https://athena.ohdsi.org/search-terms/terms/45875957).",No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,snippet,No,varchar(250),A small window of text surrounding the term,,No,No,,,,,
NOTE_NLP,offset,No,varchar(50),Character offset of the extracted term in the input note,,No,No,,,,,
NOTE_NLP,lexical_variant,Yes,varchar(250),Raw text extracted from the NLP tool.,,No,No,,,,,
NOTE_NLP,note_nlp_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,note_nlp_source_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,nlp_system,No,varchar(250),,Name and version of the NLP system that extracted the term. Useful for data provenance.,No,No,,,,,
NOTE_NLP,nlp_date,Yes,date,The date of the note processing.,,No,No,,,,,
NOTE_NLP,nlp_datetime,No,datetime,The date and time of the note processing.,,No,No,,,,,
Document Type Vocabulary classification of the note.",Map the note classification to a Standard Concept. For more information see the ETL Conventions in the description of the NOTE table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&conceptClass=Doc+Kind&conceptClass=Doc+Role&conceptClass=Doc+Setting&conceptClass=Doc+Subject+Matter&conceptClass=Doc+Type+of+Service&domain=Meas+Value&page=1&pageSize=15&query=). This Concept can alternatively be represented by concepts with the relationship 'Kind of (LOINC)' to [706391](https://athena.ohdsi.org/search-terms/terms/706391) (Note).,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,note_title,No,varchar(250),The title of the note.,,No,No,,,,,
NOTE,note_text,Yes,varchar(MAX),The content of the note.,,No,No,,,,,
NOTE,encoding_concept_id,Yes,integer,This is the Concept representing the character encoding type. ,"Put the Concept Id that represents the encoding character type here. Currently the only option is UTF-8 ([32678](https://athena.ohdsi.org/search-terms/terms/32678)). It the note is encoded in any other type, like ASCII then put 0. ",No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,language_concept_id,Yes,integer,The language of the note. ,Use Concepts that are descendants of the concept [4182347](https://athena.ohdsi.org/search-terms/terms/4182347) (World Languages).,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE,provider_id,No,integer,The Provider who wrote the note.,The ETL may need to make a determination on which provider to put here.,No,Yes,PROVIDER,PROVIDER_ID,,,
NOTE,visit_occurrence_id,No,integer,The Visit during which the note was written. ,,No,Yes,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
NOTE,visit_detail_id,No,integer,The Visit Detail during which the note was written.,,No,Yes,VISIT_DETAIL,VISIT_DETAIL_ID,,,
NOTE,note_source_value,No,varchar(50),,The source value mapped to the NOTE_CLASS_CONCEPT_ID.,No,No,,,,,
NOTE_NLP,note_nlp_id,Yes,integer,A unique identifier for the NLP record.,,Yes,No,,,,,
NOTE_NLP,note_id,Yes,integer,This is the NOTE_ID for the NOTE record the NLP record is associated to.,,No,No,,,,,
NOTE_NLP,section_concept_id,No,integer,,"The SECTION_CONCEPT_ID should be used to represent the note section contained in the NOTE_NLP record. These concepts can be found as parts of document panels and are based on the type of note written, i.e. a discharge summary. These panels can be found as concepts with the relationship 'Subsumes' to CONCEPT_ID [45875957](https://athena.ohdsi.org/search-terms/terms/45875957).",No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,snippet,No,varchar(250),A small window of text surrounding the term,,No,No,,,,,
NOTE_NLP,offset,No,varchar(50),Character offset of the extracted term in the input note,,No,No,,,,,
NOTE_NLP,lexical_variant,Yes,varchar(250),Raw text extracted from the NLP tool.,,No,No,,,,,
NOTE_NLP,note_nlp_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,note_nlp_source_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,nlp_system,No,varchar(250),,Name and version of the NLP system that extracted the term. Useful for data provenance.,No,No,,,,,
NOTE_NLP,nlp_date,Yes,date,The date of the note processing.,,No,No,,,,,
NOTE_NLP,nlp_datetime,No,datetime,The date and time of the note processing.,,No,No,,,,,
NOTE_NLP,term_exists,No,varchar(1),,"Term_exists is defined as a flag that indicates if the patient actually has or had the condition. Any of the following modifiers would make Term_exists false:
Negation = true
Subject = [anything other than the patient]
@ -226,304 +232,320 @@ Conditional = true/li>
Rule_out = true
Uncertain = very low certainty or any lower certainties
A complete lack of modifiers would make Term_exists true.
",No,No,,,,,
",No,No,,,,,
NOTE_NLP,term_temporal,No,varchar(50),,"Term_temporal is to indicate if a condition is present or just in the past. The following would be past:<br><br>
- History = true
- Concept_date = anything before the time of the report",No,No,,,,,
- Concept_date = anything before the time of the report",No,No,,,,,
NOTE_NLP,term_modifiers,No,varchar(2000),,"For the modifiers that are there, they would have to have these values:<br><br>
- Negation = false
- Subject = patient
- Conditional = false
- Rule_out = false
- Uncertain = true or high or moderate or even low (could argue about low). Term_modifiers will concatenate all modifiers for different types of entities (conditions, drugs, labs etc) into one string. Lab values will be saved as one of the modifiers. ",No,No,,,,,
SPECIMEN,specimen_id,Yes,integer,Unique identifier for each specimen.,,Yes,No,,,,,
SPECIMEN,person_id,Yes,integer,The person from whom the specimen is collected.,,No,Yes,PERSON,PERSON_ID,,,
SPECIMEN,specimen_concept_id,Yes,integer,,The standard CONCEPT_ID that the SPECIMEN_SOURCE_VALUE maps to in the specimen domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Specimen&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,specimen_type_concept_id,Yes,integer,,"Put the source of the specimen record, as in an EHR system. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
SPECIMEN,specimen_date,Yes,date,The date the specimen was collected.,,No,No,,,,,
SPECIMEN,specimen_datetime,No,datetime,,,No,No,,,,,
SPECIMEN,quantity,No,float,The amount of specimen collected from the person.,,No,No,,,,,
SPECIMEN,unit_concept_id,No,integer,The unit for the quantity of the specimen.,Map the UNIT_SOURCE_VALUE to a Standard Concept in the Unit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Unit&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,anatomic_site_concept_id,No,integer,This is the site on the body where the specimen is from.,Map the ANATOMIC_SITE_SOURCE_VALUE to a Standard Concept in the Spec Anatomic Site domain. This should be coded at the lowest level of granularity [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Spec+Anatomic+Site&conceptClass=Body+Structure&page=4&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,disease_status_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,specimen_source_id,No,varchar(50),This is the identifier for the specimen from the source system. ,,No,No,,,,,
SPECIMEN,specimen_source_value,No,varchar(50),,,No,No,,,,,
SPECIMEN,unit_source_value,No,varchar(50),,"This unit for the quantity of the specimen, as represented in the source.",No,No,,,,,
SPECIMEN,anatomic_site_source_value,No,varchar(50),,"This is the site on the body where the specimen was taken from, as represented in the source.",No,No,,,,,
SPECIMEN,disease_status_source_value,No,varchar(50),,,No,No,,,,,
FACT_RELATIONSHIP,domain_concept_id_1,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
FACT_RELATIONSHIP,fact_id_1,Yes,integer,,,No,No,,,,,
FACT_RELATIONSHIP,domain_concept_id_2,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
FACT_RELATIONSHIP,fact_id_2,Yes,integer,,,No,No,,,,,
FACT_RELATIONSHIP,relationship_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
LOCATION,location_id,Yes,integer,The unique key given to a unique Location.,Each instance of a Location in the source data should be assigned this unique key.,Yes,No,,,,,
LOCATION,address_1,No,varchar(50),This is the first line of the address.,,No,No,,,,,
LOCATION,address_2,No,varchar(50),This is the second line of the address,,No,No,,,,,
LOCATION,city,No,varchar(50),,,No,No,,,,,
LOCATION,state,No,varchar(2),,,No,No,,,,,
LOCATION,zip,No,varchar(9),,"Zip codes are handled as strings of up to 9 characters length. For US addresses, these represent either a 3-digit abbreviated Zip code as provided by many sources for patient protection reasons, the full 5-digit Zip or the 9-digit (ZIP + 4) codes. Unless for specific reasons analytical methods should expect and utilize only the first 3 digits. For international addresses, different rules apply.",No,No,,,,,
LOCATION,county,No,varchar(20),,,No,No,,,,,
LOCATION,location_source_value,No,varchar(50),,"Put the verbatim value for the location here, as it shows up in the source. ",No,No,,,,,
LOCATION,country_concept_id,No,integer,The Concept Id representing the country. Values should conform to the [Geography](https://athena.ohdsi.org/search-terms/terms?domain=Geography&standardConcept=Standard&page=1&pageSize=15&query=&boosts) domain. ,,,,,,,,
LOCATION,country_source_value,No,varchar(80),The name of the country.,,,,,,,,
LOCATION,latitude,No,float,,Must be between -90 and 90.,,,,,,,
LOCATION,longitude,No,float,,Must be between -180 and 180.,,,,,,,
CARE_SITE,care_site_id,Yes,integer,,Assign an id to each unique combination of location_id and place_of_service_source_value,Yes,No,,,,,
CARE_SITE,care_site_name,No,varchar(255),The name of the care_site as it appears in the source data,,No,No,,,,,
CARE_SITE,place_of_service_concept_id,No,integer,"This is a high-level way of characterizing a Care Site. Typically, however, Care Sites can provide care in multiple settings (inpatient, outpatient, etc.) and this granularity should be reflected in the visit.","Choose the concept in the visit domain that best represents the setting in which healthcare is provided in the Care Site. If most visits in a Care Site are Inpatient, then the place_of_service_concept_id should represent Inpatient. If information is present about a unique Care Site (e.g. Pharmacy) then a Care Site record should be created. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=2&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
CARE_SITE,location_id,No,integer,The location_id from the LOCATION table representing the physical location of the care_site.,,No,Yes,LOCATION,LOCATION_ID,,,
CARE_SITE,care_site_source_value,No,varchar(50),The identifier of the care_site as it appears in the source data. This could be an identifier separate from the name of the care_site.,,No,No,,,,,
CARE_SITE,place_of_service_source_value,No,varchar(50),,Put the place of service of the care_site as it appears in the source data.,No,No,,,,,
PROVIDER,provider_id,Yes,integer,It is assumed that every provider with a different unique identifier is in fact a different person and should be treated independently.,"This identifier can be the original id from the source data provided it is an integer, otherwise it can be an autogenerated number.",Yes,No,,,,,
PROVIDER,provider_name,No,varchar(255),,"This field is not necessary as it is not necessary to have the actual identity of the Provider. Rather, the idea is to uniquely and anonymously identify providers of care across the database.",No,No,,,,,
PROVIDER,npi,No,varchar(20),This is the National Provider Number issued to health care providers in the US by the Centers for Medicare and Medicaid Services (CMS).,,No,No,,,,,
PROVIDER,dea,No,varchar(20),"This is the identifier issued by the DEA, a US federal agency, that allows a provider to write prescriptions for controlled substances.",,No,No,,,,,
PROVIDER,specialty_concept_id,No,integer,"This field either represents the most common specialty that occurs in the data or the most specific concept that represents all specialties listed, should the provider have more than one. This includes physician specialties such as internal medicine, emergency medicine, etc. and allied health professionals such as nurses, midwives, and pharmacists.","If a Provider has more than one Specialty, there are two options: 1. Choose a concept_id which is a common ancestor to the multiple specialties, or, 2. Choose the specialty that occurs most often for the provider. Concepts in this field should be Standard with a domain of Provider. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Provider&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PROVIDER,care_site_id,No,integer,This is the CARE_SITE_ID for the location that the provider primarily practices in.,"If a Provider has more than one Care Site, the main or most often exerted CARE_SITE_ID should be recorded.",No,Yes,CARE_SITE,CARE_SITE_ID,,,
PROVIDER,year_of_birth,No,integer,,,No,No,,,,,
PROVIDER,gender_concept_id,No,integer,This field represents the recorded gender of the provider in the source data.,"If given, put a concept from the gender domain representing the recorded gender of the provider. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Gender&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Gender,,
PROVIDER,provider_source_value,No,varchar(50),Use this field to link back to providers in the source data. This is typically used for error checking of ETL logic.,Some use cases require the ability to link back to providers in the source data. This field allows for the storing of the provider identifier as it appears in the source.,No,No,,,,,
PROVIDER,specialty_source_value,No,varchar(50),"This is the kind of provider or specialty as it appears in the source data. This includes physician specialties such as internal medicine, emergency medicine, etc. and allied health professionals such as nurses, midwives, and pharmacists.",Put the kind of provider as it appears in the source data. This field is up to the discretion of the ETL-er as to whether this should be the coded value from the source or the text description of the lookup value.,No,No,,,,,
PROVIDER,specialty_source_concept_id,No,integer,This is often zero as many sites use proprietary codes to store physician speciality.,If the source data codes provider specialty in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PROVIDER,gender_source_value,No,varchar(50),This is provider's gender as it appears in the source data.,Put the provider's gender as it appears in the source data. This field is up to the discretion of the ETL-er as to whether this should be the coded value from the source or the text description of the lookup value.,No,No,,,,,
PROVIDER,gender_source_concept_id,No,integer,This is often zero as many sites use proprietary codes to store provider gender.,If the source data codes provider gender in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,payer_plan_period_id,Yes,integer,"A unique identifier for each unique combination of a Person, Payer, Plan, and Period of time.",,Yes,Yes,PERSON,PERSON_ID,,,
PAYER_PLAN_PERIOD,person_id,Yes,integer,The Person covered by the Plan.,"A single Person can have multiple, overlapping, PAYER_PLAN_PERIOD records",No,Yes,PERSON,PERSON_ID,,,
PAYER_PLAN_PERIOD,payer_plan_period_start_date,Yes,date,Start date of Plan coverage.,,No,No,,,,,
PAYER_PLAN_PERIOD,payer_plan_period_end_date,Yes,date,End date of Plan coverage.,,No,No,,,,,
PAYER_PLAN_PERIOD,payer_concept_id,No,integer,This field represents the organization who reimburses the provider which administers care to the Person.,"Map the Payer directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same payer, though the name of the Payer is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Payer&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,payer_source_value,No,varchar(50),This is the Payer as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,payer_source_concept_id,No,integer,,If the source data codes the Payer in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,plan_concept_id,No,integer,This field represents the specific health benefit Plan the Person is enrolled in.,Map the Plan directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same health benefit Plan though the name of the Plan is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,plan_source_value,No,varchar(50),This is the health benefit Plan of the Person as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,plan_source_concept_id,No,integer,,If the source data codes the Plan in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,sponsor_concept_id,No,integer,"This field represents the sponsor of the Plan who finances the Plan. This includes self-insured, small group health plan and large group health plan.",Map the sponsor directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same sponsor though the name of the sponsor is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Sponsor&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,sponsor_source_value,No,varchar(50),The Plan sponsor as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,sponsor_source_concept_id,No,integer,,If the source data codes the sponsor in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,family_source_value,No,varchar(50),The common identifier for all people (often a family) that covered by the same policy.,Often these are the common digits of the enrollment id of the policy members.,No,No,,,,,
PAYER_PLAN_PERIOD,stop_reason_concept_id,No,integer,"This field represents the reason the Person left the Plan, if known.",Map the stop reason directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan+Stop+Reason&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,stop_reason_source_value,No,varchar(50),The Plan stop reason as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,stop_reason_source_concept_id,No,integer,,If the source data codes the stop reason in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,cost_id,Yes,integer,,,Yes,No,,,,,
COST,cost_event_id,Yes,integer,,,No,No,,,,,
COST,cost_domain_id,Yes,varchar(20),,,No,Yes,DOMAIN,DOMAIN_ID,,,
COST,cost_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,currency_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,total_charge,No,float,,,No,No,,,,,
COST,total_cost,No,float,,,No,No,,,,,
COST,total_paid,No,float,,,No,No,,,,,
COST,paid_by_payer,No,float,,,No,No,,,,,
COST,paid_by_patient,No,float,,,No,No,,,,,
COST,paid_patient_copay,No,float,,,No,No,,,,,
COST,paid_patient_coinsurance,No,float,,,No,No,,,,,
COST,paid_patient_deductible,No,float,,,No,No,,,,,
COST,paid_by_primary,No,float,,,No,No,,,,,
COST,paid_ingredient_cost,No,float,,,No,No,,,,,
COST,paid_dispensing_fee,No,float,,,No,No,,,,,
COST,payer_plan_period_id,No,integer,,,No,No,,,,,
COST,amount_allowed,No,float,,,No,No,,,,,
COST,revenue_code_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,revenue_code_source_value,No,varchar(50),Revenue codes are a method to charge for a class of procedures and conditions in the U.S. hospital system.,,No,No,,,,,
COST,drg_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,drg_source_value,No,varchar(3),Diagnosis Related Groups are US codes used to classify hospital cases into one of approximately 500 groups. ,,No,No,,,,,
DRUG_ERA,drug_era_id,Yes,integer,,,Yes,No,,,,,
DRUG_ERA,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DRUG_ERA,drug_concept_id,Yes,integer,The Concept Id representing the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Drug,Ingredient,
DRUG_ERA,drug_era_start_date,Yes,datetime,,"The Drug Era Start Date is the start date of the first Drug Exposure for a given ingredient, with at least 31 days since the previous exposure. ",No,No,,,,,
- Uncertain = true or high or moderate or even low (could argue about low). Term_modifiers will concatenate all modifiers for different types of entities (conditions, drugs, labs etc) into one string. Lab values will be saved as one of the modifiers. ",No,No,,,,,
SPECIMEN,specimen_id,Yes,integer,Unique identifier for each specimen.,,Yes,No,,,,,
SPECIMEN,person_id,Yes,integer,The person from whom the specimen is collected.,,No,Yes,PERSON,PERSON_ID,,,
SPECIMEN,specimen_concept_id,Yes,integer,,The standard CONCEPT_ID that the SPECIMEN_SOURCE_VALUE maps to in the specimen domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Specimen&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,specimen_type_concept_id,Yes,integer,,"Put the source of the specimen record, as in an EHR system. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
SPECIMEN,specimen_date,Yes,date,The date the specimen was collected.,,No,No,,,,,
SPECIMEN,specimen_datetime,No,datetime,,,No,No,,,,,
SPECIMEN,quantity,No,float,The amount of specimen collected from the person.,,No,No,,,,,
SPECIMEN,unit_concept_id,No,integer,The unit for the quantity of the specimen.,Map the UNIT_SOURCE_VALUE to a Standard Concept in the Unit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Unit&standardConcept=Standard&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,anatomic_site_concept_id,No,integer,This is the site on the body where the specimen is from.,Map the ANATOMIC_SITE_SOURCE_VALUE to a Standard Concept in the Spec Anatomic Site domain. This should be coded at the lowest level of granularity [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Spec+Anatomic+Site&conceptClass=Body+Structure&page=4&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,disease_status_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
SPECIMEN,specimen_source_id,No,varchar(50),This is the identifier for the specimen from the source system. ,,No,No,,,,,
SPECIMEN,specimen_source_value,No,varchar(50),,,No,No,,,,,
SPECIMEN,unit_source_value,No,varchar(50),,"This unit for the quantity of the specimen, as represented in the source.",No,No,,,,,
SPECIMEN,anatomic_site_source_value,No,varchar(50),,"This is the site on the body where the specimen was taken from, as represented in the source.",No,No,,,,,
SPECIMEN,disease_status_source_value,No,varchar(50),,,No,No,,,,,
FACT_RELATIONSHIP,domain_concept_id_1,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
FACT_RELATIONSHIP,fact_id_1,Yes,integer,,,No,No,,,,,
FACT_RELATIONSHIP,domain_concept_id_2,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
FACT_RELATIONSHIP,fact_id_2,Yes,integer,,,No,No,,,,,
FACT_RELATIONSHIP,relationship_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
LOCATION,location_id,Yes,integer,The unique key given to a unique Location.,Each instance of a Location in the source data should be assigned this unique key.,Yes,No,,,,,
LOCATION,address_1,No,varchar(50),This is the first line of the address.,,No,No,,,,,
LOCATION,address_2,No,varchar(50),This is the second line of the address,,No,No,,,,,
LOCATION,city,No,varchar(50),,,No,No,,,,,
LOCATION,state,No,varchar(2),Please see the user guide for the location table for clarification on what this field represents in locations outside of the US.,,No,No,,,,,
LOCATION,zip,No,varchar(9),,"Zip codes are handled as strings of up to 9 characters length. For US addresses, these represent either a 3-digit abbreviated Zip code as provided by many sources for patient protection reasons, the full 5-digit Zip or the 9-digit (ZIP + 4) codes. Unless for specific reasons analytical methods should expect and utilize only the first 3 digits. For international addresses, different rules apply.",No,No,,,,,
LOCATION,county,No,varchar(20),,,No,No,,,,,
LOCATION,location_source_value,No,varchar(50),,"Put the verbatim value for the location here, as it shows up in the source. ",No,No,,,,,
LOCATION,country_concept_id,No,integer,The Concept Id representing the country. Values should conform to the [Geography](https://athena.ohdsi.org/search-terms/terms?domain=Geography&standardConcept=Standard&page=1&pageSize=15&query=&boosts) domain. ,,,,,,,,
LOCATION,country_source_value,No,varchar(80),The name of the country.,,,,,,,,
LOCATION,latitude,No,float,,Must be between -90 and 90.,,,,,,,
LOCATION,longitude,No,float,,Must be between -180 and 180.,,,,,,,
CARE_SITE,care_site_id,Yes,integer,,Assign an id to each unique combination of location_id and place_of_service_source_value,Yes,No,,,,,
CARE_SITE,care_site_name,No,varchar(255),The name of the care_site as it appears in the source data,,No,No,,,,,
CARE_SITE,place_of_service_concept_id,No,integer,"This is a high-level way of characterizing a Care Site. Typically, however, Care Sites can provide care in multiple settings (inpatient, outpatient, etc.) and this granularity should be reflected in the visit.","Choose the concept in the visit domain that best represents the setting in which healthcare is provided in the Care Site. If most visits in a Care Site are Inpatient, then the place_of_service_concept_id should represent Inpatient. If information is present about a unique Care Site (e.g. Pharmacy) then a Care Site record should be created. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=2&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
CARE_SITE,location_id,No,integer,The location_id from the LOCATION table representing the physical location of the care_site.,,No,Yes,LOCATION,LOCATION_ID,,,
CARE_SITE,care_site_source_value,No,varchar(50),The identifier of the care_site as it appears in the source data. This could be an identifier separate from the name of the care_site.,,No,No,,,,,
CARE_SITE,place_of_service_source_value,No,varchar(50),,Put the place of service of the care_site as it appears in the source data.,No,No,,,,,
PROVIDER,provider_id,Yes,integer,It is assumed that every provider with a different unique identifier is in fact a different person and should be treated independently.,"This identifier can be the original id from the source data provided it is an integer, otherwise it can be an autogenerated number.",Yes,No,,,,,
PROVIDER,provider_name,No,varchar(255),,"This field is not necessary as it is not necessary to have the actual identity of the Provider. Rather, the idea is to uniquely and anonymously identify providers of care across the database.",No,No,,,,,
PROVIDER,npi,No,varchar(20),This is the National Provider Number issued to health care providers in the US by the Centers for Medicare and Medicaid Services (CMS).,,No,No,,,,,
PROVIDER,dea,No,varchar(20),"This is the identifier issued by the DEA, a US federal agency, that allows a provider to write prescriptions for controlled substances.",,No,No,,,,,
PROVIDER,specialty_concept_id,No,integer,"This field either represents the most common specialty that occurs in the data or the most specific concept that represents all specialties listed, should the provider have more than one. This includes physician specialties such as internal medicine, emergency medicine, etc. and allied health professionals such as nurses, midwives, and pharmacists.","If a Provider has more than one Specialty, there are two options: 1. Choose a concept_id which is a common ancestor to the multiple specialties, or, 2. Choose the specialty that occurs most often for the provider. Concepts in this field should be Standard with a domain of Provider. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Provider&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PROVIDER,care_site_id,No,integer,This is the CARE_SITE_ID for the location that the provider primarily practices in.,"If a Provider has more than one Care Site, the main or most often exerted CARE_SITE_ID should be recorded.",No,Yes,CARE_SITE,CARE_SITE_ID,,,
PROVIDER,year_of_birth,No,integer,,,No,No,,,,,
PROVIDER,gender_concept_id,No,integer,This field represents the recorded gender of the provider in the source data.,"If given, put a concept from the gender domain representing the recorded gender of the provider. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Gender&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Gender,,
PROVIDER,provider_source_value,No,varchar(50),Use this field to link back to providers in the source data. This is typically used for error checking of ETL logic.,Some use cases require the ability to link back to providers in the source data. This field allows for the storing of the provider identifier as it appears in the source.,No,No,,,,,
PROVIDER,specialty_source_value,No,varchar(50),"This is the kind of provider or specialty as it appears in the source data. This includes physician specialties such as internal medicine, emergency medicine, etc. and allied health professionals such as nurses, midwives, and pharmacists.",Put the kind of provider as it appears in the source data. This field is up to the discretion of the ETL-er as to whether this should be the coded value from the source or the text description of the lookup value.,No,No,,,,,
PROVIDER,specialty_source_concept_id,No,integer,This is often zero as many sites use proprietary codes to store physician speciality.,If the source data codes provider specialty in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PROVIDER,gender_source_value,No,varchar(50),This is provider's gender as it appears in the source data.,Put the provider's gender as it appears in the source data. This field is up to the discretion of the ETL-er as to whether this should be the coded value from the source or the text description of the lookup value.,No,No,,,,,
PROVIDER,gender_source_concept_id,No,integer,This is often zero as many sites use proprietary codes to store provider gender.,If the source data codes provider gender in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,payer_plan_period_id,Yes,integer,"A unique identifier for each unique combination of a Person, Payer, Plan, and Period of time.",,Yes,Yes,PERSON,PERSON_ID,,,
PAYER_PLAN_PERIOD,person_id,Yes,integer,The Person covered by the Plan.,"A single Person can have multiple, overlapping, PAYER_PLAN_PERIOD records",No,Yes,PERSON,PERSON_ID,,,
PAYER_PLAN_PERIOD,payer_plan_period_start_date,Yes,date,Start date of Plan coverage.,,No,No,,,,,
PAYER_PLAN_PERIOD,payer_plan_period_end_date,Yes,date,End date of Plan coverage.,,No,No,,,,,
PAYER_PLAN_PERIOD,payer_concept_id,No,integer,This field represents the organization who reimburses the provider which administers care to the Person.,"Map the Payer directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same payer, though the name of the Payer is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Payer&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,payer_source_value,No,varchar(50),This is the Payer as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,payer_source_concept_id,No,integer,,If the source data codes the Payer in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,plan_concept_id,No,integer,This field represents the specific health benefit Plan the Person is enrolled in.,Map the Plan directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same health benefit Plan though the name of the Plan is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,plan_source_value,No,varchar(50),This is the health benefit Plan of the Person as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,plan_source_concept_id,No,integer,,If the source data codes the Plan in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,sponsor_concept_id,No,integer,"This field represents the sponsor of the Plan who finances the Plan. This includes self-insured, small group health plan and large group health plan.",Map the sponsor directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same sponsor though the name of the sponsor is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Sponsor&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,sponsor_source_value,No,varchar(50),The Plan sponsor as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,sponsor_source_concept_id,No,integer,,If the source data codes the sponsor in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,family_source_value,No,varchar(50),The common identifier for all people (often a family) that covered by the same policy.,Often these are the common digits of the enrollment id of the policy members.,No,No,,,,,
PAYER_PLAN_PERIOD,stop_reason_concept_id,No,integer,"This field represents the reason the Person left the Plan, if known.",Map the stop reason directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan+Stop+Reason&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,stop_reason_source_value,No,varchar(50),The Plan stop reason as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,stop_reason_source_concept_id,No,integer,,If the source data codes the stop reason in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,cost_id,Yes,integer,,,Yes,No,,,,,
COST,cost_event_id,Yes,integer,,,No,No,,,,,
COST,cost_domain_id,Yes,varchar(20),,,No,Yes,DOMAIN,DOMAIN_ID,,,
COST,cost_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,currency_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,total_charge,No,float,,,No,No,,,,,
COST,total_cost,No,float,,,No,No,,,,,
COST,total_paid,No,float,,,No,No,,,,,
COST,paid_by_payer,No,float,,,No,No,,,,,
COST,paid_by_patient,No,float,,,No,No,,,,,
COST,paid_patient_copay,No,float,,,No,No,,,,,
COST,paid_patient_coinsurance,No,float,,,No,No,,,,,
COST,paid_patient_deductible,No,float,,,No,No,,,,,
COST,paid_by_primary,No,float,,,No,No,,,,,
COST,paid_ingredient_cost,No,float,,,No,No,,,,,
COST,paid_dispensing_fee,No,float,,,No,No,,,,,
COST,payer_plan_period_id,No,integer,,,No,No,,,,,
COST,amount_allowed,No,float,,,No,No,,,,,
COST,revenue_code_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,revenue_code_source_value,No,varchar(50),Revenue codes are a method to charge for a class of procedures and conditions in the U.S. hospital system.,,No,No,,,,,
COST,drg_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,drg_source_value,No,varchar(3),Diagnosis Related Groups are US codes used to classify hospital cases into one of approximately 500 groups. ,,No,No,,,,,
DRUG_ERA,drug_era_id,Yes,integer,,,Yes,No,,,,,
DRUG_ERA,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DRUG_ERA,drug_concept_id,Yes,integer,The Concept Id representing the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Drug,Ingredient,
DRUG_ERA,drug_era_start_date,Yes,datetime,,"The Drug Era Start Date is the start date of the first Drug Exposure for a given ingredient, with at least 31 days since the previous exposure. ",No,No,,,,,
DRUG_ERA,drug_era_end_date,Yes,datetime,,"The Drug Era End Date is the end date of the last Drug Exposure. The End Date of each Drug Exposure is either taken from the field drug_exposure_end_date or, as it is typically not available, inferred using the following rules:
For pharmacy prescription data, the date when the drug was dispensed plus the number of days of supply are used to extrapolate the End Date for the Drug Exposure. Depending on the country-specific healthcare system, this supply information is either explicitly provided in the day_supply field or inferred from package size or similar information.
For Procedure Drugs, usually the drug is administered on a single date (i.e., the administration date).
A standard Persistence Window of 30 days (gap, slack) is permitted between two subsequent such extrapolated DRUG_EXPOSURE records to be considered to be merged into a single Drug Era.",No,No,,,,,
DRUG_ERA,drug_exposure_count,No,integer,,,No,No,,,,,
DRUG_ERA,gap_days,No,integer,,"The Gap Days determine how many total drug-free days are observed between all Drug Exposure events that contribute to a DRUG_ERA record. It is assumed that the drugs are ""not stockpiled"" by the patient, i.e. that if a new drug prescription or refill is observed (a new DRUG_EXPOSURE record is written), the remaining supply from the previous events is abandoned. The difference between Persistence Window and Gap Days is that the former is the maximum drug-free time allowed between two subsequent DRUG_EXPOSURE records, while the latter is the sum of actual drug-free days for the given Drug Era under the above assumption of non-stockpiling.",No,No,,,,,
DOSE_ERA,dose_era_id,Yes,integer,,,Yes,No,,,,,
DOSE_ERA,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DOSE_ERA,drug_concept_id,Yes,integer,The Concept Id representing the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Drug,Ingredient,
DOSE_ERA,unit_concept_id,Yes,integer,The Concept Id representing the unit of the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Unit,,
DOSE_ERA,dose_value,Yes,float,The numeric value of the dosage of the drug_ingredient.,,No,No,,,,,
DOSE_ERA,dose_era_start_date,Yes,datetime,"The date the Person started on the specific dosage, with at least 31 days since any prior exposure.",,No,No,,,,,
DOSE_ERA,dose_era_end_date,Yes,datetime,,The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records.,No,No,,,,,
CONDITION_ERA,condition_era_id,Yes,integer,,,Yes,No,,,,,
CONDITION_ERA,person_id,Yes,integer,,,No,No,PERSON,PERSON_ID,,,
CONDITION_ERA,condition_concept_id,Yes,integer,The Concept Id representing the Condition.,,No,Yes,CONCEPT,CONCEPT_ID,Condition,,
A standard Persistence Window of 30 days (gap, slack) is permitted between two subsequent such extrapolated DRUG_EXPOSURE records to be considered to be merged into a single Drug Era.",No,No,,,,,
DRUG_ERA,drug_exposure_count,No,integer,,,No,No,,,,,
DRUG_ERA,gap_days,No,integer,,"The Gap Days determine how many total drug-free days are observed between all Drug Exposure events that contribute to a DRUG_ERA record. It is assumed that the drugs are ""not stockpiled"" by the patient, i.e. that if a new drug prescription or refill is observed (a new DRUG_EXPOSURE record is written), the remaining supply from the previous events is abandoned. The difference between Persistence Window and Gap Days is that the former is the maximum drug-free time allowed between two subsequent DRUG_EXPOSURE records, while the latter is the sum of actual drug-free days for the given Drug Era under the above assumption of non-stockpiling.",No,No,,,,,
DOSE_ERA,dose_era_id,Yes,integer,,,Yes,No,,,,,
DOSE_ERA,person_id,Yes,integer,,,No,Yes,PERSON,PERSON_ID,,,
DOSE_ERA,drug_concept_id,Yes,integer,The Concept Id representing the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Drug,Ingredient,
DOSE_ERA,unit_concept_id,Yes,integer,The Concept Id representing the unit of the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Unit,,
DOSE_ERA,dose_value,Yes,float,The numeric value of the dosage of the drug_ingredient.,,No,No,,,,,
DOSE_ERA,dose_era_start_date,Yes,datetime,"The date the Person started on the specific dosage, with at least 31 days since any prior exposure.",,No,No,,,,,
DOSE_ERA,dose_era_end_date,Yes,datetime,,The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records.,No,No,,,,,
CONDITION_ERA,condition_era_id,Yes,integer,,,Yes,No,,,,,
CONDITION_ERA,person_id,Yes,integer,,,No,No,PERSON,PERSON_ID,,,
CONDITION_ERA,condition_concept_id,Yes,integer,The Concept Id representing the Condition.,,No,Yes,CONCEPT,CONCEPT_ID,Condition,,
CONDITION_ERA,condition_era_start_date,Yes,datetime,"The start date for the Condition Era
constructed from the individual
instances of Condition Occurrences.
It is the start date of the very first
chronologically recorded instance of
the condition with at least 31 days since any prior record of the same Condition. ",,No,No,,,,,
the condition with at least 31 days since any prior record of the same Condition. ",,No,No,,,,,
CONDITION_ERA,condition_era_end_date,Yes,datetime,"The end date for the Condition Era
constructed from the individual
instances of Condition Occurrences.
It is the end date of the final
continuously recorded instance of the
Condition.",,No,No,,,,,
Condition.",,No,No,,,,,
CONDITION_ERA,condition_occurrence_count,No,integer,"The number of individual Condition
Occurrences used to construct the
condition era.",,No,No,,,,,
METADATA,metadata_id,Yes,integer,The unique key given to a Metadata record.,Attribute value is auto-generated,Yes,No,,,,,
METADATA,metadata_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,metadata_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,name,Yes,varchar(250),,,No,No,,,,,
METADATA,value_as_string,No,varchar(250),,,No,No,,,,,
METADATA,value_as_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,value_as_number,No,float,"This is the numerical value of the Result of the Metadata, if applicable and available. It is not expected that all Metadata will have numeric results, rather, this field is here to house values should they exist. ",,No,No,,,,,
METADATA,metadata_date,No,date,,,No,No,,,,,
METADATA,metadata_datetime,No,datetime,,,No,No,,,,,
CDM_SOURCE,cdm_source_name,Yes,varchar(255),The name of the CDM instance.,,No,No,,,,,
CDM_SOURCE,cdm_source_abbreviation,Yes,varchar(25),The abbreviation of the CDM instance.,,No,No,,,,,
CDM_SOURCE,cdm_holder,Yes,varchar(255),The holder of the CDM instance.,,No,No,,,,,
CDM_SOURCE,source_description,No,varchar(MAX),The description of the CDM instance.,,No,No,,,,,
CDM_SOURCE,source_documentation_reference,No,varchar(255),,,No,No,,,,,
CDM_SOURCE,cdm_etl_reference,No,varchar(255),,Put the link to the CDM version used.,No,No,,,,,
CDM_SOURCE,source_release_date,Yes,date,The release date of the source data.,,No,No,,,,,
CDM_SOURCE,cdm_release_date,Yes,date,The release data of the CDM instance.,,No,No,,,,,
CDM_SOURCE,cdm_version,No,varchar(10),,,No,No,,,,,
CDM_SOURCE,cdm_version_concept_id,Yes,integer,The Concept Id representing the version of the CDM.,,,,,,,,
CDM_SOURCE,vocabulary_version,Yes,varchar(20),,,No,No,,,,,
CONCEPT,concept_id,Yes,integer,A unique identifier for each Concept across all domains.,,Yes,No,,,,,
CONCEPT,concept_name,Yes,varchar(255),"An unambiguous, meaningful and descriptive name for the Concept.",,No,No,,,,,
CONCEPT,domain_id,Yes,varchar(20),A foreign key to the [DOMAIN](https://ohdsi.github.io/CommonDataModel/cdm531.html#domain) table the Concept belongs to.,,No,Yes,DOMAIN,DOMAIN_ID,,,
condition era.",,No,No,,,,,
EPISODE,episode_id,Yes,integer,A unique identifier for each Episode.,,Yes,No,,,,,
EPISODE,person_id,Yes,integer,The PERSON_ID of the PERSON for whom the episode is recorded.,,No,Yes,PERSON,PERSON_ID,,,
EPISODE,episode_concept_id,Yes,integer,"The EPISODE_CONCEPT_ID represents the kind abstraction related to the disease phase, outcome or treatment.","Choose a concept in the Episode domain that best represents the ongoing disease phase, outcome, or treatment. Please see [article] for cancers and [article] for non-cancers describing how these are defined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Episode&page=1&pageSize=15&query=)",No,Yes,CONCEPT,CONCEPT_ID,,,
EPISODE,episode_start_date,Yes,date,The date when the Episode beings. ,Please see [article] for how to define an Episode start date.,No,No,,,,,
EPISODE,episode_start_datetime,No,datetime,The date and time when the Episode begins.,,No,No,,,,,
EPISODE,episode_end_date,No,date,The date when the instance of the Episode is considered to have ended.,Please see [article] for how to define an Episode end date.,,,,,,,
EPISODE,episode_end_datetime,No,datetime,The date when the instance of the Episode is considered to have ended.,,No,No,,,,,
EPISODE,episode_parent_id,No,integer,Use this field to find the Episode that subsumes the given Episode record. This is used in the case that an Episode are nested into each other.,"If there are multiple nested levels to how Episodes are represented, the EPISODE_PARENT_ID can be used to record this relationship. ",No,No,,,,,
EPISODE,episode_number,No,integer,"For sequences of episodes, this is used to indicate the order the episodes occurred. For example, lines of treatment could be indicated here. ",Please see [article] for the details of how to count episodes.,No,No,,,,,
EPISODE,episode_object_concept_id,Yes,integer,"A Standard Concept representing the disease phase, outcome, or other abstraction of which the episode consists. For example, if the EPISODE_CONCEPT_ID is [treatment regimen](https://athena.ohdsi.org/search-terms/terms/32531) then the EPISODE_OBJECT_CONCEPT_ID should contain the chemotherapy regimen concept, like [Afatinib monotherapy](https://athena.ohdsi.org/search-terms/terms/35804392). ",Episode entries from the 'Disease Episode' concept class should have an episode_object_concept_id that comes from the Condition domain. Episode entries from the 'Treatment Episode' concept class should have an episode_object_concept_id that scome from the 'Procedure' domain or 'Regimen' concept class.,No,Yes,CONCEPT,CONCEPT_ID,,,
EPISODE,episode_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Episode record, as in whether the episode was from an EHR system, insurance claim, registry, or other sources.",Choose the EPISODE_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
EPISODE,episode_source_value,No,varchar(50),The source code for the Episdoe as it appears in the source data. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference.,,No,No,,,,,
EPISODE,episode_source_concept_id,No,integer,A foreign key to a Episode Concept that refers to the code used in the source.,Given that the Episodes are user-defined it is unlikely that there will be a Source Concept available. If that is the case then set this field to zero. ,No,Yes,CONCEPT,CONCEPT_ID,,,
EPISODE_EVENT,episode_id,Yes,integer,Use this field to link the EPISODE_EVENT record to its EPISODE.,Put the EPISODE_ID that subsumes the EPISODE_EVENT record here.,No,Yes,EPISODE,EPISODE_ID,,,
EPISODE_EVENT,event_id,Yes,integer,"This field is the primary key of the linked record in the database. For example, if the Episode Event is a Condition Occurrence, then the CONDITION_OCCURRENCE_ID of the linked record goes in this field. ",Put the primary key of the linked record here. ,No,No,,,,,
EPISODE_EVENT,episode_event_field_concept_id,Yes,integer,This field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ,Put the CONCEPT_ID that identifies which table and field the EVENT_ID came from. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?vocabulary=CDM&conceptClass=Field&page=1&pageSize=15&query=),No,Yes,CONCEPT,CONCEPT_ID,Metadata,,
METADATA,metadata_id,Yes,integer,The unique key given to a Metadata record.,Attribute value is auto-generated,Yes,No,,,,,
METADATA,metadata_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,metadata_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,name,Yes,varchar(250),,,No,No,,,,,
METADATA,value_as_string,No,varchar(250),,,No,No,,,,,
METADATA,value_as_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
METADATA,value_as_number,No,float,"This is the numerical value of the Result of the Metadata, if applicable and available. It is not expected that all Metadata will have numeric results, rather, this field is here to house values should they exist. ",,No,No,,,,,
METADATA,metadata_date,No,date,,,No,No,,,,,
METADATA,metadata_datetime,No,datetime,,,No,No,,,,,
CDM_SOURCE,cdm_source_name,Yes,varchar(255),The name of the CDM instance.,,No,No,,,,,
CDM_SOURCE,cdm_source_abbreviation,Yes,varchar(25),The abbreviation of the CDM instance.,,No,No,,,,,
CDM_SOURCE,cdm_holder,Yes,varchar(255),The holder of the CDM instance.,,No,No,,,,,
CDM_SOURCE,source_description,No,varchar(MAX),The description of the CDM instance.,,No,No,,,,,
CDM_SOURCE,source_documentation_reference,No,varchar(255),,,No,No,,,,,
CDM_SOURCE,cdm_etl_reference,No,varchar(255),,Put the link to the CDM version used.,No,No,,,,,
CDM_SOURCE,source_release_date,Yes,date,The release date of the source data.,,No,No,,,,,
CDM_SOURCE,cdm_release_date,Yes,date,The release data of the CDM instance.,,No,No,,,,,
CDM_SOURCE,cdm_version,No,varchar(10),,,No,No,,,,,
CDM_SOURCE,cdm_version_concept_id,Yes,integer,The Concept Id representing the version of the CDM.,,,,,,,,
CDM_SOURCE,vocabulary_version,Yes,varchar(20),,,No,No,,,,,
CONCEPT,concept_id,Yes,integer,A unique identifier for each Concept across all domains.,,Yes,No,,,,,
CONCEPT,concept_name,Yes,varchar(255),"An unambiguous, meaningful and descriptive name for the Concept.",,No,No,,,,,
CONCEPT,domain_id,Yes,varchar(20),A foreign key to the [DOMAIN](https://ohdsi.github.io/CommonDataModel/cdm531.html#domain) table the Concept belongs to.,,No,Yes,DOMAIN,DOMAIN_ID,,,
CONCEPT,vocabulary_id,Yes,varchar(20),"A foreign key to the [VOCABULARY](https://ohdsi.github.io/CommonDataModel/cdm531.html#vocabulary)
table indicating from which source the
Concept has been adapted.",,No,Yes,VOCABULARY,VOCABULARY_ID,,,
Concept has been adapted.",,No,Yes,VOCABULARY,VOCABULARY_ID,,,
CONCEPT,concept_class_id,Yes,varchar(20),"The attribute or concept class of the
Concept. Examples are 'Clinical Drug',
'Ingredient', 'Clinical Finding' etc.",,No,Yes,CONCEPT_CLASS,CONCEPT_CLASS_ID,,,
'Ingredient', 'Clinical Finding' etc.",,No,Yes,CONCEPT_CLASS,CONCEPT_CLASS_ID,,,
CONCEPT,standard_concept,No,varchar(1),"This flag determines where a Concept is
a Standard Concept, i.e. is used in the
data, a Classification Concept, or a
non-standard Source Concept. The
allowable values are 'S' (Standard
Concept) and 'C' (Classification
Concept), otherwise the content is NULL.",,No,No,,,,,
Concept), otherwise the content is NULL.",,No,No,,,,,
CONCEPT,concept_code,Yes,varchar(50),"The concept code represents the identifier
of the Concept in the source vocabulary,
such as SNOMED-CT concept IDs,
RxNorm RXCUIs etc. Note that concept
codes are not unique across vocabularies.",,No,No,,,,,
codes are not unique across vocabularies.",,No,No,,,,,
CONCEPT,valid_start_date,Yes,date,"The date when the Concept was first
recorded. The default value is
1-Jan-1970, meaning, the Concept has no
(known) date of inception.",,No,No,,,,,
(known) date of inception.",,No,No,,,,,
CONCEPT,valid_end_date,Yes,date,"The date when the Concept became
invalid because it was deleted or
superseded (updated) by a new concept.
The default value is 31-Dec-2099,
meaning, the Concept is valid until it
becomes deprecated.",,No,No,,,,,
becomes deprecated.",,No,No,,,,,
CONCEPT,invalid_reason,No,varchar(1),"Reason the Concept was invalidated.
Possible values are D (deleted), U
(replaced with an update) or NULL when
valid_end_date has the default value.",,No,No,,,,,
valid_end_date has the default value.",,No,No,,,,,
VOCABULARY,vocabulary_id,Yes,varchar(20),"A unique identifier for each Vocabulary, such
as ICD9CM, SNOMED, Visit.",,Yes,No,,,,,
as ICD9CM, SNOMED, Visit.",,Yes,No,,,,,
VOCABULARY,vocabulary_name,Yes,varchar(255),"The name describing the vocabulary, for
example, International Classification of
Diseases, Ninth Revision, Clinical
Modification, Volume 1 and 2 (NCHS) etc.",,No,No,,,,,
Modification, Volume 1 and 2 (NCHS) etc.",,No,No,,,,,
VOCABULARY,vocabulary_reference,Yes,varchar(255),"External reference to documentation or
available download of the about the
vocabulary.",,No,No,,,,,
vocabulary.",,No,No,,,,,
VOCABULARY,vocabulary_version,No,varchar(255),"Version of the Vocabulary as indicated in
the source.",,No,No,,,,,
VOCABULARY,vocabulary_concept_id,Yes,integer,A Concept that represents the Vocabulary the VOCABULARY record belongs to.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DOMAIN,domain_id,Yes,varchar(20),A unique key for each domain.,,Yes,No,,,,,
the source.",,No,No,,,,,
VOCABULARY,vocabulary_concept_id,Yes,integer,A Concept that represents the Vocabulary the VOCABULARY record belongs to.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DOMAIN,domain_id,Yes,varchar(20),A unique key for each domain.,,Yes,No,,,,,
DOMAIN,domain_name,Yes,varchar(255),"The name describing the Domain, e.g.
Condition, Procedure, Measurement
etc.",,No,No,,,,,
DOMAIN,domain_concept_id,Yes,integer,A Concept representing the Domain Concept the DOMAIN record belongs to.,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_CLASS,concept_class_id,Yes,varchar(20),A unique key for each class.,,Yes,No,,,,,
etc.",,No,No,,,,,
DOMAIN,domain_concept_id,Yes,integer,A Concept representing the Domain Concept the DOMAIN record belongs to.,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_CLASS,concept_class_id,Yes,varchar(20),A unique key for each class.,,Yes,No,,,,,
CONCEPT_CLASS,concept_class_name,Yes,varchar(255),"The name describing the Concept Class, e.g.
Clinical Finding, Ingredient, etc.",,No,No,,,,,
CONCEPT_CLASS,concept_class_concept_id,Yes,integer,A Concept that represents the Concept Class.,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_RELATIONSHIP,concept_id_1,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_RELATIONSHIP,concept_id_2,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_RELATIONSHIP,relationship_id,Yes,varchar(20),The relationship between CONCEPT_ID_1 and CONCEPT_ID_2. Please see the [Vocabulary Conventions](https://ohdsi.github.io/CommonDataModel/dataModelConventions.html#concept_relationships). for more information. ,,No,Yes,RELATIONSHIP,RELATIONSHIP_ID,,,
CONCEPT_RELATIONSHIP,valid_start_date,Yes,date,The date when the relationship is first recorded.,,No,No,,,,,
CONCEPT_RELATIONSHIP,valid_end_date,Yes,date,The date when the relationship is invalidated.,,No,No,,,,,
CONCEPT_RELATIONSHIP,invalid_reason,No,varchar(1),"Reason the relationship was invalidated. Possible values are 'D' (deleted), 'U' (updated) or NULL. ",,No,No,,,,,
Clinical Finding, Ingredient, etc.",,No,No,,,,,
CONCEPT_CLASS,concept_class_concept_id,Yes,integer,A Concept that represents the Concept Class.,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_RELATIONSHIP,concept_id_1,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_RELATIONSHIP,concept_id_2,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_RELATIONSHIP,relationship_id,Yes,varchar(20),The relationship between CONCEPT_ID_1 and CONCEPT_ID_2. Please see the [Vocabulary Conventions](https://ohdsi.github.io/CommonDataModel/dataModelConventions.html#concept_relationships). for more information. ,,No,Yes,RELATIONSHIP,RELATIONSHIP_ID,,,
CONCEPT_RELATIONSHIP,valid_start_date,Yes,date,The date when the relationship is first recorded.,,No,No,,,,,
CONCEPT_RELATIONSHIP,valid_end_date,Yes,date,The date when the relationship is invalidated.,,No,No,,,,,
CONCEPT_RELATIONSHIP,invalid_reason,No,varchar(1),"Reason the relationship was invalidated. Possible values are 'D' (deleted), 'U' (updated) or NULL. ",,No,No,,,,,
RELATIONSHIP,relationship_id,Yes,varchar(20),"The type of relationship captured by the
relationship record.",,Yes,No,,,,,
RELATIONSHIP,relationship_name,Yes,varchar(255),,,No,No,,,,,
relationship record.",,Yes,No,,,,,
RELATIONSHIP,relationship_name,Yes,varchar(255),,,No,No,,,,,
RELATIONSHIP,is_hierarchical,Yes,varchar(1),"Defines whether a relationship defines
concepts into classes or hierarchies. Values
are 1 for hierarchical relationship or 0 if not.",,No,No,,,,,
are 1 for hierarchical relationship or 0 if not.",,No,No,,,,,
RELATIONSHIP,defines_ancestry,Yes,varchar(1),"Defines whether a hierarchical relationship
contributes to the concept_ancestor table.
These are subsets of the hierarchical
relationships. Valid values are 1 or 0.",,No,No,,,,,
relationships. Valid values are 1 or 0.",,No,No,,,,,
RELATIONSHIP,reverse_relationship_id,Yes,varchar(20),"The identifier for the relationship used to
define the reverse relationship between two
concepts.",,No,No,,,,,
concepts.",,No,No,,,,,
RELATIONSHIP,relationship_concept_id,Yes,integer,"A foreign key that refers to an identifier in
the [CONCEPT](https://ohdsi.github.io/CommonDataModel/cdm531.html#concept) table for the unique
relationship concept.",,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_SYNONYM,concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_SYNONYM,concept_synonym_name,Yes,varchar(1000),,,No,No,,,,,
CONCEPT_SYNONYM,language_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
relationship concept.",,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_SYNONYM,concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_SYNONYM,concept_synonym_name,Yes,varchar(1000),,,No,No,,,,,
CONCEPT_SYNONYM,language_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_ANCESTOR,ancestor_concept_id,Yes,integer,"The Concept Id for the higher-level concept
that forms the ancestor in the relationship.",,No,Yes,CONCEPT,CONCEPT_ID,,,
that forms the ancestor in the relationship.",,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_ANCESTOR,descendant_concept_id,Yes,integer,"The Concept Id for the lower-level concept
that forms the descendant in the
relationship.",,No,Yes,CONCEPT,CONCEPT_ID,,,
relationship.",,No,Yes,CONCEPT,CONCEPT_ID,,,
CONCEPT_ANCESTOR,min_levels_of_separation,Yes,integer,"The minimum separation in number of
levels of hierarchy between ancestor and
descendant concepts. This is an attribute
that is used to simplify hierarchic analysis.",,No,No,,,,,
that is used to simplify hierarchic analysis.",,No,No,,,,,
CONCEPT_ANCESTOR,max_levels_of_separation,Yes,integer,"The maximum separation in number of
levels of hierarchy between ancestor and
descendant concepts. This is an attribute
that is used to simplify hierarchic analysis.",,No,No,,,,,
that is used to simplify hierarchic analysis.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,source_code,Yes,varchar(50),"The source code being translated
into a Standard Concept.",,No,No,,,,,
into a Standard Concept.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,source_concept_id,Yes,integer,"A foreign key to the Source
Concept that is being translated
into a Standard Concept.","This is either 0 or should be a number above 2 billion, which are the Concepts reserved for site-specific codes and mappings. ",No,Yes,CONCEPT,CONCEPT_ID,,,
into a Standard Concept.","This is either 0 or should be a number above 2 billion, which are the Concepts reserved for site-specific codes and mappings. ",No,Yes,CONCEPT,CONCEPT_ID,,,
SOURCE_TO_CONCEPT_MAP,source_vocabulary_id,Yes,varchar(20),"A foreign key to the
VOCABULARY table defining the
vocabulary of the source code that
is being translated to a Standard
Concept.",,No,No,,,,,
Concept.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,source_code_description,No,varchar(255),"An optional description for the
source code. This is included as a
convenience to compare the
description of the source code to
the name of the concept.",,No,No,,,,,
the name of the concept.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,target_concept_id,Yes,integer,"The target Concept
to which the source code is being
mapped.",,No,Yes,CONCEPT,CONCEPT_ID,,,
SOURCE_TO_CONCEPT_MAP,target_vocabulary_id,Yes,varchar(20),The Vocabulary of the target Concept.,,No,Yes,VOCABULARY,VOCABULARY_ID,,,
mapped.",,No,Yes,CONCEPT,CONCEPT_ID,,,
SOURCE_TO_CONCEPT_MAP,target_vocabulary_id,Yes,varchar(20),The Vocabulary of the target Concept.,,No,Yes,VOCABULARY,VOCABULARY_ID,,,
SOURCE_TO_CONCEPT_MAP,valid_start_date,Yes,date,"The date when the mapping
instance was first recorded.",,No,No,,,,,
instance was first recorded.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,valid_end_date,Yes,date,"The date when the mapping
instance became invalid because it
was deleted or superseded
(updated) by a new relationship.
Default value is 31-Dec-2099.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,invalid_reason,No,varchar(1),"Reason the mapping instance was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value.",,No,No,,,,,
DRUG_STRENGTH,drug_concept_id,Yes,integer,The Concept representing the Branded Drug or Clinical Drug Product.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,ingredient_concept_id,Yes,integer,The Concept representing the active ingredient contained within the drug product.,"Combination Drugs will have more than one record in this table, one for each active Ingredient.",No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,amount_value,No,float,The numeric value or the amount of active ingredient contained within the drug product.,,No,No,,,,,
DRUG_STRENGTH,amount_unit_concept_id,No,integer,The Concept representing the Unit of measure for the amount of active ingredient contained within the drug product. ,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,numerator_value,No,float,The concentration of the active ingredient contained within the drug product.,,No,No,,,,,
DRUG_STRENGTH,numerator_unit_concept_id,No,integer,The Concept representing the Unit of measure for the concentration of active ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,denominator_value,No,float,"The amount of total liquid (or other divisible product, such as ointment, gel, spray, etc.).",,No,No,,,,,
DRUG_STRENGTH,denominator_unit_concept_id,No,integer,The Concept representing the denominator unit for the concentration of active ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,box_size,No,integer,The number of units of Clinical Branded Drug or Quantified Clinical or Branded Drug contained in a box as dispensed to the patient.,,No,No,,,,,
Default value is 31-Dec-2099.",,No,No,,,,,
SOURCE_TO_CONCEPT_MAP,invalid_reason,No,varchar(1),"Reason the mapping instance was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value.",,No,No,,,,,
DRUG_STRENGTH,drug_concept_id,Yes,integer,The Concept representing the Branded Drug or Clinical Drug Product.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,ingredient_concept_id,Yes,integer,The Concept representing the active ingredient contained within the drug product.,"Combination Drugs will have more than one record in this table, one for each active Ingredient.",No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,amount_value,No,float,The numeric value or the amount of active ingredient contained within the drug product.,,No,No,,,,,
DRUG_STRENGTH,amount_unit_concept_id,No,integer,The Concept representing the Unit of measure for the amount of active ingredient contained within the drug product. ,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,numerator_value,No,float,The concentration of the active ingredient contained within the drug product.,,No,No,,,,,
DRUG_STRENGTH,numerator_unit_concept_id,No,integer,The Concept representing the Unit of measure for the concentration of active ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,denominator_value,No,float,"The amount of total liquid (or other divisible product, such as ointment, gel, spray, etc.).",,No,No,,,,,
DRUG_STRENGTH,denominator_unit_concept_id,No,integer,The Concept representing the denominator unit for the concentration of active ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,,,
DRUG_STRENGTH,box_size,No,integer,The number of units of Clinical Branded Drug or Quantified Clinical or Branded Drug contained in a box as dispensed to the patient.,,No,No,,,,,
DRUG_STRENGTH,valid_start_date,Yes,date,"The date when the Concept was first
recorded. The default value is
1-Jan-1970.",,No,No,,,,,
DRUG_STRENGTH,valid_end_date,Yes,date,The date when then Concept became invalid.,,No,No,,,,,
DRUG_STRENGTH,invalid_reason,No,varchar(1),"Reason the concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value.",,No,No,,,,,
COHORT,cohort_definition_id,Yes,integer,,,No,No,,,,,
COHORT,subject_id,Yes,integer,,,No,No,,,,,
COHORT,cohort_start_date,Yes,date,,,No,No,,,,,
COHORT,cohort_end_date,Yes,date,,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_id,Yes,integer,"This is the identifier given to the cohort, usually by the ATLAS application",,No,No,COHORT,COHORT_DEFINITION_ID,,,
COHORT_DEFINITION,cohort_definition_name,Yes,varchar(255),A short description of the cohort,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_description,No,varchar(MAX),A complete description of the cohort.,,No,No,,,,,
COHORT_DEFINITION,definition_type_concept_id,Yes,integer,Type defining what kind of Cohort Definition the record represents and how the syntax may be executed.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_definition_syntax,No,varchar(MAX),Syntax or code to operationalize the Cohort Definition.,,No,No,,,,,
COHORT_DEFINITION,subject_concept_id,Yes,integer,"This field contains a Concept that represents the domain of the subjects that are members of the cohort (e.g., Person, Provider, Visit).",,No,Yes,CONCEPT,CONCEPT_ID,,,
1-Jan-1970.",,No,No,,,,,
DRUG_STRENGTH,valid_end_date,Yes,date,The date when then Concept became invalid.,,No,No,,,,,
DRUG_STRENGTH,invalid_reason,No,varchar(1),"Reason the concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value.",,No,No,,,,,
COHORT,cohort_definition_id,Yes,integer,,,No,No,,,,,
COHORT,subject_id,Yes,integer,,,No,No,,,,,
COHORT,cohort_start_date,Yes,date,,,No,No,,,,,
COHORT,cohort_end_date,Yes,date,,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_id,Yes,integer,"This is the identifier given to the cohort, usually by the ATLAS application",,No,No,COHORT,COHORT_DEFINITION_ID,,,
COHORT_DEFINITION,cohort_definition_name,Yes,varchar(255),A short description of the cohort,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_description,No,varchar(MAX),A complete description of the cohort.,,No,No,,,,,
COHORT_DEFINITION,definition_type_concept_id,Yes,integer,Type defining what kind of Cohort Definition the record represents and how the syntax may be executed.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_definition_syntax,No,varchar(MAX),Syntax or code to operationalize the Cohort Definition.,,No,No,,,,,
COHORT_DEFINITION,subject_concept_id,Yes,integer,"This field contains a Concept that represents the domain of the subjects that are members of the cohort (e.g., Person, Provider, Visit).",,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_initiation_date,No,date,A date to indicate when the Cohort was initiated in the COHORT table.,,No,No,,,,,
1 cdmTableName cdmFieldName isRequired cdmDatatype userGuidance etlConventions isPrimaryKey isForeignKey fkTableName fkFieldName fkDomain fkClass unique DQ identifiers
2 PERSON person_id Yes integer It is assumed that every person with a different unique identifier is in fact a different person and should be treated independently. Any person linkage that needs to occur to uniquely identify Persons ought to be done prior to writing this table. This identifier can be the original id from the source data provided if it is an integer, otherwise it can be an autogenerated number. Yes No
3 PERSON gender_concept_id Yes integer This field is meant to capture the biological sex at birth of the Person. This field should not be used to study gender identity issues. Use the gender or sex value present in the data under the assumption that it is the biological sex at birth. If the source data captures gender identity it should be stored in the [OBSERVATION](https://ohdsi.github.io/CommonDataModel/cdm531.html#observation) table. [Accepted gender concepts](http://athena.ohdsi.org/search-terms/terms?domain=Gender&standardConcept=Standard&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID Gender
4 PERSON year_of_birth Yes integer Compute age using year_of_birth. For data sources with date of birth, the year should be extracted. For data sources where the year of birth is not available, the approximate year of birth could be derived based on age group categorization, if available. No No
5 PERSON month_of_birth No integer For data sources that provide the precise date of birth, the month should be extracted and stored in this field. No No
6 PERSON day_of_birth No integer For data sources that provide the precise date of birth, the day should be extracted and stored in this field. No No
7 PERSON birth_datetime No datetime This field is not required but highly encouraged. For data sources that provide the precise datetime of birth, that value should be stored in this field. If birth_datetime is not provided in the source, use the following logic to infer the date: If day_of_birth is null and month_of_birth is not null then use the first of the month in that year. If month_of_birth is null or if day_of_birth AND month_of_birth are both null and the person has records during their year of birth then use the date of the earliest record, otherwise use the 15th of June of that year. If time of birth is not given use midnight (00:00:0000). No No
8 PERSON race_concept_id Yes integer This field captures race or ethnic background of the person. Only use this field if you have information about race or ethnic background. The Vocabulary contains Concepts about the main races and ethnic backgrounds in a hierarchical system. Due to the imprecise nature of human races and ethnic backgrounds, this is not a perfect system. Mixed races are not supported. If a clear race or ethnic background cannot be established, use Concept_Id 0. [Accepted Race Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Race&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Race
9 PERSON ethnicity_concept_id Yes integer This field captures Ethnicity as defined by the Office of Management and Budget (OMB) of the US Government: it distinguishes only between "Hispanic" and "Not Hispanic". Races and ethnic backgrounds are not stored here. Only use this field if you have US-based data and a source of this information. Do not attempt to infer Ethnicity from the race or ethnic background of the Person. [Accepted ethnicity concepts](http://athena.ohdsi.org/search-terms/terms?domain=Ethnicity&standardConcept=Standard&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID Ethnicity
10 PERSON location_id No integer The location refers to the physical address of the person. This field should capture the last known location of the person. Put the location_id from the [LOCATION](https://ohdsi.github.io/CommonDataModel/cdm531.html#location) table here that represents the most granular location information for the person. This could represent anything from postal code or parts thereof, state, or county for example. Since many databases contain deidentified data, it is common that the precision of the location is reduced to prevent re-identification. This field should capture the last known location. No Yes LOCATION LOCATION_ID
11 PERSON provider_id No integer The Provider refers to the last known primary care provider (General Practitioner). Put the provider_id from the [PROVIDER](https://ohdsi.github.io/CommonDataModel/cdm531.html#provider) table of the last known general practitioner of the person. If there are multiple providers, it is up to the ETL to decide which to put here. No Yes PROVIDER PROVIDER_ID
12 PERSON care_site_id No integer The Care Site refers to where the Provider typically provides the primary care. No Yes CARE_SITE CARE_SITE_ID
13 PERSON person_source_value No varchar(50) Use this field to link back to persons in the source data. This is typically used for error checking of ETL logic. Some use cases require the ability to link back to persons in the source data. This field allows for the storing of the person value as it appears in the source. This field is not required but strongly recommended. No No
14 PERSON gender_source_value No varchar(50) This field is used to store the biological sex of the person from the source data. It is not intended for use in standard analytics but for reference only. Put the biological sex of the person as it appears in the source data. No No
15 PERSON gender_source_concept_id No integer Due to the small number of options, this tends to be zero. If the source data codes biological sex in a non-standard vocabulary, store the concept_id here. No Yes CONCEPT CONCEPT_ID
16 PERSON race_source_value No varchar(50) This field is used to store the race of the person from the source data. It is not intended for use in standard analytics but for reference only. Put the race of the person as it appears in the source data. No No
17 PERSON race_source_concept_id No integer Due to the small number of options, this tends to be zero. If the source data codes race in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
18 PERSON ethnicity_source_value No varchar(50) This field is used to store the ethnicity of the person from the source data. It is not intended for use in standard analytics but for reference only. If the person has an ethnicity other than the OMB standard of "Hispanic" or "Not Hispanic" store that value from the source data here. No No
19 PERSON ethnicity_source_concept_id No integer Due to the small number of options, this tends to be zero. If the source data codes ethnicity in an OMOP supported vocabulary, store the concept_id here. No Yes CONCEPT CONCEPT_ID
20 OBSERVATION_PERIOD observation_period_id Yes integer A Person can have multiple discrete Observation Periods which are identified by the Observation_Period_Id. Assign a unique observation_period_id to each discrete Observation Period for a Person. Yes No
21 OBSERVATION_PERIOD person_id Yes integer The Person ID of the PERSON record for which the Observation Period is recorded. No Yes PERSON PERSON_ID
22 OBSERVATION_PERIOD observation_period_start_date Yes date Use this date to determine the start date of the Observation Period. It is often the case that the idea of Observation Periods does not exist in source data. In those cases, the observation_period_start_date can be inferred as the earliest Event date available for the Person. In insurance claim data, the Observation Period can be considered as the time period the Person is enrolled with a payer. If a Person switches plans but stays with the same payer, and therefore capturing of data continues, that change would be captured in [PAYER_PLAN_PERIOD](https://ohdsi.github.io/CommonDataModel/cdm531.html#payer_plan_period). No No
23 OBSERVATION_PERIOD observation_period_end_date Yes date Use this date to determine the end date of the period for which we can assume that all events for a Person are recorded. It is often the case that the idea of Observation Periods does not exist in source data. In those cases, the observation_period_end_date can be inferred as the last Event date available for the Person. In insurance claim data, the Observation Period can be considered as the time period the Person is enrolled with a payer. No No
24 OBSERVATION_PERIOD period_type_concept_id Yes integer This field can be used to determine the provenance of the Observation Period as in whether the period was determined from an insurance enrollment file, EHR healthcare encounters, or other sources. Choose the observation_period_type_concept_id that best represents how the period was determined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
25 VISIT_OCCURRENCE visit_occurrence_id Yes integer Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit. This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time. Yes No
26 VISIT_OCCURRENCE person_id Yes integer No Yes PERSON PERSON_ID
27 VISIT_OCCURRENCE visit_concept_id Yes integer This field contains a concept id representing the kind of visit, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain. Populate this field based on the kind of visit that took place for the person. For example this could be "Inpatient Visit", "Outpatient Visit", "Ambulatory Visit", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
28 VISIT_OCCURRENCE visit_start_date Yes date For inpatient visits, the start date is typically the admission date. For outpatient visits the start date and end date will be the same. When populating VISIT_START_DATE, you should think about the patient experience to make decisions on how to define visits. In the case of an inpatient visit this should be the date the patient was admitted to the hospital or institution. In all other cases this should be the date of the patient-provider interaction. No No
29 VISIT_OCCURRENCE visit_start_datetime No datetime If no time is given for the start date of a visit, set it to midnight (00:00:0000). No No
30 VISIT_OCCURRENCE visit_end_date Yes date For inpatient visits the end date is typically the discharge date. Visit end dates are mandatory. If end dates are not provided in the source there are three ways in which to derive them: - Outpatient Visit: visit_end_datetime = visit_start_datetime - Emergency Room Visit: visit_end_datetime = visit_start_datetime - Inpatient Visit: Usually there is information about discharge. If not, you should be able to derive the end date from the sudden decline of activity or from the absence of inpatient procedures/drugs. - Non-hospital institution Visits: Particularly for claims data, if end dates are not provided assume the visit is for the duration of month that it occurs. For Inpatient Visits ongoing at the date of ETL, put date of processing the data into visit_end_datetime and visit_type_concept_id with 32220 "Still patient" to identify the visit as incomplete. - All other Visits: visit_end_datetime = visit_start_datetime. If this is a one-day visit the end date should match the start date. No No
31 VISIT_OCCURRENCE visit_end_datetime No datetime If no time is given for the end date of a visit, set it to midnight (00:00:0000). No No
32 VISIT_OCCURRENCE visit_type_concept_id Yes Integer Use this field to understand the provenance of the visit record, or where the record comes from. Populate this field based on the provenance of the visit record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
33 VISIT_OCCURRENCE provider_id No integer There will only be one provider per visit record and the ETL document should clearly state how they were chosen (attending, admitting, etc.). If there are multiple providers associated with a visit in the source, this can be reflected in the event tables (CONDITION_OCCURRENCE, PROCEDURE_OCCURRENCE, etc.) or in the VISIT_DETAIL table. If there are multiple providers associated with a visit, you will need to choose which one to put here. The additional providers can be stored in the [VISIT_DETAIL](https://ohdsi.github.io/CommonDataModel/cdm531.html#visit_detail) table. No Yes PROVIDER PROVIDER_ID
34 VISIT_OCCURRENCE care_site_id No integer This field provides information about the Care Site where the Visit took place. There should only be one Care Site associated with a Visit. No Yes CARE_SITE CARE_SITE_ID
35 VISIT_OCCURRENCE visit_source_value No varchar(50) This field houses the verbatim value from the source data representing the kind of visit that took place (inpatient, outpatient, emergency, etc.) If there is information about the kind of visit in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the visit source value, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created. No No
36 VISIT_OCCURRENCE visit_source_concept_id No integer If the visit source value is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
37 VISIT_OCCURRENCE admitted_from_concept_id No integer Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example. If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
38 VISIT_OCCURRENCE admitted_from_source_value No varchar(50) This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits. No No
39 VISIT_OCCURRENCE discharged_to_concept_id No integer Use this field to determine where the patient was discharged to after a visit. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example. If available, map the discharge_to_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
40 VISIT_OCCURRENCE discharged_to_source_value No varchar(50) This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more. No No
41 VISIT_OCCURRENCE preceding_visit_occurrence_id No integer Use this field to find the visit that occurred for the person prior to the given visit. There could be a few days or a few years in between. This field can be used to link a visit immediately preceding the current visit. Note this is not symmetrical, and there is no such thing as a "following_visit_id". No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
42 VISIT_DETAIL visit_detail_id Yes integer Use this to identify unique interactions between a person and the health care system. This identifier links across the other CDM event tables to associate events with a visit detail. This should be populated by creating a unique identifier for each unique interaction between a person and the healthcare system where the person receives a medical good or service over a span of time. Yes No
43 VISIT_DETAIL person_id Yes integer No Yes PERSON PERSON_ID
44 VISIT_DETAIL visit_detail_concept_id Yes integer This field contains a concept id representing the kind of visit detail, like inpatient or outpatient. All concepts in this field should be standard and belong to the Visit domain. Populate this field based on the kind of visit that took place for the person. For example this could be "Inpatient Visit", "Outpatient Visit", "Ambulatory Visit", etc. This table will contain standard concepts in the Visit domain. These concepts are arranged in a hierarchical structure to facilitate cohort definitions by rolling up to generally familiar Visits adopted in most healthcare systems worldwide. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
45 VISIT_DETAIL visit_detail_start_date Yes date This is the date of the start of the encounter. This may or may not be equal to the date of the Visit the Visit Detail is associated with. When populating VISIT_DETAIL_START_DATE, you should think about the patient experience to make decisions on how to define visits. Most likely this should be the date of the patient-provider interaction. No No
46 VISIT_DETAIL visit_detail_start_datetime No datetime If no time is given for the start date of a visit, set it to midnight (00:00:0000). No No
47 VISIT_DETAIL visit_detail_end_date Yes date This the end date of the patient-provider interaction. Visit Detail end dates are mandatory. If end dates are not provided in the source there are three ways in which to derive them:<br> - Outpatient Visit Detail: visit_detail_end_datetime = visit_detail_start_datetime - Emergency Room Visit Detail: visit_detail_end_datetime = visit_detail_start_datetime - Inpatient Visit Detail: Usually there is information about discharge. If not, you should be able to derive the end date from the sudden decline of activity or from the absence of inpatient procedures/drugs. - Non-hospital institution Visit Details: Particularly for claims data, if end dates are not provided assume the visit is for the duration of month that it occurs.<br> For Inpatient Visit Details ongoing at the date of ETL, put date of processing the data into visit_detai_end_datetime and visit_detail_type_concept_id with 32220 "Still patient" to identify the visit as incomplete. All other Visits Details: visit_detail_end_datetime = visit_detail_start_datetime. No No
48 VISIT_DETAIL visit_detail_end_datetime No datetime If no time is given for the end date of a visit, set it to midnight (00:00:0000). No No
49 VISIT_DETAIL visit_detail_type_concept_id Yes integer Use this field to understand the provenance of the visit detail record, or where the record comes from. Populate this field based on the provenance of the visit detail record, as in whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
50 VISIT_DETAIL provider_id No integer There will only be one provider per **visit** record and the ETL document should clearly state how they were chosen (attending, admitting, etc.). This is a typical reason for leveraging the VISIT_DETAIL table as even though each VISIT_DETAIL record can only have one provider, there is no limit to the number of VISIT_DETAIL records that can be associated to a VISIT_OCCURRENCE record. The additional providers associated to a Visit can be stored in this table where each VISIT_DETAIL record represents a different provider. No Yes PROVIDER PROVIDER_ID
51 VISIT_DETAIL care_site_id No integer This field provides information about the Care Site where the Visit Detail took place. There should only be one Care Site associated with a Visit Detail. No Yes CARE_SITE CARE_SITE_ID
52 VISIT_DETAIL visit_detail_source_value No varchar(50) This field houses the verbatim value from the source data representing the kind of visit detail that took place (inpatient, outpatient, emergency, etc.) If there is information about the kind of visit detail in the source data that value should be stored here. If a visit is an amalgamation of visits from the source then use a hierarchy to choose the VISIT_DETAIL_SOURCE_VALUE, such as IP -> ER-> OP. This should line up with the logic chosen to determine how visits are created. No No
53 VISIT_DETAIL visit_detail_source_concept_id No Integer If the VISIT_DETAIL_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
54 VISIT_DETAIL admitted_from_concept_id No Integer Use this field to determine where the patient was admitted from. This concept is part of the visit domain and can indicate if a patient was admitted to the hospital from a long-term care facility, for example. If available, map the admitted_from_source_value to a standard concept in the visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
55 VISIT_DETAIL admitted_from_source_value No Varchar(50) This information may be called something different in the source data but the field is meant to contain a value indicating where a person was admitted from. Typically this applies only to visits that have a length of stay, like inpatient visits or long-term care visits. No No
56 VISIT_DETAIL discharged_to_source_value No Varchar(50) This information may be called something different in the source data but the field is meant to contain a value indicating where a person was discharged to after a visit, as in they went home or were moved to long-term care. Typically this applies only to visits that have a length of stay of a day or more. No No
57 VISIT_DETAIL discharged_to_concept_id No integer Use this field to determine where the patient was discharged to after a visit detail record. This concept is part of the visit domain and can indicate if a patient was discharged to home or sent to a long-term care facility, for example. If available, map the DISCHARGE_TO_SOURCE_VALUE to a Standard Concept in the Visit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Visit
58 VISIT_DETAIL preceding_visit_detail_id No integer Use this field to find the visit detail that occurred for the person prior to the given visit detail record. There could be a few days or a few years in between. The PRECEDING_VISIT_DETAIL_ID can be used to link a visit immediately preceding the current Visit Detail. Note this is not symmetrical, and there is no such thing as a "following_visit_id". No Yes VISIT_DETAIL VISIT_DETAIL_ID
59 VISIT_DETAIL parent_visit_detail_id No integer Use this field to find the visit detail that subsumes the given visit detail record. This is used in the case that a visit detail record needs to be nested beyond the VISIT_OCCURRENCE/VISIT_DETAIL relationship. If there are multiple nested levels to how Visits are represented in the source, the VISIT_DETAIL_PARENT_ID can be used to record this relationship. No Yes VISIT_DETAIL VISIT_DETAIL_ID
60 VISIT_DETAIL visit_occurrence_id Yes integer Use this field to link the VISIT_DETAIL record to its VISIT_OCCURRENCE. Put the VISIT_OCCURRENCE_ID that subsumes the VISIT_DETAIL record here. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
61 CONDITION_OCCURRENCE condition_occurrence_id Yes integer The unique key given to a condition record for a person. Refer to the ETL for how duplicate conditions during the same visit were handled. Each instance of a condition present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same condition within the same visit. It is valid to keep these duplicates and assign them individual, unique, CONDITION_OCCURRENCE_IDs, though it is up to the ETL how they should be handled. Yes No
62 CONDITION_OCCURRENCE person_id Yes integer The PERSON_ID of the PERSON for whom the condition is recorded. No Yes PERSON PERSON_ID
63 CONDITION_OCCURRENCE condition_concept_id Yes integer The CONDITION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a condition The CONCEPT_ID that the CONDITION_SOURCE_VALUE maps to. Only records whose source values map to concepts with a domain of "Condition" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Condition
64 CONDITION_OCCURRENCE condition_start_date Yes date Use this date to determine the start date of the condition Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE. No No
65 CONDITION_OCCURRENCE condition_start_datetime No datetime If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
66 CONDITION_OCCURRENCE condition_end_date No date Use this date to determine the end date of the condition Most often data sources do not have the idea of a start date for a condition. Rather, if a source only has one date associated with a condition record it is acceptable to use that date for both the CONDITION_START_DATE and the CONDITION_END_DATE. No No
67 CONDITION_OCCURRENCE condition_end_datetime No datetime If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
68 CONDITION_OCCURRENCE condition_type_concept_id Yes integer This field can be used to determine the provenance of the Condition record, as in whether the condition was from an EHR system, insurance claim, registry, or other sources. Choose the CONDITION_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
69 CONDITION_OCCURRENCE condition_status_concept_id No integer This concept represents the point during the visit the diagnosis was given (admitting diagnosis, final diagnosis), whether the diagnosis was determined due to laboratory findings, if the diagnosis was exclusionary, or if it was a preliminary diagnosis, among others. Choose the Concept in the Condition Status domain that best represents the point during the visit when the diagnosis was given. These can include admitting diagnosis, principal diagnosis, and secondary diagnosis. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Condition Status
70 CONDITION_OCCURRENCE stop_reason No varchar(20) The Stop Reason indicates why a Condition is no longer valid with respect to the purpose within the source data. Note that a Stop Reason does not necessarily imply that the condition is no longer occurring. This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist. No No
71 CONDITION_OCCURRENCE provider_id No integer The provider associated with condition record, e.g. the provider who made the diagnosis or the provider who recorded the symptom. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record. No Yes PROVIDER PROVIDER_ID
72 CONDITION_OCCURRENCE visit_occurrence_id No integer The visit during which the condition occurred. Depending on the structure of the source data, this may have to be determined based on dates. If a CONDITION_START_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the CONDITION_OCCURRENCE record. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
73 CONDITION_OCCURRENCE visit_detail_id No integer The VISIT_DETAIL record during which the condition occurred. For example, if the person was in the ICU at the time of the diagnosis the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. Same rules apply as for the VISIT_OCCURRENCE_ID. No Yes VISIT_DETAIL VISIT_DETAIL_ID
74 CONDITION_OCCURRENCE condition_source_value No varchar(50) This field houses the verbatim value from the source data representing the condition that occurred. For example, this could be an ICD10 or Read code. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
75 CONDITION_OCCURRENCE condition_source_concept_id No integer This is the concept representing the condition source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Condition necessary for a given analytic use case. Consider using CONDITION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the CONDITION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
76 CONDITION_OCCURRENCE condition_status_source_value No varchar(50) This field houses the verbatim value from the source data representing the condition status. This information may be called something different in the source data but the field is meant to contain a value indicating when and how a diagnosis was given to a patient. This source value is mapped to a standard concept which is stored in the CONDITION_STATUS_CONCEPT_ID field. No No
77 DRUG_EXPOSURE drug_exposure_id Yes integer The unique key given to records of drug dispensings or administrations for a person. Refer to the ETL for how duplicate drugs during the same visit were handled. Each instance of a drug dispensing or administration present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same drug within the same visit. It is valid to keep these duplicates and assign them individual, unique, DRUG_EXPOSURE_IDs, though it is up to the ETL how they should be handled. Yes No
78 DRUG_EXPOSURE person_id Yes integer The PERSON_ID of the PERSON for whom the drug dispensing or administration is recorded. This may be a system generated code. No Yes PERSON PERSON_ID
79 DRUG_EXPOSURE drug_concept_id Yes integer The DRUG_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source concept id which represents a drug product or molecule otherwise introduced to the body. The drug concepts can have a varying degree of information about drug strength and dose. This information is relevant in the context of quantity and administration information in the subsequent fields plus strength information from the DRUG_STRENGTH table, provided as part of the standard vocabulary download. The CONCEPT_ID that the DRUG_SOURCE_VALUE maps to. The concept id should be derived either from mapping from the source concept id or by picking the drug concept representing the most amount of detail you have. Records whose source values map to standard concepts with a domain of Drug should go in this table. When the Drug Source Value of the code cannot be translated into Standard Drug Concept IDs, a Drug exposure entry is stored with only the corresponding SOURCE_CONCEPT_ID and DRUG_SOURCE_VALUE and a DRUG_CONCEPT_ID of 0. The Drug Concept with the most detailed content of information is preferred during the mapping process. These are indicated in the CONCEPT_CLASS_ID field of the Concept and are recorded in the following order of precedence: 'Branded Pack', 'Clinical Pack', 'Branded Drug', 'Clinical Drug', 'Branded Drug Component', 'Clinical Drug Component', 'Branded Drug Form', 'Clinical Drug Form', and only if no other information is available 'Ingredient'. Note: If only the drug class is known, the DRUG_CONCEPT_ID field should contain 0. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Drug&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Drug
80 DRUG_EXPOSURE drug_exposure_start_date Yes date Use this date to determine the start date of the drug record. Valid entries include a start date of a prescription, the date a prescription was filled, or the date on which a Drug administration was recorded. It is a valid ETL choice to use the date the drug was ordered as the DRUG_EXPOSURE_START_DATE. No No
81 DRUG_EXPOSURE drug_exposure_start_datetime No datetime This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
82 DRUG_EXPOSURE drug_exposure_end_date Yes date The DRUG_EXPOSURE_END_DATE denotes the day the drug exposure ended for the patient. If this information is not explicitly available in the data, infer the end date using the following methods:<br><br> 1. Start first with duration or days supply using the calculation drug start date + days supply -1 day. 2. Use quantity divided by daily dose that you may obtain from the sig or a source field (or assumed daily dose of 1) for solid, indivisibile, drug products. If quantity represents ingredient amount, quantity divided by daily dose * concentration (from drug_strength) drug concept id tells you the dose form. 3. If it is an administration record, set drug end date equal to drug start date. If the record is a written prescription then set end date to start date + 29. If the record is a mail-order prescription set end date to start date + 89. The end date must be equal to or greater than the start date. Ibuprofen 20mg/mL oral solution concept tells us this is oral solution. Calculate duration as quantity (200 example) * daily dose (5mL) /concentration (20mg/mL) 200*5/20 = 50 days. [Examples by dose form](https://ohdsi.github.io/CommonDataModel/drug_dose.html) No No
83 DRUG_EXPOSURE drug_exposure_end_datetime No datetime This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
84 DRUG_EXPOSURE verbatim_end_date No date This is the end date of the drug exposure as it appears in the source data, if it is given Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable. No No
85 DRUG_EXPOSURE drug_type_concept_id Yes integer You can use the TYPE_CONCEPT_ID to delineate between prescriptions written vs. prescriptions dispensed vs. medication history vs. patient-reported exposure, etc. Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
86 DRUG_EXPOSURE stop_reason No varchar(20) The reason a person stopped a medication as it is represented in the source. Reasons include regimen completed, changed, removed, etc. This field will be retired in v6.0. This information is often not populated in source data and it is a valid etl choice to leave it blank if the information does not exist. No No
87 DRUG_EXPOSURE refills No integer This is only filled in when the record is coming from a prescription written this field is meant to represent intended refills at time of the prescription. No No
88 DRUG_EXPOSURE quantity No float To find the dose form of a drug the RELATIONSHIP table can be used where the relationship_id is 'Has dose form'. If liquid, quantity stands for the total amount dispensed or ordered of ingredient in the units given by the drug_strength table. If the unit from the source data does not align with the unit in the DRUG_STRENGTH table the quantity should be converted to the correct unit given in DRUG_STRENGTH. For clinical drugs with fixed dose forms (tablets etc.) the quantity is the number of units/tablets/capsules prescribed or dispensed (can be partial, but then only 1/2 or 1/3, not 0.01). Clinical drugs with divisible dose forms (injections) the quantity is the amount of ingredient the patient got. For example, if the injection is 2mg/mL but the patient got 80mL then quantity is reported as 160. Quantified clinical drugs with divisible dose forms (prefilled syringes), the quantity is the amount of ingredient similar to clinical drugs. Please see [how to calculate drug dose](https://ohdsi.github.io/CommonDataModel/drug_dose.html) for more information. No No
89 DRUG_EXPOSURE days_supply No integer Days supply of the drug. This should be the verbatim days_supply as given on the prescription. If the drug is physician administered use duration end date if given or set to 1 as default if duration is not available. No No
90 DRUG_EXPOSURE sig No varchar(MAX) This is the verbatim instruction for the drug as written by the provider. Put the written out instructions for the drug as it is verbatim in the source, if available. No No
91 DRUG_EXPOSURE route_concept_id No integer The standard CONCEPT_ID that the ROUTE_SOURCE_VALUE maps to in the route domain. No Yes CONCEPT CONCEPT_ID Route
92 DRUG_EXPOSURE lot_number No varchar(50) No No
93 DRUG_EXPOSURE provider_id No integer The Provider associated with drug record, e.g. the provider who wrote the prescription or the provider who administered the drug. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the ordering vs administering physician on an EHR record. No Yes PROVIDER PROVIDER_ID
94 DRUG_EXPOSURE visit_occurrence_id No integer The Visit during which the drug was prescribed, administered or dispensed. To populate this field drug exposures must be explicitly initiated in the visit. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
95 DRUG_EXPOSURE visit_detail_id No integer The VISIT_DETAIL record during which the drug exposure occurred. For example, if the person was in the ICU at the time of the drug administration the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. Same rules apply as for the VISIT_OCCURRENCE_ID. No Yes VISIT_DETAIL VISIT_DETAIL_ID
96 DRUG_EXPOSURE drug_source_value No varchar(50) This field houses the verbatim value from the source data representing the drug exposure that occurred. For example, this could be an NDC or Gemscript code. This code is mapped to a Standard Drug Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
97 DRUG_EXPOSURE drug_source_concept_id No integer This is the concept representing the drug source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Drug necessary for a given analytic use case. Consider using DRUG_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the DRUG_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
98 DRUG_EXPOSURE route_source_value No varchar(50) This field houses the verbatim value from the source data representing the drug route. This information may be called something different in the source data but the field is meant to contain a value indicating when and how a drug was given to a patient. This source value is mapped to a standard concept which is stored in the ROUTE_CONCEPT_ID field. No No
99 DRUG_EXPOSURE dose_unit_source_value No varchar(50) This field houses the verbatim value from the source data representing the dose unit of the drug given. This information may be called something different in the source data but the field is meant to contain a value indicating the unit of dosage of drug given to the patient. This is an older column and will be deprecated in an upcoming version. No No
100 PROCEDURE_OCCURRENCE procedure_occurrence_id Yes integer The unique key given to a procedure record for a person. Refer to the ETL for how duplicate procedures during the same visit were handled. Each instance of a procedure occurrence in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same procedure within the same visit. It is valid to keep these duplicates and assign them individual, unique, PROCEDURE_OCCURRENCE_IDs, though it is up to the ETL how they should be handled. Yes No
101 PROCEDURE_OCCURRENCE person_id Yes integer The PERSON_ID of the PERSON for whom the procedure is recorded. This may be a system generated code. No Yes PERSON PERSON_ID
102 PROCEDURE_OCCURRENCE procedure_concept_id Yes integer The PROCEDURE_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source value which represents a procedure The CONCEPT_ID that the PROCEDURE_SOURCE_VALUE maps to. Only records whose source values map to standard concepts with a domain of "Procedure" should go in this table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Procedure&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Procedure
103 PROCEDURE_OCCURRENCE procedure_date Yes date Use this date to determine the date the procedure occurred. If a procedure lasts more than a day, then it should be recorded as a separate record for each day the procedure occurred, this logic is in lieu of the procedure_end_date, which will be added in a future version of the CDM. No No
104 PROCEDURE_OCCURRENCE procedure_datetime No datetime This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
105 PROCEDURE_OCCURRENCE procedure_type_concept_id Yes integer This field can be used to determine the provenance of the Procedure record, as in whether the procedure was from an EHR system, insurance claim, registry, or other sources. Choose the PROCEDURE_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. If a procedure is recorded as an EHR encounter, the PROCEDURE_TYPE_CONCEPT would be 'EHR encounter record'. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
106 PROCEDURE_OCCURRENCE modifier_concept_id No integer The modifiers are intended to give additional information about the procedure but as of now the vocabulary is under review. It is up to the ETL to choose how to map modifiers if they exist in source data. These concepts are typically distinguished by 'Modifier' concept classes (e.g., 'CPT4 Modifier' as part of the 'CPT4' vocabulary). If there is more than one modifier on a record, one should be chosen that pertains to the procedure rather than provider. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?conceptClass=CPT4+Modifier&conceptClass=HCPCS+Modifier&vocabulary=CPT4&vocabulary=HCPCS&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
107 PROCEDURE_OCCURRENCE quantity No integer If the quantity value is omitted, a single procedure is assumed. If a Procedure has a quantity of '0' in the source, this should default to '1' in the ETL. If there is a record in the source it can be assumed the exposure occurred at least once No No
108 PROCEDURE_OCCURRENCE provider_id No integer The provider associated with the procedure record, e.g. the provider who performed the Procedure. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record. No No PROVIDER PROVIDER_ID
109 PROCEDURE_OCCURRENCE visit_occurrence_id No integer The visit during which the procedure occurred. Depending on the structure of the source data, this may have to be determined based on dates. If a PROCEDURE_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the PROCEDURE_OCCURRENCE record. No No VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
110 PROCEDURE_OCCURRENCE visit_detail_id No integer The VISIT_DETAIL record during which the Procedure occurred. For example, if the Person was in the ICU at the time of the Procedure the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. Same rules apply as for the VISIT_OCCURRENCE_ID. No No VISIT_DETAIL VISIT_DETAIL_ID
111 PROCEDURE_OCCURRENCE procedure_source_value No varchar(50) This field houses the verbatim value from the source data representing the procedure that occurred. For example, this could be an CPT4 or OPCS4 code. Use this value to look up the source concept id and then map the source concept id to a standard concept id. No No
112 PROCEDURE_OCCURRENCE procedure_source_concept_id No integer This is the concept representing the procedure source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Procedure necessary for a given analytic use case. Consider using PROCEDURE_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the PROCEDURE_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No No CONCEPT CONCEPT_ID
113 PROCEDURE_OCCURRENCE modifier_source_value No varchar(50) The original modifier code from the source is stored here for reference. No No
114 PROCEDURE_OCCURRENCE procedure_status_source_value No varchar(50) This field houses the verbatim value from the source data representing the procedure status (primary or secondary). This information may be called something different in the source data but the field is meant to contain a value indicating whether the procedure was the primary reason for performing a surgical operation, infusion, etc. This source value is mapped to a standard concept which is stored in the PROCEDURE_STATUS_CONCEPT_ID field.
115 PROCEDURE_OCCURRENCE procedure_status_concept_id Yes integer This concept represents if the procedure was the primary reason for the surgical operation, infusion, etc . Choose the Concept in the Procedure Status domain that best represents the status ( [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Condition+Status&standardConcept=Standard&page=1&pageSize=15&query=).
116 DEVICE_EXPOSURE device_exposure_id Yes integer The unique key given to records a person's exposure to a foreign physical object or instrument. Each instance of an exposure to a foreign object or device present in the source data should be assigned this unique key. Yes No
117 DEVICE_EXPOSURE person_id Yes integer No Yes PERSON PERSON_ID
118 DEVICE_EXPOSURE device_concept_id Yes integer The DEVICE_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. This is the standard concept mapped from the source concept id which represents a foreign object or instrument the person was exposed to. The CONCEPT_ID that the DEVICE_SOURCE_VALUE maps to. No Yes CONCEPT CONCEPT_ID Device
119 DEVICE_EXPOSURE device_exposure_start_date Yes date Use this date to determine the start date of the device record. Valid entries include a start date of a procedure to implant a device, the date of a prescription for a device, or the date of device administration. No No
120 DEVICE_EXPOSURE device_exposure_start_datetime No datetime This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
121 DEVICE_EXPOSURE device_exposure_end_date No date The DEVICE_EXPOSURE_END_DATE denotes the day the device exposure ended for the patient, if given. Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable. No No
122 DEVICE_EXPOSURE device_exposure_end_datetime No datetime If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
123 DEVICE_EXPOSURE device_type_concept_id Yes integer You can use the TYPE_CONCEPT_ID to denote the provenance of the record, as in whether the record is from administrative claims or EHR. Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
124 DEVICE_EXPOSURE unique_device_id No varchar(255) This is the Unique Device Identification (UDI-DI) number for devices regulated by the FDA, if given. For medical devices that are regulated by the FDA, a Unique Device Identification (UDI) is provided if available in the data source and is recorded in the UNIQUE_DEVICE_ID field. No No
125 DEVICE_EXPOSURE production_id No varchar(255) This is the Production Identifier (UDI-PI) portion of the Unique Device Identification.
126 DEVICE_EXPOSURE quantity No integer No No
127 DEVICE_EXPOSURE provider_id No integer The Provider associated with device record, e.g. the provider who wrote the prescription or the provider who implanted the device. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. No Yes PROVIDER PROVIDER_ID
128 DEVICE_EXPOSURE visit_occurrence_id No integer The Visit during which the device was prescribed or given. To populate this field device exposures must be explicitly initiated in the visit. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
129 DEVICE_EXPOSURE visit_detail_id No integer The Visit Detail during which the device was prescribed or given. To populate this field device exposures must be explicitly initiated in the visit detail record. No Yes VISIT_DETAIL VISIT_DETAIL_ID
130 DEVICE_EXPOSURE device_source_value No varchar(50) This field houses the verbatim value from the source data representing the device exposure that occurred. For example, this could be an NDC or Gemscript code. This code is mapped to a Standard Device Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
131 DEVICE_EXPOSURE device_source_concept_id No integer This is the concept representing the device source value and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Device necessary for a given analytic use case. Consider using DEVICE_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the DEVICE_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
132 DEVICE_EXPOSURE unit_concept_id No integer UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. There is no standardization requirement for units associated with DEVICE_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. If there is no unit associated with a Device record, set to NULL.
133 DEVICE_EXPOSURE unit_source_value No varchar(50) This field houses the verbatim value from the source data representing the unit of the Device. For example, blood transfusions are considered devices and can be given in mL quantities. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. Using the blood transfusion example, blood transfusion is represented by the DEVICE_CONCEPT_ID and the unit (mL) would be housed in the UNIT_SOURCE_VALUE and mapped to a standard concept in the unit domain.
134 DEVICE_EXPOSURE unit_source_concept_id No integer This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Unit necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here.
135 MEASUREMENT measurement_id Yes integer The unique key given to a Measurement record for a Person. Refer to the ETL for how duplicate Measurements during the same Visit were handled. Each instance of a measurement present in the source data should be assigned this unique key. In some cases, a person can have multiple records of the same measurement within the same visit. It is valid to keep these duplicates and assign them individual, unique, MEASUREMENT_IDs, though it is up to the ETL how they should be handled. Yes No
136 MEASUREMENT person_id Yes integer The PERSON_ID of the Person for whom the Measurement is recorded. This may be a system generated code. No Yes PERSON PERSON_ID
137 MEASUREMENT measurement_concept_id Yes integer The MEASUREMENT_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. The CONCEPT_ID that the MEASUREMENT_SOURCE_CONCEPT_ID maps to. Only records whose SOURCE_CONCEPT_IDs map to Standard Concepts with a domain of "Measurement" should go in this table. No Yes CONCEPT CONCEPT_ID Measurement
138 MEASUREMENT measurement_date Yes date Use this date to determine the date of the measurement. If there are multiple dates in the source data associated with a record such as order_date, draw_date, and result_date, choose the one that is closest to the date the sample was drawn from the patient. No No
139 MEASUREMENT measurement_datetime No datetime This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
140 MEASUREMENT measurement_time No varchar(10) This is present for backwards compatibility and will be deprecated in an upcoming version. No No
141 MEASUREMENT measurement_type_concept_id Yes integer This field can be used to determine the provenance of the Measurement record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources. Choose the MEASUREMENT_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
142 MEASUREMENT operator_concept_id No integer The meaning of Concept [4172703](https://athena.ohdsi.org/search-terms/terms/4172703) for '=' is identical to omission of a OPERATOR_CONCEPT_ID value. Since the use of this field is rare, it's important when devising analyses to not to forget testing for the content of this field for values different from =. Operators are <, <=, =, >=, > and these concepts belong to the 'Meas Value Operator' domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Meas+Value+Operator&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
143 MEASUREMENT value_as_number No float This is the numerical value of the Result of the Measurement, if available. Note that measurements such as blood pressures will be split into their component parts i.e. one record for systolic, one record for diastolic. If there is a negative value coming from the source, set the VALUE_AS_NUMBER to NULL, with the exception of the following Measurements (listed as LOINC codes):<br>- [1925-7](https://athena.ohdsi.org/search-terms/terms/3003396) Base excess in Arterial blood by calculation - [1927-3](https://athena.ohdsi.org/search-terms/terms/3002032) Base excess in Venous blood by calculation - [8632-2](https://athena.ohdsi.org/search-terms/terms/3006277) QRS-Axis - [11555-0](https://athena.ohdsi.org/search-terms/terms/3012501) Base excess in Blood by calculation - [1926-5](https://athena.ohdsi.org/search-terms/terms/3003129) Base excess in Capillary blood by calculation - [28638-5](https://athena.ohdsi.org/search-terms/terms/3004959) Base excess in Arterial cord blood by calculation [28639-3](https://athena.ohdsi.org/search-terms/terms/3007435) Base excess in Venous cord blood by calculation No No
144 MEASUREMENT value_as_concept_id No integer If the raw data gives a categorial result for measurements those values are captured and mapped to standard concepts in the 'Meas Value' domain. If the raw data provides categorial results as well as continuous results for measurements, it is a valid ETL choice to preserve both values. The continuous value should go in the VALUE_AS_NUMBER field and the categorical value should be mapped to a standard concept in the 'Meas Value' domain and put in the VALUE_AS_CONCEPT_ID field. This is also the destination for the 'Maps to value' relationship. No Yes CONCEPT CONCEPT_ID
145 MEASUREMENT unit_concept_id No integer There is currently no recommended unit for individual measurements, i.e. it is not mandatory to represent Hemoglobin a1C measurements as a percentage. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. There is no standardization requirement for units associated with MEASUREMENT_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. No Yes CONCEPT CONCEPT_ID Unit
146 MEASUREMENT range_low No float Ranges have the same unit as the VALUE_AS_NUMBER. These ranges are provided by the source and should remain NULL if not given. If reference ranges for upper and lower limit of normal as provided (typically by a laboratory) these are stored in the RANGE_HIGH and RANGE_LOW fields. This should be set to NULL if not provided. No No
147 MEASUREMENT range_high No float Ranges have the same unit as the VALUE_AS_NUMBER. These ranges are provided by the source and should remain NULL if not given. If reference ranges for upper and lower limit of normal as provided (typically by a laboratory) these are stored in the RANGE_HIGH and RANGE_LOW fields. This should be set to NULL if not provided. No No
148 MEASUREMENT provider_id No integer The provider associated with measurement record, e.g. the provider who ordered the test or the provider who recorded the result. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record. No Yes PROVIDER PROVIDER_ID
149 MEASUREMENT visit_occurrence_id No integer The visit during which the Measurement occurred. Depending on the structure of the source data, this may have to be determined based on dates. If a MEASUREMENT_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the measurement record. If a measurement is related to a visit explicitly in the source data, it is possible that the result date of the Measurement falls outside of the bounds of the Visit dates. No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
150 MEASUREMENT visit_detail_id No integer The VISIT_DETAIL record during which the Measurement occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. Same rules apply as for the VISIT_OCCURRENCE_ID. No Yes VISIT_DETAIL VISIT_DETAIL_ID
151 MEASUREMENT measurement_source_value No varchar(50) This field houses the verbatim value from the source data representing the Measurement that occurred. For example, this could be an ICD10 or Read code. This code is mapped to a Standard Measurement Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
152 MEASUREMENT measurement_source_concept_id No integer This is the concept representing the MEASUREMENT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using MEASUREMENT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. If the MEASUREMENT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
153 MEASUREMENT unit_source_value No varchar(50) This field houses the verbatim value from the source data representing the unit of the Measurement that occurred. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
154 MEASUREMENT unit_source_concept_id No integer "This is the concept representing the UNIT_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Measurement necessary for a given analytic use case. Consider using UNIT_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network." If the UNIT_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No Yes CONCEPT CONCEPT_ID
155 MEASUREMENT value_source_value No varchar(50) This field houses the verbatim result value of the Measurement from the source data . If both a continuous and categorical result are given in the source data such that both VALUE_AS_NUMBER and VALUE_AS_CONCEPT_ID are both included, store the verbatim value that was mapped to VALUE_AS_CONCEPT_ID here. No No
156 OBSERVATION MEASUREMENT observation_id measurement_event_id Yes No integer bigint The unique key given to an Observation record for a Person. Refer to the ETL for how duplicate Observations during the same Visit were handled. If the Measurement record is related to another record in the database, this field is the primary key of the linked record. Each instance of an observation present in the source data should be assigned this unique key. Put the primary key of the linked record, if applicable, here. Yes No No
157 OBSERVATION MEASUREMENT person_id meas_event_field_concept_id Yes No integer The PERSON_ID of the Person for whom the Observation is recorded. This may be a system generated code. If the Measurement record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. Put the CONCEPT_ID that identifies which table and field the MEASUREMENT_EVENT_ID came from. No Yes PERSON CONCEPT PERSON_ID CONCEPT_ID
158 OBSERVATION observation_concept_id observation_id Yes integer The OBSERVATION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. The unique key given to an Observation record for a Person. Refer to the ETL for how duplicate Observations during the same Visit were handled. The CONCEPT_ID that the OBSERVATION_SOURCE_CONCEPT_ID maps to. There is no specified domain that the Concepts in this table must adhere to. The only rule is that records with Concepts in the Condition, Procedure, Drug, Measurement, or Device domains MUST go to the corresponding table. Each instance of an observation present in the source data should be assigned this unique key. No Yes Yes No CONCEPT CONCEPT_ID
159 OBSERVATION observation_date person_id Yes date integer The date of the Observation. Depending on what the Observation represents this could be the date of a lab test, the date of a survey, or the date a patient's family history was taken. The PERSON_ID of the Person for whom the Observation is recorded. This may be a system generated code. For some observations the ETL may need to make a choice as to which date to choose. No No Yes PERSON PERSON_ID
160 OBSERVATION observation_datetime observation_concept_id No Yes datetime integer The OBSERVATION_CONCEPT_ID field is recommended for primary use in analyses, and must be used for network studies. If no time is given set to midnight (00:00:00). The CONCEPT_ID that the OBSERVATION_SOURCE_CONCEPT_ID maps to. There is no specified domain that the Concepts in this table must adhere to. The only rule is that records with Concepts in the Condition, Procedure, Drug, Measurement, or Device domains MUST go to the corresponding table. No No Yes CONCEPT CONCEPT_ID
161 OBSERVATION observation_type_concept_id observation_date Yes integer date This field can be used to determine the provenance of the Observation record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources. The date of the Observation. Depending on what the Observation represents this could be the date of a lab test, the date of a survey, or the date a patient's family history was taken. Choose the OBSERVATION_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). For some observations the ETL may need to make a choice as to which date to choose. No Yes No CONCEPT CONCEPT_ID Type Concept
162 OBSERVATION value_as_number observation_datetime No float datetime This is the numerical value of the Result of the Observation, if applicable and available. It is not expected that all Observations will have numeric results, rather, this field is here to house values should they exist. If no time is given set to midnight (00:00:00). No No
163 OBSERVATION value_as_string observation_type_concept_id No Yes varchar(60) integer This is the categorical value of the Result of the Observation, if applicable and available. This field can be used to determine the provenance of the Observation record, as in whether the measurement was from an EHR system, insurance claim, registry, or other sources. Choose the OBSERVATION_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No No Yes CONCEPT CONCEPT_ID Type Concept
164 OBSERVATION value_as_concept_id value_as_number No Integer float It is possible that some records destined for the Observation table have two clinical ideas represented in one source code. This is common with ICD10 codes that describe a family history of some Condition, for example. In OMOP the Vocabulary breaks these two clinical ideas into two codes; one becomes the OBSERVATION_CONCEPT_ID and the other becomes the VALUE_AS_CONCEPT_ID. It is important when using the Observation table to keep this possibility in mind and to examine the VALUE_AS_CONCEPT_ID field for relevant information. This is the numerical value of the Result of the Observation, if applicable and available. It is not expected that all Observations will have numeric results, rather, this field is here to house values should they exist. Note that the value of VALUE_AS_CONCEPT_ID may be provided through mapping from a source Concept which contains the content of the Observation. In those situations, the CONCEPT_RELATIONSHIP table in addition to the 'Maps to' record contains a second record with the relationship_id set to 'Maps to value'. For example, ICD10 [Z82.4](https://athena.ohdsi.org/search-terms/terms/45581076) 'Family history of ischaemic heart disease and other diseases of the circulatory system' has a 'Maps to' relationship to [4167217](https://athena.ohdsi.org/search-terms/terms/4167217) 'Family history of clinical finding' as well as a 'Maps to value' record to [134057](https://athena.ohdsi.org/search-terms/terms/134057) 'Disorder of cardiovascular system'. No Yes No CONCEPT CONCEPT_ID
165 OBSERVATION qualifier_concept_id value_as_string No integer varchar(60) This field contains all attributes specifying the clinical fact further, such as as degrees, severities, drug-drug interaction alerts etc. This is the categorical value of the Result of the Observation, if applicable and available. Use your best judgement as to what Concepts to use here and if they are necessary to accurately represent the clinical record. There is no restriction on the domain of these Concepts, they just need to be Standard. No Yes No CONCEPT CONCEPT_ID
166 OBSERVATION unit_concept_id value_as_concept_id No integer Integer There is currently no recommended unit for individual observation concepts. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. It is possible that some records destined for the Observation table have two clinical ideas represented in one source code. This is common with ICD10 codes that describe a family history of some Condition, for example. In OMOP the Vocabulary breaks these two clinical ideas into two codes; one becomes the OBSERVATION_CONCEPT_ID and the other becomes the VALUE_AS_CONCEPT_ID. It is important when using the Observation table to keep this possibility in mind and to examine the VALUE_AS_CONCEPT_ID field for relevant information. There is no standardization requirement for units associated with OBSERVATION_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. Note that the value of VALUE_AS_CONCEPT_ID may be provided through mapping from a source Concept which contains the content of the Observation. In those situations, the CONCEPT_RELATIONSHIP table in addition to the 'Maps to' record contains a second record with the relationship_id set to 'Maps to value'. For example, ICD10 [Z82.4](https://athena.ohdsi.org/search-terms/terms/45581076) 'Family history of ischaemic heart disease and other diseases of the circulatory system' has a 'Maps to' relationship to [4167217](https://athena.ohdsi.org/search-terms/terms/4167217) 'Family history of clinical finding' as well as a 'Maps to value' record to [134057](https://athena.ohdsi.org/search-terms/terms/134057) 'Disorder of cardiovascular system'. No Yes CONCEPT CONCEPT_ID Unit
167 OBSERVATION provider_id qualifier_concept_id No integer The provider associated with the observation record, e.g. the provider who ordered the test or the provider who recorded the result. This field contains all attributes specifying the clinical fact further, such as as degrees, severities, drug-drug interaction alerts etc. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record. Use your best judgement as to what Concepts to use here and if they are necessary to accurately represent the clinical record. There is no restriction on the domain of these Concepts, they just need to be Standard. No Yes PROVIDER CONCEPT PROVIDER_ID CONCEPT_ID
168 OBSERVATION visit_occurrence_id unit_concept_id No integer The visit during which the Observation occurred. There is currently no recommended unit for individual observation concepts. UNIT_SOURCE_VALUES should be mapped to a Standard Concept in the Unit domain that best represents the unit as given in the source data. Depending on the structure of the source data, this may have to be determined based on dates. If an OBSERVATION_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the observation record. If an observation is related to a visit explicitly in the source data, it is possible that the result date of the Observation falls outside of the bounds of the Visit dates. There is no standardization requirement for units associated with OBSERVATION_CONCEPT_IDs, however, it is the responsibility of the ETL to choose the most plausible unit. No Yes VISIT_OCCURRENCE CONCEPT VISIT_OCCURRENCE_ID CONCEPT_ID Unit
169 OBSERVATION visit_detail_id provider_id No integer The VISIT_DETAIL record during which the Observation occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. The provider associated with the observation record, e.g. the provider who ordered the test or the provider who recorded the result. Same rules apply as for the VISIT_OCCURRENCE_ID. The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record. For example the admitting vs attending physician on an EHR record. No Yes VISIT_DETAIL PROVIDER VISIT_DETAIL_ID PROVIDER_ID
170 OBSERVATION observation_source_value visit_occurrence_id No varchar(50) integer This field houses the verbatim value from the source data representing the Observation that occurred. For example, this could be an ICD10 or Read code. The visit during which the Observation occurred. This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference. Depending on the structure of the source data, this may have to be determined based on dates. If an OBSERVATION_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the observation record. If an observation is related to a visit explicitly in the source data, it is possible that the result date of the Observation falls outside of the bounds of the Visit dates. No No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
171 OBSERVATION observation_source_concept_id visit_detail_id No integer This is the concept representing the OBSERVATION_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Observation necessary for a given analytic use case. Consider using OBSERVATION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. The VISIT_DETAIL record during which the Observation occurred. For example, if the Person was in the ICU at the time the VISIT_OCCURRENCE record would reflect the overall hospital stay and the VISIT_DETAIL record would reflect the ICU stay during the hospital visit. If the OBSERVATION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. Same rules apply as for the VISIT_OCCURRENCE_ID. No Yes CONCEPT VISIT_DETAIL CONCEPT_ID VISIT_DETAIL_ID
172 OBSERVATION unit_source_value observation_source_value No varchar(50) This field houses the verbatim value from the source data representing the unit of the Observation that occurred. This field houses the verbatim value from the source data representing the Observation that occurred. For example, this could be an ICD10 or Read code. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. This code is mapped to a Standard Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
173 OBSERVATION qualifier_source_value observation_source_concept_id No varchar(50) integer This field houses the verbatim value from the source data representing the qualifier of the Observation that occurred. This is the concept representing the OBSERVATION_SOURCE_VALUE and may not necessarily be standard. This field is discouraged from use in analysis because it is not required to contain Standard Concepts that are used across the OHDSI community, and should only be used when Standard Concepts do not adequately represent the source detail for the Observation necessary for a given analytic use case. Consider using OBSERVATION_CONCEPT_ID instead to enable standardized analytics that can be consistent across the network. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. If the OBSERVATION_SOURCE_VALUE is coded in the source data using an OMOP supported vocabulary put the concept id representing the source value here. No No Yes CONCEPT CONCEPT_ID
174 OBSERVATION value_source_value unit_source_value No varchar(50) This field houses the verbatim result value of the Observation from the source data. Do not get confused with the Observation_source_value which captures source value of the observation mapped to observation_concept_id. This field is the observation result value from the source. This field houses the verbatim value from the source data representing the unit of the Observation that occurred. If the observation_source_value was a question, for example, or an observation that requires a result then this field is the answer/ result from the source data. Store the verbatim value that represents the result of the observation_source_value. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
175 DEATH OBSERVATION person_id qualifier_source_value Yes No integer varchar(50) This field houses the verbatim value from the source data representing the qualifier of the Observation that occurred. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No Yes No PERSON PERSON_ID
176 DEATH OBSERVATION death_date value_source_value Yes No date varchar(50) The date the person was deceased. This field houses the verbatim result value of the Observation from the source data. Do not get confused with the Observation_source_value which captures source value of the observation mapped to observation_concept_id. This field is the observation result value from the source. If the precise date include day or month is not known or not allowed, December is used as the default month, and the last day of the month the default day. If the observation_source_value was a question, for example, or an observation that requires a result then this field is the answer/ result from the source data. Store the verbatim value that represents the result of the observation_source_value. No No
177 DEATH OBSERVATION death_datetime observation_event_id No datetime bigint If the Observation record is related to another record in the database, this field is the primary key of the linked record. If not available set time to midnight (00:00:00) Put the primary key of the linked record, if applicable, here. See the [ETL Conventions for the OBSERVATION](https://ohdsi.github.io/CommonDataModel/cdm60.html#observation) table for more details. No No
178 DEATH OBSERVATION death_type_concept_id obs_event_field_concept_id No integer This is the provenance of the death record, i.e., where it came from. It is possible that an administrative claims database would source death information from a government file so do not assume the Death Type is the same as the Visit Type, etc. If the Observation record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. Use the type concept that be reflects the source of the death record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). Put the CONCEPT_ID that identifies which table and field the OBSERVATION_EVENT_ID came from. No Yes CONCEPT CONCEPT_ID Type Concept
179 DEATH cause_concept_id person_id No Yes integer This is the Standard Concept representing the Person's cause of death, if available. There is no specified domain for this concept, just choose the Standard Concept Id that best represents the person's cause of death. No Yes CONCEPT PERSON CONCEPT_ID PERSON_ID
180 DEATH cause_source_value death_date No Yes varchar(50) date The date the person was deceased. If available, put the source code representing the cause of death here. If the precise date include day or month is not known or not allowed, December is used as the default month, and the last day of the month the default day. No No
181 DEATH cause_source_concept_id death_datetime No integer datetime If the cause of death was coded using a Vocabulary present in the OMOP Vocabularies put the CONCEPT_ID representing the cause of death here. If not available set time to midnight (00:00:00) No Yes No CONCEPT CONCEPT_ID
182 NOTE DEATH note_id death_type_concept_id Yes No integer A unique identifier for each note. This is the provenance of the death record, i.e., where it came from. It is possible that an administrative claims database would source death information from a government file so do not assume the Death Type is the same as the Visit Type, etc. Use the type concept that be reflects the source of the death record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). Yes No No Yes CONCEPT CONCEPT_ID Type Concept
183 NOTE DEATH person_id cause_concept_id Yes No integer This is the Standard Concept representing the Person's cause of death, if available. There is no specified domain for this concept, just choose the Standard Concept Id that best represents the person's cause of death. No Yes PERSON CONCEPT PERSON_ID CONCEPT_ID
184 NOTE DEATH note_date cause_source_value Yes No date varchar(50) The date the note was recorded. If available, put the source code representing the cause of death here. No No
185 NOTE DEATH note_datetime cause_source_concept_id No datetime integer If time is not given set the time to midnight. If the cause of death was coded using a Vocabulary present in the OMOP Vocabularies put the CONCEPT_ID representing the cause of death here. No No Yes CONCEPT CONCEPT_ID
186 NOTE note_type_concept_id note_id Yes integer The provenance of the note. Most likely this will be EHR. A unique identifier for each note. Put the source system of the note, as in EHR record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=). No Yes Yes No CONCEPT CONCEPT_ID Type Concept
187 NOTE note_class_concept_id person_id Yes integer A Standard Concept Id representing the HL7 LOINC Document Type Vocabulary classification of the note. Map the note classification to a Standard Concept. For more information see the ETL Conventions in the description of the NOTE table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&conceptClass=Doc+Kind&conceptClass=Doc+Role&conceptClass=Doc+Setting&conceptClass=Doc+Subject+Matter&conceptClass=Doc+Type+of+Service&domain=Meas+Value&page=1&pageSize=15&query=). This Concept can alternatively be represented by concepts with the relationship 'Kind of (LOINC)' to [706391](https://athena.ohdsi.org/search-terms/terms/706391) (Note). No Yes CONCEPT PERSON CONCEPT_ID PERSON_ID
188 NOTE note_title note_event_id No varchar(250) bigint The title of the note. If the Note record is related to another record in the database, this field is the primary key of the linked record. Put the primary key of the linked record, if applicable, here. No No
189 NOTE note_text note_event_field_concept_id Yes No varchar(MAX) integer The content of the note. If the Note record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. Put the CONCEPT_ID that identifies which table and field the NOTE_EVENT_ID came from. No No Yes CONCEPT CONCEPT_ID
190 NOTE encoding_concept_id note_date Yes integer date This is the Concept representing the character encoding type. The date the note was recorded. Put the Concept Id that represents the encoding character type here. Currently the only option is UTF-8 ([32678](https://athena.ohdsi.org/search-terms/terms/32678)). It the note is encoded in any other type, like ASCII then put 0. No Yes No CONCEPT CONCEPT_ID
191 NOTE language_concept_id note_datetime Yes No integer datetime The language of the note. Use Concepts that are descendants of the concept [4182347](https://athena.ohdsi.org/search-terms/terms/4182347) (World Languages). If time is not given set the time to midnight. No Yes No CONCEPT CONCEPT_ID
192 NOTE provider_id note_type_concept_id No Yes integer The Provider who wrote the note. The provenance of the note. Most likely this will be EHR. The ETL may need to make a determination on which provider to put here. Put the source system of the note, as in EHR record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=). No Yes PROVIDER CONCEPT PROVIDER_ID CONCEPT_ID Type Concept
193 NOTE visit_occurrence_id note_class_concept_id No Yes integer The Visit during which the note was written. A Standard Concept Id representing the HL7 LOINC Document Type Vocabulary classification of the note. Map the note classification to a Standard Concept. For more information see the ETL Conventions in the description of the NOTE table. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&conceptClass=Doc+Kind&conceptClass=Doc+Role&conceptClass=Doc+Setting&conceptClass=Doc+Subject+Matter&conceptClass=Doc+Type+of+Service&domain=Meas+Value&page=1&pageSize=15&query=). This Concept can alternatively be represented by concepts with the relationship 'Kind of (LOINC)' to [706391](https://athena.ohdsi.org/search-terms/terms/706391) (Note). No Yes VISIT_OCCURRENCE CONCEPT VISIT_OCCURRENCE_ID CONCEPT_ID
194 NOTE visit_detail_id note_title No integer varchar(250) The Visit Detail during which the note was written. The title of the note. No Yes No VISIT_DETAIL VISIT_DETAIL_ID
195 NOTE note_source_value note_text No Yes varchar(50) varchar(MAX) The content of the note. The source value mapped to the NOTE_CLASS_CONCEPT_ID. No No
196 NOTE_NLP NOTE note_nlp_id encoding_concept_id Yes integer A unique identifier for the NLP record. This is the Concept representing the character encoding type. Put the Concept Id that represents the encoding character type here. Currently the only option is UTF-8 ([32678](https://athena.ohdsi.org/search-terms/terms/32678)). It the note is encoded in any other type, like ASCII then put 0. Yes No No Yes CONCEPT CONCEPT_ID
197 NOTE_NLP NOTE note_id language_concept_id Yes integer This is the NOTE_ID for the NOTE record the NLP record is associated to. The language of the note. Use Concepts that are descendants of the concept [4182347](https://athena.ohdsi.org/search-terms/terms/4182347) (World Languages). No No Yes CONCEPT CONCEPT_ID
198 NOTE_NLP NOTE section_concept_id provider_id No integer The Provider who wrote the note. The SECTION_CONCEPT_ID should be used to represent the note section contained in the NOTE_NLP record. These concepts can be found as parts of document panels and are based on the type of note written, i.e. a discharge summary. These panels can be found as concepts with the relationship 'Subsumes' to CONCEPT_ID [45875957](https://athena.ohdsi.org/search-terms/terms/45875957). The ETL may need to make a determination on which provider to put here. No Yes CONCEPT PROVIDER CONCEPT_ID PROVIDER_ID
199 NOTE_NLP NOTE snippet visit_occurrence_id No varchar(250) integer A small window of text surrounding the term The Visit during which the note was written. No No Yes VISIT_OCCURRENCE VISIT_OCCURRENCE_ID
200 NOTE_NLP NOTE offset visit_detail_id No varchar(50) integer Character offset of the extracted term in the input note The Visit Detail during which the note was written. No No Yes VISIT_DETAIL VISIT_DETAIL_ID
201 NOTE note_source_value No varchar(50) The source value mapped to the NOTE_CLASS_CONCEPT_ID. No No
202 NOTE_NLP note_nlp_id Yes integer A unique identifier for the NLP record. Yes No
203 NOTE_NLP note_id Yes integer This is the NOTE_ID for the NOTE record the NLP record is associated to. No No
204 NOTE_NLP section_concept_id No integer The SECTION_CONCEPT_ID should be used to represent the note section contained in the NOTE_NLP record. These concepts can be found as parts of document panels and are based on the type of note written, i.e. a discharge summary. These panels can be found as concepts with the relationship 'Subsumes' to CONCEPT_ID [45875957](https://athena.ohdsi.org/search-terms/terms/45875957). No Yes CONCEPT CONCEPT_ID
205 NOTE_NLP snippet No varchar(250) A small window of text surrounding the term No No
206 NOTE_NLP offset No varchar(50) Character offset of the extracted term in the input note No No
207 NOTE_NLP lexical_variant Yes varchar(250) Raw text extracted from the NLP tool. No No
208 NOTE_NLP note_nlp_concept_id No integer No Yes CONCEPT CONCEPT_ID
209 NOTE_NLP note_nlp_source_concept_id No integer No Yes CONCEPT CONCEPT_ID
210 NOTE_NLP nlp_system No varchar(250) Name and version of the NLP system that extracted the term. Useful for data provenance. No No
211 NOTE_NLP nlp_date Yes date The date of the note processing. No No
212 NOTE_NLP nlp_datetime No datetime The date and time of the note processing. No No
213 NOTE_NLP term_exists No varchar(1) Term_exists is defined as a flag that indicates if the patient actually has or had the condition. Any of the following modifiers would make Term_exists false: Negation = true Subject = [anything other than the patient] Conditional = true/li> Rule_out = true Uncertain = very low certainty or any lower certainties A complete lack of modifiers would make Term_exists true. No No
214 NOTE_NLP term_temporal No varchar(50) Term_temporal is to indicate if a condition is present or just in the past. The following would be past:<br><br> - History = true - Concept_date = anything before the time of the report No No
215 NOTE_NLP term_modifiers No varchar(2000) For the modifiers that are there, they would have to have these values:<br><br> - Negation = false - Subject = patient - Conditional = false - Rule_out = false - Uncertain = true or high or moderate or even low (could argue about low). Term_modifiers will concatenate all modifiers for different types of entities (conditions, drugs, labs etc) into one string. Lab values will be saved as one of the modifiers. No No
216 SPECIMEN specimen_id Yes integer Unique identifier for each specimen. Yes No
217 SPECIMEN person_id Yes integer The person from whom the specimen is collected. No Yes PERSON PERSON_ID
218 SPECIMEN specimen_concept_id Yes integer The standard CONCEPT_ID that the SPECIMEN_SOURCE_VALUE maps to in the specimen domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Specimen&standardConcept=Standard&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
219 SPECIMEN specimen_type_concept_id Yes integer Put the source of the specimen record, as in an EHR system. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
220 SPECIMEN specimen_date Yes date The date the specimen was collected. No No
221 SPECIMEN specimen_datetime No datetime No No
222 SPECIMEN quantity No float The amount of specimen collected from the person. No No
223 SPECIMEN unit_concept_id No integer The unit for the quantity of the specimen. Map the UNIT_SOURCE_VALUE to a Standard Concept in the Unit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Unit&standardConcept=Standard&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
224 SPECIMEN anatomic_site_concept_id No integer This is the site on the body where the specimen is from. Map the ANATOMIC_SITE_SOURCE_VALUE to a Standard Concept in the Spec Anatomic Site domain. This should be coded at the lowest level of granularity [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Spec+Anatomic+Site&conceptClass=Body+Structure&page=4&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
225 SPECIMEN disease_status_concept_id No integer No Yes CONCEPT CONCEPT_ID
226 SPECIMEN specimen_source_id No varchar(50) This is the identifier for the specimen from the source system. No No
227 SPECIMEN specimen_source_value No varchar(50) No No
228 SPECIMEN unit_source_value No varchar(50) This unit for the quantity of the specimen, as represented in the source. No No
229 SPECIMEN anatomic_site_source_value No varchar(50) This is the site on the body where the specimen was taken from, as represented in the source. No No
230 SPECIMEN disease_status_source_value No varchar(50) No No
232 FACT_RELATIONSHIP fact_id_1 Yes integer No No
233 FACT_RELATIONSHIP domain_concept_id_2 Yes integer No Yes CONCEPT CONCEPT_ID
234 FACT_RELATIONSHIP fact_id_2 Yes integer No No
235 FACT_RELATIONSHIP relationship_concept_id Yes integer No Yes CONCEPT CONCEPT_ID
236 LOCATION location_id Yes integer The unique key given to a unique Location. Each instance of a Location in the source data should be assigned this unique key. Yes No
237 LOCATION address_1 No varchar(50) This is the first line of the address. No No
238 LOCATION address_2 No varchar(50) This is the second line of the address No No
239 LOCATION city No varchar(50) No No
240 LOCATION state No varchar(2) Please see the user guide for the location table for clarification on what this field represents in locations outside of the US. No No
241 LOCATION zip No varchar(9) Zip codes are handled as strings of up to 9 characters length. For US addresses, these represent either a 3-digit abbreviated Zip code as provided by many sources for patient protection reasons, the full 5-digit Zip or the 9-digit (ZIP + 4) codes. Unless for specific reasons analytical methods should expect and utilize only the first 3 digits. For international addresses, different rules apply. No No
242 LOCATION county No varchar(20) No No
243 LOCATION location_source_value No varchar(50) Put the verbatim value for the location here, as it shows up in the source. No No
244 LOCATION country_concept_id No integer The Concept Id representing the country. Values should conform to the [Geography](https://athena.ohdsi.org/search-terms/terms?domain=Geography&standardConcept=Standard&page=1&pageSize=15&query=&boosts) domain.
245 LOCATION country_source_value No varchar(80) The name of the country.
246 LOCATION latitude No float Must be between -90 and 90.
247 LOCATION longitude No float Must be between -180 and 180.
248 CARE_SITE care_site_id Yes integer Assign an id to each unique combination of location_id and place_of_service_source_value Yes No
249 CARE_SITE care_site_name No varchar(255) The name of the care_site as it appears in the source data No No
250 CARE_SITE place_of_service_concept_id No integer This is a high-level way of characterizing a Care Site. Typically, however, Care Sites can provide care in multiple settings (inpatient, outpatient, etc.) and this granularity should be reflected in the visit. Choose the concept in the visit domain that best represents the setting in which healthcare is provided in the Care Site. If most visits in a Care Site are Inpatient, then the place_of_service_concept_id should represent Inpatient. If information is present about a unique Care Site (e.g. Pharmacy) then a Care Site record should be created. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Visit&standardConcept=Standard&page=2&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
251 CARE_SITE location_id No integer The location_id from the LOCATION table representing the physical location of the care_site. No Yes LOCATION LOCATION_ID
252 CARE_SITE care_site_source_value No varchar(50) The identifier of the care_site as it appears in the source data. This could be an identifier separate from the name of the care_site. No No
253 CARE_SITE place_of_service_source_value No varchar(50) Put the place of service of the care_site as it appears in the source data. No No
254 PROVIDER provider_id Yes integer It is assumed that every provider with a different unique identifier is in fact a different person and should be treated independently. This identifier can be the original id from the source data provided it is an integer, otherwise it can be an autogenerated number. Yes No
255 PROVIDER provider_name No varchar(255) This field is not necessary as it is not necessary to have the actual identity of the Provider. Rather, the idea is to uniquely and anonymously identify providers of care across the database. No No
256 PROVIDER npi No varchar(20) This is the National Provider Number issued to health care providers in the US by the Centers for Medicare and Medicaid Services (CMS). No No
257 PROVIDER dea No varchar(20) This is the identifier issued by the DEA, a US federal agency, that allows a provider to write prescriptions for controlled substances. No No
258 PROVIDER specialty_concept_id No integer This field either represents the most common specialty that occurs in the data or the most specific concept that represents all specialties listed, should the provider have more than one. This includes physician specialties such as internal medicine, emergency medicine, etc. and allied health professionals such as nurses, midwives, and pharmacists. If a Provider has more than one Specialty, there are two options: 1. Choose a concept_id which is a common ancestor to the multiple specialties, or, 2. Choose the specialty that occurs most often for the provider. Concepts in this field should be Standard with a domain of Provider. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Provider&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
259 PROVIDER care_site_id No integer This is the CARE_SITE_ID for the location that the provider primarily practices in. If a Provider has more than one Care Site, the main or most often exerted CARE_SITE_ID should be recorded. No Yes CARE_SITE CARE_SITE_ID
260 PROVIDER year_of_birth No integer No No
261 PROVIDER gender_concept_id No integer This field represents the recorded gender of the provider in the source data. If given, put a concept from the gender domain representing the recorded gender of the provider. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Gender&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Gender
262 PROVIDER provider_source_value No varchar(50) Use this field to link back to providers in the source data. This is typically used for error checking of ETL logic. Some use cases require the ability to link back to providers in the source data. This field allows for the storing of the provider identifier as it appears in the source. No No
263 PROVIDER specialty_source_value No varchar(50) This is the kind of provider or specialty as it appears in the source data. This includes physician specialties such as internal medicine, emergency medicine, etc. and allied health professionals such as nurses, midwives, and pharmacists. Put the kind of provider as it appears in the source data. This field is up to the discretion of the ETL-er as to whether this should be the coded value from the source or the text description of the lookup value. No No
264 PROVIDER specialty_source_concept_id No integer This is often zero as many sites use proprietary codes to store physician speciality. If the source data codes provider specialty in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
265 PROVIDER gender_source_value No varchar(50) This is provider's gender as it appears in the source data. Put the provider's gender as it appears in the source data. This field is up to the discretion of the ETL-er as to whether this should be the coded value from the source or the text description of the lookup value. No No
266 PROVIDER gender_source_concept_id No integer This is often zero as many sites use proprietary codes to store provider gender. If the source data codes provider gender in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
267 PAYER_PLAN_PERIOD payer_plan_period_id Yes integer A unique identifier for each unique combination of a Person, Payer, Plan, and Period of time. Yes Yes PERSON PERSON_ID
268 PAYER_PLAN_PERIOD person_id Yes integer The Person covered by the Plan. A single Person can have multiple, overlapping, PAYER_PLAN_PERIOD records No Yes PERSON PERSON_ID
269 PAYER_PLAN_PERIOD payer_plan_period_start_date Yes date Start date of Plan coverage. No No
270 PAYER_PLAN_PERIOD payer_plan_period_end_date Yes date End date of Plan coverage. No No
271 PAYER_PLAN_PERIOD payer_concept_id No integer This field represents the organization who reimburses the provider which administers care to the Person. Map the Payer directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same payer, though the name of the Payer is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Payer&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
272 PAYER_PLAN_PERIOD payer_source_value No varchar(50) This is the Payer as it appears in the source data. No No
273 PAYER_PLAN_PERIOD payer_source_concept_id No integer If the source data codes the Payer in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
274 PAYER_PLAN_PERIOD plan_concept_id No integer This field represents the specific health benefit Plan the Person is enrolled in. Map the Plan directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same health benefit Plan though the name of the Plan is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
275 PAYER_PLAN_PERIOD plan_source_value No varchar(50) This is the health benefit Plan of the Person as it appears in the source data. No No
276 PAYER_PLAN_PERIOD plan_source_concept_id No integer If the source data codes the Plan in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
277 PAYER_PLAN_PERIOD sponsor_concept_id No integer This field represents the sponsor of the Plan who finances the Plan. This includes self-insured, small group health plan and large group health plan. Map the sponsor directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. The point is to stratify on this information and identify if Persons have the same sponsor though the name of the sponsor is not necessary. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Sponsor&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
278 PAYER_PLAN_PERIOD sponsor_source_value No varchar(50) The Plan sponsor as it appears in the source data. No No
279 PAYER_PLAN_PERIOD sponsor_source_concept_id No integer If the source data codes the sponsor in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
280 PAYER_PLAN_PERIOD family_source_value No varchar(50) The common identifier for all people (often a family) that covered by the same policy. Often these are the common digits of the enrollment id of the policy members. No No
281 PAYER_PLAN_PERIOD stop_reason_concept_id No integer This field represents the reason the Person left the Plan, if known. Map the stop reason directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan+Stop+Reason&standardConcept=Standard&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID
282 PAYER_PLAN_PERIOD stop_reason_source_value No varchar(50) The Plan stop reason as it appears in the source data. No No
283 PAYER_PLAN_PERIOD stop_reason_source_concept_id No integer If the source data codes the stop reason in an OMOP supported vocabulary store the concept_id here. No Yes CONCEPT CONCEPT_ID
284 COST cost_id Yes integer Yes No
285 COST cost_event_id Yes integer No No
286 COST cost_domain_id Yes varchar(20) No Yes DOMAIN DOMAIN_ID
287 COST cost_type_concept_id Yes integer No Yes CONCEPT CONCEPT_ID
288 COST currency_concept_id No integer No Yes CONCEPT CONCEPT_ID
289 COST total_charge No float No No
290 COST total_cost No float No No
291 COST total_paid No float No No
292 COST paid_by_payer No float No No
293 COST paid_by_patient No float No No
294 COST paid_patient_copay No float No No
295 COST paid_patient_coinsurance No float No No
296 COST paid_patient_deductible No float No No
297 COST paid_by_primary No float No No
298 COST paid_ingredient_cost No float No No
299 COST paid_dispensing_fee No float No No
300 COST payer_plan_period_id No integer No No
301 COST amount_allowed No float No No
302 COST revenue_code_concept_id No integer No Yes CONCEPT CONCEPT_ID
303 COST revenue_code_source_value No varchar(50) Revenue codes are a method to charge for a class of procedures and conditions in the U.S. hospital system. No No
304 COST drg_concept_id No integer No Yes CONCEPT CONCEPT_ID
305 COST drg_source_value No varchar(3) Diagnosis Related Groups are US codes used to classify hospital cases into one of approximately 500 groups. No No
306 DRUG_ERA drug_era_id Yes integer Yes No
307 DRUG_ERA person_id Yes integer No Yes PERSON PERSON_ID
308 DRUG_ERA drug_concept_id Yes integer The Concept Id representing the specific drug ingredient. No Yes CONCEPT CONCEPT_ID Drug Ingredient
309 DRUG_ERA drug_era_start_date Yes datetime The Drug Era Start Date is the start date of the first Drug Exposure for a given ingredient, with at least 31 days since the previous exposure. No No
310 DRUG_ERA drug_era_end_date Yes datetime The Drug Era End Date is the end date of the last Drug Exposure. The End Date of each Drug Exposure is either taken from the field drug_exposure_end_date or, as it is typically not available, inferred using the following rules: For pharmacy prescription data, the date when the drug was dispensed plus the number of days of supply are used to extrapolate the End Date for the Drug Exposure. Depending on the country-specific healthcare system, this supply information is either explicitly provided in the day_supply field or inferred from package size or similar information. For Procedure Drugs, usually the drug is administered on a single date (i.e., the administration date). A standard Persistence Window of 30 days (gap, slack) is permitted between two subsequent such extrapolated DRUG_EXPOSURE records to be considered to be merged into a single Drug Era. No No
311 DRUG_ERA drug_exposure_count No integer No No
312 DRUG_ERA gap_days No integer The Gap Days determine how many total drug-free days are observed between all Drug Exposure events that contribute to a DRUG_ERA record. It is assumed that the drugs are "not stockpiled" by the patient, i.e. that if a new drug prescription or refill is observed (a new DRUG_EXPOSURE record is written), the remaining supply from the previous events is abandoned. The difference between Persistence Window and Gap Days is that the former is the maximum drug-free time allowed between two subsequent DRUG_EXPOSURE records, while the latter is the sum of actual drug-free days for the given Drug Era under the above assumption of non-stockpiling. No No
313 DOSE_ERA dose_era_id Yes integer Yes No
314 DOSE_ERA person_id Yes integer No Yes PERSON PERSON_ID
315 DOSE_ERA drug_concept_id Yes integer The Concept Id representing the specific drug ingredient. No Yes CONCEPT CONCEPT_ID Drug Ingredient
316 DOSE_ERA unit_concept_id Yes integer The Concept Id representing the unit of the specific drug ingredient. No Yes CONCEPT CONCEPT_ID Unit
317 DOSE_ERA dose_value Yes float The numeric value of the dosage of the drug_ingredient. No No
318 DOSE_ERA dose_era_start_date Yes datetime The date the Person started on the specific dosage, with at least 31 days since any prior exposure. No No
319 DOSE_ERA dose_era_end_date Yes datetime The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records. No No
320 CONDITION_ERA condition_era_id Yes integer Yes No
321 CONDITION_ERA person_id Yes integer No No PERSON PERSON_ID
322 CONDITION_ERA condition_concept_id Yes integer The Concept Id representing the Condition. No Yes CONCEPT CONCEPT_ID Condition
323 CONDITION_ERA condition_era_start_date Yes datetime The start date for the Condition Era constructed from the individual instances of Condition Occurrences. It is the start date of the very first chronologically recorded instance of the condition with at least 31 days since any prior record of the same Condition. No No
324 CONDITION_ERA condition_era_end_date Yes datetime The end date for the Condition Era constructed from the individual instances of Condition Occurrences. It is the end date of the final continuously recorded instance of the Condition. No No
325 CONDITION_ERA condition_occurrence_count No integer The number of individual Condition Occurrences used to construct the condition era. No No
326 METADATA EPISODE metadata_id episode_id Yes integer The unique key given to a Metadata record. A unique identifier for each Episode. Attribute value is auto-generated Yes No
327 METADATA EPISODE metadata_concept_id person_id Yes integer The PERSON_ID of the PERSON for whom the episode is recorded. No Yes CONCEPT PERSON CONCEPT_ID PERSON_ID
328 METADATA EPISODE metadata_type_concept_id episode_concept_id Yes integer The EPISODE_CONCEPT_ID represents the kind abstraction related to the disease phase, outcome or treatment. Choose a concept in the Episode domain that best represents the ongoing disease phase, outcome, or treatment. Please see [article] for cancers and [article] for non-cancers describing how these are defined. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Episode&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
329 METADATA EPISODE name episode_start_date Yes varchar(250) date The date when the Episode beings. Please see [article] for how to define an Episode start date. No No
330 METADATA EPISODE value_as_string episode_start_datetime No varchar(250) datetime The date and time when the Episode begins. No No
331 METADATA EPISODE value_as_concept_id episode_end_date No integer date The date when the instance of the Episode is considered to have ended. Please see [article] for how to define an Episode end date. No Yes CONCEPT CONCEPT_ID
332 METADATA EPISODE value_as_number episode_end_datetime No float datetime This is the numerical value of the Result of the Metadata, if applicable and available. It is not expected that all Metadata will have numeric results, rather, this field is here to house values should they exist. The date when the instance of the Episode is considered to have ended. No No
333 METADATA EPISODE metadata_date episode_parent_id No date integer Use this field to find the Episode that subsumes the given Episode record. This is used in the case that an Episode are nested into each other. If there are multiple nested levels to how Episodes are represented, the EPISODE_PARENT_ID can be used to record this relationship. No No
334 METADATA EPISODE metadata_datetime episode_number No datetime integer For sequences of episodes, this is used to indicate the order the episodes occurred. For example, lines of treatment could be indicated here. Please see [article] for the details of how to count episodes. No No
335 CDM_SOURCE EPISODE cdm_source_name episode_object_concept_id Yes varchar(255) integer The name of the CDM instance. A Standard Concept representing the disease phase, outcome, or other abstraction of which the episode consists. For example, if the EPISODE_CONCEPT_ID is [treatment regimen](https://athena.ohdsi.org/search-terms/terms/32531) then the EPISODE_OBJECT_CONCEPT_ID should contain the chemotherapy regimen concept, like [Afatinib monotherapy](https://athena.ohdsi.org/search-terms/terms/35804392). Episode entries from the 'Disease Episode' concept class should have an episode_object_concept_id that comes from the Condition domain. Episode entries from the 'Treatment Episode' concept class should have an episode_object_concept_id that scome from the 'Procedure' domain or 'Regimen' concept class. No No Yes CONCEPT CONCEPT_ID
336 CDM_SOURCE EPISODE cdm_source_abbreviation episode_type_concept_id Yes varchar(25) integer The abbreviation of the CDM instance. This field can be used to determine the provenance of the Episode record, as in whether the episode was from an EHR system, insurance claim, registry, or other sources. Choose the EPISODE_TYPE_CONCEPT_ID that best represents the provenance of the record. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). No No Yes CONCEPT CONCEPT_ID Type Concept
337 CDM_SOURCE EPISODE cdm_holder episode_source_value Yes No varchar(255) varchar(50) The holder of the CDM instance. The source code for the Episdoe as it appears in the source data. This code is mapped to a Standard Condition Concept in the Standardized Vocabularies and the original code is stored here for reference. No No
338 CDM_SOURCE EPISODE source_description episode_source_concept_id No varchar(MAX) integer The description of the CDM instance. A foreign key to a Episode Concept that refers to the code used in the source. Given that the Episodes are user-defined it is unlikely that there will be a Source Concept available. If that is the case then set this field to zero. No No Yes CONCEPT CONCEPT_ID
339 CDM_SOURCE EPISODE_EVENT source_documentation_reference episode_id No Yes varchar(255) integer Use this field to link the EPISODE_EVENT record to its EPISODE. Put the EPISODE_ID that subsumes the EPISODE_EVENT record here. No No Yes EPISODE EPISODE_ID
340 CDM_SOURCE EPISODE_EVENT cdm_etl_reference event_id No Yes varchar(255) integer This field is the primary key of the linked record in the database. For example, if the Episode Event is a Condition Occurrence, then the CONDITION_OCCURRENCE_ID of the linked record goes in this field. Put the link to the CDM version used. Put the primary key of the linked record here. No No
341 CDM_SOURCE EPISODE_EVENT source_release_date episode_event_field_concept_id Yes date integer The release date of the source data. This field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. Put the CONCEPT_ID that identifies which table and field the EVENT_ID came from. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?vocabulary=CDM&conceptClass=Field&page=1&pageSize=15&query=) No No Yes CONCEPT CONCEPT_ID Metadata
342 CDM_SOURCE METADATA cdm_release_date metadata_id Yes date integer The release data of the CDM instance. The unique key given to a Metadata record. Attribute value is auto-generated No Yes No
343 CDM_SOURCE METADATA cdm_version metadata_concept_id No Yes varchar(10) integer No No Yes CONCEPT CONCEPT_ID
344 CDM_SOURCE METADATA cdm_version_concept_id metadata_type_concept_id Yes integer The Concept Id representing the version of the CDM. No Yes CONCEPT CONCEPT_ID
345 CDM_SOURCE METADATA vocabulary_version name Yes varchar(20) varchar(250) No No
346 CONCEPT METADATA concept_id value_as_string Yes No integer varchar(250) A unique identifier for each Concept across all domains. Yes No No
347 CONCEPT METADATA concept_name value_as_concept_id Yes No varchar(255) integer An unambiguous, meaningful and descriptive name for the Concept. No No Yes CONCEPT CONCEPT_ID
348 CONCEPT METADATA domain_id value_as_number Yes No varchar(20) float A foreign key to the [DOMAIN](https://ohdsi.github.io/CommonDataModel/cdm531.html#domain) table the Concept belongs to. This is the numerical value of the Result of the Metadata, if applicable and available. It is not expected that all Metadata will have numeric results, rather, this field is here to house values should they exist. No Yes No DOMAIN DOMAIN_ID
349 CONCEPT METADATA vocabulary_id metadata_date Yes No varchar(20) date A foreign key to the [VOCABULARY](https://ohdsi.github.io/CommonDataModel/cdm531.html#vocabulary) table indicating from which source the Concept has been adapted. No Yes No VOCABULARY VOCABULARY_ID
350 CONCEPT METADATA concept_class_id metadata_datetime Yes No varchar(20) datetime The attribute or concept class of the Concept. Examples are 'Clinical Drug', 'Ingredient', 'Clinical Finding' etc. No Yes No CONCEPT_CLASS CONCEPT_CLASS_ID
351 CONCEPT CDM_SOURCE standard_concept cdm_source_name No Yes varchar(1) varchar(255) This flag determines where a Concept is a Standard Concept, i.e. is used in the data, a Classification Concept, or a non-standard Source Concept. The allowable values are 'S' (Standard Concept) and 'C' (Classification Concept), otherwise the content is NULL. The name of the CDM instance. No No
352 CONCEPT CDM_SOURCE concept_code cdm_source_abbreviation Yes varchar(50) varchar(25) The concept code represents the identifier of the Concept in the source vocabulary, such as SNOMED-CT concept IDs, RxNorm RXCUIs etc. Note that concept codes are not unique across vocabularies. The abbreviation of the CDM instance. No No
353 CONCEPT CDM_SOURCE valid_start_date cdm_holder Yes date varchar(255) The date when the Concept was first recorded. The default value is 1-Jan-1970, meaning, the Concept has no (known) date of inception. The holder of the CDM instance. No No
354 CONCEPT CDM_SOURCE valid_end_date source_description Yes No date varchar(MAX) The date when the Concept became invalid because it was deleted or superseded (updated) by a new concept. The default value is 31-Dec-2099, meaning, the Concept is valid until it becomes deprecated. The description of the CDM instance. No No
355 CONCEPT CDM_SOURCE invalid_reason source_documentation_reference No varchar(1) varchar(255) Reason the Concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value. No No
356 VOCABULARY CDM_SOURCE vocabulary_id cdm_etl_reference Yes No varchar(20) varchar(255) A unique identifier for each Vocabulary, such as ICD9CM, SNOMED, Visit. Put the link to the CDM version used. Yes No No
357 VOCABULARY CDM_SOURCE vocabulary_name source_release_date Yes varchar(255) date The name describing the vocabulary, for example, International Classification of Diseases, Ninth Revision, Clinical Modification, Volume 1 and 2 (NCHS) etc. The release date of the source data. No No
358 VOCABULARY CDM_SOURCE vocabulary_reference cdm_release_date Yes varchar(255) date External reference to documentation or available download of the about the vocabulary. The release data of the CDM instance. No No
359 VOCABULARY CDM_SOURCE vocabulary_version cdm_version No varchar(255) varchar(10) Version of the Vocabulary as indicated in the source. No No
360 VOCABULARY CDM_SOURCE vocabulary_concept_id cdm_version_concept_id Yes integer A Concept that represents the Vocabulary the VOCABULARY record belongs to. The Concept Id representing the version of the CDM. No Yes CONCEPT CONCEPT_ID
361 DOMAIN CDM_SOURCE domain_id vocabulary_version Yes varchar(20) A unique key for each domain. Yes No No
362 DOMAIN CONCEPT domain_name concept_id Yes varchar(255) integer The name describing the Domain, e.g. Condition, Procedure, Measurement etc. A unique identifier for each Concept across all domains. No Yes No
363 DOMAIN CONCEPT domain_concept_id concept_name Yes integer varchar(255) A Concept representing the Domain Concept the DOMAIN record belongs to. An unambiguous, meaningful and descriptive name for the Concept. No Yes No CONCEPT CONCEPT_ID
364 CONCEPT_CLASS CONCEPT concept_class_id domain_id Yes varchar(20) A unique key for each class. A foreign key to the [DOMAIN](https://ohdsi.github.io/CommonDataModel/cdm531.html#domain) table the Concept belongs to. Yes No No Yes DOMAIN DOMAIN_ID
365 CONCEPT_CLASS CONCEPT concept_class_name vocabulary_id Yes varchar(255) varchar(20) The name describing the Concept Class, e.g. Clinical Finding, Ingredient, etc. A foreign key to the [VOCABULARY](https://ohdsi.github.io/CommonDataModel/cdm531.html#vocabulary) table indicating from which source the Concept has been adapted. No No Yes VOCABULARY VOCABULARY_ID
366 CONCEPT_CLASS CONCEPT concept_class_concept_id concept_class_id Yes integer varchar(20) A Concept that represents the Concept Class. The attribute or concept class of the Concept. Examples are 'Clinical Drug', 'Ingredient', 'Clinical Finding' etc. No Yes CONCEPT CONCEPT_CLASS CONCEPT_ID CONCEPT_CLASS_ID
367 CONCEPT_RELATIONSHIP CONCEPT concept_id_1 standard_concept Yes No integer varchar(1) This flag determines where a Concept is a Standard Concept, i.e. is used in the data, a Classification Concept, or a non-standard Source Concept. The allowable values are 'S' (Standard Concept) and 'C' (Classification Concept), otherwise the content is NULL. No Yes No CONCEPT CONCEPT_ID
368 CONCEPT_RELATIONSHIP CONCEPT concept_id_2 concept_code Yes integer varchar(50) The concept code represents the identifier of the Concept in the source vocabulary, such as SNOMED-CT concept IDs, RxNorm RXCUIs etc. Note that concept codes are not unique across vocabularies. No Yes No CONCEPT CONCEPT_ID
369 CONCEPT_RELATIONSHIP CONCEPT relationship_id valid_start_date Yes varchar(20) date The relationship between CONCEPT_ID_1 and CONCEPT_ID_2. Please see the [Vocabulary Conventions](https://ohdsi.github.io/CommonDataModel/dataModelConventions.html#concept_relationships). for more information. The date when the Concept was first recorded. The default value is 1-Jan-1970, meaning, the Concept has no (known) date of inception. No Yes No RELATIONSHIP RELATIONSHIP_ID
370 CONCEPT_RELATIONSHIP CONCEPT valid_start_date valid_end_date Yes date The date when the relationship is first recorded. The date when the Concept became invalid because it was deleted or superseded (updated) by a new concept. The default value is 31-Dec-2099, meaning, the Concept is valid until it becomes deprecated. No No
371 CONCEPT_RELATIONSHIP CONCEPT valid_end_date invalid_reason Yes No date varchar(1) The date when the relationship is invalidated. Reason the Concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value. No No
372 CONCEPT_RELATIONSHIP VOCABULARY invalid_reason vocabulary_id No Yes varchar(1) varchar(20) Reason the relationship was invalidated. Possible values are 'D' (deleted), 'U' (updated) or NULL. A unique identifier for each Vocabulary, such as ICD9CM, SNOMED, Visit. No Yes No
373 RELATIONSHIP VOCABULARY relationship_id vocabulary_name Yes varchar(20) varchar(255) The type of relationship captured by the relationship record. The name describing the vocabulary, for example, International Classification of Diseases, Ninth Revision, Clinical Modification, Volume 1 and 2 (NCHS) etc. Yes No No
374 RELATIONSHIP VOCABULARY relationship_name vocabulary_reference Yes varchar(255) External reference to documentation or available download of the about the vocabulary. No No
375 RELATIONSHIP VOCABULARY is_hierarchical vocabulary_version Yes No varchar(1) varchar(255) Defines whether a relationship defines concepts into classes or hierarchies. Values are 1 for hierarchical relationship or 0 if not. Version of the Vocabulary as indicated in the source. No No
376 RELATIONSHIP VOCABULARY defines_ancestry vocabulary_concept_id Yes varchar(1) integer Defines whether a hierarchical relationship contributes to the concept_ancestor table. These are subsets of the hierarchical relationships. Valid values are 1 or 0. A Concept that represents the Vocabulary the VOCABULARY record belongs to. No No Yes CONCEPT CONCEPT_ID
377 RELATIONSHIP DOMAIN reverse_relationship_id domain_id Yes varchar(20) The identifier for the relationship used to define the reverse relationship between two concepts. A unique key for each domain. No Yes No
378 RELATIONSHIP DOMAIN relationship_concept_id domain_name Yes integer varchar(255) A foreign key that refers to an identifier in the [CONCEPT](https://ohdsi.github.io/CommonDataModel/cdm531.html#concept) table for the unique relationship concept. The name describing the Domain, e.g. Condition, Procedure, Measurement etc. No Yes No CONCEPT CONCEPT_ID
379 CONCEPT_SYNONYM DOMAIN concept_id domain_concept_id Yes integer A Concept representing the Domain Concept the DOMAIN record belongs to. No Yes CONCEPT CONCEPT_ID
380 CONCEPT_SYNONYM CONCEPT_CLASS concept_synonym_name concept_class_id Yes varchar(1000) varchar(20) A unique key for each class. No Yes No
381 CONCEPT_SYNONYM CONCEPT_CLASS language_concept_id concept_class_name Yes integer varchar(255) The name describing the Concept Class, e.g. Clinical Finding, Ingredient, etc. No Yes No CONCEPT CONCEPT_ID
382 CONCEPT_ANCESTOR CONCEPT_CLASS ancestor_concept_id concept_class_concept_id Yes integer The Concept Id for the higher-level concept that forms the ancestor in the relationship. A Concept that represents the Concept Class. No Yes CONCEPT CONCEPT_ID
383 CONCEPT_ANCESTOR CONCEPT_RELATIONSHIP descendant_concept_id concept_id_1 Yes integer The Concept Id for the lower-level concept that forms the descendant in the relationship. No Yes CONCEPT CONCEPT_ID
384 CONCEPT_ANCESTOR CONCEPT_RELATIONSHIP min_levels_of_separation concept_id_2 Yes integer The minimum separation in number of levels of hierarchy between ancestor and descendant concepts. This is an attribute that is used to simplify hierarchic analysis. No No Yes CONCEPT CONCEPT_ID
385 CONCEPT_ANCESTOR CONCEPT_RELATIONSHIP max_levels_of_separation relationship_id Yes integer varchar(20) The maximum separation in number of levels of hierarchy between ancestor and descendant concepts. This is an attribute that is used to simplify hierarchic analysis. The relationship between CONCEPT_ID_1 and CONCEPT_ID_2. Please see the [Vocabulary Conventions](https://ohdsi.github.io/CommonDataModel/dataModelConventions.html#concept_relationships). for more information. No No Yes RELATIONSHIP RELATIONSHIP_ID
386 SOURCE_TO_CONCEPT_MAP CONCEPT_RELATIONSHIP source_code valid_start_date Yes varchar(50) date The source code being translated into a Standard Concept. The date when the relationship is first recorded. No No
387 SOURCE_TO_CONCEPT_MAP CONCEPT_RELATIONSHIP source_concept_id valid_end_date Yes integer date A foreign key to the Source Concept that is being translated into a Standard Concept. The date when the relationship is invalidated. This is either 0 or should be a number above 2 billion, which are the Concepts reserved for site-specific codes and mappings. No Yes No CONCEPT CONCEPT_ID
388 SOURCE_TO_CONCEPT_MAP CONCEPT_RELATIONSHIP source_vocabulary_id invalid_reason Yes No varchar(20) varchar(1) A foreign key to the VOCABULARY table defining the vocabulary of the source code that is being translated to a Standard Concept. Reason the relationship was invalidated. Possible values are 'D' (deleted), 'U' (updated) or NULL. No No
389 SOURCE_TO_CONCEPT_MAP RELATIONSHIP source_code_description relationship_id No Yes varchar(255) varchar(20) An optional description for the source code. This is included as a convenience to compare the description of the source code to the name of the concept. The type of relationship captured by the relationship record. No Yes No
390 SOURCE_TO_CONCEPT_MAP RELATIONSHIP target_concept_id relationship_name Yes integer varchar(255) The target Concept to which the source code is being mapped. No Yes No CONCEPT CONCEPT_ID
391 SOURCE_TO_CONCEPT_MAP RELATIONSHIP target_vocabulary_id is_hierarchical Yes varchar(20) varchar(1) The Vocabulary of the target Concept. Defines whether a relationship defines concepts into classes or hierarchies. Values are 1 for hierarchical relationship or 0 if not. No Yes No VOCABULARY VOCABULARY_ID
392 SOURCE_TO_CONCEPT_MAP RELATIONSHIP valid_start_date defines_ancestry Yes date varchar(1) The date when the mapping instance was first recorded. Defines whether a hierarchical relationship contributes to the concept_ancestor table. These are subsets of the hierarchical relationships. Valid values are 1 or 0. No No
393 RELATIONSHIP reverse_relationship_id Yes varchar(20) The identifier for the relationship used to define the reverse relationship between two concepts. No No
394 RELATIONSHIP relationship_concept_id Yes integer A foreign key that refers to an identifier in the [CONCEPT](https://ohdsi.github.io/CommonDataModel/cdm531.html#concept) table for the unique relationship concept. No Yes CONCEPT CONCEPT_ID
395 CONCEPT_SYNONYM concept_id Yes integer No Yes CONCEPT CONCEPT_ID
396 CONCEPT_SYNONYM concept_synonym_name Yes varchar(1000) No No
397 CONCEPT_SYNONYM language_concept_id Yes integer No Yes CONCEPT CONCEPT_ID
398 CONCEPT_ANCESTOR ancestor_concept_id Yes integer The Concept Id for the higher-level concept that forms the ancestor in the relationship. No Yes CONCEPT CONCEPT_ID
399 CONCEPT_ANCESTOR descendant_concept_id Yes integer The Concept Id for the lower-level concept that forms the descendant in the relationship. No Yes CONCEPT CONCEPT_ID
400 CONCEPT_ANCESTOR min_levels_of_separation Yes integer The minimum separation in number of levels of hierarchy between ancestor and descendant concepts. This is an attribute that is used to simplify hierarchic analysis. No No
401 CONCEPT_ANCESTOR max_levels_of_separation Yes integer The maximum separation in number of levels of hierarchy between ancestor and descendant concepts. This is an attribute that is used to simplify hierarchic analysis. No No
402 SOURCE_TO_CONCEPT_MAP source_code Yes varchar(50) The source code being translated into a Standard Concept. No No
403 SOURCE_TO_CONCEPT_MAP source_concept_id Yes integer A foreign key to the Source Concept that is being translated into a Standard Concept. This is either 0 or should be a number above 2 billion, which are the Concepts reserved for site-specific codes and mappings. No Yes CONCEPT CONCEPT_ID
404 SOURCE_TO_CONCEPT_MAP source_vocabulary_id Yes varchar(20) A foreign key to the VOCABULARY table defining the vocabulary of the source code that is being translated to a Standard Concept. No No
405 SOURCE_TO_CONCEPT_MAP source_code_description No varchar(255) An optional description for the source code. This is included as a convenience to compare the description of the source code to the name of the concept. No No
406 SOURCE_TO_CONCEPT_MAP target_concept_id Yes integer The target Concept to which the source code is being mapped. No Yes CONCEPT CONCEPT_ID
407 SOURCE_TO_CONCEPT_MAP target_vocabulary_id Yes varchar(20) The Vocabulary of the target Concept. No Yes VOCABULARY VOCABULARY_ID
408 SOURCE_TO_CONCEPT_MAP valid_start_date Yes date The date when the mapping instance was first recorded. No No
409 SOURCE_TO_CONCEPT_MAP valid_end_date Yes date The date when the mapping instance became invalid because it was deleted or superseded (updated) by a new relationship. Default value is 31-Dec-2099. No No
410 SOURCE_TO_CONCEPT_MAP invalid_reason No varchar(1) Reason the mapping instance was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value. No No
411 DRUG_STRENGTH drug_concept_id Yes integer The Concept representing the Branded Drug or Clinical Drug Product. No Yes CONCEPT CONCEPT_ID
412 DRUG_STRENGTH ingredient_concept_id Yes integer The Concept representing the active ingredient contained within the drug product. Combination Drugs will have more than one record in this table, one for each active Ingredient. No Yes CONCEPT CONCEPT_ID
413 DRUG_STRENGTH amount_value No float The numeric value or the amount of active ingredient contained within the drug product. No No
414 DRUG_STRENGTH amount_unit_concept_id No integer The Concept representing the Unit of measure for the amount of active ingredient contained within the drug product. No Yes CONCEPT CONCEPT_ID
415 DRUG_STRENGTH numerator_value No float The concentration of the active ingredient contained within the drug product. No No
416 DRUG_STRENGTH numerator_unit_concept_id No integer The Concept representing the Unit of measure for the concentration of active ingredient. No Yes CONCEPT CONCEPT_ID
417 DRUG_STRENGTH denominator_value No float The amount of total liquid (or other divisible product, such as ointment, gel, spray, etc.). No No
418 DRUG_STRENGTH denominator_unit_concept_id No integer The Concept representing the denominator unit for the concentration of active ingredient. No Yes CONCEPT CONCEPT_ID
419 DRUG_STRENGTH box_size No integer The number of units of Clinical Branded Drug or Quantified Clinical or Branded Drug contained in a box as dispensed to the patient. No No
420 DRUG_STRENGTH valid_start_date Yes date The date when the Concept was first recorded. The default value is 1-Jan-1970. No No
421 DRUG_STRENGTH valid_end_date Yes date The date when then Concept became invalid. No No
422 DRUG_STRENGTH invalid_reason No varchar(1) Reason the concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value. No No
423 COHORT cohort_definition_id Yes integer No No
424 COHORT subject_id Yes integer No No
425 COHORT cohort_start_date Yes date No No
426 COHORT cohort_end_date Yes date No No
427 COHORT_DEFINITION cohort_definition_id Yes integer This is the identifier given to the cohort, usually by the ATLAS application No No COHORT COHORT_DEFINITION_ID
428 COHORT_DEFINITION cohort_definition_name Yes varchar(255) A short description of the cohort No No
429 COHORT_DEFINITION cohort_definition_description No varchar(MAX) A complete description of the cohort. No No
430 COHORT_DEFINITION definition_type_concept_id Yes integer Type defining what kind of Cohort Definition the record represents and how the syntax may be executed. No Yes CONCEPT CONCEPT_ID
431 COHORT_DEFINITION cohort_definition_syntax No varchar(MAX) Syntax or code to operationalize the Cohort Definition. No No
432 COHORT_DEFINITION subject_concept_id Yes integer This field contains a Concept that represents the domain of the subjects that are members of the cohort (e.g., Person, Provider, Visit). No Yes CONCEPT CONCEPT_ID
433 COHORT_DEFINITION cohort_initiation_date No date A date to indicate when the Cohort was initiated in the COHORT table. No No
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551

View File

@ -40,7 +40,7 @@ SPECIMEN,CDM,No,SPECIMEN_,Yes,0,,The specimen domain contains the records identi
FACT_RELATIONSHIP,CDM,No,,No,,,"The FACT_RELATIONSHIP table contains records about the relationships between facts stored as records in any table of the CDM. Relationships can be defined between facts from the same domain, or different domains. Examples of Fact Relationships include: [Person relationships](https://athena.ohdsi.org/search-terms/terms?domain=Relationship&standardConcept=Standard&page=2&pageSize=15&query=) (parent-child), care site relationships (hierarchical organizational structure of facilities within a health system), indication relationship (between drug exposures and associated conditions), usage relationships (of devices during the course of an associated procedure), or facts derived from one another (measurements derived from an associated specimen).",,"All relationships are directional, and each relationship is represented twice symmetrically within the FACT_RELATIONSHIP table. For example, two persons if person_id = 1 is the mother of person_id = 2 two records are in the FACT_RELATIONSHIP table (all strings in fact concept_id records in the Concept table:
- Person, 1, Person, 2, parent of
- Person, 2, Person, 1, child of"
LOCATION,CDM,No,,No,,,The LOCATION table represents a generic way to capture physical location or address information of Persons and Care Sites.,,"Each address or Location is unique and is present only once in the table. Locations do not contain names, such as the name of a hospital. In order to construct a full address that can be used in the postal service, the address information from the Location needs to be combined with information from the Care Site."
LOCATION,CDM,No,,No,,,The LOCATION table represents a generic way to capture physical location or address information of Persons and Care Sites.,"The current iteration of the LOCATION table is US centric. Until a major release to correct this, certain fields can be used to represent different international values. <br><br> - STATE can also be used for province or district<br>- ZIP is also the postal code or postcode","Each address or Location is unique and is present only once in the table. Locations do not contain names, such as the name of a hospital. In order to construct a full address that can be used in the postal service, the address information from the Location needs to be combined with information from the Care Site."
CARE_SITE,CDM,No,,No,,,"The CARE_SITE table contains a list of uniquely identified institutional (physical or organizational) units where healthcare delivery is practiced (offices, wards, hospitals, clinics, etc.).",,"Care site is a unique combination of location_id and place_of_service_source_value. Care site does not take into account the provider (human) information such a specialty. Many source data do not make a distinction between individual and institutional providers. The CARE_SITE table contains the institutional providers. If the source, instead of uniquely identifying individual Care Sites, only provides limited information such as Place of Service, generic or ""pooled"" Care Site records are listed in the CARE_SITE table. There can be hierarchical and business relationships between Care Sites. For example, wards can belong to clinics or departments, which can in turn belong to hospitals, which in turn can belong to hospital systems, which in turn can belong to HMOs.The relationships between Care Sites are defined in the FACT_RELATIONSHIP table."
PROVIDER,CDM,No,,No,,,"The PROVIDER table contains a list of uniquely identified healthcare providers. These are individuals providing hands-on healthcare to patients, such as physicians, nurses, midwives, physical therapists etc.","Many sources do not make a distinction between individual and institutional providers. The PROVIDER table contains the individual providers. If the source, instead of uniquely identifying individual providers, only provides limited information such as specialty, generic or 'pooled' Provider records are listed in the PROVIDER table.",
PAYER_PLAN_PERIOD,CDM,No,,Yes,0,,"The PAYER_PLAN_PERIOD table captures details of the period of time that a Person is continuously enrolled under a specific health Plan benefit structure from a given Payer. Each Person receiving healthcare is typically covered by a health benefit plan, which pays for (fully or partially), or directly provides, the care. These benefit plans are provided by payers, such as health insurances or state or government agencies. In each plan the details of the health benefits are defined for the Person or her family, and the health benefit Plan might change over time typically with increasing utilization (reaching certain cost thresholds such as deductibles), plan availability and purchasing choices of the Person. The unique combinations of Payer organizations, health benefit Plans and time periods in which they are valid for a Person are recorded in this table.","A Person can have multiple, overlapping, Payer_Plan_Periods in this table. For example, medical and drug coverage in the US can be represented by two Payer_Plan_Periods. The details of the benefit structure of the Plan is rarely known, the idea is just to identify that the Plans are different.",

1 cdmTableName schema isRequired conceptPrefix measurePersonCompleteness measurePersonCompletenessThreshold validation tableDescription userGuidance etlConventions
40 COHORT_DEFINITION RESULTS No No The COHORT_DEFINITION table contains records defining a Cohort derived from the data through the associated description and syntax and upon instantiation (execution of the algorithm) placed into the COHORT table. Cohorts are a set of subjects that satisfy a given combination of inclusion criteria for a duration of time. The COHORT_DEFINITION table provides a standardized structure for maintaining the rules governing the inclusion of a subject into a cohort, and can store operational programming code to instantiate the cohort within the OMOP Common Data Model.
41
42
43
44
45
46

View File

@ -118,7 +118,7 @@ PROCEDURE_OCCURRENCE,procedure_concept_id,Yes,integer,"The PROCEDURE_CONCEPT_ID
PROCEDURE_OCCURRENCE,procedure_date,No,date,Use this date to determine the date the procedure occurred.,"If a procedure lasts more than a day, then it should be recorded as a separate record for each day the procedure occurred, this logic is in lieu of the procedure_end_date, which will be added in a future version of the CDM.",No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_datetime,Yes,datetime,,"This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000)",No,No,,,,,
PROCEDURE_OCCURRENCE,procedure_type_concept_id,Yes,integer,"This field can be used to determine the provenance of the Procedure record, as in whether the procedure was from an EHR system, insurance claim, registry, or other sources.","Choose the PROCEDURE_TYPE_CONCEPT_ID that best represents the provenance of the record, for example whether it came from an EHR record or billing claim. If a procedure is recorded as an EHR encounter, the PROCEDURE_TYPE_CONCEPT would be 'EHR encounter record'. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
PROCEDURE_OCCURRENCE,modifier_concept_id,Yes,integer,The modifiers are intended to give additional information about the procedure but as of now the vocabulary is under review.,"It is up to the ETL to choose how to map modifiers if they exist in source data. These concepts are typically distinguished by 'Modifier' concept classes (e.g., 'CPT4 Modifier' as part of the 'CPT4' vocabulary). If there is more than one modifier on a record, one should be chosen that pertains to the procedure rather than provider. If not available, set to 0. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?conceptClass=CPT4+Modifier&conceptClass=HCPCS+Modifier&vocabulary=CPT4&vocabulary=HCPCS&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PROCEDURE_OCCURRENCE,modifier_concept_id,No,integer,The modifiers are intended to give additional information about the procedure but as of now the vocabulary is under review.,"It is up to the ETL to choose how to map modifiers if they exist in source data. These concepts are typically distinguished by 'Modifier' concept classes (e.g., 'CPT4 Modifier' as part of the 'CPT4' vocabulary). If there is more than one modifier on a record, one should be chosen that pertains to the procedure rather than provider. If not available, set to 0. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?conceptClass=CPT4+Modifier&conceptClass=HCPCS+Modifier&vocabulary=CPT4&vocabulary=HCPCS&standardConcept=Standard&page=1&pageSize=15&query=).",No,Yes,CONCEPT,CONCEPT_ID,,,
PROCEDURE_OCCURRENCE,quantity,No,integer,"If the quantity value is omitted, a single procedure is assumed.","If a Procedure has a quantity of '0' in the source, this should default to '1' in the ETL. If there is a record in the source it can be assumed the exposure occurred at least once",No,No,,,,,
PROCEDURE_OCCURRENCE,provider_id,No,bigint,"The provider associated with the procedure record, e.g. the provider who performed the Procedure.","The ETL may need to make a choice as to which PROVIDER_ID to put here. Based on what is available this may or may not be different than the provider associated with the overall VISIT_OCCURRENCE record, for example the admitting vs attending physician on an EHR record.",No,No,PROVIDER,PROVIDER_ID,,,
PROCEDURE_OCCURRENCE,visit_occurrence_id,No,bigint,The visit during which the procedure occurred.,"Depending on the structure of the source data, this may have to be determined based on dates. If a PROCEDURE_DATE occurs within the start and end date of a Visit it is a valid ETL choice to choose the VISIT_OCCURRENCE_ID from the Visit that subsumes it, even if not explicitly stated in the data. While not required, an attempt should be made to locate the VISIT_OCCURRENCE_ID of the PROCEDURE_OCCURRENCE record.",No,No,VISIT_OCCURRENCE,VISIT_OCCURRENCE_ID,,,
@ -210,7 +210,7 @@ NOTE_NLP,note_nlp_id,Yes,bigint,A unique identifier for the NLP record.,,Yes,No,
NOTE_NLP,note_id,Yes,integer,This is the NOTE_ID for the NOTE record the NLP record is associated to.,,No,No,,,,,
NOTE_NLP,section_concept_id,No,integer,,"The SECTION_CONCEPT_ID should be used to represent the note section contained in the NOTE_NLP record. These concepts can be found as parts of document panels and are based on the type of note written, i.e. a discharge summary. These panels can be found as concepts with the relationship 'Subsumes' to CONCEPT_ID [45875957](https://athena.ohdsi.org/search-terms/terms/45875957).",No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,snippet,No,varchar(250),A small window of text surrounding the term,,No,No,,,,,
NOTE_NLP,offset,No,varchar(50),Character offset of the extracted term in the input note,,No,No,,,,,
NOTE_NLP,"\""offset\""",No,varchar(50),Character offset of the extracted term in the input note,,No,No,,,,,
NOTE_NLP,lexical_variant,Yes,varchar(250),Raw text extracted from the NLP tool.,,No,No,,,,,
NOTE_NLP,note_nlp_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
NOTE_NLP,note_nlp_source_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
@ -334,33 +334,29 @@ PAYER_PLAN_PERIOD,family_source_value,No,varchar(50),The common identifier for a
PAYER_PLAN_PERIOD,stop_reason_concept_id,No,integer,"This field represents the reason the Person left the Plan, if known.",Map the stop reason directly to a standard CONCEPT_ID. If one does not exists please contact the vocabulary team. There is no global controlled vocabulary available for this information. [Accepted Concepts](http://athena.ohdsi.org/search-terms/terms?domain=Plan+Stop+Reason&standardConcept=Standard&page=1&pageSize=15&query=).,No,Yes,CONCEPT,CONCEPT_ID,,,
PAYER_PLAN_PERIOD,stop_reason_source_value,No,varchar(50),The Plan stop reason as it appears in the source data.,,No,No,,,,,
PAYER_PLAN_PERIOD,stop_reason_source_concept_id,No,integer,,If the source data codes the stop reason in an OMOP supported vocabulary store the concept_id here.,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,cost_id,Yes,INTEGER,,,Yes,No,,,,,
COST,cost_event_id,Yes,bigint,,,No,No,,,,,
COST,cost_domain_id,Yes,VARCHAR(20),,,No,Yes,DOMAIN,DOMAIN_ID,,,
COST,cost_type_concept_id,Yes,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,currency_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,total_charge,No,FLOAT,,,No,No,,,,,
COST,total_cost,No,FLOAT,,,No,No,,,,,
COST,total_paid,No,FLOAT,,,No,No,,,,,
COST,paid_by_payer,No,FLOAT,,,No,No,,,,,
COST,paid_by_patient,No,FLOAT,,,No,No,,,,,
COST,paid_patient_copay,No,FLOAT,,,No,No,,,,,
COST,paid_patient_coinsurance,No,FLOAT,,,No,No,,,,,
COST,paid_patient_deductible,No,FLOAT,,,No,No,,,,,
COST,paid_by_primary,No,FLOAT,,,No,No,,,,,
COST,paid_ingredient_cost,No,FLOAT,,,No,No,,,,,
COST,paid_dispensing_fee,No,FLOAT,,,No,No,,,,,
COST,payer_plan_period_id,No,bigint,,,No,No,,,,,
COST,amount_allowed,No,FLOAT,,,No,No,,,,,
COST,revenue_code_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,revenue_code_source_value,No,VARCHAR(50),Revenue codes are a method to charge for a class of procedures and conditions in the U.S. hospital system.,,No,No,,,,,
COST,drg_concept_id,No,integer,,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,drg_source_value,No,VARCHAR(3),Diagnosis Related Groups are US codes used to classify hospital cases into one of approximately 500 groups. ,,No,No,,,,,
COST,cost_id,Yes,bigint,A unique identifier for each COST record.,,Yes,No,,,,,
COST,person_id,Yes,bigint,,,No,No,,,,,
COST,cost_event_id,Yes,bigint,"If the Cost record is related to another record in the database, this field is the primary key of the linked record. ","Put the primary key of the linked record, if applicable, here.",No,No,,,,,
COST,cost_event_field_concept_id,Yes,integer,"If the Cost record is related to another record in the database, this field is the CONCEPT_ID that identifies which table the primary key of the linked record came from. ",Put the CONCEPT_ID that identifies which table and field the COST_EVENT_ID came from.,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,cost_concept_id,No,integer,A foreign key that refers to a Standard Cost Concept identifier in the Standardized Vocabularies belonging to the 'Cost' vocabulary.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,cost_type_concept_id,No,integer,A foreign key identifier to a concept in the CONCEPT table for the provenance or the source of the COST data and belonging to the 'Type Concept' vocabulary,,No,Yes,CONCEPT,CONCEPT_ID,Type Concept,,
COST,cost_source_concept_id,No,integer,A foreign key to a Cost Concept that refers to the code used in the source.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,cost_source_value,No,varchar(50),The source value for the cost as it appears in the source data,,No,No,,,,,
COST,currency_concept_id,No,integer,"A foreign key identifier to the concept representing the 3-letter code used to delineate international currencies, such as USD for US Dollar. These belong to the 'Currency' vocabulary",,No,No,CONCEPT,CONCEPT_ID,,,
COST,cost,No,float,The actual financial cost amount,,No,No,,,,,
COST,incurred_date,No,date,"The first date of service of the clinical event corresponding to the cost as in table capturing the information (e.g. date of visit, date of procedure, date of condition, date of drug etc).",,No,No,,,,,
COST,billed_date,No,date,The date a bill was generated for a service or encounter,,No,No,,,,,
COST,paid_date,No,date,The date payment was received for a service or encounter,,No,No,,,,,
COST,revenue_code_concept_id,No,integer,A foreign key referring to a Standard Concept ID in the Standardized Vocabularies for Revenue codes belonging to the 'Revenue Code' vocabulary.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,drg_concept_id,No,integer,A foreign key referring to a Standard Concept ID in the Standardized Vocabularies for DRG codes belonging to the 'DRG' vocabulary.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COST,revenue_code_source_value,No,varchar(50),"The source value for the Revenue code as it appears in the source data, stored here for reference.",,No,No,,,,,
COST,drg_source_value,No,varchar(50),"The source value for the 3-digit DRG source code as it appears in the source data, stored here for reference.",,No,No,,,,,
COST,payer_plan_period_id,No,bigint,"A foreign key to the PAYER_PLAN_PERIOD table, where the details of the Payer, Plan and Family are stored. Record the payer_plan_id that relates to the payer who contributed to the paid_by_payer field.",,No,No,,,,,
DRUG_ERA,drug_era_id,Yes,bigint,,,Yes,No,,,,,
DRUG_ERA,person_id,Yes,bigint,,,No,Yes,PERSON,PERSON_ID,,,
DRUG_ERA,drug_concept_id,Yes,integer,The Concept Id representing the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Drug,Ingredient,
DRUG_ERA,drug_era_start_date,Yes,datetime,,"The Drug Era Start Date is the start date of the first Drug Exposure for a given ingredient, with at least 31 days since the previous exposure. ",No,No,,,,,
DRUG_ERA,drug_era_end_date,Yes,datetime,,"The Drug Era End Date is the end date of the last Drug Exposure. The End Date of each Drug Exposure is either taken from the field drug_exposure_end_date or, as it is typically not available, inferred using the following rules:
DRUG_ERA,drug_era_start_datetime,Yes,datetime,,"The Drug Era Start Date is the start date of the first Drug Exposure for a given ingredient, with at least 31 days since the previous exposure. ",No,No,,,,,
DRUG_ERA,drug_era_end_datetime,Yes,datetime,,"The Drug Era End Date is the end date of the last Drug Exposure. The End Date of each Drug Exposure is either taken from the field drug_exposure_end_date or, as it is typically not available, inferred using the following rules:
For pharmacy prescription data, the date when the drug was dispensed plus the number of days of supply are used to extrapolate the End Date for the Drug Exposure. Depending on the country-specific healthcare system, this supply information is either explicitly provided in the day_supply field or inferred from package size or similar information.
For Procedure Drugs, usually the drug is administered on a single date (i.e., the administration date).
A standard Persistence Window of 30 days (gap, slack) is permitted between two subsequent such extrapolated DRUG_EXPOSURE records to be considered to be merged into a single Drug Era.",No,No,,,,,
@ -371,18 +367,18 @@ DOSE_ERA,person_id,Yes,bigint,,,No,Yes,PERSON,PERSON_ID,,,
DOSE_ERA,drug_concept_id,Yes,integer,The Concept Id representing the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Drug,Ingredient,
DOSE_ERA,unit_concept_id,Yes,integer,The Concept Id representing the unit of the specific drug ingredient.,,No,Yes,CONCEPT,CONCEPT_ID,Unit,,
DOSE_ERA,dose_value,Yes,float,The numeric value of the dosage of the drug_ingredient.,,No,No,,,,,
DOSE_ERA,dose_era_start_date,Yes,datetime,"The date the Person started on the specific dosage, with at least 31 days since any prior exposure.",,No,No,,,,,
DOSE_ERA,dose_era_end_date,Yes,datetime,,The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records.,No,No,,,,,
CONDITION_ERA,condition_era_id,Yes,integer,,,Yes,No,,,,,
DOSE_ERA,dose_era_start_datetime,Yes,datetime,"The date the Person started on the specific dosage, with at least 31 days since any prior exposure.",,No,No,,,,,
DOSE_ERA,dose_era_end_datetime,Yes,datetime,,The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records.,No,No,,,,,
CONDITION_ERA,condition_era_id,Yes,bigint,,,Yes,No,,,,,
CONDITION_ERA,person_id,Yes,bigint,,,No,No,PERSON,PERSON_ID,,,
CONDITION_ERA,condition_concept_id,Yes,integer,The Concept Id representing the Condition.,,No,Yes,CONCEPT,CONCEPT_ID,Condition,,
CONDITION_ERA,condition_era_start_date,Yes,datetime,"The start date for the Condition Era
CONDITION_ERA,condition_era_start_datetime,Yes,datetime,"The start date for the Condition Era
constructed from the individual
instances of Condition Occurrences.
It is the start date of the very first
chronologically recorded instance of
the condition with at least 31 days since any prior record of the same Condition. ",,No,No,,,,,
CONDITION_ERA,condition_era_end_date,Yes,datetime,"The end date for the Condition Era
CONDITION_ERA,condition_era_end_datetime,Yes,datetime,"The end date for the Condition Era
constructed from the individual
instances of Condition Occurrences.
It is the end date of the final
@ -538,10 +534,10 @@ recorded. The default value is
1-Jan-1970.",,No,No,,,,,
DRUG_STRENGTH,valid_end_date,Yes,date,The date when then Concept became invalid.,,No,No,,,,,
DRUG_STRENGTH,invalid_reason,No,varchar(1),"Reason the concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value.",,No,No,,,,,
COHORT_DEFINITION,cohort_definition_id,Yes,integer,"This is the identifier given to the cohort, usually by the ATLAS application",,No,No,,,,,
COHORT_DEFINITION,cohort_definition_id,Yes,bigint,"This is the identifier given to the cohort, usually by the ATLAS application",,No,No,,,,,
COHORT_DEFINITION,cohort_definition_name,Yes,varchar(255),A short description of the cohort,,No,No,,,,,
COHORT_DEFINITION,cohort_definition_description,No,varchar(MAX),A complete description of the cohort.,,No,No,,,,,
COHORT_DEFINITION,definition_type_concept_id,Yes,integer,Type defining what kind of Cohort Definition the record represents and how the syntax may be executed.,,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_definition_syntax,No,varchar(MAX),Syntax or code to operationalize the Cohort Definition.,,No,No,,,,,
COHORT_DEFINITION,subject_concept_id,Yes,integer,"This field contains a Concept that represents the domain of the subjects that are members of the cohort (e.g., Person, Provider, Visit).",,No,Yes,CONCEPT,CONCEPT_ID,,,
COHORT_DEFINITION,cohort_initiation_date,No,date,A date to indicate when the Cohort was initiated in the COHORT table.,,No,No,,,,,
COHORT_DEFINITION,cohort_initiation_date,No,date,A date to indicate when the Cohort was initiated in the COHORT table.,,No,No,,,,,
1 cdmTableName cdmFieldName isRequired cdmDatatype userGuidance etlConventions isPrimaryKey isForeignKey fkTableName fkFieldName fkDomain fkClass unique DQ identifiers
118 DEVICE_EXPOSURE device_exposure_start_date Yes date Use this date to determine the start date of the device record. Valid entries include a start date of a procedure to implant a device, the date of a prescription for a device, or the date of device administration. No No
119 DEVICE_EXPOSURE device_exposure_start_datetime No datetime This is not required, though it is in v6. If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
120 DEVICE_EXPOSURE device_exposure_end_date No date The DEVICE_EXPOSURE_END_DATE denotes the day the device exposure ended for the patient, if given. Put the end date or discontinuation date as it appears from the source data or leave blank if unavailable. No No
121 DEVICE_EXPOSURE device_exposure_end_datetime No datetime If a source does not specify datetime the convention is to set the time to midnight (00:00:0000) No No
122 DEVICE_EXPOSURE device_type_concept_id Yes integer You can use the TYPE_CONCEPT_ID to denote the provenance of the record, as in whether the record is from administrative claims or EHR. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Type+Concept&standardConcept=Standard&page=1&pageSize=15&query=). Choose the drug_type_concept_id that best represents the provenance of the record, for example whether it came from a record of a prescription written or physician administered drug. No Yes CONCEPT CONCEPT_ID Type Concept
123 DEVICE_EXPOSURE unique_device_id No varchar(50) This is the Unique Device Identification number for devices regulated by the FDA, if given. For medical devices that are regulated by the FDA, a Unique Device Identification (UDI) is provided if available in the data source and is recorded in the UNIQUE_DEVICE_ID field. No No
124 DEVICE_EXPOSURE quantity No integer No No
210 SPECIMEN specimen_concept_id Yes integer The standard CONCEPT_ID that the SPECIMEN_SOURCE_VALUE maps to in the specimen domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Specimen&standardConcept=Standard&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
211 SPECIMEN specimen_type_concept_id Yes integer Put the source of the specimen record, as in an EHR system. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Type+Concept&page=1&pageSize=15&query=). No Yes CONCEPT CONCEPT_ID Type Concept
212 SPECIMEN specimen_date Yes date The date the specimen was collected. No No
213 SPECIMEN specimen_datetime No datetime No No
214 SPECIMEN quantity No float The amount of specimen collected from the person. No No
215 SPECIMEN unit_concept_id No integer The unit for the quantity of the specimen. Map the UNIT_SOURCE_VALUE to a Standard Concept in the Unit domain. [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?domain=Unit&standardConcept=Standard&page=1&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
216 SPECIMEN anatomic_site_concept_id No integer This is the site on the body where the specimen is from. Map the ANATOMIC_SITE_SOURCE_VALUE to a Standard Concept in the Spec Anatomic Site domain. This should be coded at the lowest level of granularity [Accepted Concepts](https://athena.ohdsi.org/search-terms/terms?standardConcept=Standard&domain=Spec+Anatomic+Site&conceptClass=Body+Structure&page=4&pageSize=15&query=) No Yes CONCEPT CONCEPT_ID
334 DRUG_ERA DOSE_ERA drug_era_end_date person_id Yes datetime bigint The Drug Era End Date is the end date of the last Drug Exposure. The End Date of each Drug Exposure is either taken from the field drug_exposure_end_date or, as it is typically not available, inferred using the following rules: For pharmacy prescription data, the date when the drug was dispensed plus the number of days of supply are used to extrapolate the End Date for the Drug Exposure. Depending on the country-specific healthcare system, this supply information is either explicitly provided in the day_supply field or inferred from package size or similar information. For Procedure Drugs, usually the drug is administered on a single date (i.e., the administration date). A standard Persistence Window of 30 days (gap, slack) is permitted between two subsequent such extrapolated DRUG_EXPOSURE records to be considered to be merged into a single Drug Era. No No Yes PERSON PERSON_ID
335 DRUG_ERA DOSE_ERA drug_exposure_count drug_concept_id No Yes integer The Concept Id representing the specific drug ingredient. No No Yes CONCEPT CONCEPT_ID Drug Ingredient
336 DRUG_ERA DOSE_ERA gap_days unit_concept_id No Yes integer The Concept Id representing the unit of the specific drug ingredient. The Gap Days determine how many total drug-free days are observed between all Drug Exposure events that contribute to a DRUG_ERA record. It is assumed that the drugs are "not stockpiled" by the patient, i.e. that if a new drug prescription or refill is observed (a new DRUG_EXPOSURE record is written), the remaining supply from the previous events is abandoned. The difference between Persistence Window and Gap Days is that the former is the maximum drug-free time allowed between two subsequent DRUG_EXPOSURE records, while the latter is the sum of actual drug-free days for the given Drug Era under the above assumption of non-stockpiling. No No Yes CONCEPT CONCEPT_ID Unit
337 DOSE_ERA dose_era_id dose_value Yes bigint float The numeric value of the dosage of the drug_ingredient. Yes No No
338 DOSE_ERA person_id dose_era_start_datetime Yes bigint datetime The date the Person started on the specific dosage, with at least 31 days since any prior exposure. No Yes No PERSON PERSON_ID
339 DOSE_ERA drug_concept_id dose_era_end_datetime Yes integer datetime The Concept Id representing the specific drug ingredient. The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records. No Yes No CONCEPT CONCEPT_ID Drug Ingredient
340 DOSE_ERA CONDITION_ERA unit_concept_id condition_era_id Yes integer bigint The Concept Id representing the unit of the specific drug ingredient. No Yes Yes No CONCEPT CONCEPT_ID Unit
341 DOSE_ERA CONDITION_ERA dose_value person_id Yes float bigint The numeric value of the dosage of the drug_ingredient. No No PERSON PERSON_ID
342 DOSE_ERA CONDITION_ERA dose_era_start_date condition_concept_id Yes datetime integer The date the Person started on the specific dosage, with at least 31 days since any prior exposure. The Concept Id representing the Condition. No No Yes CONCEPT CONCEPT_ID Condition
343 DOSE_ERA CONDITION_ERA dose_era_end_date condition_era_start_datetime Yes datetime The start date for the Condition Era constructed from the individual instances of Condition Occurrences. It is the start date of the very first chronologically recorded instance of the condition with at least 31 days since any prior record of the same Condition. The date the Person was no longer exposed to the dosage of the specific drug ingredient. An era is ended if there are 31 days or more between dosage records. No No
344 CONDITION_ERA condition_era_id condition_era_end_datetime Yes integer datetime The end date for the Condition Era constructed from the individual instances of Condition Occurrences. It is the end date of the final continuously recorded instance of the Condition. Yes No No
345 CONDITION_ERA person_id condition_occurrence_count Yes No bigint integer The number of individual Condition Occurrences used to construct the condition era. No No PERSON PERSON_ID
346 CONDITION_ERA METADATA condition_concept_id metadata_concept_id Yes integer The Concept Id representing the Condition. No Yes CONCEPT CONCEPT_ID Condition
347 CONDITION_ERA METADATA condition_era_start_date metadata_type_concept_id Yes datetime integer The start date for the Condition Era constructed from the individual instances of Condition Occurrences. It is the start date of the very first chronologically recorded instance of the condition with at least 31 days since any prior record of the same Condition. No No Yes CONCEPT CONCEPT_ID
348 CONDITION_ERA METADATA condition_era_end_date name Yes datetime varchar(250) The end date for the Condition Era constructed from the individual instances of Condition Occurrences. It is the end date of the final continuously recorded instance of the Condition. No No
349 CONDITION_ERA METADATA condition_occurrence_count value_as_string No integer varchar(250) The number of individual Condition Occurrences used to construct the condition era. No No
350 METADATA metadata_concept_id value_as_concept_id Yes No integer No Yes CONCEPT CONCEPT_ID
351 METADATA metadata_type_concept_id metadata_date Yes No integer date No Yes No CONCEPT CONCEPT_ID
352 METADATA name metadata_datetime Yes No varchar(250) datetime No No
353 METADATA CDM_SOURCE value_as_string cdm_source_name No Yes varchar(250) varchar(255) The name of the CDM instance. No No
354 METADATA CDM_SOURCE value_as_concept_id cdm_source_abbreviation No integer varchar(25) The abbreviation of the CDM instance. No Yes No CONCEPT CONCEPT_ID
METADATA metadata_date No date No No
METADATA metadata_datetime No datetime No No
CDM_SOURCE cdm_source_name Yes varchar(255) The name of the CDM instance. No No
CDM_SOURCE cdm_source_abbreviation No varchar(25) The abbreviation of the CDM instance. No No
355 CDM_SOURCE cdm_holder No varchar(255) The holder of the CDM instance. No No
356 CDM_SOURCE source_description No varchar(MAX) The description of the CDM instance. No No
357 CDM_SOURCE source_documentation_reference No varchar(255) No No
358 CDM_SOURCE cdm_etl_reference No varchar(255) Put the link to the CDM version used. No No
359 CDM_SOURCE source_release_date No date The release date of the source data. No No
360 CDM_SOURCE cdm_release_date No date The release data of the CDM instance. No No
361 CDM_SOURCE cdm_version No varchar(10) No No
362 CDM_SOURCE vocabulary_version No varchar(20) No No
367 CONCEPT concept_class_id Yes varchar(20) The attribute or concept class of the Concept. Examples are 'Clinical Drug', 'Ingredient', 'Clinical Finding' etc. No Yes CONCEPT_CLASS CONCEPT_CLASS_ID
368 CONCEPT standard_concept No varchar(1) This flag determines where a Concept is a Standard Concept, i.e. is used in the data, a Classification Concept, or a non-standard Source Concept. The allowable values are 'S' (Standard Concept) and 'C' (Classification Concept), otherwise the content is NULL. No No
369 CONCEPT concept_code Yes varchar(50) The concept code represents the identifier of the Concept in the source vocabulary, such as SNOMED-CT concept IDs, RxNorm RXCUIs etc. Note that concept codes are not unique across vocabularies. No No
370 CONCEPT valid_start_date Yes date The date when the Concept was first recorded. The default value is 1-Jan-1970, meaning, the Concept has no (known) date of inception. No No
371 CONCEPT valid_end_date Yes date The date when the Concept became invalid because it was deleted or superseded (updated) by a new concept. The default value is 31-Dec-2099, meaning, the Concept is valid until it becomes deprecated. No No
372 CONCEPT invalid_reason No varchar(1) Reason the Concept was invalidated. Possible values are D (deleted), U (replaced with an update) or NULL when valid_end_date has the default value. No No
373 VOCABULARY vocabulary_id Yes varchar(20) A unique identifier for each Vocabulary, such as ICD9CM, SNOMED, Visit. Yes No
374 VOCABULARY vocabulary_name Yes varchar(255) The name describing the vocabulary, for example International Classification of Diseases, Ninth Revision, Clinical Modification, Volume 1 and 2 (NCHS) etc. No No
375 VOCABULARY vocabulary_reference Yes varchar(255) External reference to documentation or available download of the about the vocabulary. No No
376 VOCABULARY vocabulary_version No varchar(255) Version of the Vocabulary as indicated in the source. No No
377 VOCABULARY vocabulary_concept_id Yes integer A Concept that represents the Vocabulary the VOCABULARY record belongs to. No Yes CONCEPT CONCEPT_ID
378 DOMAIN domain_id Yes varchar(20) A unique key for each domain. Yes No
379 DOMAIN domain_name Yes varchar(255) The name describing the Domain, e.g. Condition, Procedure, Measurement etc. No No
380 DOMAIN domain_concept_id Yes integer A Concept representing the Domain Concept the DOMAIN record belongs to. No Yes CONCEPT CONCEPT_ID
381 CONCEPT_CLASS concept_class_id Yes varchar(20) A unique key for each class. Yes No
382 CONCEPT_CLASS concept_class_name Yes varchar(255) The name describing the Concept Class, e.g. Clinical Finding, Ingredient, etc. No No
383 CONCEPT_CLASS concept_class_concept_id Yes integer A Concept that represents the Concept Class. No Yes CONCEPT CONCEPT_ID
384 CONCEPT_RELATIONSHIP concept_id_1 Yes integer No Yes CONCEPT CONCEPT_ID
534
535
536
537
538
539
540
541
542
543

View File

@ -30,5 +30,4 @@ The default location is
downloadCurrentDdl("OHDSI/CommonDataModel",
pathToCsv="Sql\%20Server/OMOP\%20CDM\%20sql\%20server\%20ddl.txt")
}
}

View File

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

View File

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/writeDDL.R
% Please edit documentation in R/writeDdl.R
\name{writeDdl}
\alias{writeDdl}
\alias{writePrimaryKeys}

View File

@ -1,21 +0,0 @@
# Download the JDBC drivers used in the tests
# oldJarFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
driverPath <- file.path(Sys.getenv("HOME"), "drivers")
if(!dir.exists(driverPath)) dir.create(driverPath)
Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = driverPath)
DatabaseConnector::downloadJdbcDrivers("postgresql", pathToDriver = driverPath)
print(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"))
print(list.files(driverPath))
# if(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER") == "") {
# driverPath <- file.path(Sys.getenv("HOME"), "drivers")
# }
# downloadJdbcDrivers("sql server")
# downloadJdbcDrivers("oracle")
# withr::defer({
# unlink(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"), recursive = TRUE, force = TRUE)
# Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = oldJarFolder)
# }, testthat::teardown_env())

113
tests/testthat/setup.R Normal file
View File

@ -0,0 +1,113 @@
# Download the JDBC drivers used in the tests
library(DatabaseConnector)
driverPath <- file.path(Sys.getenv("HOME"), "drivers")
if(!dir.exists(driverPath)) dir.create(driverPath)
if(Sys.getenv("LOCAL_TEST") != "TRUE") {
cat("\ndownloading drivers\n")
downloadJdbcDrivers("redshift", pathToDriver = driverPath)
downloadJdbcDrivers("postgresql", pathToDriver = driverPath)
downloadJdbcDrivers("oracle", pathToDriver = driverPath)
downloadJdbcDrivers("sql server", pathToDriver = driverPath)
}
# Helper functions used in tests -----------------------------------------------
getConnectionDetails <- function(dbms) {
switch (dbms,
"postgresql" = createConnectionDetails(
dbms = "postgresql",
user = Sys.getenv("CDMDDLBASE_POSTGRESQL_USER"),
password = Sys.getenv("CDMDDLBASE_POSTGRESQL_PASSWORD"),
server = Sys.getenv("CDMDDLBASE_POSTGRESQL_SERVER"),
pathToDriver = file.path(Sys.getenv("HOME"), "drivers")
),
"redshift" = createConnectionDetails(
dbms = "redshift",
user = Sys.getenv("CDMDDLBASE_REDSHIFT_USER"),
password = Sys.getenv("CDMDDLBASE_REDSHIFT_PASSWORD"),
server = Sys.getenv("CDMDDLBASE_REDSHIFT_SERVER"),
pathToDriver = file.path(Sys.getenv("HOME"), "drivers")
),
"sql server" = createConnectionDetails(
dbms = "sql server",
user = Sys.getenv("CDMDDLBASE_SQL_SERVER_USER"),
password = Sys.getenv("CDMDDLBASE_SQL_SERVER_PASSWORD"),
server = Sys.getenv("CDMDDLBASE_SQL_SERVER_SERVER"),
pathToDriver = file.path(Sys.getenv("HOME"), "drivers")
),
"oracle" = createConnectionDetails(
dbms = "oracle",
user = Sys.getenv("CDMDDLBASE_ORACLE_USER"),
password = Sys.getenv("CDMDDLBASE_ORACLE_PASSWORD"),
server = Sys.getenv("CDMDDLBASE_ORACLE_SERVER"),
pathToDriver = file.path(Sys.getenv("HOME"), "drivers")
)
)
}
getSchema <- function(dbms) {
switch (dbms,
"postgresql" = Sys.getenv("CDMDDLBASE_POSTGRESQL_SCHEMA"),
"redshift" = Sys.getenv("CDMDDLBASE_REDSHIFT_SCHEMA"),
"sql server" = Sys.getenv("CDMDDLBASE_SQL_SERVER_CDM_SCHEMA"),
"oracle" = Sys.getenv("CDMDDLBASE_ORACLE_CDM_SCHEMA")
)
}
listTablesInSchema <- function(connectionDetails, schema) {
stopifnot(class(connectionDetails) == "connectionDetails", class(schema) == "character", length(schema) == 1)
stopifnot(connectionDetails$dbms %in% c("postgresql", "redshift", "sql server", "oracle"))
con <- DatabaseConnector::connect(connectionDetails)
on.exit(DatabaseConnector::disconnect(con))
dbms <- connectionDetails$dbms
if(dbms %in% c("postgresql", "redshift", "sql server")) {
tables <- dbGetQuery(con, paste0("select table_name from information_schema.tables where table_schema = '", schema, "'"))[[1]]
} else if(dbms == "oracle") {
query <- paste0("select table_name from all_tables where owner = '", toupper(schema), "' and tablespace_name = 'USERS'")
tables <- dbGetQuery(con, query)[[1]]
}
return(tables)
}
dropAllTablesFromSchema <- function(connectionDetails, schema) {
stopifnot(class(connectionDetails) == "connectionDetails", class(schema) == "character", length(schema) == 1)
stopifnot(connectionDetails$dbms %in% c("postgresql", "redshift", "sql server", "oracle"))
tables <- listTablesInSchema(connectionDetails, schema)
con <- DatabaseConnector::connect(connectionDetails)
on.exit(DatabaseConnector::disconnect(con))
dbms <- connectionDetails$dbms
if(dbms %in% c("redshift", "postgresql", "sql server")) {
for(table in tables) {
DBI::dbRemoveTable(con, name = DBI::SQL(paste(schema, table, sep = ".")))
}
} else if(dbms == "oracle") {
for(table in tables) {
DBI::dbRemoveTable(con, name = table)
}
}
}
# .removeConstraintsPostgresql <- function(connectionDetails, schema) {
# # the order of removal of constraints matters!
# con <- DatabaseConnector::connect(connectionDetails)
# constraints <- DBI::dbGetQuery(con,
# "SELECT con.conname, rel.relname as relname
# FROM pg_catalog.pg_constraint con
# INNER JOIN pg_catalog.pg_class rel
# ON rel.oid = con.conrelid
# INNER JOIN pg_catalog.pg_namespace nsp
# ON nsp.oid = connamespace
# WHERE nsp.nspname = 'cdmddlbase';")
#
#
# constraints <- dplyr::mutate(constraints, sql = paste0("alter table ", schema, ".", relname, " drop constraint if exists ", conname, ";\n" ))
#
# sql <- paste(rev(constraints$sql), collapse = "")
# executeSql(con, sql)
#
# disconnect(con)
#
# }

View File

@ -1,84 +1,51 @@
library(DatabaseConnector)
# To run tests for one dbms and one cdmVersion use the variables below
# dbms <- "postgresql"; cdmVersion <- "5.4"
connectionDetails <- createConnectionDetails(
dbms = "postgresql",
user = Sys.getenv("CDMDDLBASE_POSTGRESQL_USER"),
password = Sys.getenv("CDMDDLBASE_POSTGRESQL_PASSWORD"),
server = Sys.getenv("CDMDDLBASE_POSTGRESQL_SERVER"),
pathToDriver = file.path(Sys.getenv("HOME"), "drivers")
)
testDatabases <- c("oracle", "postgresql", "sql server", "redshift")
# testDatabases <- c("redshift")
# Helper functions used in tests
.listTablesInSchema <- function(connectionDetails, schema) {
con <- DatabaseConnector::connect(connectionDetails)
tables <- DBI::dbListObjects(con, prefix = "cdmddlbase")
DatabaseConnector::disconnect(con)
tables <- subset(tables, is_prefix == FALSE)
tables <- subset(tables, grepl("table", table))$table
tables <- vapply(tables, function(.) .@name, FUN.VALUE = character(1))
return(tables)
}
.dropAllTablesFromSchema <- function(connectionDetails, schema) {
tables <- .listTablesInSchema(connectionDetails, schema)
con <- DatabaseConnector::connect(connectionDetails)
for(table in tables) {
DBI::dbRemoveTable(con, name = DBI::SQL(paste(schema, table, sep = ".")))
test_that("getConnectionDetails works", {
for(dbms in testDatabases) {
expect_s3_class(getConnectionDetails(dbms), "connectionDetails")
}
DatabaseConnector::disconnect(con)
}
.removeConstraintsPostgresql <- function(connectionDetails, schema) {
# the order of removal of constraints matters!
con <- DatabaseConnector::connect(connectionDetails)
constraints <- DBI::dbGetQuery(con,
"SELECT con.conname, rel.relname as relname
FROM pg_catalog.pg_constraint con
INNER JOIN pg_catalog.pg_class rel
ON rel.oid = con.conrelid
INNER JOIN pg_catalog.pg_namespace nsp
ON nsp.oid = connamespace
WHERE nsp.nspname = 'cdmddlbase';")
constraints <- dplyr::mutate(constraints, sql = paste0("alter table ", schema, ".", relname, " drop constraint if exists ", conname, ";\n" ))
sql <- paste(rev(constraints$sql), collapse = "")
executeSql(con, sql)
disconnect(con)
}
test_that("Database can be connected to", {
expect_error(con <- connect(connectionDetails), NA)
disconnect(con)
})
test_that("Execute DDL on Postgres", {
# make sure the schema is cleared out
cdmDatabaseSchema <- Sys.getenv("CDMDDLBASE_POSTGRESQL_SCHEMA")
cdmVersion <- "5.4"
# .removeConstraintsPostgresql(connectionDetails, cdmDatabaseSchema)
.dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema)
cat(paste("Connecting to schema", cdmDatabaseSchema, "\n"))
executeDdl(connectionDetails,
cdmVersion = cdmVersion,
cdmDatabaseSchema = cdmDatabaseSchema,
executeDdl = TRUE,
executePrimaryKey = FALSE,
executeForeignKey = FALSE)
tables <- .listTablesInSchema(connectionDetails, schema = cdmDatabaseSchema)
cdmTableCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Table_Level.csv")), package = "CommonDataModel", mustWork = TRUE)
tableSpecs <- read.csv(cdmTableCsvLoc, stringsAsFactors = FALSE)$cdmTableName
# check that the tables in the database match the tables in the specification
expect_equal(sort(tables), sort(tableSpecs))
# clear schema
# .removeConstraintsPostgresql(connectionDetails, cdmDatabaseSchema)
.dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema)
test_that("getSchema works", {
for(dbms in testDatabases) {
expect_type(getSchema(dbms), "character")
}
})
for(dbms in testDatabases) {
connectionDetails <- getConnectionDetails(dbms)
cdmDatabaseSchema <- getSchema(dbms)
test_that(paste("Can connect to", dbms), {
expect_error(con <- connect(connectionDetails), NA)
expect_error(disconnect(con), NA)
})
for(cdmVersion in listSupportedVersions()) {
test_that(paste("DDL", cdmVersion, "runs on", dbms), {
dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema)
tables <- listTablesInSchema(connectionDetails, cdmDatabaseSchema)
expect_equal(tables, character(0))
executeDdl(connectionDetails,
cdmVersion = cdmVersion,
cdmDatabaseSchema = cdmDatabaseSchema,
executeDdl = TRUE,
executePrimaryKey = TRUE,
executeForeignKey = FALSE)
tables <- listTablesInSchema(connectionDetails, cdmDatabaseSchema)
cdmTableCsvLoc <- system.file(file.path("csv", paste0("OMOP_CDMv", cdmVersion, "_Table_Level.csv")), package = "CommonDataModel", mustWork = TRUE)
tableSpecs <- read.csv(cdmTableCsvLoc, stringsAsFactors = FALSE)$cdmTableName
# check that the tables in the database match the tables in the specification
expect_equal(sort(tolower(tables)), sort(tolower(tableSpecs)))
dropAllTablesFromSchema(connectionDetails, cdmDatabaseSchema)
})
}
}