Updated CDM v5.3 DDLs based on tester feedback

This commit is contained in:
Clair Blacketer 2017-12-15 11:57:18 -05:00
parent 83811a30ca
commit 38a0b9eb5f
14 changed files with 1666 additions and 366 deletions

View File

@ -167,8 +167,6 @@ ALTER TABLE death ADD CONSTRAINT fpk_death_cause_concept_s FOREIGN KEY (cause_so
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);
@ -186,8 +184,6 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_preceding FOREIGN KEY (pre
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);

View File

@ -207,10 +207,10 @@ CREATE TABLE metadata
metadata_concept_id INTEGER NOT NULL , metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string VARCHAR(MAX) NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL metadata_datetime DATETIME NULL
) )
; ;
@ -229,7 +229,7 @@ CREATE TABLE person
year_of_birth INTEGER NOT NULL , year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL, month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL, day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL, birth_datetime DATETIME NULL,
race_concept_id INTEGER NOT NULL, race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL, location_id INTEGER NULL,
@ -266,7 +266,7 @@ CREATE TABLE specimen
specimen_concept_id INTEGER NOT NULL , specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL , specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL , specimen_datetime DATETIME NULL ,
quantity FLOAT NULL , quantity FLOAT NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL ,
@ -285,7 +285,7 @@ CREATE TABLE death
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
death_date DATE NOT NULL , death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL , death_datetime DATETIME NULL ,
death_type_concept_id INTEGER NOT NULL , death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL , cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL, cause_source_value VARCHAR(50) NULL,
@ -301,17 +301,17 @@ CREATE TABLE visit_occurrence
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
@ -325,9 +325,9 @@ CREATE TABLE visit_detail
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL , visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
care_site_id INTEGER NULL , care_site_id INTEGER NULL ,
@ -351,7 +351,7 @@ CREATE TABLE procedure_occurrence
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL , procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NULL , procedure_datetime DATETIME NULL ,
procedure_type_concept_id INTEGER NOT NULL , procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL , modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -372,9 +372,9 @@ CREATE TABLE drug_exposure
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL , drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL , drug_exposure_start_datetime DATETIME NULL ,
drug_exposure_end_date DATE NOT NULL , drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL , drug_exposure_end_datetime DATETIME NULL ,
verbatim_end_date DATE NULL , verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL , drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
@ -402,9 +402,9 @@ CREATE TABLE device_exposure
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL , device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL , device_exposure_start_datetime DATETIME NULL ,
device_exposure_end_date DATE NULL , device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL , device_exposure_end_datetime DATETIME NULL ,
device_type_concept_id INTEGER NOT NULL , device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL , unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -424,9 +424,9 @@ CREATE TABLE condition_occurrence
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL , condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL , condition_start_datetime DATETIME NULL ,
condition_end_date DATE NULL , condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL , condition_end_datetime DATETIME NULL ,
condition_type_concept_id INTEGER NOT NULL , condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
@ -447,8 +447,7 @@ CREATE TABLE measurement
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
measurement_concept_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL , measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL , measurement_datetime DATETIME NULL ,
measurement_datetime DATETIME2 NULL ,
measurement_type_concept_id INTEGER NOT NULL , measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL , operator_concept_id INTEGER NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
@ -473,7 +472,7 @@ CREATE TABLE note
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
note_date DATE NOT NULL , note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL , note_datetime DATETIME NULL ,
note_type_concept_id INTEGER NOT NULL , note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL , note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL , note_title VARCHAR(250) NULL ,
@ -495,13 +494,13 @@ CREATE TABLE note_nlp
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL , nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL , nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL , nlp_datetime DATETIME NULL ,
term_exists VARCHAR(1) NULL , term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL , term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL term_modifiers VARCHAR(2000) NULL
@ -516,7 +515,7 @@ CREATE TABLE observation
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL , observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL , observation_datetime DATETIME NULL ,
observation_type_concept_id INTEGER NOT NULL , observation_type_concept_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_string VARCHAR(60) NULL , value_as_string VARCHAR(60) NULL ,

View File

@ -207,10 +207,10 @@ create table metadata
metadata_concept_id integer not null , metadata_concept_id integer not null ,
metadata_type_concept_id integer not null , metadata_type_concept_id integer not null ,
name varchar(250) not null , name varchar(250) not null ,
value_as_string nvarchar null , value_as_string varchar(max) null ,
value_as_concept_id integer null , value_as_concept_id integer null ,
metadata_date date null , metadata_date date null ,
metadata_datetime datetime2 null metadata_datetime datetime null
) )
; ;
@ -221,7 +221,7 @@ Standardized clinical data
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
create table person create table person
( (
person_id integer not null , person_id integer not null ,
@ -229,7 +229,7 @@ create table person
year_of_birth integer not null , year_of_birth integer not null ,
month_of_birth integer null, month_of_birth integer null,
day_of_birth integer null, day_of_birth integer null,
birth_datetime datetime2 null, birth_datetime datetime null,
race_concept_id integer not null, race_concept_id integer not null,
ethnicity_concept_id integer not null, ethnicity_concept_id integer not null,
location_id integer null, location_id integer null,
@ -246,6 +246,7 @@ create table person
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table observation_period create table observation_period
( (
observation_period_id integer not null , observation_period_id integer not null ,
@ -257,6 +258,7 @@ create table observation_period
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table specimen create table specimen
( (
specimen_id integer not null , specimen_id integer not null ,
@ -264,7 +266,7 @@ create table specimen
specimen_concept_id integer not null , specimen_concept_id integer not null ,
specimen_type_concept_id integer not null , specimen_type_concept_id integer not null ,
specimen_date date not null , specimen_date date not null ,
specimen_datetime datetime2 null , specimen_datetime datetime null ,
quantity float null , quantity float null ,
unit_concept_id integer null , unit_concept_id integer null ,
anatomic_site_concept_id integer null , anatomic_site_concept_id integer null ,
@ -278,12 +280,12 @@ create table specimen
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table death create table death
( (
person_id integer not null , person_id integer not null ,
death_date date not null , death_date date not null ,
death_datetime datetime2 null , death_datetime datetime null ,
death_type_concept_id integer not null , death_type_concept_id integer not null ,
cause_concept_id integer null , cause_concept_id integer null ,
cause_source_value varchar(50) null, cause_source_value varchar(50) null,
@ -292,38 +294,40 @@ create table death
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table visit_occurrence create table visit_occurrence
( (
visit_occurrence_id integer not null , visit_occurrence_id integer not null ,
person_id integer not null , person_id integer not null ,
visit_concept_id integer not null , visit_concept_id integer not null ,
visit_start_date date not null , visit_start_date date not null ,
visit_start_datetime datetime2 null , visit_start_datetime datetime null ,
visit_end_date date not null , visit_end_date date not null ,
visit_end_datetime datetime2 null , visit_end_datetime datetime null ,
visit_type_concept_id integer not null , visit_type_concept_id integer not null ,
provider_id integer null, provider_id integer null,
care_site_id integer null, care_site_id integer null,
visit_source_value varchar(50) null, visit_source_value varchar(50) null,
visit_source_concept_id integer null visit_source_concept_id integer null ,
admitting_source_concept_id integer null , admitting_source_concept_id integer null ,
admitting_source_value varchar(50) null , admitting_source_value varchar(50) null ,
discharge_to_concept_id integer(50) null , discharge_to_concept_id integer null ,
discharge_to_source_value varchar(50) null , discharge_to_source_value varchar(50) null ,
preceding_visit_occurrence_id integer null preceding_visit_occurrence_id integer null
) )
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table visit_detail create table visit_detail
( (
visit_detail_id integer not null , visit_detail_id integer not null ,
person_id integer not null , person_id integer not null ,
visit_detail_concept_id integer not null , visit_detail_concept_id integer not null ,
visit_start_date date not null , visit_start_date date not null ,
visit_start_datetime datetime2 null , visit_start_datetime datetime null ,
visit_end_date date not null , visit_end_date date not null ,
visit_end_datetime datetime2 null , visit_end_datetime datetime null ,
visit_type_concept_id integer not null , visit_type_concept_id integer not null ,
provider_id integer null , provider_id integer null ,
care_site_id integer null , care_site_id integer null ,
@ -340,13 +344,14 @@ create table visit_detail
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table procedure_occurrence create table procedure_occurrence
( (
procedure_occurrence_id integer not null , procedure_occurrence_id integer not null ,
person_id integer not null , person_id integer not null ,
procedure_concept_id integer not null , procedure_concept_id integer not null ,
procedure_date date not null , procedure_date date not null ,
procedure_datetime datetime2 null , procedure_datetime datetime null ,
procedure_type_concept_id integer not null , procedure_type_concept_id integer not null ,
modifier_concept_id integer null , modifier_concept_id integer null ,
quantity integer null , quantity integer null ,
@ -360,15 +365,16 @@ create table procedure_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table drug_exposure create table drug_exposure
( (
drug_exposure_id integer not null , drug_exposure_id integer not null ,
person_id integer not null , person_id integer not null ,
drug_concept_id integer not null , drug_concept_id integer not null ,
drug_exposure_start_date date not null , drug_exposure_start_date date not null ,
drug_exposure_start_datetime datetime2 null , drug_exposure_start_datetime datetime null ,
drug_exposure_end_date date not null , drug_exposure_end_date date not null ,
drug_exposure_end_datetime datetime2 null , drug_exposure_end_datetime datetime null ,
verbatim_end_date date null , verbatim_end_date date null ,
drug_type_concept_id integer not null , drug_type_concept_id integer not null ,
stop_reason varchar(20) null , stop_reason varchar(20) null ,
@ -389,15 +395,16 @@ create table drug_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table device_exposure create table device_exposure
( (
device_exposure_id integer not null , device_exposure_id integer not null ,
person_id integer not null , person_id integer not null ,
device_concept_id integer not null , device_concept_id integer not null ,
device_exposure_start_date date not null , device_exposure_start_date date not null ,
device_exposure_start_datetime datetime2 null , device_exposure_start_datetime datetime null ,
device_exposure_end_date date null , device_exposure_end_date date null ,
device_exposure_end_datetime datetime2 null , device_exposure_end_datetime datetime null ,
device_type_concept_id integer not null , device_type_concept_id integer not null ,
unique_device_id varchar(50) null , unique_device_id varchar(50) null ,
quantity integer null , quantity integer null ,
@ -410,15 +417,16 @@ create table device_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table condition_occurrence create table condition_occurrence
( (
condition_occurrence_id integer not null , condition_occurrence_id integer not null ,
person_id integer not null , person_id integer not null ,
condition_concept_id integer not null , condition_concept_id integer not null ,
condition_start_date date not null , condition_start_date date not null ,
condition_start_datetime datetime2 null , condition_start_datetime datetime null ,
condition_end_date date null , condition_end_date date null ,
condition_end_datetime datetime2 null , condition_end_datetime datetime null ,
condition_type_concept_id integer not null , condition_type_concept_id integer not null ,
stop_reason varchar(20) null , stop_reason varchar(20) null ,
provider_id integer null , provider_id integer null ,
@ -432,6 +440,7 @@ create table condition_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table measurement create table measurement
( (
measurement_id integer not null , measurement_id integer not null ,
@ -439,7 +448,7 @@ create table measurement
measurement_concept_id integer not null , measurement_concept_id integer not null ,
measurement_date date not null , measurement_date date not null ,
measurement_time varchar(10) null , measurement_time varchar(10) null ,
measurement_datetime datetime2 null , measurement_datetime datetime null ,
measurement_type_concept_id integer not null , measurement_type_concept_id integer not null ,
operator_concept_id integer null , operator_concept_id integer null ,
value_as_number float null , value_as_number float null ,
@ -458,13 +467,13 @@ create table measurement
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table note create table note
( (
note_id integer not null , note_id integer not null ,
person_id integer not null , person_id integer not null ,
note_date date not null , note_date date not null ,
note_datetime datetime2 null , note_datetime datetime null ,
note_type_concept_id integer not null , note_type_concept_id integer not null ,
note_class_concept_id integer not null , note_class_concept_id integer not null ,
note_title varchar(250) null , note_title varchar(250) null ,
@ -486,13 +495,13 @@ create table note_nlp
note_id integer not null , note_id integer not null ,
section_concept_id integer null , section_concept_id integer null ,
snippet varchar(250) null , snippet varchar(250) null ,
offset varchar(250) null , "offset" varchar(250) null ,
lexical_variant varchar(250) not null , lexical_variant varchar(250) not null ,
note_nlp_concept_id integer null , note_nlp_concept_id integer null ,
note_nlp_source_concept_id integer null , note_nlp_source_concept_id integer null ,
nlp_system varchar(250) null , nlp_system varchar(250) null ,
nlp_date date not null , nlp_date date not null ,
nlp_datetime datetime2 null , nlp_datetime datetime null ,
term_exists varchar(1) null , term_exists varchar(1) null ,
term_temporal varchar(50) null , term_temporal varchar(50) null ,
term_modifiers varchar(2000) null term_modifiers varchar(2000) null
@ -500,14 +509,14 @@ create table note_nlp
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table observation create table observation
( (
observation_id integer not null , observation_id integer not null ,
person_id integer not null , person_id integer not null ,
observation_concept_id integer not null , observation_concept_id integer not null ,
observation_date date not null , observation_date date not null ,
observation_datetime datetime2 null , observation_datetime datetime null ,
observation_type_concept_id integer not null , observation_type_concept_id integer not null ,
value_as_number float null , value_as_number float null ,
value_as_string varchar(60) null , value_as_string varchar(60) null ,
@ -525,7 +534,6 @@ create table observation
; ;
create table fact_relationship create table fact_relationship
( (
domain_concept_id_1 integer not null , domain_concept_id_1 integer not null ,
@ -538,7 +546,6 @@ create table fact_relationship
/************************ /************************
Standardized health system data Standardized health system data
@ -546,7 +553,6 @@ Standardized health system data
************************/ ************************/
create table location create table location
( (
location_id integer not null , location_id integer not null ,
@ -561,7 +567,6 @@ create table location
; ;
create table care_site create table care_site
( (
care_site_id integer not null , care_site_id integer not null ,
@ -574,7 +579,6 @@ create table care_site
; ;
create table provider create table provider
( (
provider_id integer not null , provider_id integer not null ,
@ -594,8 +598,6 @@ create table provider
; ;
/************************ /************************
Standardized health economics Standardized health economics
@ -603,6 +605,7 @@ Standardized health economics
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
create table payer_plan_period create table payer_plan_period
( (
payer_plan_period_id integer not null , payer_plan_period_id integer not null ,
@ -654,15 +657,14 @@ create table cost
; ;
/************************ /************************
Standardized derived elements Standardized derived elements
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(subject_id)
create table cohort create table cohort
( (
cohort_definition_id integer not null , cohort_definition_id integer not null ,
@ -673,12 +675,13 @@ create table cohort
; ;
--HINT DISTRIBUTE_ON_KEY(subject_id)
create table cohort_attribute create table cohort_attribute
( (
cohort_definition_id integer not null , cohort_definition_id integer not null ,
subject_id integer not null ,
cohort_start_date date not null , cohort_start_date date not null ,
cohort_end_date date not null , cohort_end_date date not null ,
subject_id integer not null ,
attribute_definition_id integer not null , attribute_definition_id integer not null ,
value_as_number float null , value_as_number float null ,
value_as_concept_id integer null value_as_concept_id integer null
@ -686,8 +689,7 @@ create table cohort_attribute
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table drug_era create table drug_era
( (
drug_era_id integer not null , drug_era_id integer not null ,
@ -701,6 +703,7 @@ create table drug_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table dose_era create table dose_era
( (
dose_era_id integer not null , dose_era_id integer not null ,
@ -714,8 +717,7 @@ create table dose_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table condition_era create table condition_era
( (
condition_era_id integer not null , condition_era_id integer not null ,
@ -726,10 +728,3 @@ create table condition_era
condition_occurrence_count integer null condition_occurrence_count integer null
) )
; ;

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ Standardized vocabulary
************************/ ************************/
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE concept ( CREATE TABLE concept (
concept_id INTEGER NOT NULL , concept_id INTEGER NOT NULL ,
concept_name VARCHAR(255) NOT NULL , concept_name VARCHAR(255) NOT NULL ,
@ -55,9 +55,11 @@ CREATE TABLE concept (
valid_end_date DATE NOT NULL , valid_end_date DATE NOT NULL ,
invalid_reason VARCHAR(1) NULL invalid_reason VARCHAR(1) NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE vocabulary ( CREATE TABLE vocabulary (
vocabulary_id VARCHAR(20) NOT NULL, vocabulary_id VARCHAR(20) NOT NULL,
vocabulary_name VARCHAR(255) NOT NULL, vocabulary_name VARCHAR(255) NOT NULL,
@ -65,25 +67,31 @@ CREATE TABLE vocabulary (
vocabulary_version VARCHAR(255) NOT NULL, vocabulary_version VARCHAR(255) NOT NULL,
vocabulary_concept_id INTEGER NOT NULL vocabulary_concept_id INTEGER NOT NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE domain ( CREATE TABLE domain (
domain_id VARCHAR(20) NOT NULL, domain_id VARCHAR(20) NOT NULL,
domain_name VARCHAR(255) NOT NULL, domain_name VARCHAR(255) NOT NULL,
domain_concept_id INTEGER NOT NULL domain_concept_id INTEGER NOT NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE concept_class ( CREATE TABLE concept_class (
concept_class_id VARCHAR(20) NOT NULL, concept_class_id VARCHAR(20) NOT NULL,
concept_class_name VARCHAR(255) NOT NULL, concept_class_name VARCHAR(255) NOT NULL,
concept_class_concept_id INTEGER NOT NULL concept_class_concept_id INTEGER NOT NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE concept_relationship ( CREATE TABLE concept_relationship (
concept_id_1 INTEGER NOT NULL, concept_id_1 INTEGER NOT NULL,
concept_id_2 INTEGER NOT NULL, concept_id_2 INTEGER NOT NULL,
@ -92,9 +100,11 @@ CREATE TABLE concept_relationship (
valid_end_date DATE NOT NULL, valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL invalid_reason VARCHAR(1) NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE relationship ( CREATE TABLE relationship (
relationship_id VARCHAR(20) NOT NULL, relationship_id VARCHAR(20) NOT NULL,
relationship_name VARCHAR(255) NOT NULL, relationship_name VARCHAR(255) NOT NULL,
@ -106,23 +116,28 @@ CREATE TABLE relationship (
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE concept_synonym ( CREATE TABLE concept_synonym (
concept_id INTEGER NOT NULL, concept_id INTEGER NOT NULL,
concept_synonym_name VARCHAR(1000) NOT NULL, concept_synonym_name VARCHAR(1000) NOT NULL,
language_concept_id INTEGER NOT NULL language_concept_id INTEGER NOT NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE concept_ancestor ( CREATE TABLE concept_ancestor (
ancestor_concept_id INTEGER NOT NULL, ancestor_concept_id INTEGER NOT NULL,
descendant_concept_id INTEGER NOT NULL, descendant_concept_id INTEGER NOT NULL,
min_levels_of_separation INTEGER NOT NULL, min_levels_of_separation INTEGER NOT NULL,
max_levels_of_separation INTEGER NOT NULL max_levels_of_separation INTEGER NOT NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE source_to_concept_map ( CREATE TABLE source_to_concept_map (
source_code VARCHAR(50) NOT NULL, source_code VARCHAR(50) NOT NULL,
source_concept_id INTEGER NOT NULL, source_concept_id INTEGER NOT NULL,
@ -134,29 +149,30 @@ CREATE TABLE source_to_concept_map (
valid_end_date DATE NOT NULL, valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL invalid_reason VARCHAR(1) NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE drug_strength ( CREATE TABLE drug_strength (
drug_concept_id INTEGER NOT NULL, drug_concept_id INTEGER NOT NULL,
ingredient_concept_id INTEGER NOT NULL, ingredient_concept_id INTEGER NOT NULL,
amount_value NUMERIC NULL, amount_value REAL NULL,
amount_unit_concept_id INTEGER NULL, amount_unit_concept_id INTEGER NULL,
numerator_value NUMERIC NULL, numerator_value REAL NULL,
numerator_unit_concept_id INTEGER NULL, numerator_unit_concept_id INTEGER NULL,
denominator_value NUMERIC NULL, denominator_value REAL NULL,
denominator_unit_concept_id INTEGER NULL, denominator_unit_concept_id INTEGER NULL,
box_size INTEGER NULL, box_size INTEGER NULL,
valid_start_date DATE NOT NULL, valid_start_date DATE NOT NULL,
valid_end_date DATE NOT NULL, valid_end_date DATE NOT NULL,
invalid_reason VARCHAR(1) NULL invalid_reason VARCHAR(1) NULL
) )
DISTRIBUTE ON RANDOM
; ;
-HINT DISTRIBUTE ON RANDOM
CREATE TABLE cohort_definition ( CREATE TABLE cohort_definition (
cohort_definition_id INTEGER NOT NULL, cohort_definition_id INTEGER NOT NULL,
cohort_definition_name VARCHAR(255) NOT NULL, cohort_definition_name VARCHAR(255) NOT NULL,
@ -166,9 +182,11 @@ CREATE TABLE cohort_definition (
subject_concept_id INTEGER NOT NULL, subject_concept_id INTEGER NOT NULL,
cohort_initiation_date DATE NULL cohort_initiation_date DATE NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE attribute_definition ( CREATE TABLE attribute_definition (
attribute_definition_id INTEGER NOT NULL, attribute_definition_id INTEGER NOT NULL,
attribute_name VARCHAR(255) NOT NULL, attribute_name VARCHAR(255) NOT NULL,
@ -176,6 +194,7 @@ CREATE TABLE attribute_definition (
attribute_type_concept_id INTEGER NOT NULL, attribute_type_concept_id INTEGER NOT NULL,
attribute_syntax VARCHAR(1000) NULL attribute_syntax VARCHAR(1000) NULL
) )
DISTRIBUTE ON RANDOM
; ;
@ -185,7 +204,7 @@ Standardized meta-data
***************************/ ***************************/
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE cdm_source CREATE TABLE cdm_source
( (
cdm_source_name VARCHAR(255) NOT NULL , cdm_source_name VARCHAR(255) NOT NULL ,
@ -199,19 +218,22 @@ CREATE TABLE cdm_source
cdm_version VARCHAR(10) NULL , cdm_version VARCHAR(10) NULL ,
vocabulary_version VARCHAR(20) NULL vocabulary_version VARCHAR(20) NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE metadata CREATE TABLE metadata
( (
metadata_concept_id INTEGER NOT NULL , metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string VARCHAR(1000) NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL metadata_datetime DATETIME NULL
) )
DISTRIBUTE ON RANDOM
; ;
@ -229,7 +251,7 @@ CREATE TABLE person
year_of_birth INTEGER NOT NULL , year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL, month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL, day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL, birth_datetime DATETIME NULL,
race_concept_id INTEGER NOT NULL, race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL, location_id INTEGER NULL,
@ -268,8 +290,8 @@ CREATE TABLE specimen
specimen_concept_id INTEGER NOT NULL , specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL , specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL , specimen_datetime DATETIME NULL ,
quantity NUMERIC NULL , quantity REAL NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL ,
disease_status_concept_id INTEGER NULL , disease_status_concept_id INTEGER NULL ,
@ -288,7 +310,7 @@ CREATE TABLE death
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
death_date DATE NOT NULL , death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL , death_datetime DATETIME NULL ,
death_type_concept_id INTEGER NOT NULL , death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL , cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL, cause_source_value VARCHAR(50) NULL,
@ -305,17 +327,17 @@ CREATE TABLE visit_occurrence
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
@ -330,9 +352,9 @@ CREATE TABLE visit_detail
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL , visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
care_site_id INTEGER NULL , care_site_id INTEGER NULL ,
@ -357,7 +379,7 @@ CREATE TABLE procedure_occurrence
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL , procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NULL , procedure_datetime DATETIME NULL ,
procedure_type_concept_id INTEGER NOT NULL , procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL , modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -379,14 +401,14 @@ CREATE TABLE drug_exposure
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL , drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL , drug_exposure_start_datetime DATETIME NULL ,
drug_exposure_end_date DATE NOT NULL , drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL , drug_exposure_end_datetime DATETIME NULL ,
verbatim_end_date DATE NULL , verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL , drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
refills INTEGER NULL , refills INTEGER NULL ,
quantity NUMERIC NULL , quantity REAL NULL ,
days_supply INTEGER NULL , days_supply INTEGER NULL ,
sig VARCHAR(1000) NULL , sig VARCHAR(1000) NULL ,
route_concept_id INTEGER NULL , route_concept_id INTEGER NULL ,
@ -410,9 +432,9 @@ CREATE TABLE device_exposure
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL , device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL , device_exposure_start_datetime DATETIME NULL ,
device_exposure_end_date DATE NULL , device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL , device_exposure_end_datetime DATETIME NULL ,
device_type_concept_id INTEGER NOT NULL , device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL , unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -433,9 +455,9 @@ CREATE TABLE condition_occurrence
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL , condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL , condition_start_datetime DATETIME NULL ,
condition_end_date DATE NULL , condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL , condition_end_datetime DATETIME NULL ,
condition_type_concept_id INTEGER NOT NULL , condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
@ -457,15 +479,14 @@ CREATE TABLE measurement
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
measurement_concept_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL , measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL , measurement_datetime DATETIME NULL ,
measurement_datetime DATETIME2 NULL ,
measurement_type_concept_id INTEGER NOT NULL , measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL , operator_concept_id INTEGER NULL ,
value_as_number NUMERIC NULL , value_as_number REAL NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
range_low NUMERIC NULL , range_low REAL NULL ,
range_high NUMERIC NULL , range_high REAL NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
visit_occurrence_id INTEGER NULL , visit_occurrence_id INTEGER NULL ,
visit_detail_id INTEGER NULL , visit_detail_id INTEGER NULL ,
@ -484,7 +505,7 @@ CREATE TABLE note
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
note_date DATE NOT NULL , note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL , note_datetime DATETIME NULL ,
note_type_concept_id INTEGER NOT NULL , note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL , note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL , note_title VARCHAR(250) NULL ,
@ -500,24 +521,25 @@ DISTRIBUTE ON (person_id)
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE note_nlp CREATE TABLE note_nlp
( (
note_nlp_id BIGINT NOT NULL , note_nlp_id BIGINT NOT NULL ,
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL , nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL , nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL , nlp_datetime DATETIME NULL ,
term_exists VARCHAR(1) NULL , term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL , term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL term_modifiers VARCHAR(2000) NULL
) )
DISTRIBUTE ON RANDOM
; ;
@ -528,9 +550,9 @@ CREATE TABLE observation
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL , observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL , observation_datetime DATETIME NULL ,
observation_type_concept_id INTEGER NOT NULL , observation_type_concept_id INTEGER NOT NULL ,
value_as_number NUMERIC NULL , value_as_number REAL NULL ,
value_as_string VARCHAR(60) NULL , value_as_string VARCHAR(60) NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
qualifier_concept_id INTEGER NULL , qualifier_concept_id INTEGER NULL ,
@ -547,6 +569,7 @@ DISTRIBUTE ON (person_id)
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE fact_relationship CREATE TABLE fact_relationship
( (
domain_concept_id_1 INTEGER NOT NULL , domain_concept_id_1 INTEGER NOT NULL ,
@ -555,6 +578,7 @@ CREATE TABLE fact_relationship
fact_id_2 INTEGER NOT NULL , fact_id_2 INTEGER NOT NULL ,
relationship_concept_id INTEGER NOT NULL relationship_concept_id INTEGER NOT NULL
) )
DISTRIBUTE ON RANDOM
; ;
@ -565,7 +589,7 @@ Standardized health system data
************************/ ************************/
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE location CREATE TABLE location
( (
location_id INTEGER NOT NULL , location_id INTEGER NOT NULL ,
@ -577,9 +601,11 @@ CREATE TABLE location
county VARCHAR(20) NULL , county VARCHAR(20) NULL ,
location_source_value VARCHAR(50) NULL location_source_value VARCHAR(50) NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE care_site CREATE TABLE care_site
( (
care_site_id INTEGER NOT NULL , care_site_id INTEGER NOT NULL ,
@ -589,9 +615,11 @@ CREATE TABLE care_site
care_site_source_value VARCHAR(50) NULL , care_site_source_value VARCHAR(50) NULL ,
place_of_service_source_value VARCHAR(50) NULL place_of_service_source_value VARCHAR(50) NULL
) )
DISTRIBUTE ON RANDOM
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE provider CREATE TABLE provider
( (
provider_id INTEGER NOT NULL , provider_id INTEGER NOT NULL ,
@ -608,6 +636,7 @@ CREATE TABLE provider
gender_source_value VARCHAR(50) NULL , gender_source_value VARCHAR(50) NULL ,
gender_source_concept_id INTEGER NULL gender_source_concept_id INTEGER NULL
) )
DISTRIBUTE ON RANDOM
; ;
@ -643,6 +672,7 @@ DISTRIBUTE ON (person_id)
; ;
--HINT DISTRIBUTE ON RANDOM
CREATE TABLE cost CREATE TABLE cost
( (
cost_id INTEGER NOT NULL , cost_id INTEGER NOT NULL ,
@ -650,24 +680,25 @@ CREATE TABLE cost
cost_domain_id VARCHAR(20) NOT NULL , cost_domain_id VARCHAR(20) NOT NULL ,
cost_type_concept_id INTEGER NOT NULL , cost_type_concept_id INTEGER NOT NULL ,
currency_concept_id INTEGER NULL , currency_concept_id INTEGER NULL ,
total_charge NUMERIC NULL , total_charge REAL NULL ,
total_cost NUMERIC NULL , total_cost REAL NULL ,
total_paid NUMERIC NULL , total_paid REAL NULL ,
paid_by_payer NUMERIC NULL , paid_by_payer REAL NULL ,
paid_by_patient NUMERIC NULL , paid_by_patient REAL NULL ,
paid_patient_copay NUMERIC NULL , paid_patient_copay REAL NULL ,
paid_patient_coinsurance NUMERIC NULL , paid_patient_coinsurance REAL NULL ,
paid_patient_deductible NUMERIC NULL , paid_patient_deductible REAL NULL ,
paid_by_primary NUMERIC NULL , paid_by_primary REAL NULL ,
paid_ingredient_cost NUMERIC NULL , paid_ingredient_cost REAL NULL ,
paid_dispensing_fee NUMERIC NULL , paid_dispensing_fee REAL NULL ,
payer_plan_period_id INTEGER NULL , payer_plan_period_id INTEGER NULL ,
amount_allowed NUMERIC NULL , amount_allowed REAL NULL ,
revenue_code_concept_id INTEGER NULL , revenue_code_concept_id INTEGER NULL ,
reveue_code_source_value VARCHAR(50) NULL, reveue_code_source_value VARCHAR(50) NULL,
drg_concept_id INTEGER NULL, drg_concept_id INTEGER NULL,
drg_source_value VARCHAR(3) NULL drg_source_value VARCHAR(3) NULL
) )
DISTRIBUTE ON RANDOM
; ;
@ -698,7 +729,7 @@ CREATE TABLE cohort_attribute
cohort_start_date DATE NOT NULL , cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL , cohort_end_date DATE NOT NULL ,
attribute_definition_id INTEGER NOT NULL , attribute_definition_id INTEGER NOT NULL ,
value_as_number NUMERIC NULL , value_as_number REAL NULL ,
value_as_concept_id INTEGER NULL value_as_concept_id INTEGER NULL
) )
DISTRIBUTE ON (subject_id) DISTRIBUTE ON (subject_id)
@ -727,7 +758,7 @@ CREATE TABLE dose_era
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
unit_concept_id INTEGER NOT NULL , unit_concept_id INTEGER NOT NULL ,
dose_value NUMERIC NOT NULL , dose_value REAL NOT NULL ,
dose_era_start_date DATE NOT NULL , dose_era_start_date DATE NOT NULL ,
dose_era_end_date DATE NOT NULL dose_era_end_date DATE NOT NULL
) )

View File

@ -167,8 +167,6 @@ ALTER TABLE death ADD CONSTRAINT fpk_death_cause_concept_s FOREIGN KEY (cause_so
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);
@ -186,8 +184,6 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_preceding FOREIGN KEY (pre
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);

View File

@ -207,10 +207,10 @@ CREATE TABLE metadata
metadata_concept_id INTEGER NOT NULL , metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string CLOB NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL metadata_datetime TIMESTAMP NULL
) )
; ;
@ -221,7 +221,7 @@ Standardized clinical data
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE person CREATE TABLE person
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -229,7 +229,7 @@ CREATE TABLE person
year_of_birth INTEGER NOT NULL , year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL, month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL, day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL, birth_datetime TIMESTAMP NULL,
race_concept_id INTEGER NOT NULL, race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL, location_id INTEGER NULL,
@ -246,6 +246,7 @@ CREATE TABLE person
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation_period CREATE TABLE observation_period
( (
observation_period_id INTEGER NOT NULL , observation_period_id INTEGER NOT NULL ,
@ -257,6 +258,7 @@ CREATE TABLE observation_period
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE specimen CREATE TABLE specimen
( (
specimen_id INTEGER NOT NULL , specimen_id INTEGER NOT NULL ,
@ -264,7 +266,7 @@ CREATE TABLE specimen
specimen_concept_id INTEGER NOT NULL , specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL , specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL , specimen_datetime TIMESTAMP NULL ,
quantity FLOAT NULL , quantity FLOAT NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL ,
@ -278,12 +280,12 @@ CREATE TABLE specimen
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE death CREATE TABLE death
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
death_date DATE NOT NULL , death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL , death_datetime TIMESTAMP NULL ,
death_type_concept_id INTEGER NOT NULL , death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL , cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL, cause_source_value VARCHAR(50) NULL,
@ -292,38 +294,40 @@ CREATE TABLE death
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_occurrence CREATE TABLE visit_occurrence
( (
visit_occurrence_id INTEGER NOT NULL , visit_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime TIMESTAMP NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime TIMESTAMP NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_detail CREATE TABLE visit_detail
( (
visit_detail_id INTEGER NOT NULL , visit_detail_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL , visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime TIMESTAMP NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime TIMESTAMP NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
care_site_id INTEGER NULL , care_site_id INTEGER NULL ,
@ -340,13 +344,14 @@ CREATE TABLE visit_detail
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE procedure_occurrence CREATE TABLE procedure_occurrence
( (
procedure_occurrence_id INTEGER NOT NULL , procedure_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL , procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NULL , procedure_datetime TIMESTAMP NULL ,
procedure_type_concept_id INTEGER NOT NULL , procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL , modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -360,15 +365,16 @@ CREATE TABLE procedure_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_exposure CREATE TABLE drug_exposure
( (
drug_exposure_id INTEGER NOT NULL , drug_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL , drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL , drug_exposure_start_datetime TIMESTAMP NULL ,
drug_exposure_end_date DATE NOT NULL , drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL , drug_exposure_end_datetime TIMESTAMP NULL ,
verbatim_end_date DATE NULL , verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL , drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
@ -389,15 +395,16 @@ CREATE TABLE drug_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE device_exposure CREATE TABLE device_exposure
( (
device_exposure_id INTEGER NOT NULL , device_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL , device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL , device_exposure_start_datetime TIMESTAMP NULL ,
device_exposure_end_date DATE NULL , device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL , device_exposure_end_datetime TIMESTAMP NULL ,
device_type_concept_id INTEGER NOT NULL , device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL , unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -410,15 +417,16 @@ CREATE TABLE device_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_occurrence CREATE TABLE condition_occurrence
( (
condition_occurrence_id INTEGER NOT NULL , condition_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL , condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL , condition_start_datetime TIMESTAMP NULL ,
condition_end_date DATE NULL , condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL , condition_end_datetime TIMESTAMP NULL ,
condition_type_concept_id INTEGER NOT NULL , condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
@ -432,6 +440,7 @@ CREATE TABLE condition_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE measurement CREATE TABLE measurement
( (
measurement_id INTEGER NOT NULL , measurement_id INTEGER NOT NULL ,
@ -439,7 +448,7 @@ CREATE TABLE measurement
measurement_concept_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL , measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL , measurement_time VARCHAR(10) NULL ,
measurement_datetime DATETIME2 NULL , measurement_datetime TIMESTAMP NULL ,
measurement_type_concept_id INTEGER NOT NULL , measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL , operator_concept_id INTEGER NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
@ -458,13 +467,13 @@ CREATE TABLE measurement
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE note CREATE TABLE note
( (
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
note_date DATE NOT NULL , note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL , note_datetime TIMESTAMP NULL ,
note_type_concept_id INTEGER NOT NULL , note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL , note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL , note_title VARCHAR(250) NULL ,
@ -486,13 +495,13 @@ CREATE TABLE note_nlp
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL , nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL , nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL , nlp_datetime TIMESTAMP NULL ,
term_exists VARCHAR(1) NULL , term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL , term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL term_modifiers VARCHAR(2000) NULL
@ -500,14 +509,14 @@ CREATE TABLE note_nlp
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation CREATE TABLE observation
( (
observation_id INTEGER NOT NULL , observation_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL , observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL , observation_datetime TIMESTAMP NULL ,
observation_type_concept_id INTEGER NOT NULL , observation_type_concept_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_string VARCHAR(60) NULL , value_as_string VARCHAR(60) NULL ,
@ -525,7 +534,6 @@ CREATE TABLE observation
; ;
CREATE TABLE fact_relationship CREATE TABLE fact_relationship
( (
domain_concept_id_1 INTEGER NOT NULL , domain_concept_id_1 INTEGER NOT NULL ,
@ -538,7 +546,6 @@ CREATE TABLE fact_relationship
/************************ /************************
Standardized health system data Standardized health system data
@ -546,7 +553,6 @@ Standardized health system data
************************/ ************************/
CREATE TABLE location CREATE TABLE location
( (
location_id INTEGER NOT NULL , location_id INTEGER NOT NULL ,
@ -561,7 +567,6 @@ CREATE TABLE location
; ;
CREATE TABLE care_site CREATE TABLE care_site
( (
care_site_id INTEGER NOT NULL , care_site_id INTEGER NOT NULL ,
@ -574,7 +579,6 @@ CREATE TABLE care_site
; ;
CREATE TABLE provider CREATE TABLE provider
( (
provider_id INTEGER NOT NULL , provider_id INTEGER NOT NULL ,
@ -594,8 +598,6 @@ CREATE TABLE provider
; ;
/************************ /************************
Standardized health economics Standardized health economics
@ -603,6 +605,7 @@ Standardized health economics
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE payer_plan_period CREATE TABLE payer_plan_period
( (
payer_plan_period_id INTEGER NOT NULL , payer_plan_period_id INTEGER NOT NULL ,
@ -654,15 +657,14 @@ CREATE TABLE cost
; ;
/************************ /************************
Standardized derived elements Standardized derived elements
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(subject_id)
CREATE TABLE cohort CREATE TABLE cohort
( (
cohort_definition_id INTEGER NOT NULL , cohort_definition_id INTEGER NOT NULL ,
@ -673,12 +675,13 @@ CREATE TABLE cohort
; ;
--HINT DISTRIBUTE_ON_KEY(subject_id)
CREATE TABLE cohort_attribute CREATE TABLE cohort_attribute
( (
cohort_definition_id INTEGER NOT NULL , cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL , cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL , cohort_end_date DATE NOT NULL ,
subject_id INTEGER NOT NULL ,
attribute_definition_id INTEGER NOT NULL , attribute_definition_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_concept_id INTEGER NULL value_as_concept_id INTEGER NULL
@ -686,8 +689,7 @@ CREATE TABLE cohort_attribute
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_era CREATE TABLE drug_era
( (
drug_era_id INTEGER NOT NULL , drug_era_id INTEGER NOT NULL ,
@ -701,6 +703,7 @@ CREATE TABLE drug_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE dose_era CREATE TABLE dose_era
( (
dose_era_id INTEGER NOT NULL , dose_era_id INTEGER NOT NULL ,
@ -714,8 +717,7 @@ CREATE TABLE dose_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_era CREATE TABLE condition_era
( (
condition_era_id INTEGER NOT NULL , condition_era_id INTEGER NOT NULL ,
@ -726,10 +728,3 @@ CREATE TABLE condition_era
condition_occurrence_count INTEGER NULL condition_occurrence_count INTEGER NULL
) )
; ;

View File

@ -167,8 +167,6 @@ ALTER TABLE death ADD CONSTRAINT fpk_death_cause_concept_s FOREIGN KEY (cause_so
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);
@ -186,8 +184,6 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_preceding FOREIGN KEY (pre
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);

View File

@ -193,10 +193,10 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE metadata
(metadata_concept_id INTEGER NOT NULL , (metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string VARCHAR(1000) NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL metadata_datetime DATETIME NULL
) )
WITH (DISTRIBUTION = REPLICATE); WITH (DISTRIBUTION = REPLICATE);
@ -207,14 +207,14 @@ Standardized clinical data
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE person IF XACT_STATE() = 1 COMMIT; CREATE TABLE person
( person_id INTEGER NOT NULL , (person_id INTEGER NOT NULL ,
gender_concept_id INTEGER NOT NULL , gender_concept_id INTEGER NOT NULL ,
year_of_birth INTEGER NOT NULL , year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL, month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL, day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL, birth_datetime DATETIME NULL,
race_concept_id INTEGER NOT NULL, race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL, location_id INTEGER NULL,
@ -231,6 +231,7 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE person
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation_period IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation_period
(observation_period_id INTEGER NOT NULL , (observation_period_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -241,13 +242,14 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation_period
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE specimen IF XACT_STATE() = 1 COMMIT; CREATE TABLE specimen
(specimen_id INTEGER NOT NULL , (specimen_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
specimen_concept_id INTEGER NOT NULL , specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL , specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL , specimen_datetime DATETIME NULL ,
quantity FLOAT NULL , quantity FLOAT NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL ,
@ -261,11 +263,11 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE specimen
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE death IF XACT_STATE() = 1 COMMIT; CREATE TABLE death
( person_id INTEGER NOT NULL , (person_id INTEGER NOT NULL ,
death_date DATE NOT NULL , death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL , death_datetime DATETIME NULL ,
death_type_concept_id INTEGER NOT NULL , death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL , cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL, cause_source_value VARCHAR(50) NULL,
@ -274,36 +276,38 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE death
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_occurrence IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_occurrence
(visit_occurrence_id INTEGER NOT NULL , (visit_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_detail IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_detail
(visit_detail_id INTEGER NOT NULL , (visit_detail_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL , visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
care_site_id INTEGER NULL , care_site_id INTEGER NULL ,
@ -320,12 +324,13 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE visit_detail
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE procedure_occurrence IF XACT_STATE() = 1 COMMIT; CREATE TABLE procedure_occurrence
(procedure_occurrence_id INTEGER NOT NULL , (procedure_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL , procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NULL , procedure_datetime DATETIME NULL ,
procedure_type_concept_id INTEGER NOT NULL , procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL , modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -339,14 +344,15 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE procedure_occurrence
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_exposure IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_exposure
(drug_exposure_id INTEGER NOT NULL , (drug_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL , drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL , drug_exposure_start_datetime DATETIME NULL ,
drug_exposure_end_date DATE NOT NULL , drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL , drug_exposure_end_datetime DATETIME NULL ,
verbatim_end_date DATE NULL , verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL , drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
@ -367,14 +373,15 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_exposure
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE device_exposure IF XACT_STATE() = 1 COMMIT; CREATE TABLE device_exposure
(device_exposure_id INTEGER NOT NULL , (device_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL , device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL , device_exposure_start_datetime DATETIME NULL ,
device_exposure_end_date DATE NULL , device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL , device_exposure_end_datetime DATETIME NULL ,
device_type_concept_id INTEGER NOT NULL , device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL , unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -387,14 +394,15 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE device_exposure
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_occurrence IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_occurrence
(condition_occurrence_id INTEGER NOT NULL , (condition_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL , condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL , condition_start_datetime DATETIME NULL ,
condition_end_date DATE NULL , condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL , condition_end_datetime DATETIME NULL ,
condition_type_concept_id INTEGER NOT NULL , condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
@ -408,13 +416,14 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_occurrence
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE measurement IF XACT_STATE() = 1 COMMIT; CREATE TABLE measurement
(measurement_id INTEGER NOT NULL , (measurement_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
measurement_concept_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL , measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL , measurement_time VARCHAR(10) NULL ,
measurement_datetime DATETIME2 NULL , measurement_datetime DATETIME NULL ,
measurement_type_concept_id INTEGER NOT NULL , measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL , operator_concept_id INTEGER NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
@ -433,12 +442,12 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE measurement
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE note IF XACT_STATE() = 1 COMMIT; CREATE TABLE note
(note_id INTEGER NOT NULL , (note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
note_date DATE NOT NULL , note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL , note_datetime DATETIME NULL ,
note_type_concept_id INTEGER NOT NULL , note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL , note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL , note_title VARCHAR(250) NULL ,
@ -459,13 +468,13 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE note_nlp
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL , nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL , nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL , nlp_datetime DATETIME NULL ,
term_exists VARCHAR(1) NULL , term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL , term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL term_modifiers VARCHAR(2000) NULL
@ -473,13 +482,13 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE note_nlp
WITH (DISTRIBUTION = REPLICATE); WITH (DISTRIBUTION = REPLICATE);
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation
(observation_id INTEGER NOT NULL , (observation_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL , observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL , observation_datetime DATETIME NULL ,
observation_type_concept_id INTEGER NOT NULL , observation_type_concept_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_string VARCHAR(60) NULL , value_as_string VARCHAR(60) NULL ,
@ -497,7 +506,6 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE observation
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
IF XACT_STATE() = 1 COMMIT; CREATE TABLE fact_relationship IF XACT_STATE() = 1 COMMIT; CREATE TABLE fact_relationship
(domain_concept_id_1 INTEGER NOT NULL , (domain_concept_id_1 INTEGER NOT NULL ,
fact_id_1 INTEGER NOT NULL , fact_id_1 INTEGER NOT NULL ,
@ -509,7 +517,6 @@ WITH (DISTRIBUTION = REPLICATE);
/************************ /************************
Standardized health system data Standardized health system data
@ -517,7 +524,6 @@ Standardized health system data
************************/ ************************/
IF XACT_STATE() = 1 COMMIT; CREATE TABLE location IF XACT_STATE() = 1 COMMIT; CREATE TABLE location
(location_id INTEGER NOT NULL , (location_id INTEGER NOT NULL ,
address_1 VARCHAR(50) NULL , address_1 VARCHAR(50) NULL ,
@ -531,7 +537,6 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE location
WITH (DISTRIBUTION = REPLICATE); WITH (DISTRIBUTION = REPLICATE);
IF XACT_STATE() = 1 COMMIT; CREATE TABLE care_site IF XACT_STATE() = 1 COMMIT; CREATE TABLE care_site
(care_site_id INTEGER NOT NULL , (care_site_id INTEGER NOT NULL ,
care_site_name VARCHAR(255) NULL , care_site_name VARCHAR(255) NULL ,
@ -543,7 +548,6 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE care_site
WITH (DISTRIBUTION = REPLICATE); WITH (DISTRIBUTION = REPLICATE);
IF XACT_STATE() = 1 COMMIT; CREATE TABLE provider IF XACT_STATE() = 1 COMMIT; CREATE TABLE provider
(provider_id INTEGER NOT NULL , (provider_id INTEGER NOT NULL ,
provider_name VARCHAR(255) NULL , provider_name VARCHAR(255) NULL ,
@ -562,8 +566,6 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE provider
WITH (DISTRIBUTION = REPLICATE); WITH (DISTRIBUTION = REPLICATE);
/************************ /************************
Standardized health economics Standardized health economics
@ -571,6 +573,7 @@ Standardized health economics
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE payer_plan_period IF XACT_STATE() = 1 COMMIT; CREATE TABLE payer_plan_period
(payer_plan_period_id INTEGER NOT NULL , (payer_plan_period_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -620,15 +623,14 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE cost
WITH (DISTRIBUTION = REPLICATE); WITH (DISTRIBUTION = REPLICATE);
/************************ /************************
Standardized derived elements Standardized derived elements
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(subject_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort
(cohort_definition_id INTEGER NOT NULL , (cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL , subject_id INTEGER NOT NULL ,
@ -638,11 +640,12 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort
WITH (DISTRIBUTION = HASH(subject_id)); WITH (DISTRIBUTION = HASH(subject_id));
--HINT DISTRIBUTE_ON_KEY(subject_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort_attribute IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort_attribute
(cohort_definition_id INTEGER NOT NULL , (cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL , cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL , cohort_end_date DATE NOT NULL ,
subject_id INTEGER NOT NULL ,
attribute_definition_id INTEGER NOT NULL , attribute_definition_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_concept_id INTEGER NULL value_as_concept_id INTEGER NULL
@ -650,8 +653,7 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE cohort_attribute
WITH (DISTRIBUTION = HASH(subject_id)); WITH (DISTRIBUTION = HASH(subject_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_era IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_era
(drug_era_id INTEGER NOT NULL , (drug_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -664,6 +666,7 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE drug_era
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE dose_era IF XACT_STATE() = 1 COMMIT; CREATE TABLE dose_era
(dose_era_id INTEGER NOT NULL , (dose_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -676,8 +679,7 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE dose_era
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));
--HINT DISTRIBUTE_ON_KEY(person_id)
IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_era IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_era
(condition_era_id INTEGER NOT NULL , (condition_era_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -687,10 +689,3 @@ IF XACT_STATE() = 1 COMMIT; CREATE TABLE condition_era
condition_occurrence_count INTEGER NULL condition_occurrence_count INTEGER NULL
) )
WITH (DISTRIBUTION = HASH(person_id)); WITH (DISTRIBUTION = HASH(person_id));

View File

@ -167,8 +167,6 @@ ALTER TABLE death ADD CONSTRAINT fpk_death_cause_concept_s FOREIGN KEY (cause_so
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);
@ -186,8 +184,6 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_preceding FOREIGN KEY (pre
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);

View File

@ -207,10 +207,10 @@ CREATE TABLE metadata
metadata_concept_id INTEGER NOT NULL , metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string TEXT NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL metadata_datetime TIMESTAMP NULL
) )
; ;
@ -221,7 +221,7 @@ Standardized clinical data
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE person CREATE TABLE person
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -229,7 +229,7 @@ CREATE TABLE person
year_of_birth INTEGER NOT NULL , year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL, month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL, day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL, birth_datetime TIMESTAMP NULL,
race_concept_id INTEGER NOT NULL, race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL, location_id INTEGER NULL,
@ -246,6 +246,7 @@ CREATE TABLE person
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation_period CREATE TABLE observation_period
( (
observation_period_id INTEGER NOT NULL , observation_period_id INTEGER NOT NULL ,
@ -257,6 +258,7 @@ CREATE TABLE observation_period
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE specimen CREATE TABLE specimen
( (
specimen_id INTEGER NOT NULL , specimen_id INTEGER NOT NULL ,
@ -264,7 +266,7 @@ CREATE TABLE specimen
specimen_concept_id INTEGER NOT NULL , specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL , specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL , specimen_datetime TIMESTAMP NULL ,
quantity NUMERIC NULL , quantity NUMERIC NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL ,
@ -278,12 +280,12 @@ CREATE TABLE specimen
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE death CREATE TABLE death
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
death_date DATE NOT NULL , death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL , death_datetime TIMESTAMP NULL ,
death_type_concept_id INTEGER NOT NULL , death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL , cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL, cause_source_value VARCHAR(50) NULL,
@ -292,38 +294,40 @@ CREATE TABLE death
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_occurrence CREATE TABLE visit_occurrence
( (
visit_occurrence_id INTEGER NOT NULL , visit_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime TIMESTAMP NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime TIMESTAMP NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_detail CREATE TABLE visit_detail
( (
visit_detail_id INTEGER NOT NULL , visit_detail_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL , visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime TIMESTAMP NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime TIMESTAMP NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
care_site_id INTEGER NULL , care_site_id INTEGER NULL ,
@ -340,13 +344,14 @@ CREATE TABLE visit_detail
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE procedure_occurrence CREATE TABLE procedure_occurrence
( (
procedure_occurrence_id INTEGER NOT NULL , procedure_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL , procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NULL , procedure_datetime TIMESTAMP NULL ,
procedure_type_concept_id INTEGER NOT NULL , procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL , modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -360,15 +365,16 @@ CREATE TABLE procedure_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_exposure CREATE TABLE drug_exposure
( (
drug_exposure_id INTEGER NOT NULL , drug_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL , drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL , drug_exposure_start_datetime TIMESTAMP NULL ,
drug_exposure_end_date DATE NOT NULL , drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL , drug_exposure_end_datetime TIMESTAMP NULL ,
verbatim_end_date DATE NULL , verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL , drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
@ -389,15 +395,16 @@ CREATE TABLE drug_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE device_exposure CREATE TABLE device_exposure
( (
device_exposure_id INTEGER NOT NULL , device_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL , device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL , device_exposure_start_datetime TIMESTAMP NULL ,
device_exposure_end_date DATE NULL , device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL , device_exposure_end_datetime TIMESTAMP NULL ,
device_type_concept_id INTEGER NOT NULL , device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL , unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -410,15 +417,16 @@ CREATE TABLE device_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_occurrence CREATE TABLE condition_occurrence
( (
condition_occurrence_id INTEGER NOT NULL , condition_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL , condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL , condition_start_datetime TIMESTAMP NULL ,
condition_end_date DATE NULL , condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL , condition_end_datetime TIMESTAMP NULL ,
condition_type_concept_id INTEGER NOT NULL , condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
@ -432,6 +440,7 @@ CREATE TABLE condition_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE measurement CREATE TABLE measurement
( (
measurement_id INTEGER NOT NULL , measurement_id INTEGER NOT NULL ,
@ -439,7 +448,7 @@ CREATE TABLE measurement
measurement_concept_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL , measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL , measurement_time VARCHAR(10) NULL ,
measurement_datetime DATETIME2 NULL , measurement_datetime TIMESTAMP NULL ,
measurement_type_concept_id INTEGER NOT NULL , measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL , operator_concept_id INTEGER NULL ,
value_as_number NUMERIC NULL , value_as_number NUMERIC NULL ,
@ -458,13 +467,13 @@ CREATE TABLE measurement
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE note CREATE TABLE note
( (
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
note_date DATE NOT NULL , note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL , note_datetime TIMESTAMP NULL ,
note_type_concept_id INTEGER NOT NULL , note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL , note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL , note_title VARCHAR(250) NULL ,
@ -486,13 +495,13 @@ CREATE TABLE note_nlp
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL , nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL , nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL , nlp_datetime TIMESTAMP NULL ,
term_exists VARCHAR(1) NULL , term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL , term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL term_modifiers VARCHAR(2000) NULL
@ -500,14 +509,14 @@ CREATE TABLE note_nlp
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation CREATE TABLE observation
( (
observation_id INTEGER NOT NULL , observation_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL , observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL , observation_datetime TIMESTAMP NULL ,
observation_type_concept_id INTEGER NOT NULL , observation_type_concept_id INTEGER NOT NULL ,
value_as_number NUMERIC NULL , value_as_number NUMERIC NULL ,
value_as_string VARCHAR(60) NULL , value_as_string VARCHAR(60) NULL ,
@ -525,7 +534,6 @@ CREATE TABLE observation
; ;
CREATE TABLE fact_relationship CREATE TABLE fact_relationship
( (
domain_concept_id_1 INTEGER NOT NULL , domain_concept_id_1 INTEGER NOT NULL ,
@ -538,7 +546,6 @@ CREATE TABLE fact_relationship
/************************ /************************
Standardized health system data Standardized health system data
@ -546,7 +553,6 @@ Standardized health system data
************************/ ************************/
CREATE TABLE location CREATE TABLE location
( (
location_id INTEGER NOT NULL , location_id INTEGER NOT NULL ,
@ -561,7 +567,6 @@ CREATE TABLE location
; ;
CREATE TABLE care_site CREATE TABLE care_site
( (
care_site_id INTEGER NOT NULL , care_site_id INTEGER NOT NULL ,
@ -574,7 +579,6 @@ CREATE TABLE care_site
; ;
CREATE TABLE provider CREATE TABLE provider
( (
provider_id INTEGER NOT NULL , provider_id INTEGER NOT NULL ,
@ -594,8 +598,6 @@ CREATE TABLE provider
; ;
/************************ /************************
Standardized health economics Standardized health economics
@ -603,6 +605,7 @@ Standardized health economics
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE payer_plan_period CREATE TABLE payer_plan_period
( (
payer_plan_period_id INTEGER NOT NULL , payer_plan_period_id INTEGER NOT NULL ,
@ -654,15 +657,14 @@ CREATE TABLE cost
; ;
/************************ /************************
Standardized derived elements Standardized derived elements
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(subject_id)
CREATE TABLE cohort CREATE TABLE cohort
( (
cohort_definition_id INTEGER NOT NULL , cohort_definition_id INTEGER NOT NULL ,
@ -673,12 +675,13 @@ CREATE TABLE cohort
; ;
--HINT DISTRIBUTE_ON_KEY(subject_id)
CREATE TABLE cohort_attribute CREATE TABLE cohort_attribute
( (
cohort_definition_id INTEGER NOT NULL , cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL , cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL , cohort_end_date DATE NOT NULL ,
subject_id INTEGER NOT NULL ,
attribute_definition_id INTEGER NOT NULL , attribute_definition_id INTEGER NOT NULL ,
value_as_number NUMERIC NULL , value_as_number NUMERIC NULL ,
value_as_concept_id INTEGER NULL value_as_concept_id INTEGER NULL
@ -686,8 +689,7 @@ CREATE TABLE cohort_attribute
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_era CREATE TABLE drug_era
( (
drug_era_id INTEGER NOT NULL , drug_era_id INTEGER NOT NULL ,
@ -701,6 +703,7 @@ CREATE TABLE drug_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE dose_era CREATE TABLE dose_era
( (
dose_era_id INTEGER NOT NULL , dose_era_id INTEGER NOT NULL ,
@ -714,8 +717,7 @@ CREATE TABLE dose_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_era CREATE TABLE condition_era
( (
condition_era_id INTEGER NOT NULL , condition_era_id INTEGER NOT NULL ,
@ -726,10 +728,3 @@ CREATE TABLE condition_era
condition_occurrence_count INTEGER NULL condition_occurrence_count INTEGER NULL
) )
; ;

View File

@ -193,7 +193,7 @@ CREATE TABLE metadata
(metadata_concept_id INTEGER NOT NULL , (metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string VARCHAR(MAX) NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime TIMESTAMP NULL metadata_datetime TIMESTAMP NULL
@ -289,10 +289,10 @@ CREATE TABLE visit_occurrence
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
@ -468,7 +468,7 @@ CREATE TABLE note_nlp
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,

View File

@ -167,8 +167,6 @@ ALTER TABLE death ADD CONSTRAINT fpk_death_cause_concept_s FOREIGN KEY (cause_so
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);
@ -186,8 +184,6 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_preceding FOREIGN KEY (pre
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_person FOREIGN KEY (person_id) REFERENCES person (person_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept FOREIGN KEY (visit_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_type_concept FOREIGN KEY (visit_type_concept_id) REFERENCES concept (concept_id);
ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_provider FOREIGN KEY (provider_id) REFERENCES provider (provider_id);

View File

@ -207,10 +207,10 @@ CREATE TABLE metadata
metadata_concept_id INTEGER NOT NULL , metadata_concept_id INTEGER NOT NULL ,
metadata_type_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL ,
name VARCHAR(250) NOT NULL , name VARCHAR(250) NOT NULL ,
value_as_string NVARCHAR NULL , value_as_string VARCHAR(MAX) NULL ,
value_as_concept_id INTEGER NULL , value_as_concept_id INTEGER NULL ,
metadata_date DATE NULL , metadata_date DATE NULL ,
metadata_datetime DATETIME2 NULL metadata_datetime DATETIME NULL
) )
; ;
@ -221,7 +221,7 @@ Standardized clinical data
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE person CREATE TABLE person
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
@ -229,7 +229,7 @@ CREATE TABLE person
year_of_birth INTEGER NOT NULL , year_of_birth INTEGER NOT NULL ,
month_of_birth INTEGER NULL, month_of_birth INTEGER NULL,
day_of_birth INTEGER NULL, day_of_birth INTEGER NULL,
birth_datetime DATETIME2 NULL, birth_datetime DATETIME NULL,
race_concept_id INTEGER NOT NULL, race_concept_id INTEGER NOT NULL,
ethnicity_concept_id INTEGER NOT NULL, ethnicity_concept_id INTEGER NOT NULL,
location_id INTEGER NULL, location_id INTEGER NULL,
@ -246,6 +246,7 @@ CREATE TABLE person
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation_period CREATE TABLE observation_period
( (
observation_period_id INTEGER NOT NULL , observation_period_id INTEGER NOT NULL ,
@ -257,6 +258,7 @@ CREATE TABLE observation_period
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE specimen CREATE TABLE specimen
( (
specimen_id INTEGER NOT NULL , specimen_id INTEGER NOT NULL ,
@ -264,7 +266,7 @@ CREATE TABLE specimen
specimen_concept_id INTEGER NOT NULL , specimen_concept_id INTEGER NOT NULL ,
specimen_type_concept_id INTEGER NOT NULL , specimen_type_concept_id INTEGER NOT NULL ,
specimen_date DATE NOT NULL , specimen_date DATE NOT NULL ,
specimen_datetime DATETIME2 NULL , specimen_datetime DATETIME NULL ,
quantity FLOAT NULL , quantity FLOAT NULL ,
unit_concept_id INTEGER NULL , unit_concept_id INTEGER NULL ,
anatomic_site_concept_id INTEGER NULL , anatomic_site_concept_id INTEGER NULL ,
@ -278,12 +280,12 @@ CREATE TABLE specimen
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE death CREATE TABLE death
( (
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
death_date DATE NOT NULL , death_date DATE NOT NULL ,
death_datetime DATETIME2 NULL , death_datetime DATETIME NULL ,
death_type_concept_id INTEGER NOT NULL , death_type_concept_id INTEGER NOT NULL ,
cause_concept_id INTEGER NULL , cause_concept_id INTEGER NULL ,
cause_source_value VARCHAR(50) NULL, cause_source_value VARCHAR(50) NULL,
@ -292,38 +294,40 @@ CREATE TABLE death
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_occurrence CREATE TABLE visit_occurrence
( (
visit_occurrence_id INTEGER NOT NULL , visit_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_concept_id INTEGER NOT NULL , visit_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL, provider_id INTEGER NULL,
care_site_id INTEGER NULL, care_site_id INTEGER NULL,
visit_source_value VARCHAR(50) NULL, visit_source_value VARCHAR(50) NULL,
visit_source_concept_id INTEGER NULL visit_source_concept_id INTEGER NULL ,
admitting_source_concept_id INTEGER NULL , admitting_source_concept_id INTEGER NULL ,
admitting_source_value VARCHAR(50) NULL , admitting_source_value VARCHAR(50) NULL ,
discharge_to_concept_id INTEGER(50) NULL , discharge_to_concept_id INTEGER NULL ,
discharge_to_source_value VARCHAR(50) NULL , discharge_to_source_value VARCHAR(50) NULL ,
preceding_visit_occurrence_id INTEGER NULL preceding_visit_occurrence_id INTEGER NULL
) )
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE visit_detail CREATE TABLE visit_detail
( (
visit_detail_id INTEGER NOT NULL , visit_detail_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
visit_detail_concept_id INTEGER NOT NULL , visit_detail_concept_id INTEGER NOT NULL ,
visit_start_date DATE NOT NULL , visit_start_date DATE NOT NULL ,
visit_start_datetime DATETIME2 NULL , visit_start_datetime DATETIME NULL ,
visit_end_date DATE NOT NULL , visit_end_date DATE NOT NULL ,
visit_end_datetime DATETIME2 NULL , visit_end_datetime DATETIME NULL ,
visit_type_concept_id INTEGER NOT NULL , visit_type_concept_id INTEGER NOT NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
care_site_id INTEGER NULL , care_site_id INTEGER NULL ,
@ -340,13 +344,14 @@ CREATE TABLE visit_detail
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE procedure_occurrence CREATE TABLE procedure_occurrence
( (
procedure_occurrence_id INTEGER NOT NULL , procedure_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
procedure_concept_id INTEGER NOT NULL , procedure_concept_id INTEGER NOT NULL ,
procedure_date DATE NOT NULL , procedure_date DATE NOT NULL ,
procedure_datetime DATETIME2 NULL , procedure_datetime DATETIME NULL ,
procedure_type_concept_id INTEGER NOT NULL , procedure_type_concept_id INTEGER NOT NULL ,
modifier_concept_id INTEGER NULL , modifier_concept_id INTEGER NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -360,15 +365,16 @@ CREATE TABLE procedure_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_exposure CREATE TABLE drug_exposure
( (
drug_exposure_id INTEGER NOT NULL , drug_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
drug_concept_id INTEGER NOT NULL , drug_concept_id INTEGER NOT NULL ,
drug_exposure_start_date DATE NOT NULL , drug_exposure_start_date DATE NOT NULL ,
drug_exposure_start_datetime DATETIME2 NULL , drug_exposure_start_datetime DATETIME NULL ,
drug_exposure_end_date DATE NOT NULL , drug_exposure_end_date DATE NOT NULL ,
drug_exposure_end_datetime DATETIME2 NULL , drug_exposure_end_datetime DATETIME NULL ,
verbatim_end_date DATE NULL , verbatim_end_date DATE NULL ,
drug_type_concept_id INTEGER NOT NULL , drug_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
@ -389,15 +395,16 @@ CREATE TABLE drug_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE device_exposure CREATE TABLE device_exposure
( (
device_exposure_id INTEGER NOT NULL , device_exposure_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
device_concept_id INTEGER NOT NULL , device_concept_id INTEGER NOT NULL ,
device_exposure_start_date DATE NOT NULL , device_exposure_start_date DATE NOT NULL ,
device_exposure_start_datetime DATETIME2 NULL , device_exposure_start_datetime DATETIME NULL ,
device_exposure_end_date DATE NULL , device_exposure_end_date DATE NULL ,
device_exposure_end_datetime DATETIME2 NULL , device_exposure_end_datetime DATETIME NULL ,
device_type_concept_id INTEGER NOT NULL , device_type_concept_id INTEGER NOT NULL ,
unique_device_id VARCHAR(50) NULL , unique_device_id VARCHAR(50) NULL ,
quantity INTEGER NULL , quantity INTEGER NULL ,
@ -410,15 +417,16 @@ CREATE TABLE device_exposure
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_occurrence CREATE TABLE condition_occurrence
( (
condition_occurrence_id INTEGER NOT NULL , condition_occurrence_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
condition_concept_id INTEGER NOT NULL , condition_concept_id INTEGER NOT NULL ,
condition_start_date DATE NOT NULL , condition_start_date DATE NOT NULL ,
condition_start_datetime DATETIME2 NULL , condition_start_datetime DATETIME NULL ,
condition_end_date DATE NULL , condition_end_date DATE NULL ,
condition_end_datetime DATETIME2 NULL , condition_end_datetime DATETIME NULL ,
condition_type_concept_id INTEGER NOT NULL , condition_type_concept_id INTEGER NOT NULL ,
stop_reason VARCHAR(20) NULL , stop_reason VARCHAR(20) NULL ,
provider_id INTEGER NULL , provider_id INTEGER NULL ,
@ -432,6 +440,7 @@ CREATE TABLE condition_occurrence
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE measurement CREATE TABLE measurement
( (
measurement_id INTEGER NOT NULL , measurement_id INTEGER NOT NULL ,
@ -439,7 +448,7 @@ CREATE TABLE measurement
measurement_concept_id INTEGER NOT NULL , measurement_concept_id INTEGER NOT NULL ,
measurement_date DATE NOT NULL , measurement_date DATE NOT NULL ,
measurement_time VARCHAR(10) NULL , measurement_time VARCHAR(10) NULL ,
measurement_datetime DATETIME2 NULL , measurement_datetime DATETIME NULL ,
measurement_type_concept_id INTEGER NOT NULL , measurement_type_concept_id INTEGER NOT NULL ,
operator_concept_id INTEGER NULL , operator_concept_id INTEGER NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
@ -458,13 +467,13 @@ CREATE TABLE measurement
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE note CREATE TABLE note
( (
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
note_date DATE NOT NULL , note_date DATE NOT NULL ,
note_datetime DATETIME2 NULL , note_datetime DATETIME NULL ,
note_type_concept_id INTEGER NOT NULL , note_type_concept_id INTEGER NOT NULL ,
note_class_concept_id INTEGER NOT NULL , note_class_concept_id INTEGER NOT NULL ,
note_title VARCHAR(250) NULL , note_title VARCHAR(250) NULL ,
@ -486,13 +495,13 @@ CREATE TABLE note_nlp
note_id INTEGER NOT NULL , note_id INTEGER NOT NULL ,
section_concept_id INTEGER NULL , section_concept_id INTEGER NULL ,
snippet VARCHAR(250) NULL , snippet VARCHAR(250) NULL ,
offset VARCHAR(250) NULL , "offset" VARCHAR(250) NULL ,
lexical_variant VARCHAR(250) NOT NULL , lexical_variant VARCHAR(250) NOT NULL ,
note_nlp_concept_id INTEGER NULL , note_nlp_concept_id INTEGER NULL ,
note_nlp_source_concept_id INTEGER NULL , note_nlp_source_concept_id INTEGER NULL ,
nlp_system VARCHAR(250) NULL , nlp_system VARCHAR(250) NULL ,
nlp_date DATE NOT NULL , nlp_date DATE NOT NULL ,
nlp_datetime DATETIME2 NULL , nlp_datetime DATETIME NULL ,
term_exists VARCHAR(1) NULL , term_exists VARCHAR(1) NULL ,
term_temporal VARCHAR(50) NULL , term_temporal VARCHAR(50) NULL ,
term_modifiers VARCHAR(2000) NULL term_modifiers VARCHAR(2000) NULL
@ -500,14 +509,14 @@ CREATE TABLE note_nlp
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE observation CREATE TABLE observation
( (
observation_id INTEGER NOT NULL , observation_id INTEGER NOT NULL ,
person_id INTEGER NOT NULL , person_id INTEGER NOT NULL ,
observation_concept_id INTEGER NOT NULL , observation_concept_id INTEGER NOT NULL ,
observation_date DATE NOT NULL , observation_date DATE NOT NULL ,
observation_datetime DATETIME2 NULL , observation_datetime DATETIME NULL ,
observation_type_concept_id INTEGER NOT NULL , observation_type_concept_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_string VARCHAR(60) NULL , value_as_string VARCHAR(60) NULL ,
@ -525,7 +534,6 @@ CREATE TABLE observation
; ;
CREATE TABLE fact_relationship CREATE TABLE fact_relationship
( (
domain_concept_id_1 INTEGER NOT NULL , domain_concept_id_1 INTEGER NOT NULL ,
@ -538,7 +546,6 @@ CREATE TABLE fact_relationship
/************************ /************************
Standardized health system data Standardized health system data
@ -546,7 +553,6 @@ Standardized health system data
************************/ ************************/
CREATE TABLE location CREATE TABLE location
( (
location_id INTEGER NOT NULL , location_id INTEGER NOT NULL ,
@ -561,7 +567,6 @@ CREATE TABLE location
; ;
CREATE TABLE care_site CREATE TABLE care_site
( (
care_site_id INTEGER NOT NULL , care_site_id INTEGER NOT NULL ,
@ -574,7 +579,6 @@ CREATE TABLE care_site
; ;
CREATE TABLE provider CREATE TABLE provider
( (
provider_id INTEGER NOT NULL , provider_id INTEGER NOT NULL ,
@ -594,8 +598,6 @@ CREATE TABLE provider
; ;
/************************ /************************
Standardized health economics Standardized health economics
@ -603,6 +605,7 @@ Standardized health economics
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE payer_plan_period CREATE TABLE payer_plan_period
( (
payer_plan_period_id INTEGER NOT NULL , payer_plan_period_id INTEGER NOT NULL ,
@ -654,15 +657,14 @@ CREATE TABLE cost
; ;
/************************ /************************
Standardized derived elements Standardized derived elements
************************/ ************************/
--HINT DISTRIBUTE_ON_KEY(subject_id)
CREATE TABLE cohort CREATE TABLE cohort
( (
cohort_definition_id INTEGER NOT NULL , cohort_definition_id INTEGER NOT NULL ,
@ -673,12 +675,13 @@ CREATE TABLE cohort
; ;
--HINT DISTRIBUTE_ON_KEY(subject_id)
CREATE TABLE cohort_attribute CREATE TABLE cohort_attribute
( (
cohort_definition_id INTEGER NOT NULL , cohort_definition_id INTEGER NOT NULL ,
subject_id INTEGER NOT NULL ,
cohort_start_date DATE NOT NULL , cohort_start_date DATE NOT NULL ,
cohort_end_date DATE NOT NULL , cohort_end_date DATE NOT NULL ,
subject_id INTEGER NOT NULL ,
attribute_definition_id INTEGER NOT NULL , attribute_definition_id INTEGER NOT NULL ,
value_as_number FLOAT NULL , value_as_number FLOAT NULL ,
value_as_concept_id INTEGER NULL value_as_concept_id INTEGER NULL
@ -686,8 +689,7 @@ CREATE TABLE cohort_attribute
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE drug_era CREATE TABLE drug_era
( (
drug_era_id INTEGER NOT NULL , drug_era_id INTEGER NOT NULL ,
@ -701,6 +703,7 @@ CREATE TABLE drug_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE dose_era CREATE TABLE dose_era
( (
dose_era_id INTEGER NOT NULL , dose_era_id INTEGER NOT NULL ,
@ -714,8 +717,7 @@ CREATE TABLE dose_era
; ;
--HINT DISTRIBUTE_ON_KEY(person_id)
CREATE TABLE condition_era CREATE TABLE condition_era
( (
condition_era_id INTEGER NOT NULL , condition_era_id INTEGER NOT NULL ,
@ -726,10 +728,3 @@ CREATE TABLE condition_era
condition_occurrence_count INTEGER NULL condition_occurrence_count INTEGER NULL
) )
; ;