OMOP/PostgreSQL/OMOP CDM ddl - PostgreSQL.sql

736 lines
20 KiB
MySQL
Raw Normal View History

2014-10-14 20:35:46 +00:00
/*********************************************************************************
# Copyright 2014-6 Observational Health Data Sciences and Informatics
2014-10-14 20:35:46 +00:00
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
********************************************************************************/
/************************
####### # # ####### ###### ##### ###### # # ####### #####
# # ## ## # # # # # # # # ## ## # # # # #
# # # # # # # # # # # # # # # # # # # # #
# # # # # # # ###### # # # # # # # # ###### #####
# # # # # # # # # # # # # # # ### #
# # # # # # # # # # # # # # # # # ### #
####### # # ####### # ##### ###### # # ## ##### ### #######
2014-10-14 20:35:46 +00:00
script to create OMOP common data model, version 5.2 for PostgreSQL database
2014-10-14 20:35:46 +00:00
last revised: 14 July 2017
2014-10-14 20:35:46 +00:00
Authors: Patrick Ryan, Christian Reich
2014-10-14 20:35:46 +00:00
*************************/
/************************
Standardized vocabulary
************************/
CREATE TABLE concept (
concept_id INTEGER NOT NULL,
2017-09-10 00:14:11 +00:00
concept_name VARCHAR(255) NOT NULL,
domain_id VARCHAR(20) NOT NULL,
2014-10-14 20:35:46 +00:00
vocabulary_id VARCHAR(20) NOT NULL,
concept_class_id VARCHAR(20) NOT NULL,
standard_concept VARCHAR(1) NULL,
concept_code VARCHAR(50) NOT NULL,
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL
)
;
CREATE TABLE vocabulary (
vocabulary_id VARCHAR(20) NOT NULL,
2017-09-10 00:14:11 +00:00
vocabulary_name VARCHAR(255) NOT NULL,
vocabulary_reference VARCHAR(255) NULL,
vocabulary_version VARCHAR(255) NULL,
vocabulary_concept_id INTEGER NOT NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE domain (
domain_id VARCHAR(20) NOT NULL,
2017-09-10 00:14:11 +00:00
domain_name VARCHAR(255) NOT NULL,
domain_concept_id INTEGER NOT NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE concept_class (
2017-09-10 00:14:11 +00:00
concept_class_id VARCHAR(20) NOT NULL,
concept_class_name VARCHAR(255) NOT NULL,
2014-10-14 20:35:46 +00:00
concept_class_concept_id INTEGER NOT NULL
)
;
CREATE TABLE concept_relationship (
concept_id_1 INTEGER NOT NULL,
concept_id_2 INTEGER NOT NULL,
relationship_id VARCHAR(20) NOT NULL,
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL)
;
CREATE TABLE relationship (
2017-09-10 00:14:11 +00:00
relationship_id VARCHAR(20) NOT NULL,
relationship_name VARCHAR(255) NOT NULL,
is_hierarchical VARCHAR(1) NOT NULL,
defines_ancestry VARCHAR(1) NOT NULL,
2014-10-14 20:35:46 +00:00
reverse_relationship_id VARCHAR(20) NOT NULL,
relationship_concept_id INTEGER NOT NULL
)
;
CREATE TABLE concept_synonym (
concept_id INTEGER NOT NULL,
2017-09-10 00:14:11 +00:00
concept_synonym_name VARCHAR(1000) NOT NULL,
language_concept_id INTEGER NOT NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE concept_ancestor (
2017-09-10 00:14:11 +00:00
ancestor_concept_id INTEGER NOT NULL,
descendant_concept_id INTEGER NOT NULL,
min_levels_of_separation INTEGER NOT NULL,
max_levels_of_separation INTEGER NOT NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE source_to_concept_map (
2017-09-10 00:14:11 +00:00
source_code VARCHAR(50) NOT NULL,
source_concept_id INTEGER NOT NULL,
2014-10-14 20:35:46 +00:00
source_vocabulary_id VARCHAR(20) NOT NULL,
2017-09-10 00:14:11 +00:00
source_code_description VARCHAR(255) NULL,
target_concept_id INTEGER NOT NULL,
2014-10-14 20:35:46 +00:00
target_vocabulary_id VARCHAR(20) NOT NULL,
2017-09-10 00:14:11 +00:00
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE drug_strength (
2017-09-10 00:14:11 +00:00
drug_concept_id INTEGER NOT NULL,
ingredient_concept_id INTEGER NOT NULL,
amount_value NUMERIC NULL,
amount_unit_concept_id INTEGER NULL,
numerator_value NUMERIC NULL,
numerator_unit_concept_id INTEGER NULL,
denominator_value NUMERIC NULL,
2014-10-14 20:35:46 +00:00
denominator_unit_concept_id INTEGER NULL,
2017-09-10 00:14:11 +00:00
box_size INTEGER NULL,
valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE cohort_definition (
2017-09-10 00:14:11 +00:00
cohort_definition_id INTEGER NOT NULL,
cohort_definition_name VARCHAR(255) NOT NULL,
cohort_definition_description TEXT NULL,
2014-10-14 20:35:46 +00:00
definition_type_concept_id INTEGER NOT NULL,
2017-09-10 00:14:11 +00:00
cohort_definition_syntax TEXT NULL,
subject_concept_id INTEGER NOT NULL,
cohort_initiation_date DATE NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE attribute_definition (
attribute_definition_id INTEGER NOT NULL,
2017-09-10 00:14:11 +00:00
attribute_name VARCHAR(255) NOT NULL,
attribute_description TEXT NULL,
2014-10-14 20:35:46 +00:00
attribute_type_concept_id INTEGER NOT NULL,
2017-09-10 00:14:11 +00:00
attribute_syntax TEXT NULL
2014-10-14 20:35:46 +00:00
)
;
/**************************
Standardized meta-data
***************************/
CREATE TABLE cdm_source
(
2017-09-10 00:14:11 +00:00
cdm_source_name VARCHAR(255) NOT NULL,
2014-10-14 20:35:46 +00:00
cdm_source_abbreviation VARCHAR(25) NULL,
2017-09-10 00:14:11 +00:00
cdm_holder VARCHAR(255) NULL,
source_description TEXT NULL,
source_documentation_reference VARCHAR(255) NULL,
cdm_etl_reference VARCHAR(255) NULL,
2014-10-14 20:35:46 +00:00
source_release_date DATE NULL,
2017-09-10 00:14:11 +00:00
cdm_release_date DATE NULL,
cdm_version VARCHAR(10) NULL,
vocabulary_version VARCHAR(20) NULL
2014-10-14 20:35:46 +00:00
)
;
/************************
Standardized clinical data
************************/
CREATE TABLE person
(
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
gender_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL,
birth_datetime TIMESTAMP NULL,
2014-10-14 20:35:46 +00:00
race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL,
2017-09-10 00:14:11 +00:00
location_id INTEGER NULL,
provider_id INTEGER NULL,
care_site_id INTEGER NULL,
person_source_value VARCHAR(50) NULL,
gender_source_value VARCHAR(50) NULL,
gender_source_concept_id INTEGER NULL,
race_source_value VARCHAR(50) NULL,
race_source_concept_id INTEGER NULL,
ethnicity_source_value VARCHAR(50) NULL,
ethnicity_source_concept_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE observation_period
(
2017-09-10 00:14:11 +00:00
observation_period_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
observation_period_start_date DATE NOT NULL ,
2017-09-10 00:14:11 +00:00
observation_period_start_datetime TIMESTAMP NOT NULL ,
2014-10-14 20:35:46 +00:00
observation_period_end_date DATE NOT NULL ,
2017-09-10 00:14:11 +00:00
observation_period_end_datetime TIMESTAMP NOT NULL ,
period_type_concept_id INTEGER NOT NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE specimen
(
2017-09-10 00:14:11 +00:00
specimen_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
specimen_date DATE NOT NULL ,
specimen_datetime TIMESTAMP NULL ,
quantity NUMERIC NULL ,
unit_concept_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
anatomic_site_concept_id INTEGER NULL ,
disease_status_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
specimen_source_id VARCHAR(50) NULL ,
2014-10-14 20:35:46 +00:00
specimen_source_value VARCHAR(50) NULL ,
2017-09-10 00:14:11 +00:00
unit_source_value VARCHAR(50) NULL ,
2014-10-14 20:35:46 +00:00
anatomic_site_source_value VARCHAR(50) NULL ,
2017-09-10 00:14:11 +00:00
disease_status_source_value VARCHAR(50) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE death
(
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
death_date DATE NOT NULL ,
death_datetime TIMESTAMP NULL ,
death_type_concept_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL,
cause_source_concept_id INTEGER NULL
)
;
CREATE TABLE visit_occurrence
(
visit_occurrence_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
visit_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
visit_start_date DATE NOT NULL ,
visit_start_datetime TIMESTAMP NULL ,
visit_end_date DATE NOT NULL ,
visit_end_datetime TIMESTAMP NULL ,
visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL,
care_site_id INTEGER NULL,
2014-10-14 20:35:46 +00:00
visit_source_value VARCHAR(50) NULL,
2017-09-10 00:14:11 +00:00
visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
2017-09-10 00:14:11 +00:00
CREATE TABLE visit_detail
(
visit_detail_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL ,
visit_start_datetime TIMESTAMP NULL ,
visit_end_date DATE NOT NULL ,
visit_end_datetime TIMESTAMP NULL ,
visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL,
care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_detail_id INTEGER NULL ,
visit_detail_parent_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL
)
;
2014-10-14 20:35:46 +00:00
CREATE TABLE procedure_occurrence
(
procedure_occurrence_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL ,
procedure_datetime TIMESTAMP NOT NULL ,
2014-10-14 20:35:46 +00:00
procedure_type_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
procedure_source_value VARCHAR(50) NULL ,
procedure_source_concept_id INTEGER NULL ,
qualifier_source_value VARCHAR(50) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE drug_exposure
(
2017-09-10 00:14:11 +00:00
drug_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime TIMESTAMP NOT NULL ,
2017-09-10 00:14:11 +00:00
drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime TIMESTAMP NULL ,
2017-09-10 00:14:11 +00:00
verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL ,
refills INTEGER NULL ,
quantity NUMERIC NULL ,
days_supply INTEGER NULL ,
sig TEXT NULL ,
route_concept_id INTEGER NULL ,
lot_number VARCHAR(50) NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
drug_source_value VARCHAR(50) NULL ,
drug_source_concept_id INTEGER NULL ,
route_source_value VARCHAR(50) NULL ,
dose_unit_source_value VARCHAR(50) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE device_exposure
(
device_exposure_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
device_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime TIMESTAMP NOT NULL ,
device_exposure_end_date DATE NULL ,
device_exposure_end_datetime TIMESTAMP NULL ,
device_type_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL ,
provider_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
visit_occurrence_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
visit_detail_id INTEGER NULL ,
device_source_value VARCHAR(100) NULL ,
device_source_concept_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE condition_occurrence
(
condition_occurrence_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL ,
condition_start_datetime TIMESTAMP NOT NULL ,
condition_end_date DATE NULL ,
condition_end_datetime TIMESTAMP NULL ,
condition_type_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL ,
condition_source_value VARCHAR(50) NULL ,
condition_source_concept_id INTEGER NULL ,
condition_status_source_value VARCHAR(50) NULL ,
2017-07-14 17:12:23 +00:00
condition_status_concept_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE measurement
(
2017-09-10 00:14:11 +00:00
measurement_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL ,
2017-09-10 00:14:11 +00:00
measurement_datetime TIMESTAMP NULL ,
measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
value_as_number NUMERIC NULL ,
value_as_concept_id INTEGER NULL ,
unit_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
range_low NUMERIC NULL ,
range_high NUMERIC NULL ,
provider_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
visit_occurrence_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
visit_detail_id INTEGER NULL ,
measurement_source_value VARCHAR(50) NULL ,
measurement_source_concept_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
unit_source_value VARCHAR(50) NULL ,
2017-09-10 00:14:11 +00:00
value_source_value VARCHAR(50) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE note
(
2017-09-10 00:14:11 +00:00
note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
note_date DATE NOT NULL ,
note_datetime TIMESTAMP NULL ,
note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL ,
note_text TEXT NOT NULL ,
encoding_concept_id INTEGER NOT NULL ,
language_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL ,
note_source_value VARCHAR(50) NULL ,
visit_detail_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
2017-07-14 19:44:35 +00:00
/*This table is new in CDM v5.2*/
CREATE TABLE note_nlp
(
note_nlp_id BIGINT NOT NULL ,
2017-09-10 00:14:11 +00:00
note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL ,
"offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL ,
2017-07-14 19:44:35 +00:00
nlp_datetime TIMESTAMP NULL ,
term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL ,
2017-09-10 00:14:11 +00:00
term_modifiers VARCHAR(2000) NULL
2017-07-14 19:44:35 +00:00
)
;
2014-10-14 20:35:46 +00:00
CREATE TABLE observation
(
2017-09-10 00:14:11 +00:00
observation_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL ,
2017-09-10 00:14:11 +00:00
observation_datetime TIMESTAMP NULL ,
observation_type_concept_id INTEGER NOT NULL ,
value_as_number NUMERIC NULL ,
2014-10-14 20:35:46 +00:00
value_as_string VARCHAR(60) NULL ,
value_as_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
qualifier_concept_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
unit_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
provider_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
visit_occurrence_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
visit_detail_id INTEGER NULL ,
observation_source_value VARCHAR(50) NULL ,
observation_source_concept_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
unit_source_value VARCHAR(50) NULL ,
2017-09-10 00:14:11 +00:00
qualifier_source_value VARCHAR(50) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE fact_relationship
(
domain_concept_id_1 INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
fact_id_1 INTEGER NOT NULL ,
domain_concept_id_2 INTEGER NOT NULL ,
fact_id_2 INTEGER NOT NULL ,
relationship_concept_id INTEGER NOT NULL
2014-10-14 20:35:46 +00:00
)
;
/************************
Standardized health system data
************************/
CREATE TABLE location
(
2017-09-10 00:14:11 +00:00
location_id INTEGER NOT NULL ,
address_1 VARCHAR(50) NULL ,
address_2 VARCHAR(50) NULL ,
city VARCHAR(50) NULL ,
state VARCHAR(2) NULL ,
zip VARCHAR(9) NULL ,
county VARCHAR(20) NULL ,
2014-10-14 20:35:46 +00:00
location_source_value VARCHAR(50) NULL
)
;
CREATE TABLE care_site
(
2017-09-10 00:14:11 +00:00
care_site_id INTEGER NOT NULL ,
care_site_name VARCHAR(255) NULL ,
2014-10-14 20:35:46 +00:00
place_of_service_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
location_id INTEGER NULL ,
care_site_source_value VARCHAR(50) NULL ,
2014-10-14 20:35:46 +00:00
place_of_service_source_value VARCHAR(50) NULL
)
;
CREATE TABLE provider
(
2017-09-10 00:14:11 +00:00
provider_id INTEGER NOT NULL ,
provider_name VARCHAR(255) NULL ,
NPI VARCHAR(20) NULL ,
DEA VARCHAR(20) NULL ,
2014-10-14 20:35:46 +00:00
specialty_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
care_site_id INTEGER NULL ,
year_of_birth INTEGER NULL ,
gender_concept_id INTEGER NULL ,
2014-10-14 20:35:46 +00:00
provider_source_value VARCHAR(50) NULL ,
specialty_source_value VARCHAR(50) NULL ,
2017-09-10 00:14:11 +00:00
specialty_source_concept_id INTEGER NULL ,
gender_source_value VARCHAR(50) NULL ,
gender_source_concept_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
/************************
Standardized health economics
************************/
CREATE TABLE payer_plan_period
(
payer_plan_period_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
payer_plan_period_start_date DATE NOT NULL ,
payer_plan_period_end_date DATE NOT NULL ,
payer_source_value VARCHAR (50) NULL ,
plan_source_value VARCHAR (50) NULL ,
family_source_value VARCHAR (50) NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE cost
(
2017-09-10 00:14:11 +00:00
cost_id INTEGER NOT NULL ,
cost_event_id INTEGER NOT NULL ,
cost_domain_id VARCHAR(20) NOT NULL ,
cost_type_concept_id INTEGER NOT NULL ,
currency_concept_id INTEGER NULL ,
total_charge NUMERIC NULL ,
total_cost NUMERIC NULL ,
total_paid NUMERIC NULL ,
paid_by_payer NUMERIC NULL ,
paid_by_patient NUMERIC NULL ,
paid_patient_copay NUMERIC NULL ,
paid_patient_coinsurance NUMERIC NULL ,
paid_patient_deductible NUMERIC NULL ,
paid_by_primary NUMERIC NULL ,
paid_ingredient_cost NUMERIC NULL ,
paid_dispensing_fee NUMERIC NULL ,
payer_plan_period_id INTEGER NULL ,
amount_allowed NUMERIC NULL ,
revenue_code_concept_id INTEGER NULL ,
2017-09-10 00:14:11 +00:00
revenue_code_source_value VARCHAR(50) NULL ,
drg_concept_id INTEGER NULL,
drg_source_value VARCHAR(3) NULL
)
;
2014-10-14 20:35:46 +00:00
/************************
Standardized derived elements
************************/
CREATE TABLE cohort
(
2017-09-10 00:14:11 +00:00
cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL ,
2014-10-14 20:35:46 +00:00
cohort_end_date DATE NOT NULL
)
;
CREATE TABLE cohort_attribute
(
2017-09-10 00:14:11 +00:00
cohort_definition_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL ,
2017-09-10 00:14:11 +00:00
subject_id INTEGER NOT NULL ,
attribute_definition_id INTEGER NOT NULL ,
value_as_number NUMERIC NULL ,
value_as_concept_id INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE drug_era
(
2017-09-10 00:14:11 +00:00
drug_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
drug_concept_id INTEGER NOT NULL ,
drug_era_start_date DATE NOT NULL ,
drug_era_end_date DATE NOT NULL ,
drug_exposure_count INTEGER NULL ,
2017-09-10 00:14:11 +00:00
gap_days INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;
CREATE TABLE dose_era
(
2017-09-10 00:14:11 +00:00
dose_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
drug_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
unit_concept_id INTEGER NOT NULL ,
dose_value NUMERIC NOT NULL ,
2014-10-14 20:35:46 +00:00
dose_era_start_date DATE NOT NULL ,
dose_era_end_date DATE NOT NULL
)
;
CREATE TABLE condition_era
(
condition_era_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
person_id INTEGER NOT NULL ,
2014-10-14 20:35:46 +00:00
condition_concept_id INTEGER NOT NULL ,
2017-09-10 00:14:11 +00:00
condition_era_start_date DATE NOT NULL ,
2014-10-14 20:35:46 +00:00
condition_era_end_date DATE NOT NULL ,
2017-09-10 00:14:11 +00:00
condition_occurrence_count INTEGER NULL
2014-10-14 20:35:46 +00:00
)
;