2018-01-03 19:56:42 +00:00
/*********************************************************************************
2018-08-31 01:00:34 +00:00
# Copyright 2018-08 Observational Health Data Sciences and Informatics
2018-01-03 19:56:42 +00:00
#
#
2018-08-31 01:00:34 +00:00
# Licensed under the Apache License, Version 2.0 (the "License");
2018-01-03 19:56:42 +00:00
# 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.
********************************************************************************/
/************************
2018-08-31 01:00:34 +00:00
####### # # ####### ###### ##### ###### # # ##### ###
# # ## ## # # # # # # # # ## ## # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # ###### # # # # # # # # ###### # #
# # # # # # # # # # # # # # # # ### # #
# # # # # # # # # # # # # # # # # ### # #
####### # # ####### # ##### ###### # # ## ##### ### ###
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
impala script to create OMOP common data model version 6.0
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
last revised: 27-Aug-2018
2018-01-03 19:56:42 +00:00
Authors: Patrick Ryan, Christian Reich, Clair Blacketer
*************************/
/************************
Standardized vocabulary
************************/
CREATE TABLE concept (
2018-09-24 16:00:16 +00:00
concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
concept_name VARCHAR(255) ,
2018-09-24 16:00:16 +00:00
domain_id VARCHAR(20) ,
2018-08-31 01:00:34 +00:00
vocabulary_id VARCHAR(20) ,
2018-09-24 16:00:16 +00:00
concept_class_id VARCHAR(20) ,
standard_concept VARCHAR(1) ,
2018-08-31 01:00:34 +00:00
concept_code VARCHAR(50) ,
2018-09-24 16:00:16 +00:00
valid_start_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
valid_end_date TIMESTAMP ,
invalid_reason VARCHAR(1)
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE vocabulary (
2018-09-24 16:00:16 +00:00
vocabulary_id VARCHAR(20),
vocabulary_name VARCHAR(255),
2018-08-31 01:00:34 +00:00
vocabulary_reference VARCHAR(255),
2018-09-24 16:00:16 +00:00
vocabulary_version VARCHAR(255),
2018-08-31 01:00:34 +00:00
vocabulary_concept_id INTEGER
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE domain (
2018-08-31 01:00:34 +00:00
domain_id VARCHAR(20),
domain_name VARCHAR(255),
2018-09-24 16:00:16 +00:00
domain_concept_id INTEGER
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE concept_class (
2018-08-31 01:00:34 +00:00
concept_class_id VARCHAR(20),
concept_class_name VARCHAR(255),
2018-09-24 16:00:16 +00:00
concept_class_concept_id INTEGER
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE concept_relationship (
2018-08-31 01:00:34 +00:00
concept_id_1 INTEGER ,
concept_id_2 INTEGER ,
relationship_id VARCHAR(20),
2018-09-24 16:00:16 +00:00
valid_start_date TIMESTAMP,
2018-08-31 01:00:34 +00:00
valid_end_date TIMESTAMP,
invalid_reason VARCHAR(1)
)
2018-01-03 19:56:42 +00:00
;
CREATE TABLE relationship (
2018-09-24 16:00:16 +00:00
relationship_id VARCHAR(20),
relationship_name VARCHAR(255),
is_hierarchical VARCHAR(1),
defines_ancestry VARCHAR(1),
2018-08-31 01:00:34 +00:00
reverse_relationship_id VARCHAR(20),
relationship_concept_id INTEGER
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE concept_synonym (
2018-09-24 16:00:16 +00:00
concept_id INTEGER ,
concept_synonym_name STRING,
2018-08-31 01:00:34 +00:00
language_concept_id INTEGER
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE concept_ancestor (
2018-09-24 16:00:16 +00:00
ancestor_concept_id INTEGER ,
descendant_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
min_levels_of_separation INTEGER ,
max_levels_of_separation INTEGER
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE source_to_concept_map (
2018-09-24 16:00:16 +00:00
source_code VARCHAR(50),
source_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
source_vocabulary_id VARCHAR(20),
source_code_description VARCHAR(255),
2018-09-24 16:00:16 +00:00
target_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
target_vocabulary_id VARCHAR(20),
2018-09-24 16:00:16 +00:00
valid_start_date TIMESTAMP,
valid_end_date TIMESTAMP,
invalid_reason VARCHAR(1)
2018-01-03 19:56:42 +00:00
)
;
CREATE TABLE drug_strength (
2018-09-24 16:00:16 +00:00
drug_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
ingredient_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
amount_value FLOAT,
2018-08-31 01:00:34 +00:00
amount_unit_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
numerator_value FLOAT,
numerator_unit_concept_id INTEGER ,
denominator_value FLOAT,
denominator_unit_concept_id INTEGER ,
box_size INTEGER ,
valid_start_date TIMESTAMP,
valid_end_date TIMESTAMP,
invalid_reason VARCHAR(1)
2018-01-03 19:56:42 +00:00
)
;
/**************************
Standardized meta-data
***************************/
CREATE TABLE cdm_source
(
2018-09-24 16:00:16 +00:00
cdm_source_name VARCHAR(255) ,
2018-08-31 01:00:34 +00:00
cdm_source_abbreviation VARCHAR(25) ,
2018-09-24 16:00:16 +00:00
cdm_holder VARCHAR(255) ,
source_description STRING ,
source_documentation_reference VARCHAR(255) ,
cdm_etl_reference VARCHAR(255) ,
source_release_date TIMESTAMP ,
cdm_release_date TIMESTAMP ,
cdm_version VARCHAR(10) ,
vocabulary_version VARCHAR(20)
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE `metadata`
(
metadata_concept_id INTEGER ,
metadata_type_concept_id INTEGER ,
name VARCHAR(250) ,
value_as_string STRING ,
value_as_concept_id INTEGER ,
metadata_date TIMESTAMP ,
metadata_datetime TIMESTAMP
)
;
2018-01-03 19:56:42 +00:00
2018-09-24 16:00:16 +00:00
INSERT INTO `metadata` (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record
VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL)
2018-08-31 01:00:34 +00:00
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
/************************
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
Standardized clinical data
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
************************/
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE person
(
2018-09-25 16:40:53 +00:00
person_id BIGINT ,
2018-08-31 01:00:34 +00:00
gender_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
year_of_birth INTEGER ,
month_of_birth INTEGER ,
day_of_birth INTEGER ,
birth_datetime TIMESTAMP ,
2018-09-27 15:46:34 +00:00
death_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
race_concept_id INTEGER ,
ethnicity_concept_id INTEGER ,
location_id BIGINT ,
provider_id BIGINT ,
care_site_id BIGINT ,
2018-08-31 01:00:34 +00:00
person_source_value VARCHAR(50),
gender_source_value VARCHAR(50),
2018-09-24 16:00:16 +00:00
gender_source_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
race_source_value VARCHAR(50),
2018-09-24 16:00:16 +00:00
race_source_concept_id INTEGER ,
ethnicity_source_value VARCHAR(50),
ethnicity_source_concept_id INTEGER
2018-08-31 01:00:34 +00:00
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation_period
(
2018-09-24 16:00:16 +00:00
observation_period_id BIGINT ,
person_id BIGINT ,
2018-08-31 01:00:34 +00:00
observation_period_start_date TIMESTAMP ,
2018-09-24 16:00:16 +00:00
observation_period_end_date TIMESTAMP ,
period_type_concept_id INTEGER
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE specimen
(
2018-09-24 16:00:16 +00:00
specimen_id BIGINT ,
person_id BIGINT ,
specimen_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
specimen_type_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
specimen_date TIMESTAMP ,
specimen_datetime TIMESTAMP ,
quantity FLOAT ,
unit_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
anatomic_site_concept_id INTEGER ,
disease_status_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
specimen_source_id VARCHAR(50) ,
specimen_source_value VARCHAR(50) ,
unit_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
anatomic_site_source_value VARCHAR(50) ,
2018-09-24 16:00:16 +00:00
disease_status_source_value VARCHAR(50)
2018-01-03 19:56:42 +00:00
)
;
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_occurrence
(
2018-09-24 16:00:16 +00:00
visit_occurrence_id BIGINT ,
person_id BIGINT ,
visit_concept_id INTEGER ,
visit_start_date TIMESTAMP ,
visit_start_datetime TIMESTAMP ,
visit_end_date TIMESTAMP ,
visit_end_datetime TIMESTAMP ,
visit_type_concept_id INTEGER ,
provider_id BIGINT ,
care_site_id BIGINT ,
visit_source_value VARCHAR(50),
visit_source_concept_id INTEGER ,
2018-09-25 16:40:53 +00:00
admitted_from_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
admitted_from_source_value VARCHAR(50),
2018-09-24 16:00:16 +00:00
discharge_to_source_value VARCHAR(50) ,
discharge_to_concept_id INTEGER ,
2018-10-26 14:27:19 +00:00
preceding_visit_occurrence_id BIGINT
2018-08-31 01:00:34 +00:00
)
;
2018-09-24 16:00:16 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_detail
(
visit_detail_id BIGINT ,
person_id BIGINT ,
visit_detail_concept_id INTEGER ,
visit_detail_start_date TIMESTAMP ,
visit_detail_start_datetime TIMESTAMP ,
visit_detail_end_date TIMESTAMP ,
visit_detail_end_datetime TIMESTAMP ,
visit_detail_type_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
provider_id BIGINT ,
care_site_id BIGINT ,
2018-08-31 01:00:34 +00:00
discharge_to_concept_id INTEGER ,
2018-09-25 16:40:53 +00:00
admitted_from_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
admitted_from_source_value VARCHAR(50) ,
visit_detail_source_value VARCHAR(50) ,
visit_detail_source_concept_id INTEGER ,
discharge_to_source_value VARCHAR(50) ,
preceding_visit_detail_id BIGINT ,
visit_detail_parent_id BIGINT ,
visit_occurrence_id BIGINT
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE procedure_occurrence
(
2018-09-24 16:00:16 +00:00
procedure_occurrence_id BIGINT ,
person_id BIGINT ,
procedure_concept_id INTEGER ,
procedure_date TIMESTAMP ,
procedure_datetime TIMESTAMP ,
2018-08-31 01:00:34 +00:00
procedure_type_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
modifier_concept_id INTEGER ,
quantity INTEGER ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
visit_detail_id BIGINT ,
procedure_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
procedure_source_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
modifier_source_value VARCHAR(50)
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_exposure
(
2018-09-24 16:00:16 +00:00
drug_exposure_id BIGINT ,
person_id BIGINT ,
drug_concept_id INTEGER ,
drug_exposure_start_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
drug_exposure_start_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
drug_exposure_end_date TIMESTAMP ,
drug_exposure_end_datetime TIMESTAMP ,
verbatim_end_date TIMESTAMP ,
drug_type_concept_id INTEGER ,
stop_reason VARCHAR(20) ,
refills INTEGER ,
quantity FLOAT ,
days_supply INTEGER ,
sig STRING ,
route_concept_id INTEGER ,
lot_number VARCHAR(50) ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
visit_detail_id BIGINT ,
drug_source_value VARCHAR(50) ,
drug_source_concept_id INTEGER ,
route_source_value VARCHAR(50) ,
dose_unit_source_value VARCHAR(50)
2018-08-31 01:00:34 +00:00
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE device_exposure
(
2018-09-24 16:00:16 +00:00
device_exposure_id BIGINT ,
person_id BIGINT ,
device_concept_id INTEGER ,
device_exposure_start_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
device_exposure_start_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
device_exposure_end_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
device_exposure_end_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
device_type_concept_id INTEGER ,
unique_device_id VARCHAR(50) ,
quantity INTEGER ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
visit_detail_id BIGINT ,
device_source_value VARCHAR(100) ,
device_source_concept_id INTEGER
2018-08-31 01:00:34 +00:00
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_occurrence
(
condition_occurrence_id BIGINT ,
2018-09-24 16:00:16 +00:00
person_id BIGINT ,
2018-08-31 01:00:34 +00:00
condition_concept_id INTEGER ,
condition_start_date TIMESTAMP ,
2018-09-24 16:00:16 +00:00
condition_start_datetime TIMESTAMP ,
condition_end_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
condition_end_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
condition_type_concept_id INTEGER ,
condition_status_concept_id INTEGER ,
stop_reason VARCHAR(20) ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
visit_detail_id BIGINT ,
2018-08-31 01:00:34 +00:00
condition_source_value VARCHAR(50) ,
2018-09-24 16:00:16 +00:00
condition_source_concept_id INTEGER ,
condition_status_source_value VARCHAR(50)
2018-08-31 01:00:34 +00:00
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE measurement
2018-01-03 19:56:42 +00:00
(
2018-09-24 16:00:16 +00:00
measurement_id BIGINT ,
person_id BIGINT ,
2018-08-31 01:00:34 +00:00
measurement_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
measurement_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
measurement_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
measurement_time VARCHAR(10),
measurement_type_concept_id INTEGER ,
operator_concept_id INTEGER ,
value_as_number FLOAT ,
value_as_concept_id INTEGER ,
unit_concept_id INTEGER ,
range_low FLOAT ,
range_high FLOAT ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
visit_detail_id BIGINT ,
measurement_source_value VARCHAR(50) ,
measurement_source_concept_id INTEGER ,
unit_source_value VARCHAR(50) ,
value_source_value VARCHAR(50)
2018-08-31 01:00:34 +00:00
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE note
(
2018-09-24 16:00:16 +00:00
note_id BIGINT ,
person_id BIGINT ,
note_event_id BIGINT ,
note_event_field_concept_id INTEGER ,
note_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
note_datetime TIMESTAMP ,
2018-09-24 16:00:16 +00:00
note_type_concept_id INTEGER ,
note_class_concept_id INTEGER ,
note_title VARCHAR(250) ,
note_text STRING ,
encoding_concept_id INTEGER ,
language_concept_id INTEGER ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
visit_detail_id BIGINT ,
note_source_value VARCHAR(50)
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE note_nlp
(
2018-09-24 16:00:16 +00:00
note_nlp_id BIGINT ,
note_id BIGINT ,
section_concept_id INTEGER ,
snippet VARCHAR(250) ,
`offset` VARCHAR(250) ,
lexical_variant VARCHAR(250) ,
note_nlp_concept_id INTEGER ,
nlp_system VARCHAR(250) ,
nlp_date TIMESTAMP ,
nlp_datetime TIMESTAMP ,
term_exists VARCHAR(1) ,
term_temporal VARCHAR(50) ,
term_modifiers VARCHAR(2000) ,
note_nlp_source_concept_id INTEGER
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation
(
2018-09-24 16:00:16 +00:00
observation_id BIGINT ,
person_id BIGINT ,
observation_concept_id INTEGER ,
observation_date TIMESTAMP ,
observation_datetime TIMESTAMP ,
2018-08-31 01:00:34 +00:00
observation_type_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
value_as_number FLOAT ,
value_as_string VARCHAR(60) ,
value_as_concept_id INTEGER ,
qualifier_concept_id INTEGER ,
unit_concept_id INTEGER ,
provider_id BIGINT ,
visit_occurrence_id BIGINT ,
2018-08-31 01:00:34 +00:00
visit_detail_id BIGINT ,
observation_source_value VARCHAR(50) ,
observation_source_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
unit_source_value VARCHAR(50) ,
qualifier_source_value VARCHAR(50) ,
2018-09-25 16:40:53 +00:00
observation_event_id BIGINT ,
obs_event_field_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
value_as_datetime TIMESTAMP
2018-08-31 01:00:34 +00:00
)
;
CREATE TABLE survey_conduct
(
2018-09-24 16:00:16 +00:00
survey_conduct_id BIGINT ,
person_id BIGINT ,
survey_concept_id INTEGER ,
survey_start_date TIMESTAMP ,
survey_start_datetime TIMESTAMP ,
survey_end_date TIMESTAMP ,
survey_end_datetime TIMESTAMP ,
provider_id BIGINT ,
assisted_concept_id INTEGER ,
respondent_type_concept_id INTEGER ,
timing_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
collection_method_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
assisted_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
respondent_type_source_value VARCHAR(100) ,
2018-09-24 16:00:16 +00:00
timing_source_value VARCHAR(100) ,
2018-08-31 01:00:34 +00:00
collection_method_source_value VARCHAR(100) ,
2018-09-24 16:00:16 +00:00
survey_source_value VARCHAR(100) ,
survey_source_concept_id INTEGER ,
survey_source_identifier VARCHAR(100) ,
validated_survey_concept_id INTEGER ,
2018-08-31 01:00:34 +00:00
validated_survey_source_value VARCHAR(100) ,
2018-09-24 16:00:16 +00:00
survey_version_number VARCHAR(20) ,
visit_occurrence_id BIGINT ,
2018-08-31 01:00:34 +00:00
visit_detail_id BIGINT ,
2018-09-25 16:40:53 +00:00
response_visit_occurrence_id BIGINT
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE fact_relationship
(
domain_concept_id_1 INTEGER ,
2018-09-24 16:00:16 +00:00
fact_id_1 BIGINT ,
2018-08-31 01:00:34 +00:00
domain_concept_id_2 INTEGER ,
2018-09-24 16:00:16 +00:00
fact_id_2 BIGINT ,
relationship_concept_id INTEGER
2018-01-03 19:56:42 +00:00
)
;
/************************
2018-08-31 01:00:34 +00:00
Standardized health system data
2018-01-03 19:56:42 +00:00
************************/
2018-09-24 16:00:16 +00:00
CREATE TABLE `location`
2018-01-03 19:56:42 +00:00
(
2018-08-31 01:00:34 +00:00
location_id BIGINT ,
address_1 VARCHAR(50) ,
address_2 VARCHAR(50) ,
2018-09-24 16:00:16 +00:00
city VARCHAR(50) ,
state VARCHAR(2) ,
zip VARCHAR(9) ,
county VARCHAR(20) ,
country VARCHAR(100) ,
location_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
latitude FLOAT ,
longitude FLOAT
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE location_history
(
location_history_id BIGINT ,
2018-09-24 16:00:16 +00:00
location_id BIGINT ,
2018-09-25 16:40:53 +00:00
relationship_type_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
domain_id VARCHAR(50) ,
entity_id BIGINT ,
start_date TIMESTAMP ,
end_date TIMESTAMP
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE care_site
(
2018-09-24 16:00:16 +00:00
care_site_id BIGINT ,
care_site_name VARCHAR(255) ,
place_of_service_concept_id INTEGER ,
location_id BIGINT ,
care_site_source_value VARCHAR(50) ,
place_of_service_source_value VARCHAR(50)
2018-08-31 01:00:34 +00:00
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE provider
(
2018-09-24 16:00:16 +00:00
provider_id BIGINT ,
provider_name VARCHAR(255) ,
NPI VARCHAR(20) ,
DEA VARCHAR(20) ,
specialty_concept_id INTEGER ,
care_site_id BIGINT ,
year_of_birth INTEGER ,
gender_concept_id INTEGER ,
provider_source_value VARCHAR(50) ,
specialty_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
specialty_source_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
gender_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
gender_source_concept_id INTEGER
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
/************************
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
Standardized health economics
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
************************/
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE payer_plan_period
(
2018-09-24 16:00:16 +00:00
payer_plan_period_id BIGINT ,
person_id BIGINT ,
2018-08-31 01:00:34 +00:00
contract_person_id BIGINT ,
payer_plan_period_start_date TIMESTAMP ,
2018-09-24 16:00:16 +00:00
payer_plan_period_end_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
payer_concept_id INTEGER ,
plan_concept_id INTEGER ,
contract_concept_id INTEGER ,
sponsor_concept_id INTEGER ,
stop_reason_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
payer_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
payer_source_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
plan_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
plan_source_concept_id INTEGER ,
contract_source_value VARCHAR(50) ,
contract_source_concept_id INTEGER ,
sponsor_source_value VARCHAR(50) ,
sponsor_source_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
family_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
stop_reason_source_value VARCHAR(50) ,
stop_reason_source_concept_id INTEGER
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
CREATE TABLE cost
(
2018-09-24 16:00:16 +00:00
cost_id BIGINT ,
person_id BIGINT,
cost_event_id BIGINT ,
2018-09-25 16:40:53 +00:00
cost_event_field_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
cost_concept_id INTEGER ,
cost_type_concept_id INTEGER ,
currency_concept_id INTEGER ,
cost FLOAT ,
incurred_date TIMESTAMP ,
billed_date TIMESTAMP ,
paid_date TIMESTAMP ,
2018-08-31 01:00:34 +00:00
revenue_code_concept_id INTEGER ,
2018-09-24 16:00:16 +00:00
drg_concept_id INTEGER ,
cost_source_value VARCHAR(50) ,
cost_source_concept_id INTEGER ,
revenue_code_source_value VARCHAR(50) ,
2018-08-31 01:00:34 +00:00
drg_source_value VARCHAR(3) ,
payer_plan_period_id BIGINT
)
;
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
/************************
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
Standardized derived elements
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
************************/
2018-01-03 19:56:42 +00:00
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
2018-01-03 19:56:42 +00:00
CREATE TABLE drug_era
(
2018-10-02 13:21:26 +00:00
drug_era_id BIGINT ,
person_id BIGINT ,
drug_concept_id INTEGER ,
drug_era_start_datetime TIMESTAMP ,
drug_era_end_datetime TIMESTAMP ,
drug_exposure_count INTEGER ,
gap_days INTEGER
2018-01-03 19:56:42 +00:00
)
;
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
2018-01-03 19:56:42 +00:00
CREATE TABLE dose_era
(
2018-10-02 13:21:26 +00:00
dose_era_id BIGINT ,
person_id BIGINT ,
drug_concept_id INTEGER ,
unit_concept_id INTEGER ,
dose_value FLOAT ,
dose_era_start_datetime TIMESTAMP ,
dose_era_end_datetime TIMESTAMP
2018-01-03 19:56:42 +00:00
)
;
2018-08-31 01:00:34 +00:00
--HINT DISTRIBUTE_ON_KEY(person_id)
2018-01-03 19:56:42 +00:00
CREATE TABLE condition_era
(
2018-10-02 13:21:26 +00:00
condition_era_id BIGINT ,
person_id BIGINT ,
condition_concept_id INTEGER ,
condition_era_start_datetime TIMESTAMP ,
condition_era_end_datetime TIMESTAMP ,
condition_occurrence_count INTEGER
2018-01-03 19:56:42 +00:00
)
;