diff --git a/Impala/DataImport/OMOP_CDM_synpuf_load_Impala.sql b/Impala/DataImport/OMOP_CDM_synpuf_load_Impala.sql index 59c6fa4..ac4a86b 100644 --- a/Impala/DataImport/OMOP_CDM_synpuf_load_Impala.sql +++ b/Impala/DataImport/OMOP_CDM_synpuf_load_Impala.sql @@ -1,6 +1,6 @@ LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_CARE_SITE.csv' OVERWRITE INTO TABLE care_site; LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_CONDITION_OCCURRENCE.csv' OVERWRITE INTO TABLE condition_occurrence; -LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DEATH.csv' OVERWRITE INTO TABLE death; +--LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DEATH.csv' OVERWRITE INTO TABLE death; LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DRUG_EXPOSURE.csv' OVERWRITE INTO TABLE drug_exposure; LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_DEVICE_EXPOSURE.csv' OVERWRITE INTO TABLE device_exposure; LOAD DATA INPATH '${VAR:OMOP_SYNPUF_PATH}/CDM_LOCATION.csv' OVERWRITE INTO TABLE `location`; diff --git a/Impala/OMOP CDM impala ddl.txt b/Impala/OMOP CDM impala ddl.txt index 1378d02..bdb6e6f 100644 --- a/Impala/OMOP CDM impala ddl.txt +++ b/Impala/OMOP CDM impala ddl.txt @@ -43,14 +43,14 @@ Standardized vocabulary CREATE TABLE concept ( - concept_id INTEGER , + concept_id INTEGER , concept_name VARCHAR(255) , - domain_id VARCHAR(20) , + domain_id VARCHAR(20) , vocabulary_id VARCHAR(20) , - concept_class_id VARCHAR(20) , - standard_concept VARCHAR(1) , + concept_class_id VARCHAR(20) , + standard_concept VARCHAR(1) , concept_code VARCHAR(50) , - valid_start_date TIMESTAMP , + valid_start_date TIMESTAMP , valid_end_date TIMESTAMP , invalid_reason VARCHAR(1) ) @@ -58,10 +58,10 @@ CREATE TABLE concept ( CREATE TABLE vocabulary ( - vocabulary_id VARCHAR(20), - vocabulary_name VARCHAR(255), + vocabulary_id VARCHAR(20), + vocabulary_name VARCHAR(255), vocabulary_reference VARCHAR(255), - vocabulary_version VARCHAR(255), + vocabulary_version VARCHAR(255), vocabulary_concept_id INTEGER ) ; @@ -70,7 +70,7 @@ CREATE TABLE vocabulary ( CREATE TABLE domain ( domain_id VARCHAR(20), domain_name VARCHAR(255), - domain_concept_id INTEGER + domain_concept_id INTEGER ) ; @@ -78,7 +78,7 @@ CREATE TABLE domain ( CREATE TABLE concept_class ( concept_class_id VARCHAR(20), concept_class_name VARCHAR(255), - concept_class_concept_id INTEGER + concept_class_concept_id INTEGER ) ; @@ -87,7 +87,7 @@ CREATE TABLE concept_relationship ( concept_id_1 INTEGER , concept_id_2 INTEGER , relationship_id VARCHAR(20), - valid_start_date TIMESTAMP, + valid_start_date TIMESTAMP, valid_end_date TIMESTAMP, invalid_reason VARCHAR(1) ) @@ -95,10 +95,10 @@ CREATE TABLE concept_relationship ( CREATE TABLE relationship ( - relationship_id VARCHAR(20), - relationship_name VARCHAR(255), - is_hierarchical VARCHAR(1), - defines_ancestry VARCHAR(1), + relationship_id VARCHAR(20), + relationship_name VARCHAR(255), + is_hierarchical VARCHAR(1), + defines_ancestry VARCHAR(1), reverse_relationship_id VARCHAR(20), relationship_concept_id INTEGER ) @@ -106,16 +106,16 @@ CREATE TABLE relationship ( CREATE TABLE concept_synonym ( - concept_id INTEGER , - concept_synonym_name STRING, + concept_id INTEGER , + concept_synonym_name STRING, language_concept_id INTEGER ) ; CREATE TABLE concept_ancestor ( - ancestor_concept_id INTEGER , - descendant_concept_id INTEGER , + ancestor_concept_id INTEGER , + descendant_concept_id INTEGER , min_levels_of_separation INTEGER , max_levels_of_separation INTEGER ) @@ -123,54 +123,32 @@ CREATE TABLE concept_ancestor ( CREATE TABLE source_to_concept_map ( - source_code VARCHAR(50), - source_concept_id INTEGER , + source_code VARCHAR(50), + source_concept_id INTEGER , source_vocabulary_id VARCHAR(20), source_code_description VARCHAR(255), - target_concept_id INTEGER , + target_concept_id INTEGER , target_vocabulary_id VARCHAR(20), - valid_start_date TIMESTAMP, - valid_end_date TIMESTAMP, - invalid_reason VARCHAR(1) + valid_start_date TIMESTAMP, + valid_end_date TIMESTAMP, + invalid_reason VARCHAR(1) ) ; CREATE TABLE drug_strength ( - drug_concept_id INTEGER , + drug_concept_id INTEGER , ingredient_concept_id INTEGER , - amount_value FLOAT, + amount_value FLOAT, amount_unit_concept_id INTEGER , - numerator_value FLOAT, - numerator_unit_concept_id INTEGER , - denominator_value FLOAT, - denominator_unit_concept_id INTEGER , - box_size INTEGER , - valid_start_date TIMESTAMP, - valid_end_date TIMESTAMP, - invalid_reason VARCHAR(1) -) -; - - -CREATE TABLE cohort_definition ( - cohort_definition_id INTEGER , - cohort_definition_name VARCHAR(255), - cohort_definition_description STRING, - definition_type_concept_id INTEGER , - cohort_definition_syntax STRING, - subject_concept_id INTEGER , - cohort_initiation_date TIMESTAMP -) -; - - -CREATE TABLE attribute_definition ( - attribute_definition_id INTEGER , - attribute_name VARCHAR(255), - attribute_description STRING, - attribute_type_concept_id INTEGER , - attribute_syntax STRING + numerator_value FLOAT, + numerator_unit_concept_id INTEGER , + denominator_value FLOAT, + denominator_unit_concept_id INTEGER , + box_size INTEGER , + valid_start_date TIMESTAMP, + valid_end_date TIMESTAMP, + invalid_reason VARCHAR(1) ) ; @@ -184,16 +162,16 @@ Standardized meta-data CREATE TABLE cdm_source ( - cdm_source_name VARCHAR(255) , + cdm_source_name VARCHAR(255) , cdm_source_abbreviation VARCHAR(25) , - cdm_holder VARCHAR(255) , - source_description STRING , - source_documentation_reference VARCHAR(255) , - cdm_etl_reference VARCHAR(255) , - source_release_date TIMESTAMP , - cdm_release_date TIMESTAMP , - cdm_version VARCHAR(10) , - vocabulary_version VARCHAR(20) + cdm_holder VARCHAR(255) , + source_description STRING , + source_documentation_reference VARCHAR(255) , + cdm_etl_reference VARCHAR(255) , + source_release_date TIMESTAMP , + cdm_release_date TIMESTAMP , + cdm_version VARCHAR(10) , + vocabulary_version VARCHAR(20) ) ; @@ -210,8 +188,8 @@ CREATE TABLE `metadata` ) ; -INSERT INTO metadata (name, value_as_string) --Added cdm version record -VALUES ('CDM Version', '6.0') +INSERT INTO `metadata` (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record +VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL) ; @@ -225,24 +203,24 @@ Standardized clinical data --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE person ( - person_id BIGINT , --BIGINTs added + person_id BIGINT , --BIGINTs added gender_concept_id INTEGER , - year_of_birth INTEGER , - month_of_birth INTEGER , - day_of_birth INTEGER , - birth_datetime TIMESTAMP , - race_concept_id INTEGER , - ethnicity_concept_id INTEGER , - location_id INTEGER , - provider_id INTEGER , - care_site_id INTEGER , + year_of_birth INTEGER , + month_of_birth INTEGER , + day_of_birth INTEGER , + birth_datetime TIMESTAMP , + race_concept_id INTEGER , + ethnicity_concept_id INTEGER , + location_id BIGINT , + provider_id BIGINT , + care_site_id BIGINT , person_source_value VARCHAR(50), gender_source_value VARCHAR(50), - gender_source_concept_id INTEGER , + gender_source_concept_id INTEGER , race_source_value VARCHAR(50), - race_source_concept_id INTEGER , - ethnicity_source_value VARCHAR(50), - ethnicity_source_concept_id INTEGER + race_source_concept_id INTEGER , + ethnicity_source_value VARCHAR(50), + ethnicity_source_concept_id INTEGER ) ; @@ -250,11 +228,11 @@ CREATE TABLE person --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE observation_period ( - observation_period_id BIGINT , - person_id BIGINT , + observation_period_id BIGINT , + person_id BIGINT , observation_period_start_date TIMESTAMP , - observation_period_end_date TIMESTAMP , - period_type_concept_id INTEGER + observation_period_end_date TIMESTAMP , + period_type_concept_id INTEGER ) ; @@ -262,35 +240,21 @@ CREATE TABLE observation_period --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE specimen ( - specimen_id BIGINT , - person_id BIGINT , - specimen_concept_id INTEGER , + specimen_id BIGINT , + person_id BIGINT , + specimen_concept_id INTEGER , specimen_type_concept_id INTEGER , - specimen_date TIMESTAMP , - specimen_datetime TIMESTAMP , - quantity FLOAT , - unit_concept_id INTEGER , + specimen_date TIMESTAMP , + specimen_datetime TIMESTAMP , + quantity FLOAT , + unit_concept_id INTEGER , anatomic_site_concept_id INTEGER , disease_status_concept_id INTEGER , - specimen_source_id VARCHAR(50) , - specimen_source_value VARCHAR(50) , - unit_source_value VARCHAR(50) , + specimen_source_id VARCHAR(50) , + specimen_source_value VARCHAR(50) , + unit_source_value VARCHAR(50) , anatomic_site_source_value VARCHAR(50) , - disease_status_source_value VARCHAR(50) -) -; - - ---HINT DISTRIBUTE_ON_KEY(person_id) -CREATE TABLE death -( - person_id BIGINT , - death_date TIMESTAMP , - death_datetime TIMESTAMP , - death_type_concept_id INTEGER , - cause_concept_id INTEGER , - cause_source_value VARCHAR(50), - cause_source_concept_id INTEGER + disease_status_source_value VARCHAR(50) ) ; @@ -298,27 +262,27 @@ CREATE TABLE death --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE visit_occurrence ( - visit_occurrence_id BIGINT , - person_id BIGINT , - visit_concept_id INTEGER , - visit_start_date TIMESTAMP , - visit_start_datetime TIMESTAMP , - visit_end_date TIMESTAMP , - visit_end_datetime TIMESTAMP , - visit_type_concept_id INTEGER , - provider_id INTEGER , - care_site_id INTEGER , - visit_source_value VARCHAR(50), - visit_source_concept_id INTEGER , + visit_occurrence_id BIGINT , + person_id BIGINT , + visit_concept_id INTEGER , + visit_start_date TIMESTAMP , + visit_start_datetime TIMESTAMP , + visit_end_date TIMESTAMP , + visit_end_datetime TIMESTAMP , + visit_type_concept_id INTEGER , + provider_id BIGINT , + care_site_id BIGINT , + visit_source_value VARCHAR(50), + visit_source_concept_id INTEGER , admitted_from_concept_id INTEGER , /*Changed from admitting_source_* */ admitted_from_source_value VARCHAR(50), - discharge_to_source_value VARCHAR(50) , - discharge_to_concept_id INTEGER , + discharge_to_source_value VARCHAR(50) , + discharge_to_concept_id INTEGER , preceding_visit_occurrence_id INTEGER ) ; ---todo admitting 'source' + --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE visit_detail ( @@ -330,8 +294,8 @@ CREATE TABLE visit_detail visit_detail_end_date TIMESTAMP , visit_detail_end_datetime TIMESTAMP , visit_detail_type_concept_id INTEGER , - provider_id INTEGER , - care_site_id INTEGER , + provider_id BIGINT , + care_site_id BIGINT , discharge_to_concept_id INTEGER , admitted_from_concept_id INTEGER , /*Changed from admitting_source_* */ admitted_from_source_value VARCHAR(50) , @@ -348,20 +312,20 @@ CREATE TABLE visit_detail --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE procedure_occurrence ( - procedure_occurrence_id BIGINT , - person_id BIGINT , - procedure_concept_id INTEGER , - procedure_date TIMESTAMP , - procedure_datetime TIMESTAMP , + procedure_occurrence_id BIGINT , + person_id BIGINT , + procedure_concept_id INTEGER , + procedure_date TIMESTAMP , + procedure_datetime TIMESTAMP , procedure_type_concept_id INTEGER , - modifier_concept_id INTEGER , - quantity INTEGER , - provider_id INTEGER , - visit_occurrence_id INTEGER , - visit_detail_id INTEGER , - procedure_source_value VARCHAR(50) , + modifier_concept_id INTEGER , + quantity INTEGER , + provider_id BIGINT , + visit_occurrence_id BIGINT , + visit_detail_id BIGINT , + procedure_source_value VARCHAR(50) , procedure_source_concept_id INTEGER , - modifier_source_value VARCHAR(50) , + modifier_source_value VARCHAR(50) ) ; @@ -369,29 +333,29 @@ CREATE TABLE procedure_occurrence --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE drug_exposure ( - drug_exposure_id BIGINT , - person_id BIGINT , - drug_concept_id INTEGER , - drug_exposure_start_date TIMESTAMP , + drug_exposure_id BIGINT , + person_id BIGINT , + drug_concept_id INTEGER , + drug_exposure_start_date TIMESTAMP , drug_exposure_start_datetime TIMESTAMP , - drug_exposure_end_date TIMESTAMP , - drug_exposure_end_datetime TIMESTAMP , - verbatim_end_date TIMESTAMP , - drug_type_concept_id INTEGER , - stop_reason VARCHAR(20) , - refills INTEGER , - quantity FLOAT , - days_supply INTEGER , - sig STRING , - route_concept_id INTEGER , - lot_number VARCHAR(50) , - provider_id INTEGER , - visit_occurrence_id INTEGER , - visit_detail_id INTEGER , - drug_source_value VARCHAR(50) , - drug_source_concept_id INTEGER , - route_source_value VARCHAR(50) , - dose_unit_source_value VARCHAR(50) + drug_exposure_end_date TIMESTAMP , + drug_exposure_end_datetime TIMESTAMP , + verbatim_end_date TIMESTAMP , + drug_type_concept_id INTEGER , + stop_reason VARCHAR(20) , + refills INTEGER , + quantity FLOAT , + days_supply INTEGER , + sig STRING , + route_concept_id INTEGER , + lot_number VARCHAR(50) , + provider_id BIGINT , + visit_occurrence_id BIGINT , + visit_detail_id BIGINT , + drug_source_value VARCHAR(50) , + drug_source_concept_id INTEGER , + route_source_value VARCHAR(50) , + dose_unit_source_value VARCHAR(50) ) ; @@ -399,21 +363,21 @@ CREATE TABLE drug_exposure --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE device_exposure ( - device_exposure_id BIGINT , - person_id BIGINT , - device_concept_id INTEGER , - device_exposure_start_date TIMESTAMP , + device_exposure_id BIGINT , + person_id BIGINT , + device_concept_id INTEGER , + device_exposure_start_date TIMESTAMP , device_exposure_start_datetime TIMESTAMP , - device_exposure_end_date TIMESTAMP , + device_exposure_end_date TIMESTAMP , device_exposure_end_datetime TIMESTAMP , - device_type_concept_id INTEGER , - unique_device_id VARCHAR(50) , - quantity INTEGER , - provider_id INTEGER , - visit_occurrence_id INTEGER , - visit_detail_id INTEGER , - device_source_value VARCHAR(100) , - device_source_concept_id INTEGER + device_type_concept_id INTEGER , + unique_device_id VARCHAR(50) , + quantity INTEGER , + provider_id BIGINT , + visit_occurrence_id BIGINT , + visit_detail_id BIGINT , + device_source_value VARCHAR(100) , + device_source_concept_id INTEGER ) ; @@ -422,21 +386,21 @@ CREATE TABLE device_exposure CREATE TABLE condition_occurrence ( condition_occurrence_id BIGINT , - person_id BIGINT , + person_id BIGINT , condition_concept_id INTEGER , condition_start_date TIMESTAMP , - condition_start_datetime TIMESTAMP , - condition_end_date TIMESTAMP , + condition_start_datetime TIMESTAMP , + condition_end_date TIMESTAMP , condition_end_datetime TIMESTAMP , - condition_type_concept_id INTEGER , - condition_status_concept_id INTEGER , - stop_reason VARCHAR(20) , - provider_id INTEGER , - visit_occurrence_id INTEGER , - visit_detail_id INTEGER , + condition_type_concept_id INTEGER , + condition_status_concept_id INTEGER , + stop_reason VARCHAR(20) , + provider_id BIGINT , + visit_occurrence_id BIGINT , + visit_detail_id BIGINT , condition_source_value VARCHAR(50) , - condition_source_concept_id INTEGER , - condition_status_source_value VARCHAR(50) + condition_source_concept_id INTEGER , + condition_status_source_value VARCHAR(50) ) ; @@ -444,26 +408,26 @@ CREATE TABLE condition_occurrence --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE measurement ( - measurement_id BIGINT , - person_id BIGINT , + measurement_id BIGINT , + person_id BIGINT , measurement_concept_id INTEGER , - measurement_date TIMESTAMP , + measurement_date TIMESTAMP , measurement_datetime TIMESTAMP , - measurement_time VARCHAR(10), - measurement_type_concept_id INTEGER , - operator_concept_id INTEGER , - value_as_number FLOAT , - value_as_concept_id INTEGER , - unit_concept_id INTEGER , - range_low FLOAT , - range_high FLOAT , - provider_id INTEGER , - visit_occurrence_id INTEGER , - visit_detail_id INTEGER , - measurement_source_value VARCHAR(50) , - measurement_source_concept_id INTEGER , - unit_source_value VARCHAR(50) , - value_source_value VARCHAR(50) + measurement_time VARCHAR(10), + measurement_type_concept_id INTEGER , + operator_concept_id INTEGER , + value_as_number FLOAT , + value_as_concept_id INTEGER , + unit_concept_id INTEGER , + range_low FLOAT , + range_high FLOAT , + provider_id BIGINT , + visit_occurrence_id BIGINT , + visit_detail_id BIGINT , + measurement_source_value VARCHAR(50) , + measurement_source_concept_id INTEGER , + unit_source_value VARCHAR(50) , + value_source_value VARCHAR(50) ) ; @@ -471,44 +435,42 @@ CREATE TABLE measurement --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE note ( - note_id BIGINT , - person_id BIGINT , - note_event_id BIGINT , --This and the field below added - note_domain_id VARCHAR(20) , --This field may be removed in favor of the one below ---note_event_table_concept_id INTEGER , --This may be added based on 9/4 meeting - note_date TIMESTAMP , + note_id BIGINT , + person_id BIGINT , + note_event_id BIGINT , + note_event_field_concept_id INTEGER , + note_date TIMESTAMP , note_datetime TIMESTAMP , - note_type_concept_id INTEGER , - note_class_concept_id INTEGER , - note_title VARCHAR(250) , - note_text STRING , - encoding_concept_id INTEGER , - language_concept_id INTEGER , - provider_id INTEGER , - visit_occurrence_id INTEGER , - visit_detail_id INTEGER , - note_source_value VARCHAR(50) + note_type_concept_id INTEGER , + note_class_concept_id INTEGER , + note_title VARCHAR(250) , + note_text STRING , + encoding_concept_id INTEGER , + language_concept_id INTEGER , + provider_id BIGINT , + visit_occurrence_id BIGINT , + visit_detail_id BIGINT , + note_source_value VARCHAR(50) ) ; - CREATE TABLE note_nlp ( - note_nlp_id BIGINT , - note_id BIGINT , - section_concept_id INTEGER , - snippet VARCHAR(250) , - `offset` VARCHAR(250) , - lexical_variant VARCHAR(250) , - note_nlp_concept_id INTEGER , - nlp_system VARCHAR(250) , - nlp_date TIMESTAMP , - nlp_datetime TIMESTAMP , - term_exists VARCHAR(1) , - term_temporal VARCHAR(50) , - term_modifiers VARCHAR(2000) , - note_nlp_source_concept_id INTEGER + note_nlp_id BIGINT , + note_id BIGINT , + section_concept_id INTEGER , + snippet VARCHAR(250) , + `offset` VARCHAR(250) , + lexical_variant VARCHAR(250) , + note_nlp_concept_id INTEGER , + nlp_system VARCHAR(250) , + nlp_date TIMESTAMP , + nlp_datetime TIMESTAMP , + term_exists VARCHAR(1) , + term_temporal VARCHAR(50) , + term_modifiers VARCHAR(2000) , + note_nlp_source_concept_id INTEGER ) ; @@ -516,57 +478,56 @@ CREATE TABLE note_nlp --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE observation ( - observation_id BIGINT , - person_id BIGINT , - observation_concept_id INTEGER , - observation_date TIMESTAMP , - observation_datetime TIMESTAMP , + observation_id BIGINT , + person_id BIGINT , + observation_concept_id INTEGER , + observation_date TIMESTAMP , + observation_datetime TIMESTAMP , observation_type_concept_id INTEGER , - value_as_number FLOAT , - value_as_string VARCHAR(60) , - value_as_concept_id INTEGER , - qualifier_concept_id INTEGER , - unit_concept_id INTEGER , - provider_id INTEGER , - visit_occurrence_id BIGINT , + value_as_number FLOAT , + value_as_string VARCHAR(60) , + value_as_concept_id INTEGER , + qualifier_concept_id INTEGER , + unit_concept_id INTEGER , + provider_id BIGINT , + visit_occurrence_id BIGINT , visit_detail_id BIGINT , observation_source_value VARCHAR(50) , observation_source_concept_id INTEGER , - unit_source_value VARCHAR(50) , - qualifier_source_value VARCHAR(50) , - observation_event_id BIGINT , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/ - observation_event_domain_id VARCHAR(20) , - --obs_event_table_concept_id INTEGER , /* Changed name to comply with COST and NOTE. This should be 'Survey'. Had to use 'obs' for oracle restriction, may be added on 9/4*/ - value_as_datetime TIMESTAMP + unit_source_value VARCHAR(50) , + qualifier_source_value VARCHAR(50) , + observation_event_id BIGINT , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/ + obs_event_field_concept_id INTEGER , /* Changed name to comply with COST and NOTE. This should be 'Survey'. Had to use 'obs' for oracle restriction, may be added on 9/4*/ + value_as_datetime TIMESTAMP ) ; CREATE TABLE survey_conduct ( - survey_conduct_id BIGINT , - person_id BIGINT , - survey_concept_id INTEGER , - survey_start_date TIMESTAMP , - survey_start_datetime TIMESTAMP , - survey_end_date TIMESTAMP , - survey_end_datetime TIMESTAMP , - provider_id BIGINT , - assisted_concept_id INTEGER , - respondent_type_concept_id INTEGER , - timing_concept_id INTEGER , + survey_conduct_id BIGINT , + person_id BIGINT , + survey_concept_id INTEGER , + survey_start_date TIMESTAMP , + survey_start_datetime TIMESTAMP , + survey_end_date TIMESTAMP , + survey_end_datetime TIMESTAMP , + provider_id BIGINT , + assisted_concept_id INTEGER , + respondent_type_concept_id INTEGER , + timing_concept_id INTEGER , collection_method_concept_id INTEGER , - assisted_source_value VARCHAR(50) , + assisted_source_value VARCHAR(50) , respondent_type_source_value VARCHAR(100) , - timing_source_value VARCHAR(100) , + timing_source_value VARCHAR(100) , collection_method_source_value VARCHAR(100) , - survey_source_value VARCHAR(100) , - survey_source_concept_id INTEGER , - survey_source_identifier VARCHAR(100) , - validated_survey_concept_id INTEGER , + survey_source_value VARCHAR(100) , + survey_source_concept_id INTEGER , + survey_source_identifier VARCHAR(100) , + validated_survey_concept_id INTEGER , validated_survey_source_value VARCHAR(100) , - survey_version_number VARCHAR(20) , - visit_occurrence_id BIGINT , + survey_version_number VARCHAR(20) , + visit_occurrence_id BIGINT , visit_detail_id BIGINT , response_to_visit_occurrence_id BIGINT ) @@ -577,10 +538,10 @@ CREATE TABLE survey_conduct CREATE TABLE fact_relationship ( domain_concept_id_1 INTEGER , - fact_id_1 BIGINT , + fact_id_1 BIGINT , domain_concept_id_2 INTEGER , - fact_id_2 BIGINT , - relationship_concept_id INTEGER + fact_id_2 BIGINT , + relationship_concept_id INTEGER ) ; @@ -593,17 +554,17 @@ Standardized health system data ************************/ -CREATE TABLE location +CREATE TABLE `location` ( location_id BIGINT , address_1 VARCHAR(50) , address_2 VARCHAR(50) , - city VARCHAR(50) , - state VARCHAR(2) , - zip VARCHAR(9) , - county VARCHAR(20) , - country VARCHAR(100) , - location_source_value VARCHAR(50) , + city VARCHAR(50) , + state VARCHAR(2) , + zip VARCHAR(9) , + county VARCHAR(20) , + country VARCHAR(100) , + location_source_value VARCHAR(50) , latitude FLOAT , longitude FLOAT ) @@ -612,42 +573,42 @@ CREATE TABLE location CREATE TABLE location_history ( location_history_id BIGINT , - location_id BIGINT , + location_id BIGINT , relationship_type_concept_id INTEGER , --Recent addition based on github discussion - domain_id VARCHAR(50) , - entity_id BIGINT , - start_date TIMESTAMP , - end_date TIMESTAMP + domain_id VARCHAR(50) , + entity_id BIGINT , + start_date TIMESTAMP , + end_date TIMESTAMP ) ; CREATE TABLE care_site ( - care_site_id BIGINT , - care_site_name VARCHAR(255) , - place_of_service_concept_id INTEGER , - location_id BIGINT , - care_site_source_value VARCHAR(50) , - place_of_service_source_value VARCHAR(50) + care_site_id BIGINT , + care_site_name VARCHAR(255) , + place_of_service_concept_id INTEGER , + location_id BIGINT , + care_site_source_value VARCHAR(50) , + place_of_service_source_value VARCHAR(50) ) ; CREATE TABLE provider ( - provider_id BIGINT , - provider_name VARCHAR(255) , - NPI VARCHAR(20) , - DEA VARCHAR(20) , - specialty_concept_id INTEGER , - care_site_id BIGINT , - year_of_birth INTEGER , - gender_concept_id INTEGER , - provider_source_value VARCHAR(50) , - specialty_source_value VARCHAR(50) , + provider_id BIGINT , + provider_name VARCHAR(255) , + NPI VARCHAR(20) , + DEA VARCHAR(20) , + specialty_concept_id INTEGER , + care_site_id BIGINT , + year_of_birth INTEGER , + gender_concept_id INTEGER , + provider_source_value VARCHAR(50) , + specialty_source_value VARCHAR(50) , specialty_source_concept_id INTEGER , - gender_source_value VARCHAR(50) , + gender_source_value VARCHAR(50) , gender_source_concept_id INTEGER ) ; @@ -663,25 +624,25 @@ Standardized health economics --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE payer_plan_period ( - payer_plan_period_id BIGINT , - person_id BIGINT , + payer_plan_period_id BIGINT , + person_id BIGINT , contract_person_id BIGINT , payer_plan_period_start_date TIMESTAMP , - payer_plan_period_end_date TIMESTAMP , + payer_plan_period_end_date TIMESTAMP , payer_concept_id INTEGER , plan_concept_id INTEGER , contract_concept_id INTEGER , sponsor_concept_id INTEGER , stop_reason_concept_id INTEGER , - payer_source_value VARCHAR(50) , + payer_source_value VARCHAR(50) , payer_source_concept_id INTEGER , - plan_source_value VARCHAR(50) , + plan_source_value VARCHAR(50) , plan_source_concept_id INTEGER , contract_source_value VARCHAR(50) , contract_source_concept_id INTEGER , sponsor_source_value VARCHAR(50) , sponsor_source_concept_id INTEGER , - family_source_value VARCHAR(50) , + family_source_value VARCHAR(50) , stop_reason_source_value VARCHAR(50) , stop_reason_source_concept_id INTEGER ) @@ -690,23 +651,22 @@ CREATE TABLE payer_plan_period CREATE TABLE cost ( - cost_id BIGINT , - person_id BIGINT, - cost_event_id BIGINT , - cost_domain_id VARCHAR(20) , ---cost_event_table_concept_id INTEGER , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/ - cost_concept_id INTEGER , - cost_type_concept_id INTEGER , - currency_concept_id INTEGER , - cost FLOAT , - incurred_date TIMESTAMP , - billed_date TIMESTAMP , - paid_date TIMESTAMP , + cost_id BIGINT , + person_id BIGINT, + cost_event_id BIGINT , + cost_event_field_concept_id INTEGER , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/ + cost_concept_id INTEGER , + cost_type_concept_id INTEGER , + currency_concept_id INTEGER , + cost FLOAT , + incurred_date TIMESTAMP , + billed_date TIMESTAMP , + paid_date TIMESTAMP , revenue_code_concept_id INTEGER , - drg_concept_id INTEGER , - cost_source_value VARCHAR(50) , - cost_source_concept_id INTEGER , - revenue_code_source_value VARCHAR(50) , + drg_concept_id INTEGER , + cost_source_value VARCHAR(50) , + cost_source_concept_id INTEGER , + revenue_code_source_value VARCHAR(50) , drg_source_value VARCHAR(3) , payer_plan_period_id BIGINT ) @@ -720,41 +680,16 @@ Standardized derived elements ************************/ ---HINT DISTRIBUTE_ON_KEY(subject_id) -CREATE TABLE cohort -( - cohort_definition_id BIGINT , - subject_id BIGINT , - cohort_start_date TIMESTAMP , - cohort_end_date TIMESTAMP -) -; - - ---HINT DISTRIBUTE_ON_KEY(subject_id) -CREATE TABLE cohort_attribute -( - cohort_definition_id BIGINT , - subject_id BIGINT , - cohort_start_date TIMESTAMP , - cohort_end_date TIMESTAMP , - attribute_definition_id BIGINT , - value_as_number FLOAT , - value_as_concept_id INTEGER -) -; - - --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE drug_era ( - drug_era_id BIGINT , - person_id BIGINT , - drug_concept_id INTEGER , + drug_era_id BIGINT , + person_id BIGINT , + drug_concept_id INTEGER , drug_era_start_date TIMESTAMP , drug_era_end_date TIMESTAMP , drug_exposure_count INTEGER , - gap_days INTEGER + gap_days INTEGER ) ; @@ -762,12 +697,12 @@ CREATE TABLE drug_era --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE dose_era ( - dose_era_id BIGINT , - person_id BIGINT , - drug_concept_id INTEGER , - unit_concept_id INTEGER , - dose_value FLOAT , - dose_era_start_date TIMESTAMP , + dose_era_id BIGINT , + person_id BIGINT , + drug_concept_id INTEGER , + unit_concept_id INTEGER , + dose_value FLOAT , + dose_era_start_date TIMESTAMP , dose_era_end_date TIMESTAMP ) ; @@ -776,11 +711,11 @@ CREATE TABLE dose_era --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE condition_era ( - condition_era_id BIGINT , - person_id BIGINT , - condition_concept_id INTEGER , + condition_era_id BIGINT , + person_id BIGINT , + condition_concept_id INTEGER , condition_era_start_date TIMESTAMP , - condition_era_end_date TIMESTAMP , + condition_era_end_date TIMESTAMP , condition_occurrence_count INTEGER ) ; diff --git a/Impala/README.md b/Impala/README.md index 3b64926..92547d1 100644 --- a/Impala/README.md +++ b/Impala/README.md @@ -11,10 +11,11 @@ In order to create your instantiation of the Common Data Model, we recommend fol impala-shell -q 'CREATE DATABASE omop_cdm' ``` -2. Execute the script `OMOP CDM impala ddl.txt` (you will need to convert it to a sql file first) to create the tables and fields. +2. Execute the scripts `OMOP CDM impala ddl.txt` and `OMOP CDM Results impala ddl.txt` (you will need to convert them to sql files first) to create the tables and fields. ```bash impala-shell -d omop_cdm -f OMOP_CDM_impala_ddl.sql +impala-shell -d omop_cdm -f OMOP_CDM_Results_impala_ddl.sql ``` 3. Load your data into the schema. @@ -42,6 +43,7 @@ hadoop fs -put synpuf synpuf hadoop fs -chmod +w synpuf impala-shell -d omop_cdm -f DataImport/OMOP_CDM_synpuf_load_Impala.sql --var=OMOP_SYNPUF_PATH=/user/$USER/synpuf ``` +* Note that these tables are in CDM v5.2.2 format 4. Convert to Parquet format. diff --git a/Netezza/OMOP CDM netezza ddl.txt b/Netezza/OMOP CDM netezza ddl.txt index 9789bc0..ef7c8a2 100644 --- a/Netezza/OMOP CDM netezza ddl.txt +++ b/Netezza/OMOP CDM netezza ddl.txt @@ -44,16 +44,16 @@ Standardized vocabulary --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept ( - concept_id INTEGER NOT NULL , - concept_name VARCHAR(255) NOT NULL , - domain_id VARCHAR(20) NOT NULL , - vocabulary_id VARCHAR(20) NOT NULL , - concept_class_id VARCHAR(20) NOT NULL , - standard_concept VARCHAR(1) NULL , - concept_code VARCHAR(50) NOT NULL , - valid_start_date DATE NOT NULL , - valid_end_date DATE NOT NULL , - invalid_reason VARCHAR(1) NULL + concept_id INTEGER NOT NULL , + concept_name VARCHAR(255) NOT NULL , + domain_id VARCHAR(20) NOT NULL , + vocabulary_id VARCHAR(20) NOT NULL , + concept_class_id VARCHAR(20) NOT NULL , + standard_concept VARCHAR(1) NULL , + concept_code VARCHAR(50) NOT NULL , + valid_start_date DATE NOT NULL , + valid_end_date DATE NOT NULL , + invalid_reason VARCHAR(1) NULL ) DISTRIBUTE ON RANDOM ; @@ -61,11 +61,11 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE vocabulary ( - vocabulary_id VARCHAR(20) NOT NULL, - vocabulary_name VARCHAR(255) NOT NULL, - vocabulary_reference VARCHAR(255) NOT NULL, - vocabulary_version VARCHAR(255) NOT NULL, - vocabulary_concept_id INTEGER NOT NULL + vocabulary_id VARCHAR(20) NOT NULL, + vocabulary_name VARCHAR(255) NOT NULL, + vocabulary_reference VARCHAR(255) NOT NULL, + vocabulary_version VARCHAR(255) NOT NULL, + vocabulary_concept_id INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; @@ -73,9 +73,9 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE domain ( - domain_id VARCHAR(20) NOT NULL, - domain_name VARCHAR(255) NOT NULL, - domain_concept_id INTEGER NOT NULL + domain_id VARCHAR(20) NOT NULL, + domain_name VARCHAR(255) NOT NULL, + domain_concept_id INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; @@ -83,9 +83,9 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_class ( - concept_class_id VARCHAR(20) NOT NULL, - concept_class_name VARCHAR(255) NOT NULL, - concept_class_concept_id INTEGER NOT NULL + concept_class_id VARCHAR(20) NOT NULL, + concept_class_name VARCHAR(255) NOT NULL, + concept_class_concept_id INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; @@ -93,12 +93,12 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_relationship ( - concept_id_1 INTEGER NOT NULL, - concept_id_2 INTEGER NOT NULL, - relationship_id VARCHAR(20) NOT NULL, - valid_start_date DATE NOT NULL, - valid_end_date DATE NOT NULL, - invalid_reason VARCHAR(1) NULL + concept_id_1 INTEGER NOT NULL, + concept_id_2 INTEGER NOT NULL, + relationship_id VARCHAR(20) NOT NULL, + valid_start_date DATE NOT NULL, + valid_end_date DATE NOT NULL, + invalid_reason VARCHAR(1) NULL ) DISTRIBUTE ON RANDOM ; @@ -106,12 +106,12 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE relationship ( - relationship_id VARCHAR(20) NOT NULL, - relationship_name VARCHAR(255) NOT NULL, - is_hierarchical VARCHAR(1) NOT NULL, - defines_ancestry VARCHAR(1) NOT NULL, - reverse_relationship_id VARCHAR(20) NOT NULL, - relationship_concept_id INTEGER NOT NULL + relationship_id VARCHAR(20) NOT NULL, + relationship_name VARCHAR(255) NOT NULL, + is_hierarchical VARCHAR(1) NOT NULL, + defines_ancestry VARCHAR(1) NOT NULL, + reverse_relationship_id VARCHAR(20) NOT NULL, + relationship_concept_id INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; @@ -119,9 +119,9 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_synonym ( - concept_id INTEGER NOT NULL, - concept_synonym_name VARCHAR(1000) NOT NULL, - language_concept_id INTEGER NOT NULL + concept_id INTEGER NOT NULL, + concept_synonym_name VARCHAR(1000) NOT NULL, + language_concept_id INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; @@ -129,10 +129,10 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_ancestor ( - ancestor_concept_id INTEGER NOT NULL, - descendant_concept_id INTEGER NOT NULL, - min_levels_of_separation INTEGER NOT NULL, - max_levels_of_separation INTEGER NOT NULL + ancestor_concept_id INTEGER NOT NULL, + descendant_concept_id INTEGER NOT NULL, + min_levels_of_separation INTEGER NOT NULL, + max_levels_of_separation INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; @@ -140,15 +140,15 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE source_to_concept_map ( - source_code VARCHAR(50) NOT NULL, - source_concept_id INTEGER NOT NULL, - source_vocabulary_id VARCHAR(20) NOT NULL, - source_code_description VARCHAR(255) NULL, - target_concept_id INTEGER NOT NULL, - target_vocabulary_id VARCHAR(20) NOT NULL, - valid_start_date DATE NOT NULL, - valid_end_date DATE NOT NULL, - invalid_reason VARCHAR(1) NULL + source_code VARCHAR(50) NOT NULL, + source_concept_id INTEGER NOT NULL, + source_vocabulary_id VARCHAR(20) NOT NULL, + source_code_description VARCHAR(255) NULL, + target_concept_id INTEGER NOT NULL, + target_vocabulary_id VARCHAR(20) NOT NULL, + valid_start_date DATE NOT NULL, + valid_end_date DATE NOT NULL, + invalid_reason VARCHAR(1) NULL ) DISTRIBUTE ON RANDOM ; @@ -156,44 +156,18 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE drug_strength ( - drug_concept_id INTEGER NOT NULL, - ingredient_concept_id INTEGER NOT NULL, - amount_value REAL NULL, - amount_unit_concept_id INTEGER NULL, - numerator_value REAL NULL, - numerator_unit_concept_id INTEGER NULL, - denominator_value REAL NULL, - denominator_unit_concept_id INTEGER NULL, - box_size INTEGER NULL, - valid_start_date DATE NOT NULL, - valid_end_date DATE NOT NULL, - invalid_reason VARCHAR(1) NULL -) -DISTRIBUTE ON RANDOM -; - - ---HINT DISTRIBUTE ON RANDOM -CREATE TABLE cohort_definition ( - cohort_definition_id INTEGER NOT NULL, - cohort_definition_name VARCHAR(255) NOT NULL, - cohort_definition_description VARCHAR(1000) NULL, - definition_type_concept_id INTEGER NOT NULL, - cohort_definition_syntax VARCHAR(1000) NULL, - subject_concept_id INTEGER NOT NULL, - cohort_initiation_date DATE NULL -) -DISTRIBUTE ON RANDOM -; - - ---HINT DISTRIBUTE ON RANDOM -CREATE TABLE attribute_definition ( - attribute_definition_id INTEGER NOT NULL, - attribute_name VARCHAR(255) NOT NULL, - attribute_description VARCHAR(1000) NULL, - attribute_type_concept_id INTEGER NOT NULL, - attribute_syntax VARCHAR(1000) NULL + drug_concept_id INTEGER NOT NULL, + ingredient_concept_id INTEGER NOT NULL, + amount_value REAL NULL, + amount_unit_concept_id INTEGER NULL, + numerator_value REAL NULL, + numerator_unit_concept_id INTEGER NULL, + denominator_value REAL NULL, + denominator_unit_concept_id INTEGER NULL, + box_size INTEGER NULL, + valid_start_date DATE NOT NULL, + valid_end_date DATE NOT NULL, + invalid_reason VARCHAR(1) NULL ) DISTRIBUTE ON RANDOM ; @@ -209,16 +183,16 @@ Standardized meta-data --HINT DISTRIBUTE ON RANDOM CREATE TABLE cdm_source ( - cdm_source_name VARCHAR(255) NOT NULL , - cdm_source_abbreviation VARCHAR(25) NULL , - cdm_holder VARCHAR(255) NULL , - source_description VARCHAR(1000) NULL , - source_documentation_reference VARCHAR(255) NULL , - cdm_etl_reference VARCHAR(255) NULL , - source_release_date DATE NULL , - cdm_release_date DATE NULL , - cdm_version VARCHAR(10) NULL , - vocabulary_version VARCHAR(20) NULL + cdm_source_name VARCHAR(255) NOT NULL , + cdm_source_abbreviation VARCHAR(25) NULL , + cdm_holder VARCHAR(255) NULL , + source_description VARCHAR(1000) NULL , + source_documentation_reference VARCHAR(255) NULL , + cdm_etl_reference VARCHAR(255) NULL , + source_release_date DATE NULL , + cdm_release_date DATE NULL , + cdm_version VARCHAR(10) NULL , + vocabulary_version VARCHAR(20) NULL ) DISTRIBUTE ON RANDOM ; @@ -238,8 +212,8 @@ CREATE TABLE metadata DISTRIBUTE ON RANDOM ; -INSERT INTO metadata (name, value_as_string) --Added cdm version record -VALUES ('CDM Version', '6.0') +INSERT INTO metadata (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record +VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL) ; @@ -253,103 +227,88 @@ Standardized clinical data --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE person ( - person_id BIGINT NOT NULL , --BIGINTs added - gender_concept_id INTEGER NOT NULL , - year_of_birth INTEGER NOT NULL , - month_of_birth INTEGER NULL, - day_of_birth INTEGER NULL, - birth_datetime DATETIME NULL, - race_concept_id INTEGER NOT NULL, - ethnicity_concept_id INTEGER NOT NULL, - location_id INTEGER NULL, - provider_id INTEGER NULL, - care_site_id INTEGER NULL, - person_source_value VARCHAR(50) NULL, - gender_source_value VARCHAR(50) NULL, - gender_source_concept_id INTEGER NULL, - race_source_value VARCHAR(50) NULL, - race_source_concept_id INTEGER NULL, - ethnicity_source_value VARCHAR(50) NULL, - ethnicity_source_concept_id INTEGER NULL + person_id BIGINT NOT NULL , --BIGINTs added + gender_concept_id INTEGER NOT NULL , + year_of_birth INTEGER NOT NULL , + month_of_birth INTEGER NULL, + day_of_birth INTEGER NULL, + birth_datetime DATETIME NULL, + race_concept_id INTEGER NOT NULL, + ethnicity_concept_id INTEGER NOT NULL, + location_id BIGINT NULL, + provider_id BIGINT NULL, + care_site_id BIGINT NULL, + person_source_value VARCHAR(50) NULL, + gender_source_value VARCHAR(50) NULL, + gender_source_concept_id INTEGER NULL, + race_source_value VARCHAR(50) NULL, + race_source_concept_id INTEGER NULL, + ethnicity_source_value VARCHAR(50) NULL, + ethnicity_source_concept_id INTEGER NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE observation_period ( - observation_period_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - observation_period_start_date DATE NOT NULL , - observation_period_end_date DATE NOT NULL , - period_type_concept_id INTEGER NOT NULL + observation_period_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + observation_period_start_date DATE NOT NULL , + observation_period_end_date DATE NOT NULL , + period_type_concept_id INTEGER NOT NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE specimen ( - specimen_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - specimen_concept_id INTEGER NOT NULL , - specimen_type_concept_id INTEGER NOT NULL , - specimen_date DATE NULL , - specimen_datetime DATETIME NOT NULL , - quantity REAL NULL , - unit_concept_id INTEGER NULL , - anatomic_site_concept_id INTEGER NULL , - disease_status_concept_id INTEGER NULL , - specimen_source_id VARCHAR(50) NULL , - specimen_source_value VARCHAR(50) NULL , - unit_source_value VARCHAR(50) NULL , - anatomic_site_source_value VARCHAR(50) NULL , - disease_status_source_value VARCHAR(50) NULL + specimen_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + specimen_concept_id INTEGER NOT NULL , + specimen_type_concept_id INTEGER NOT NULL , + specimen_date DATE NULL , + specimen_datetime DATETIME NOT NULL , + quantity REAL NULL , + unit_concept_id INTEGER NULL , + anatomic_site_concept_id INTEGER NULL , + disease_status_concept_id INTEGER NULL , + specimen_source_id VARCHAR(50) NULL , + specimen_source_value VARCHAR(50) NULL , + unit_source_value VARCHAR(50) NULL , + anatomic_site_source_value VARCHAR(50) NULL , + disease_status_source_value VARCHAR(50) NULL ) -DISTRUBTE ON (person_id); - - ---HINT DISTRIBUTE_ON_KEY(person_id) -CREATE TABLE death -( - person_id BIGINT NOT NULL , - death_date DATE NULL , - death_datetime DATETIME NOT NULL , - death_type_concept_id INTEGER NOT NULL , - cause_concept_id INTEGER NULL , - cause_source_value VARCHAR(50) NULL, - cause_source_concept_id INTEGER NULL -) - -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE visit_occurrence ( - visit_occurrence_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - visit_concept_id INTEGER NOT NULL , - visit_start_date DATE NULL , - visit_start_datetime DATETIME NOT NULL , - visit_end_date DATE NULL , - visit_end_datetime DATETIME NOT NULL , - visit_type_concept_id INTEGER NOT NULL , - provider_id INTEGER NULL, - care_site_id INTEGER NULL, - visit_source_value VARCHAR(50) NULL, - visit_source_concept_id INTEGER NULL , - admitted_from_concept_id INTEGER NULL , - admitted_from_source_value VARCHAR(50) NULL , - discharge_to_source_value VARCHAR(50) NULL , - discharge_to_concept_id INTEGER NULL , - preceding_visit_occurrence_id INTEGER NULL + visit_occurrence_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + visit_concept_id INTEGER NOT NULL , + visit_start_date DATE NULL , + visit_start_datetime DATETIME NOT NULL , + visit_end_date DATE NULL , + visit_end_datetime DATETIME NOT NULL , + visit_type_concept_id INTEGER NOT NULL , + provider_id BIGINT NULL, + care_site_id BIGINT NULL, + visit_source_value VARCHAR(50) NULL, + visit_source_concept_id INTEGER NULL , + admitted_from_concept_id INTEGER NULL , + admitted_from_source_value VARCHAR(50) NULL , + discharge_to_source_value VARCHAR(50) NULL , + discharge_to_concept_id INTEGER NULL , + preceding_visit_occurrence_id INTEGER NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) @@ -363,8 +322,8 @@ CREATE TABLE visit_detail visit_detail_end_date DATE NULL , visit_detail_end_datetime DATETIME NOT NULL , visit_detail_type_concept_id INTEGER NOT NULL , - provider_id INTEGER NULL , - care_site_id INTEGER NULL , + provider_id BIGINT NULL , + care_site_id BIGINT NULL , discharge_to_concept_id INTEGER NULL , admitted_from_concept_id INTEGER NULL , admitted_from_source_value VARCHAR(50) NULL , @@ -376,179 +335,178 @@ CREATE TABLE visit_detail visit_occurrence_id BIGINT NOT NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE procedure_occurrence ( - procedure_occurrence_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - procedure_concept_id INTEGER NOT NULL , - procedure_date DATE NULL , - procedure_datetime DATETIME NOT NULL , - procedure_type_concept_id INTEGER NOT NULL , - modifier_concept_id INTEGER NULL , - quantity INTEGER NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - procedure_source_value VARCHAR(50) NULL , - procedure_source_concept_id INTEGER NULL , - modifier_source_value VARCHAR(50) NULL , + procedure_occurrence_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + procedure_concept_id INTEGER NOT NULL , + procedure_date DATE NULL , + procedure_datetime DATETIME NOT NULL , + procedure_type_concept_id INTEGER NOT NULL , + modifier_concept_id INTEGER NULL , + quantity INTEGER NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + procedure_source_value VARCHAR(50) NULL , + procedure_source_concept_id INTEGER NULL , + modifier_source_value VARCHAR(50) NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE drug_exposure ( - drug_exposure_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - drug_concept_id INTEGER NOT NULL , - drug_exposure_start_date DATE NULL , - drug_exposure_start_datetime DATETIME NOT NULL , - drug_exposure_end_date DATE NULL , - drug_exposure_end_datetime DATETIME NOT NULL , - verbatim_end_date DATE NULL , - drug_type_concept_id INTEGER NOT NULL , - stop_reason VARCHAR(20) NULL , - refills INTEGER NULL , - quantity REAL NULL , - days_supply INTEGER NULL , - sig VARCHAR(1000) NULL , - route_concept_id INTEGER NULL , - lot_number VARCHAR(50) NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - drug_source_value VARCHAR(50) NULL , - drug_source_concept_id INTEGER NULL , - route_source_value VARCHAR(50) NULL , - dose_unit_source_value VARCHAR(50) NULL + drug_exposure_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + drug_concept_id INTEGER NOT NULL , + drug_exposure_start_date DATE NULL , + drug_exposure_start_datetime DATETIME NOT NULL , + drug_exposure_end_date DATE NULL , + drug_exposure_end_datetime DATETIME NOT NULL , + verbatim_end_date DATE NULL , + drug_type_concept_id INTEGER NOT NULL , + stop_reason VARCHAR(20) NULL , + refills INTEGER NULL , + quantity REAL NULL , + days_supply INTEGER NULL , + sig VARCHAR(1000) NULL , + route_concept_id INTEGER NULL , + lot_number VARCHAR(50) NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + drug_source_value VARCHAR(50) NULL , + drug_source_concept_id INTEGER NULL , + route_source_value VARCHAR(50) NULL , + dose_unit_source_value VARCHAR(50) NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE device_exposure ( - device_exposure_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - device_concept_id INTEGER NOT NULL , - device_exposure_start_date DATE NULL , - device_exposure_start_datetime DATETIME NOT NULL , - device_exposure_end_date DATE NULL , - device_exposure_end_datetime DATETIME NULL , - device_type_concept_id INTEGER NOT NULL , - unique_device_id VARCHAR(50) NULL , - quantity INTEGER NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - device_source_value VARCHAR(100) NULL , - device_source_concept_id INTEGER NULL + device_exposure_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + device_concept_id INTEGER NOT NULL , + device_exposure_start_date DATE NULL , + device_exposure_start_datetime DATETIME NOT NULL , + device_exposure_end_date DATE NULL , + device_exposure_end_datetime DATETIME NULL , + device_type_concept_id INTEGER NOT NULL , + unique_device_id VARCHAR(50) NULL , + quantity INTEGER NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + device_source_value VARCHAR(100) NULL , + device_source_concept_id INTEGER NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE condition_occurrence ( - condition_occurrence_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - condition_concept_id INTEGER NOT NULL , - condition_start_date DATE NULL , - condition_start_datetime DATETIME NOT NULL , - condition_end_date DATE NULL , - condition_end_datetime DATETIME NULL , - condition_type_concept_id INTEGER NOT NULL , - condition_status_concept_id INTEGER NULL , - stop_reason VARCHAR(20) NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - condition_source_value VARCHAR(50) NULL , - condition_source_concept_id INTEGER NULL , - condition_status_source_value VARCHAR(50) NULL + condition_occurrence_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + condition_concept_id INTEGER NOT NULL , + condition_start_date DATE NULL , + condition_start_datetime DATETIME NOT NULL , + condition_end_date DATE NULL , + condition_end_datetime DATETIME NULL , + condition_type_concept_id INTEGER NOT NULL , + condition_status_concept_id INTEGER NULL , + stop_reason VARCHAR(20) NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + condition_source_value VARCHAR(50) NULL , + condition_source_concept_id INTEGER NULL , + condition_status_source_value VARCHAR(50) NULL ) -DISTRUBTE ON (person_id); +DISTRIBUTE ON (person_id); --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE measurement ( - measurement_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - measurement_concept_id INTEGER NOT NULL , - measurement_date DATE NULL , - measurement_datetime DATETIME NOT NULL , - measurement_time VARCHAR(10) NULL, - measurement_type_concept_id INTEGER NOT NULL , - operator_concept_id INTEGER NULL , - value_as_number REAL NULL , - value_as_concept_id INTEGER NULL , - unit_concept_id INTEGER NULL , - range_low REAL NULL , - range_high REAL NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - measurement_source_value VARCHAR(50) NULL , - measurement_source_concept_id INTEGER NULL , - unit_source_value VARCHAR(50) NULL , - value_source_value VARCHAR(50) NULL + measurement_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + measurement_concept_id INTEGER NOT NULL , + measurement_date DATE NULL , + measurement_datetime DATETIME NOT NULL , + measurement_time VARCHAR(10) NULL, + measurement_type_concept_id INTEGER NOT NULL , + operator_concept_id INTEGER NULL , + value_as_number REAL NULL , + value_as_concept_id INTEGER NULL , + unit_concept_id INTEGER NULL , + range_low REAL NULL , + range_high REAL NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + measurement_source_value VARCHAR(50) NULL , + measurement_source_concept_id INTEGER NULL , + unit_source_value VARCHAR(50) NULL , + value_source_value VARCHAR(50) NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE note ( - note_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - note_event_id BIGINT NULL , --This and the field below added - note_domain_id VARCHAR(20) NULL , --This field may be removed in favor of the one below ---note_event_table_concept_id INTEGER NULL , --This may be added based on 9/4 meeting - note_date DATE NULL , - note_datetime DATETIME NOT NULL , - note_type_concept_id INTEGER NOT NULL , - note_class_concept_id INTEGER NOT NULL , - note_title VARCHAR(250) NULL , - note_text VARCHAR(1000) NULL , - encoding_concept_id INTEGER NOT NULL , - language_concept_id INTEGER NOT NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - note_source_value VARCHAR(50) NULL + note_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + note_event_id BIGINT NULL , + note_event_field_concept_id INTEGER NULL , + note_date DATE NULL , + note_datetime DATETIME NOT NULL , + note_type_concept_id INTEGER NOT NULL , + note_class_concept_id INTEGER NOT NULL , + note_title VARCHAR(250) NULL , + note_text VARCHAR(1000) NULL , + encoding_concept_id INTEGER NOT NULL , + language_concept_id INTEGER NOT NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + note_source_value VARCHAR(50) NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; --HINT DISTRIBUTE ON RANDOM CREATE TABLE note_nlp ( - note_nlp_id BIGINT NOT NULL , - note_id BIGINT NOT NULL , - section_concept_id INTEGER NULL , - snippet VARCHAR(250) NULL , - "offset" VARCHAR(250) NULL , - lexical_variant VARCHAR(250) NOT NULL , - note_nlp_concept_id INTEGER NULL , - nlp_system VARCHAR(250) NULL , - nlp_date DATE NOT NULL , - nlp_datetime DATETIME NULL , - term_exists VARCHAR(1) NULL , - term_temporal VARCHAR(50) NULL , - term_modifiers VARCHAR(2000) NULL , - note_nlp_source_concept_id INTEGER NULL + note_nlp_id BIGINT NOT NULL , + note_id BIGINT NOT NULL , + section_concept_id INTEGER NULL , + snippet VARCHAR(250) NULL , + "offset" VARCHAR(250) NULL , + lexical_variant VARCHAR(250) NOT NULL , + note_nlp_concept_id INTEGER NULL , + nlp_system VARCHAR(250) NULL , + nlp_date DATE NOT NULL , + nlp_datetime DATETIME NULL , + term_exists VARCHAR(1) NULL , + term_temporal VARCHAR(50) NULL , + term_modifiers VARCHAR(2000) NULL , + note_nlp_source_concept_id INTEGER NULL ) DISTRIBUTE ON RANDOM ; @@ -557,61 +515,60 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE observation ( - observation_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - observation_concept_id INTEGER NOT NULL , - observation_date DATE NULL , - observation_datetime DATETIME NOT NULL , - observation_type_concept_id INTEGER NOT NULL , - value_as_number REAL NULL , - value_as_string VARCHAR(60) NULL , - value_as_concept_id INTEGER NULL , - qualifier_concept_id INTEGER NULL , - unit_concept_id INTEGER NULL , - provider_id INTEGER NULL , - visit_occurrence_id BIGINT NULL , - visit_detail_id BIGINT NULL , - observation_source_value VARCHAR(50) NULL , - observation_source_concept_id INTEGER NULL , - unit_source_value VARCHAR(50) NULL , - qualifier_source_value VARCHAR(50) NULL , - observation_event_id BIGINT NULL , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/ - observation_event_domain_id VARCHAR(20) NULL , ---obs_event_table_concept_id INTEGER NULL , /* Changed name to comply with COST and NOTE. This should be 'Survey'. Had to use 'obs' for oracle restriction, may be added on 9/4*/ - value_as_datetime DATETIME NULL + observation_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + observation_concept_id INTEGER NOT NULL , + observation_date DATE NULL , + observation_datetime DATETIME NOT NULL , + observation_type_concept_id INTEGER NOT NULL , + value_as_number REAL NULL , + value_as_string VARCHAR(60) NULL , + value_as_concept_id INTEGER NULL , + qualifier_concept_id INTEGER NULL , + unit_concept_id INTEGER NULL , + provider_id BIGINT NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + observation_source_value VARCHAR(50) NULL , + observation_source_concept_id INTEGER NULL , + unit_source_value VARCHAR(50) NULL , + qualifier_source_value VARCHAR(50) NULL , + observation_event_id BIGINT NULL , + obs_event_field_concept_id INTEGER NULL , + value_as_datetime DATETIME NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; --HINT DISTRIBUTE ON KEY(person_id) CREATE TABLE survey_conduct /*Should this be SURVEY_OCCURRENCE instead to comply with the other tables?*/ ( - survey_conduct_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - survey_concept_id INTEGER NOT NULL , - survey_start_date DATE NULL , - survey_start_datetime DATETIME NULL , - survey_end_date DATE NULL , - survey_end_datetime DATETIME NOT NULL , - provider_id BIGINT NULL , - assisted_concept_id INTEGER NULL , - respondent_type_concept_id INTEGER NULL , - timing_concept_id INTEGER NULL , - collection_method_concept_id INTEGER NULL , - assisted_source_value VARCHAR(50) NULL , - respondent_type_source_value VARCHAR(100) NULL , - timing_source_value VARCHAR(100) NULL , - collection_method_source_value VARCHAR(100) NULL , - survey_source_value VARCHAR(100) NULL , - survey_source_concept_id INTEGER NULL , - survey_source_identifier VARCHAR(100) NULL , - validated_survey_concept_id INTEGER NULL , - validated_survey_source_value VARCHAR(100) NULL , - survey_version_number VARCHAR(20) NULL , - visit_occurrence_id BIGINT NULL , - visit_detail_id BIGINT NULL , - response_to_visit_occurrence_id BIGINT NULL + survey_conduct_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + survey_concept_id INTEGER NOT NULL , + survey_start_date DATE NULL , + survey_start_datetime DATETIME NULL , + survey_end_date DATE NULL , + survey_end_datetime DATETIME NOT NULL , + provider_id BIGINT NULL , + assisted_concept_id INTEGER NULL , + respondent_type_concept_id INTEGER NULL , + timing_concept_id INTEGER NULL , + collection_method_concept_id INTEGER NULL , + assisted_source_value VARCHAR(50) NULL , + respondent_type_source_value VARCHAR(100) NULL , + timing_source_value VARCHAR(100) NULL , + collection_method_source_value VARCHAR(100) NULL , + survey_source_value VARCHAR(100) NULL , + survey_source_concept_id INTEGER NULL , + survey_source_identifier VARCHAR(100) NULL , + validated_survey_concept_id INTEGER NULL , + validated_survey_source_value VARCHAR(100) NULL , + survey_version_number VARCHAR(20) NULL , + visit_occurrence_id BIGINT NULL , + visit_detail_id BIGINT NULL , + response_to_visit_occurrence_id BIGINT NULL ) DISTRIBUTE ON (person_id) ; @@ -620,17 +577,16 @@ DISTRIBUTE ON (person_id) --HINT DISTRIBUTE ON RANDOM CREATE TABLE fact_relationship ( - domain_concept_id_1 INTEGER NOT NULL , - fact_id_1 BIGINT NOT NULL , - domain_concept_id_2 INTEGER NOT NULL , - fact_id_2 BIGINT NOT NULL , - relationship_concept_id INTEGER NOT NULL + domain_concept_id_1 INTEGER NOT NULL , + fact_id_1 BIGINT NOT NULL , + domain_concept_id_2 INTEGER NOT NULL , + fact_id_2 BIGINT NOT NULL , + relationship_concept_id INTEGER NOT NULL ) DISTRIBUTE ON RANDOM ; - /************************ Standardized health system data @@ -641,17 +597,17 @@ Standardized health system data --HINT DISTRIBUTE ON RANDOM CREATE TABLE location ( - location_id BIGINT NOT NULL , - address_1 VARCHAR(50) NULL , - address_2 VARCHAR(50) NULL , - city VARCHAR(50) NULL , - state VARCHAR(2) NULL , - zip VARCHAR(9) NULL , - county VARCHAR(20) NULL , - country VARCHAR(100) NULL , - location_source_value VARCHAR(50) NULL , - latitude REAL NULL , - longitude REAL NULL + location_id BIGINT NOT NULL , + address_1 VARCHAR(50) NULL , + address_2 VARCHAR(50) NULL , + city VARCHAR(50) NULL , + state VARCHAR(2) NULL , + zip VARCHAR(9) NULL , + county VARCHAR(20) NULL , + country VARCHAR(100) NULL , + location_source_value VARCHAR(50) NULL , + latitude REAL NULL , + longitude REAL NULL ) DISTRIBUTE ON RANDOM ; @@ -661,12 +617,12 @@ DISTRIBUTE ON RANDOM CREATE TABLE location_history ( location_history_id BIGINT NOT NULL , --unauthorized addition based on CDM conventions - location_id BIGINT NOT NULL , - relationship_type_concept_id INTEGER NULL , --Recent addition based on github discussion - domain_id VARCHAR(50) NOT NULL , - entity_id BIGINT NOT NULL , - start_date DATE NOT NULL , - end_date DATE NULL + location_id BIGINT NOT NULL , + relationship_type_concept_id INTEGER NULL , --Recent addition based on github discussion + domain_id VARCHAR(50) NOT NULL , + entity_id BIGINT NOT NULL , + start_date DATE NOT NULL , + end_date DATE NULL ) DISTRIBUTE ON RANDOM ; @@ -675,12 +631,12 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE care_site ( - care_site_id BIGINT NOT NULL , - care_site_name VARCHAR(255) NULL , - place_of_service_concept_id INTEGER NULL , - location_id BIGINT NULL , - care_site_source_value VARCHAR(50) NULL , - place_of_service_source_value VARCHAR(50) NULL + care_site_id BIGINT NOT NULL , + care_site_name VARCHAR(255) NULL , + place_of_service_concept_id INTEGER NULL , + location_id BIGINT NULL , + care_site_source_value VARCHAR(50) NULL , + place_of_service_source_value VARCHAR(50) NULL ) DISTRIBUTE ON RANDOM ; @@ -689,19 +645,19 @@ DISTRIBUTE ON RANDOM --HINT DISTRIBUTE ON RANDOM CREATE TABLE provider ( - provider_id BIGINT NOT NULL , - provider_name VARCHAR(255) NULL , - NPI VARCHAR(20) NULL , - DEA VARCHAR(20) NULL , - specialty_concept_id INTEGER NULL , - care_site_id BIGINT NULL , - year_of_birth INTEGER NULL , - gender_concept_id INTEGER NULL , - provider_source_value VARCHAR(50) NULL , - specialty_source_value VARCHAR(50) NULL , - specialty_source_concept_id INTEGER NULL , - gender_source_value VARCHAR(50) NULL , - gender_source_concept_id INTEGER NULL + provider_id BIGINT NOT NULL , + provider_name VARCHAR(255) NULL , + NPI VARCHAR(20) NULL , + DEA VARCHAR(20) NULL , + specialty_concept_id INTEGER NULL , + care_site_id BIGINT NULL , + year_of_birth INTEGER NULL , + gender_concept_id INTEGER NULL , + provider_source_value VARCHAR(50) NULL , + specialty_source_value VARCHAR(50) NULL , + specialty_source_concept_id INTEGER NULL , + gender_source_value VARCHAR(50) NULL , + gender_source_concept_id INTEGER NULL ) DISTRIBUTE ON RANDOM ; @@ -717,54 +673,53 @@ Standardized health economics --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE payer_plan_period ( - payer_plan_period_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , + payer_plan_period_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , contract_person_id BIGINT NULL , - payer_plan_period_start_date DATE NOT NULL , - payer_plan_period_end_date DATE NOT NULL , + payer_plan_period_start_date DATE NOT NULL , + payer_plan_period_end_date DATE NOT NULL , payer_concept_id INTEGER NULL , plan_concept_id INTEGER NULL , contract_concept_id INTEGER NULL , sponsor_concept_id INTEGER NULL , stop_reason_concept_id INTEGER NULL , - payer_source_value VARCHAR(50) NULL , + payer_source_value VARCHAR(50) NULL , payer_source_concept_id INTEGER NULL , - plan_source_value VARCHAR(50) NULL , + plan_source_value VARCHAR(50) NULL , plan_source_concept_id INTEGER NULL , contract_source_value VARCHAR(50) NULL , contract_source_concept_id INTEGER NULL , sponsor_source_value VARCHAR(50) NULL , sponsor_source_concept_id INTEGER NULL , - family_source_value VARCHAR(50) NULL , + family_source_value VARCHAR(50) NULL , stop_reason_source_value VARCHAR(50) NULL , stop_reason_source_concept_id INTEGER NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; --HINT DISTRIBUTE ON KEY(person_id) CREATE TABLE cost ( - cost_id BIGINT NOT NULL , - person_id BIGINT NOT NULL, - cost_event_id BIGINT NOT NULL , - cost_domain_id VARCHAR(20) NOT NULL , ---cost_event_table_concept_id INTEGER NOT NULL , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/ - cost_concept_id INTEGER NOT NULL , - cost_type_concept_id INTEGER NOT NULL , - currency_concept_id INTEGER NULL , - cost REAL NULL , - incurred_date DATE NOT NULL , - billed_date DATE NULL , - paid_date DATE NULL , - revenue_code_concept_id INTEGER NULL , - drg_concept_id INTEGER NULL , - cost_source_value VARCHAR(50) NULL , - cost_source_concept_id INTEGER NULL , - revenue_code_source_value VARCHAR(50) NULL , - drg_source_value VARCHAR(3) NULL , - payer_plan_period_id BIGINT NULL + cost_id BIGINT NOT NULL , + person_id BIGINT NOT NULL, + cost_event_id BIGINT NOT NULL , + cost_event_field_concept_id INTEGER NOT NULL , + cost_concept_id INTEGER NOT NULL , + cost_type_concept_id INTEGER NOT NULL , + currency_concept_id INTEGER NULL , + cost REAL NULL , + incurred_date DATE NOT NULL , + billed_date DATE NULL , + paid_date DATE NULL , + revenue_code_concept_id INTEGER NULL , + drg_concept_id INTEGER NULL , + cost_source_value VARCHAR(50) NULL , + cost_source_concept_id INTEGER NULL , + revenue_code_source_value VARCHAR(50) NULL , + drg_source_value VARCHAR(3) NULL , + payer_plan_period_id BIGINT NULL ) DISTRIBUTE ON (person_id) ; @@ -777,72 +732,45 @@ Standardized derived elements ************************/ ---HINT DISTRIBUTE_ON_KEY(subject_id) -CREATE TABLE cohort -( - cohort_definition_id BIGINT NOT NULL , - subject_id BIGINT NOT NULL , - cohort_start_date DATE NOT NULL , - cohort_end_date DATE NOT NULL -) -DISTRUBTE ON (subject_id) -; - - ---HINT DISTRIBUTE_ON_KEY(subject_id) -CREATE TABLE cohort_attribute -( - cohort_definition_id BIGINT NOT NULL , - subject_id BIGINT NOT NULL , - cohort_start_date DATE NOT NULL , - cohort_end_date DATE NOT NULL , - attribute_definition_id BIGINT NOT NULL , - value_as_number REAL NULL , - value_as_concept_id INTEGER NULL -) -DISTRUBTE ON (subject_id) -; - - --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE drug_era ( - drug_era_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - drug_concept_id INTEGER NOT NULL , - drug_era_start_date DATE NOT NULL , - drug_era_end_date DATE NOT NULL , - drug_exposure_count INTEGER NULL , - gap_days INTEGER NULL + drug_era_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + drug_concept_id INTEGER NOT NULL , + drug_era_start_date DATE NOT NULL , + drug_era_end_date DATE NOT NULL , + drug_exposure_count INTEGER NULL , + gap_days INTEGER NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE dose_era ( - dose_era_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - drug_concept_id INTEGER NOT NULL , - unit_concept_id INTEGER NOT NULL , - dose_value REAL NOT NULL , - dose_era_start_date DATE NOT NULL , - dose_era_end_date DATE NOT NULL + dose_era_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + drug_concept_id INTEGER NOT NULL , + unit_concept_id INTEGER NOT NULL , + dose_value REAL NOT NULL , + dose_era_start_date DATE NOT NULL , + dose_era_end_date DATE NOT NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE condition_era ( - condition_era_id BIGINT NOT NULL , - person_id BIGINT NOT NULL , - condition_concept_id INTEGER NOT NULL , - condition_era_start_date DATE NOT NULL , - condition_era_end_date DATE NOT NULL , - condition_occurrence_count INTEGER NULL + condition_era_id BIGINT NOT NULL , + person_id BIGINT NOT NULL , + condition_concept_id INTEGER NOT NULL , + condition_era_start_date DATE NOT NULL , + condition_era_end_date DATE NOT NULL , + condition_occurrence_count INTEGER NULL ) -DISTRUBTE ON (person_id) +DISTRIBUTE ON (person_id) ; diff --git a/Netezza/OMOP CDM netezza primary keys.txt b/Netezza/OMOP CDM netezza primary keys.txt index 14017b8..112593b 100644 --- a/Netezza/OMOP CDM netezza primary keys.txt +++ b/Netezza/OMOP CDM netezza primary keys.txt @@ -77,11 +77,6 @@ ALTER TABLE source_to_concept_map ADD CONSTRAINT xpk_source_to_concept_map PRIMA ALTER TABLE drug_strength ADD CONSTRAINT xpk_drug_strength PRIMARY KEY (drug_concept_id, ingredient_concept_id); -ALTER TABLE cohort_definition ADD CONSTRAINT xpk_cohort_definition PRIMARY KEY (cohort_definition_id); - -ALTER TABLE attribute_definition ADD CONSTRAINT xpk_attribute_definition PRIMARY KEY (attribute_definition_id); - - /************************** Standardized meta-data @@ -127,7 +122,7 @@ ALTER TABLE note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY ( note_nlp_id ) ; ALTER TABLE observation ADD CONSTRAINT xpk_observation PRIMARY KEY ( observation_id ) ; -ALTER TABLE survey ADD CONSTRAINT xpk_survey PRIMARY KEY ( survey_occurrence_id ) ; +ALTER TABLE survey_conduct ADD CONSTRAINT xpk_survey_conduct PRIMARY KEY ( survey_conduct_id ) ; /************************ @@ -139,7 +134,7 @@ Standardized health system data ALTER TABLE location ADD CONSTRAINT xpk_location PRIMARY KEY ( location_id ) ; -ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ; -- May need to remove this one +ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ; ALTER TABLE care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY ( care_site_id ) ; @@ -165,10 +160,6 @@ Standardized derived elements ************************/ -ALTER TABLE cohort ADD CONSTRAINT xpk_cohort PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date ) ; - -ALTER TABLE cohort_attribute ADD CONSTRAINT xpk_cohort_attribute PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date, attribute_definition_id ) ; - ALTER TABLE drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY ( drug_era_id ) ; ALTER TABLE dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY ( dose_era_id ) ; diff --git a/Oracle/OMOP CDM oracle constraints.txt b/Oracle/OMOP CDM oracle constraints.txt index abc661f..916f7a7 100644 --- a/Oracle/OMOP CDM oracle constraints.txt +++ b/Oracle/OMOP CDM oracle constraints.txt @@ -28,7 +28,7 @@ oracle script to create foreign key, unique, and check constraints within the OMOP common data model, version 6.0 -last revised: 30-Aug┌-2018 +last revised: 30-Aug-2018 author: Patrick Ryan, Clair Blacketer @@ -86,7 +86,7 @@ ALTER TABLE relationship ADD CONSTRAINT fpk_relationship_reverse FOREIGN KEY (re ALTER TABLE concept_synonym ADD CONSTRAINT fpk_concept_synonym_concept FOREIGN KEY (concept_id) REFERENCES concept (concept_id); -ALTER TABLE concept_synonym ADD CONSTRAINT fpk_concept_synonym_concept FOREIGN KEY (language_concept_id) REFERENCES concept (concept_id); +ALTER TABLE concept_synonym ADD CONSTRAINT fpk_synonym_language FOREIGN KEY (language_concept_id) REFERENCES concept (concept_id); ALTER TABLE concept_ancestor ADD CONSTRAINT fpk_concept_ancestor_concept_1 FOREIGN KEY (ancestor_concept_id) REFERENCES concept (concept_id); @@ -112,14 +112,6 @@ ALTER TABLE drug_strength ADD CONSTRAINT fpk_drug_strength_unit_2 FOREIGN KEY (n ALTER TABLE drug_strength ADD CONSTRAINT fpk_drug_strength_unit_3 FOREIGN KEY (denominator_unit_concept_id) REFERENCES concept (concept_id); -ALTER TABLE cohort_definition ADD CONSTRAINT fpk_cohort_definition_concept FOREIGN KEY (definition_type_concept_id) REFERENCES concept (concept_id); - -ALTER TABLE cohort_definition ADD CONSTRAINT fpk_subject_concept FOREIGN KEY (subject_concept_id) REFERENCES concept (concept_id); - - -ALTER TABLE attribute_definition ADD CONSTRAINT fpk_attribute_type_concept FOREIGN KEY (attribute_type_concept_id) REFERENCES concept (concept_id); - - /************************** Standardized meta-data @@ -194,9 +186,9 @@ ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_provider FOREIGN KEY (prov ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_care_site FOREIGN KEY (care_site_id) REFERENCES care_site (care_site_id); -ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_ visit_concept_s FOREIGN KEY (visit_source_concept_id) REFERENCES concept (concept_id); +ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_concept_s FOREIGN KEY (visit_source_concept_id) REFERENCES concept (concept_id); -ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_admitting_s FOREIGN KEY (admitting_source_concept_id) REFERENCES concept (concept_id); +ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_admitting_s FOREIGN KEY (admitted_from_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_occurrence ADD CONSTRAINT fpk_visit_discharge FOREIGN KEY (discharge_to_concept_id) REFERENCES concept (concept_id); @@ -215,7 +207,7 @@ ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_care_site FOREIGN KEY (care ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_discharge FOREIGN KEY (discharge_to_concept_id) REFERENCES concept (concept_id); -ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_admitting_s FOREIGN KEY (admitting_source_concept_id) REFERENCES concept (concept_id); +ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_admitting_s FOREIGN KEY (admitted_from_concept_id) REFERENCES concept (concept_id); ALTER TABLE visit_detail ADD CONSTRAINT fpk_v_detail_concept_s FOREIGN KEY (visit_detail_source_concept_id) REFERENCES concept (concept_id); @@ -476,16 +468,6 @@ Standardized derived elements ************************/ -ALTER TABLE cohort ADD CONSTRAINT fpk_cohort_definition FOREIGN KEY (cohort_definition_id) REFERENCES cohort_definition (cohort_definition_id); - - -ALTER TABLE cohort_attribute ADD CONSTRAINT fpk_ca_cohort_definition FOREIGN KEY (cohort_definition_id) REFERENCES cohort_definition (cohort_definition_id); - -ALTER TABLE cohort_attribute ADD CONSTRAINT fpk_ca_attribute_definition FOREIGN KEY (attribute_definition_id) REFERENCES attribute_definition (attribute_definition_id); - -ALTER TABLE cohort_attribute ADD CONSTRAINT fpk_ca_value FOREIGN KEY (value_as_concept_id) REFERENCES concept (concept_id); - - ALTER TABLE drug_era ADD CONSTRAINT fpk_drug_era_person FOREIGN KEY (person_id) REFERENCES person (person_id); ALTER TABLE drug_era ADD CONSTRAINT fpk_drug_era_concept FOREIGN KEY (drug_concept_id) REFERENCES concept (concept_id); diff --git a/Oracle/OMOP CDM oracle ddl.txt b/Oracle/OMOP CDM oracle ddl.txt index c60473c..22e7e63 100644 --- a/Oracle/OMOP CDM oracle ddl.txt +++ b/Oracle/OMOP CDM oracle ddl.txt @@ -44,14 +44,14 @@ Standardized vocabulary --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept ( - concept_id INTEGER NOT NULL , - concept_name VARCHAR(255) NOT NULL , - domain_id VARCHAR(20) NOT NULL , + concept_id INTEGER NOT NULL , + concept_name VARCHAR(255) NOT NULL , + domain_id VARCHAR(20) NOT NULL , vocabulary_id VARCHAR(20) NOT NULL , - concept_class_id VARCHAR(20) NOT NULL , - standard_concept VARCHAR(1) NULL , + concept_class_id VARCHAR(20) NOT NULL , + standard_concept VARCHAR(1) NULL , concept_code VARCHAR(50) NOT NULL , - valid_start_date DATE NOT NULL , + valid_start_date DATE NOT NULL , valid_end_date DATE NOT NULL , invalid_reason VARCHAR(1) NULL ) @@ -60,11 +60,11 @@ CREATE TABLE concept ( --HINT DISTRIBUTE ON RANDOM CREATE TABLE vocabulary ( - vocabulary_id VARCHAR(20) NOT NULL, - vocabulary_name VARCHAR(255) NOT NULL, + vocabulary_id VARCHAR(20) NOT NULL, + vocabulary_name VARCHAR(255) NOT NULL, vocabulary_reference VARCHAR(255) NOT NULL, - vocabulary_version VARCHAR(255) NOT NULL, - vocabulary_concept_id INTEGER NOT NULL + vocabulary_version VARCHAR(255) NOT NULL, + vocabulary_concept_id INTEGER NOT NULL ) ; @@ -73,16 +73,16 @@ CREATE TABLE vocabulary ( CREATE TABLE domain ( domain_id VARCHAR(20) NOT NULL, domain_name VARCHAR(255) NOT NULL, - domain_concept_id INTEGER NOT NULL + domain_concept_id INTEGER NOT NULL ) ; --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_class ( - concept_class_id VARCHAR(20) NOT NULL, - concept_class_name VARCHAR(255) NOT NULL, - concept_class_concept_id INTEGER NOT NULL + concept_class_id VARCHAR(20) NOT NULL, + concept_class_name VARCHAR(255) NOT NULL, + concept_class_concept_id INTEGER NOT NULL ) ; @@ -91,39 +91,39 @@ CREATE TABLE concept_class ( CREATE TABLE concept_relationship ( concept_id_1 INTEGER NOT NULL, concept_id_2 INTEGER NOT NULL, - relationship_id VARCHAR(20) NOT NULL, - valid_start_date DATE NOT NULL, - valid_end_date DATE NOT NULL, - invalid_reason VARCHAR(1) NULL + relationship_id VARCHAR(20) NOT NULL, + valid_start_date DATE NOT NULL, + valid_end_date DATE NOT NULL, + invalid_reason VARCHAR(1) NULL ) ; --HINT DISTRIBUTE ON RANDOM CREATE TABLE relationship ( - relationship_id VARCHAR(20) NOT NULL, - relationship_name VARCHAR(255) NOT NULL, - is_hierarchical VARCHAR(1) NOT NULL, - defines_ancestry VARCHAR(1) NOT NULL, + relationship_id VARCHAR(20) NOT NULL, + relationship_name VARCHAR(255) NOT NULL, + is_hierarchical VARCHAR(1) NOT NULL, + defines_ancestry VARCHAR(1) NOT NULL, reverse_relationship_id VARCHAR(20) NOT NULL, - relationship_concept_id INTEGER NOT NULL + relationship_concept_id INTEGER NOT NULL ) ; --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_synonym ( - concept_id INTEGER NOT NULL, + concept_id INTEGER NOT NULL, concept_synonym_name VARCHAR(1000) NOT NULL, - language_concept_id INTEGER NOT NULL + language_concept_id INTEGER NOT NULL ) ; --HINT DISTRIBUTE ON RANDOM CREATE TABLE concept_ancestor ( - ancestor_concept_id INTEGER NOT NULL, - descendant_concept_id INTEGER NOT NULL, + ancestor_concept_id INTEGER NOT NULL, + descendant_concept_id INTEGER NOT NULL, min_levels_of_separation INTEGER NOT NULL, max_levels_of_separation INTEGER NOT NULL ) @@ -132,57 +132,33 @@ CREATE TABLE concept_ancestor ( --HINT DISTRIBUTE ON RANDOM CREATE TABLE source_to_concept_map ( - source_code VARCHAR(50) NOT NULL, - source_concept_id INTEGER NOT NULL, + source_code VARCHAR(50) NOT NULL, + source_concept_id INTEGER NOT NULL, source_vocabulary_id VARCHAR(20) NOT NULL, source_code_description VARCHAR(255) NULL, - target_concept_id INTEGER NOT NULL, + target_concept_id INTEGER NOT NULL, target_vocabulary_id VARCHAR(20) NOT NULL, - valid_start_date DATE NOT NULL, - valid_end_date DATE NOT NULL, - invalid_reason VARCHAR(1) NULL + valid_start_date DATE NOT NULL, + valid_end_date DATE NOT NULL, + invalid_reason VARCHAR(1) NULL ) ; --HINT DISTRIBUTE ON RANDOM CREATE TABLE drug_strength ( - drug_concept_id INTEGER NOT NULL, - ingredient_concept_id INTEGER NOT NULL, - amount_value FLOAT NULL, - amount_unit_concept_id INTEGER NULL, - numerator_value FLOAT NULL, - numerator_unit_concept_id INTEGER NULL, - denominator_value FLOAT NULL, - denominator_unit_concept_id INTEGER NULL, - box_size INTEGER NULL, - valid_start_date DATE NOT NULL, - valid_end_date DATE NOT NULL, - invalid_reason VARCHAR(1) NULL -) -; - - ---HINT DISTRIBUTE ON RANDOM -CREATE TABLE cohort_definition ( - cohort_definition_id INTEGER NOT NULL, - cohort_definition_name VARCHAR(255) NOT NULL, - cohort_definition_description CLOB NULL, - definition_type_concept_id INTEGER NOT NULL, - cohort_definition_syntax CLOB NULL, - subject_concept_id INTEGER NOT NULL, - cohort_initiation_date DATE NULL -) -; - - ---HINT DISTRIBUTE ON RANDOM -CREATE TABLE attribute_definition ( - attribute_definition_id INTEGER NOT NULL, - attribute_name VARCHAR(255) NOT NULL, - attribute_description CLOB NULL, - attribute_type_concept_id INTEGER NOT NULL, - attribute_syntax CLOB NULL + drug_concept_id INTEGER NOT NULL, + ingredient_concept_id INTEGER NOT NULL, + amount_value FLOAT NULL, + amount_unit_concept_id INTEGER NULL, + numerator_value FLOAT NULL, + numerator_unit_concept_id INTEGER NULL, + denominator_value FLOAT NULL, + denominator_unit_concept_id INTEGER NULL, + box_size INTEGER NULL, + valid_start_date DATE NOT NULL, + valid_end_date DATE NOT NULL, + invalid_reason VARCHAR(1) NULL ) ; @@ -197,16 +173,16 @@ Standardized meta-data --HINT DISTRIBUTE ON RANDOM CREATE TABLE cdm_source ( - cdm_source_name VARCHAR(255) NOT NULL , - cdm_source_abbreviation VARCHAR(25) NULL , - cdm_holder VARCHAR(255) NULL , - source_description CLOB NULL , + cdm_source_name VARCHAR(255) NOT NULL , + cdm_source_abbreviation VARCHAR(25) NULL , + cdm_holder VARCHAR(255) NULL , + source_description CLOB NULL , source_documentation_reference VARCHAR(255) NULL , - cdm_etl_reference VARCHAR(255) NULL , - source_release_date DATE NULL , - cdm_release_date DATE NULL , - cdm_version VARCHAR(10) NULL , - vocabulary_version VARCHAR(20) NULL + cdm_etl_reference VARCHAR(255) NULL , + source_release_date DATE NULL , + cdm_release_date DATE NULL , + cdm_version VARCHAR(10) NULL , + vocabulary_version VARCHAR(20) NULL ) ; @@ -217,15 +193,15 @@ CREATE TABLE metadata metadata_concept_id INTEGER NOT NULL , metadata_type_concept_id INTEGER NOT NULL , name VARCHAR(250) NOT NULL , - value_as_string CLOB NULL , + value_as_string CLOB NULL , value_as_concept_id INTEGER NULL , metadata_date DATE NULL , - metadata_datetime DATETIME2 NULL + metadata_datetime TIMESTAMP NULL ) ; -INSERT INTO metadata (name, value_as_string) --Added cdm version record -VALUES ('CDM Version', '6.0') +INSERT INTO metadata (metadata_concept_id, metadata_type_concept_id, name, value_as_string, value_as_concept_id, metadata_date, metadata_datetime) --Added cdm version record +VALUES (0,0,'CDM Version', '6.0',0,NULL,NULL) ; @@ -239,24 +215,24 @@ Standardized clinical data --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE person ( - person_id NUMBER(19) NOT NULL , --BIGINTs added - gender_concept_id INTEGER NOT NULL , - year_of_birth INTEGER NOT NULL , - month_of_birth INTEGER NULL, - day_of_birth INTEGER NULL, - birth_datetime DATETIME2 NULL, - race_concept_id INTEGER NOT NULL, - ethnicity_concept_id INTEGER NOT NULL, - location_id INTEGER NULL, - provider_id INTEGER NULL, - care_site_id INTEGER NULL, - person_source_value VARCHAR(50) NULL, - gender_source_value VARCHAR(50) NULL, - gender_source_concept_id INTEGER NULL, - race_source_value VARCHAR(50) NULL, - race_source_concept_id INTEGER NULL, - ethnicity_source_value VARCHAR(50) NULL, - ethnicity_source_concept_id INTEGER NULL + person_id NUMBER(19) NOT NULL , --BIGINTs added + gender_concept_id INTEGER NOT NULL , + year_of_birth INTEGER NOT NULL , + month_of_birth INTEGER NULL, + day_of_birth INTEGER NULL, + birth_datetime TIMESTAMP NULL, + race_concept_id INTEGER NOT NULL, + ethnicity_concept_id INTEGER NOT NULL, + location_id NUMBER(19) NULL, + provider_id NUMBER(19) NULL, + care_site_id NUMBER(19) NULL, + person_source_value VARCHAR(50) NULL, + gender_source_value VARCHAR(50) NULL, + gender_source_concept_id INTEGER NULL, + race_source_value VARCHAR(50) NULL, + race_source_concept_id INTEGER NULL, + ethnicity_source_value VARCHAR(50) NULL, + ethnicity_source_concept_id INTEGER NULL ) ; @@ -264,11 +240,11 @@ CREATE TABLE person --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE observation_period ( - observation_period_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , + observation_period_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , observation_period_start_date DATE NOT NULL , - observation_period_end_date DATE NOT NULL , - period_type_concept_id INTEGER NOT NULL + observation_period_end_date DATE NOT NULL , + period_type_concept_id INTEGER NOT NULL ) ; @@ -276,35 +252,21 @@ CREATE TABLE observation_period --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE specimen ( - specimen_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - specimen_concept_id INTEGER NOT NULL , - specimen_type_concept_id INTEGER NOT NULL , - specimen_date DATE NULL , - specimen_datetime DATETIME2 NOT NULL , - quantity FLOAT NULL , - unit_concept_id INTEGER NULL , - anatomic_site_concept_id INTEGER NULL , - disease_status_concept_id INTEGER NULL , - specimen_source_id VARCHAR(50) NULL , - specimen_source_value VARCHAR(50) NULL , - unit_source_value VARCHAR(50) NULL , + specimen_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + specimen_concept_id INTEGER NOT NULL , + specimen_type_concept_id INTEGER NOT NULL , + specimen_date DATE NULL , + specimen_datetime TIMESTAMP NOT NULL , + quantity FLOAT NULL , + unit_concept_id INTEGER NULL , + anatomic_site_concept_id INTEGER NULL , + disease_status_concept_id INTEGER NULL , + specimen_source_id VARCHAR(50) NULL , + specimen_source_value VARCHAR(50) NULL , + unit_source_value VARCHAR(50) NULL , anatomic_site_source_value VARCHAR(50) NULL , - disease_status_source_value VARCHAR(50) NULL -) -; - - ---HINT DISTRIBUTE_ON_KEY(person_id) -CREATE TABLE death -( - person_id NUMBER(19) NOT NULL , - death_date DATE NULL , - death_datetime DATETIME2 NOT NULL , - death_type_concept_id INTEGER NOT NULL , - cause_concept_id INTEGER NULL , - cause_source_value VARCHAR(50) NULL, - cause_source_concept_id INTEGER NULL + disease_status_source_value VARCHAR(50) NULL ) ; @@ -312,23 +274,23 @@ CREATE TABLE death --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE visit_occurrence ( - visit_occurrence_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - visit_concept_id INTEGER NOT NULL , - visit_start_date DATE NULL , - visit_start_datetime DATETIME2 NOT NULL , - visit_end_date DATE NULL , - visit_end_datetime DATETIME2 NOT NULL , - visit_type_concept_id INTEGER NOT NULL , - provider_id INTEGER NULL, - care_site_id INTEGER NULL, - visit_source_value VARCHAR(50) NULL, - visit_source_concept_id INTEGER NULL , - admitted_from_concept_id INTEGER NULL , /*Changed from admitting_source_* */ + visit_occurrence_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + visit_concept_id INTEGER NOT NULL , + visit_start_date DATE NULL , + visit_start_datetime TIMESTAMP NOT NULL , + visit_end_date DATE NULL , + visit_end_datetime TIMESTAMP NOT NULL , + visit_type_concept_id INTEGER NOT NULL , + provider_id NUMBER(19) NULL, + care_site_id NUMBER(19) NULL, + visit_source_value VARCHAR(50) NULL, + visit_source_concept_id INTEGER NULL , + admitted_from_concept_id INTEGER NULL , admitted_from_source_value VARCHAR(50) NULL , - discharge_to_source_value VARCHAR(50) NULL , - discharge_to_concept_id INTEGER NULL , - preceding_visit_occurrence_id INTEGER NULL + discharge_to_source_value VARCHAR(50) NULL , + discharge_to_concept_id INTEGER NULL , + preceding_visit_occurrence_id INTEGER NULL ) ; @@ -336,25 +298,25 @@ CREATE TABLE visit_occurrence --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE visit_detail ( - visit_detail_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , + visit_detail_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , visit_detail_concept_id INTEGER NOT NULL , visit_detail_start_date DATE NULL , - visit_detail_start_datetime DATETIME2 NOT NULL , + visit_detail_start_datetime TIMESTAMP NOT NULL , visit_detail_end_date DATE NULL , - visit_detail_end_datetime DATETIME2 NOT NULL , + visit_detail_end_datetime TIMESTAMP NOT NULL , visit_detail_type_concept_id INTEGER NOT NULL , - provider_id INTEGER NULL , - care_site_id INTEGER NULL , + provider_id NUMBER(19) NULL , + care_site_id NUMBER(19) NULL , discharge_to_concept_id INTEGER NULL , admitted_from_concept_id INTEGER NULL , /*Changed from admitting_source_* */ admitted_from_source_value VARCHAR(50) NULL , visit_detail_source_value VARCHAR(50) NULL , visit_detail_source_concept_id INTEGER NULL , discharge_to_source_value VARCHAR(50) NULL , - preceding_visit_detail_id NUMBER(19) NULL , - visit_detail_parent_id NUMBER(19) NULL , - visit_occurrence_id NUMBER(19) NOT NULL + preceding_visit_detail_id NUMBER(19) NULL , + visit_detail_parent_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NOT NULL ) ; @@ -362,20 +324,20 @@ CREATE TABLE visit_detail --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE procedure_occurrence ( - procedure_occurrence_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - procedure_concept_id INTEGER NOT NULL , - procedure_date DATE NULL , - procedure_datetime DATETIME2 NOT NULL , + procedure_occurrence_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + procedure_concept_id INTEGER NOT NULL , + procedure_date DATE NULL , + procedure_datetime TIMESTAMP NOT NULL , procedure_type_concept_id INTEGER NOT NULL , - modifier_concept_id INTEGER NULL , - quantity INTEGER NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - procedure_source_value VARCHAR(50) NULL , + modifier_concept_id INTEGER NULL , + quantity INTEGER NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + procedure_source_value VARCHAR(50) NULL , procedure_source_concept_id INTEGER NULL , - modifier_source_value VARCHAR(50) NULL , + modifier_source_value VARCHAR(50) NULL ) ; @@ -383,29 +345,29 @@ CREATE TABLE procedure_occurrence --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE drug_exposure ( - drug_exposure_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - drug_concept_id INTEGER NOT NULL , - drug_exposure_start_date DATE NULL , - drug_exposure_start_datetime DATETIME2 NOT NULL , - drug_exposure_end_date DATE NULL , - drug_exposure_end_datetime DATETIME2 NOT NULL , - verbatim_end_date DATE NULL , - drug_type_concept_id INTEGER NOT NULL , - stop_reason VARCHAR(20) NULL , - refills INTEGER NULL , - quantity FLOAT NULL , - days_supply INTEGER NULL , - sig CLOB NULL , - route_concept_id INTEGER NULL , - lot_number VARCHAR(50) NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - drug_source_value VARCHAR(50) NULL , - drug_source_concept_id INTEGER NULL , - route_source_value VARCHAR(50) NULL , - dose_unit_source_value VARCHAR(50) NULL + drug_exposure_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + drug_concept_id INTEGER NOT NULL , + drug_exposure_start_date DATE NULL , + drug_exposure_start_datetime TIMESTAMP NOT NULL , + drug_exposure_end_date DATE NULL , + drug_exposure_end_datetime TIMESTAMP NOT NULL , + verbatim_end_date DATE NULL , + drug_type_concept_id INTEGER NOT NULL , + stop_reason VARCHAR(20) NULL , + refills INTEGER NULL , + quantity FLOAT NULL , + days_supply INTEGER NULL , + sig CLOB NULL , + route_concept_id INTEGER NULL , + lot_number VARCHAR(50) NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + drug_source_value VARCHAR(50) NULL , + drug_source_concept_id INTEGER NULL , + route_source_value VARCHAR(50) NULL , + dose_unit_source_value VARCHAR(50) NULL ) ; @@ -413,21 +375,21 @@ CREATE TABLE drug_exposure --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE device_exposure ( - device_exposure_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - device_concept_id INTEGER NOT NULL , - device_exposure_start_date DATE NULL , - device_exposure_start_datetime DATETIME2 NOT NULL , - device_exposure_end_date DATE NULL , - device_exposure_end_datetime DATETIME2 NULL , - device_type_concept_id INTEGER NOT NULL , - unique_device_id VARCHAR(50) NULL , - quantity INTEGER NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - device_source_value VARCHAR(100) NULL , - device_source_concept_id INTEGER NULL + device_exposure_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + device_concept_id INTEGER NOT NULL , + device_exposure_start_date DATE NULL , + device_exposure_start_datetime TIMESTAMP NOT NULL , + device_exposure_end_date DATE NULL , + device_exposure_end_datetime TIMESTAMP NULL , + device_type_concept_id INTEGER NOT NULL , + unique_device_id VARCHAR(50) NULL , + quantity INTEGER NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + device_source_value VARCHAR(100) NULL , + device_source_concept_id INTEGER NULL ) ; @@ -435,22 +397,22 @@ CREATE TABLE device_exposure --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE condition_occurrence ( - condition_occurrence_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - condition_concept_id INTEGER NOT NULL , - condition_start_date DATE NULL , - condition_start_datetime DATETIME2 NOT NULL , - condition_end_date DATE NULL , - condition_end_datetime DATETIME2 NULL , - condition_type_concept_id INTEGER NOT NULL , - condition_status_concept_id INTEGER NULL , - stop_reason VARCHAR(20) NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - condition_source_value VARCHAR(50) NULL , - condition_source_concept_id INTEGER NULL , - condition_status_source_value VARCHAR(50) NULL + condition_occurrence_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + condition_concept_id INTEGER NOT NULL , + condition_start_date DATE NULL , + condition_start_datetime TIMESTAMP NOT NULL , + condition_end_date DATE NULL , + condition_end_datetime TIMESTAMP NULL , + condition_type_concept_id INTEGER NOT NULL , + condition_status_concept_id INTEGER NULL , + stop_reason VARCHAR(20) NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + condition_source_value VARCHAR(50) NULL , + condition_source_concept_id INTEGER NULL , + condition_status_source_value VARCHAR(50) NULL ) ; @@ -458,26 +420,26 @@ CREATE TABLE condition_occurrence --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE measurement ( - measurement_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - measurement_concept_id INTEGER NOT NULL , - measurement_date DATE NULL , - measurement_datetime DATETIME2 NOT NULL , + measurement_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + measurement_concept_id INTEGER NOT NULL , + measurement_date DATE NULL , + measurement_datetime TIMESTAMP NOT NULL , measurement_time VARCHAR(10) NULL, - measurement_type_concept_id INTEGER NOT NULL , - operator_concept_id INTEGER NULL , - value_as_number FLOAT NULL , - value_as_concept_id INTEGER NULL , - unit_concept_id INTEGER NULL , - range_low FLOAT NULL , - range_high FLOAT NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - measurement_source_value VARCHAR(50) NULL , - measurement_source_concept_id INTEGER NULL , - unit_source_value VARCHAR(50) NULL , - value_source_value VARCHAR(50) NULL + measurement_type_concept_id INTEGER NOT NULL , + operator_concept_id INTEGER NULL , + value_as_number FLOAT NULL , + value_as_concept_id INTEGER NULL , + unit_concept_id INTEGER NULL , + range_low FLOAT NULL , + range_high FLOAT NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + measurement_source_value VARCHAR(50) NULL , + measurement_source_concept_id INTEGER NULL , + unit_source_value VARCHAR(50) NULL , + value_source_value VARCHAR(50) NULL ) ; @@ -485,23 +447,22 @@ CREATE TABLE measurement --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE note ( - note_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - note_event_id NUMBER(19) NULL , --This and the field below added - note_domain_id VARCHAR(20) NULL , --This field may be removed in favor of the one below ---note_event_table_concept_id INTEGER NULL , --This may be added based on 9/4 meeting - note_date DATE NULL , - note_datetime DATETIME2 NOT NULL , - note_type_concept_id INTEGER NOT NULL , - note_class_concept_id INTEGER NOT NULL , - note_title VARCHAR(250) NULL , - note_text CLOB NULL , - encoding_concept_id INTEGER NOT NULL , - language_concept_id INTEGER NOT NULL , - provider_id INTEGER NULL , - visit_occurrence_id INTEGER NULL , - visit_detail_id INTEGER NULL , - note_source_value VARCHAR(50) NULL + note_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + note_event_id NUMBER(19) NULL , + note_event_field_concept_id INTEGER NULL , + note_date DATE NULL , + note_datetime TIMESTAMP NOT NULL , + note_type_concept_id INTEGER NOT NULL , + note_class_concept_id INTEGER NOT NULL , + note_title VARCHAR(250) NULL , + note_text CLOB NULL , + encoding_concept_id INTEGER NOT NULL , + language_concept_id INTEGER NOT NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + note_source_value VARCHAR(50) NULL ) ; @@ -509,20 +470,20 @@ CREATE TABLE note --HINT DISTRIBUTE ON RANDOM CREATE TABLE note_nlp ( - note_nlp_id NUMBER(19) NOT NULL , - note_id NUMBER(19) NOT NULL , - section_concept_id INTEGER NULL , - snippet VARCHAR(250) NULL , - "offset" VARCHAR(250) NULL , - lexical_variant VARCHAR(250) NOT NULL , - note_nlp_concept_id INTEGER NULL , - nlp_system VARCHAR(250) NULL , - nlp_date DATE NOT NULL , - nlp_datetime DATETIME2 NULL , - term_exists VARCHAR(1) NULL , - term_temporal VARCHAR(50) NULL , - term_modifiers VARCHAR(2000) NULL , - note_nlp_source_concept_id INTEGER NULL + note_nlp_id NUMBER(19) NOT NULL , + note_id NUMBER(19) NOT NULL , + section_concept_id INTEGER NULL , + snippet VARCHAR(250) NULL , + "offset" VARCHAR(250) NULL , + lexical_variant VARCHAR(250) NOT NULL , + note_nlp_concept_id INTEGER NULL , + nlp_system VARCHAR(250) NULL , + nlp_date DATE NOT NULL , + nlp_datetime TIMESTAMP NULL , + term_exists VARCHAR(1) NULL , + term_temporal VARCHAR(50) NULL , + term_modifiers VARCHAR(2000) NULL , + note_nlp_source_concept_id INTEGER NULL ) ; @@ -530,28 +491,27 @@ CREATE TABLE note_nlp --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE observation ( - observation_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - observation_concept_id INTEGER NOT NULL , - observation_date DATE NULL , - observation_datetime DATETIME2 NOT NULL , + observation_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + observation_concept_id INTEGER NOT NULL , + observation_date DATE NULL , + observation_datetime TIMESTAMP NOT NULL , observation_type_concept_id INTEGER NOT NULL , - value_as_number FLOAT NULL , - value_as_string VARCHAR(60) NULL , - value_as_concept_id INTEGER NULL , - qualifier_concept_id INTEGER NULL , - unit_concept_id INTEGER NULL , - provider_id INTEGER NULL , - visit_occurrence_id NUMBER(19) NULL , + value_as_number FLOAT NULL , + value_as_string VARCHAR(60) NULL , + value_as_concept_id INTEGER NULL , + qualifier_concept_id INTEGER NULL , + unit_concept_id INTEGER NULL , + provider_id NUMBER(19) NULL , + visit_occurrence_id NUMBER(19) NULL , visit_detail_id NUMBER(19) NULL , - observation_source_value VARCHAR(50) NULL , + observation_source_value VARCHAR(50) NULL , observation_source_concept_id INTEGER NULL , - unit_source_value VARCHAR(50) NULL , - qualifier_source_value VARCHAR(50) NULL , - observation_event_id NUMBER(19) NULL , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/ - observation_event_domain_id VARCHAR(20) NULL , ---obs_event_table_concept_id INTEGER NULL , /* Changed name to comply with COST and NOTE. Had to use 'obs' for oracle restriction, may be added on 9/4*/ - value_as_datetime DATETIME2 NULL + unit_source_value VARCHAR(50) NULL , + qualifier_source_value VARCHAR(50) NULL , + observation_event_id NUMBER(19) NULL , /* This will link back to the event table (SURVEY) on SURVEY_OCCURRENCE_ID, changed name to comply with COST and NOTE*/ + obs_event_field_concept_id INTEGER NULL , /* Changed name to comply with COST and NOTE. Had to use 'obs' for oracle restriction, may be added on 9/4*/ + value_as_datetime TIMESTAMP NULL ) ; @@ -559,31 +519,31 @@ CREATE TABLE observation --HINT DISTRIBUTE ON KEY(person_id) CREATE TABLE survey_conduct --Table added ( - survey_conduct_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - survey_concept_id INTEGER NOT NULL , - survey_start_date DATE NULL , - survey_start_datetime DATETIME2 NULL , - survey_end_date DATE NULL , - survey_end_datetime DATETIME2 NOT NULL , - provider_id NUMBER(19) NULL , - assisted_concept_id INTEGER NULL , - respondent_type_concept_id INTEGER NULL , - timing_concept_id INTEGER NULL , - collection_method_concept_id INTEGER NULL , - assisted_source_value VARCHAR(50) NULL , - respondent_type_source_value VARCHAR(100) NULL , - timing_source_value VARCHAR(100) NULL , - collection_method_source_value VARCHAR(100) NULL , - survey_source_value VARCHAR(100) NULL , - survey_source_concept_id INTEGER NULL , - survey_source_identifier VARCHAR(100) NULL , - validated_survey_concept_id INTEGER NULL , - validated_survey_source_value VARCHAR(100) NULL , - survey_version_number VARCHAR(20) NULL , - visit_occurrence_id NUMBER(19) NULL , - visit_detail_id NUMBER(19) NULL , - response_to_visit_occurrence_id NUMBER(19) NULL + survey_conduct_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + survey_concept_id INTEGER NOT NULL , + survey_start_date DATE NULL , + survey_start_datetime TIMESTAMP NULL , + survey_end_date DATE NULL , + survey_end_datetime TIMESTAMP NOT NULL , + provider_id NUMBER(19) NULL , + assisted_concept_id INTEGER NULL , + respondent_type_concept_id INTEGER NULL , + timing_concept_id INTEGER NULL , + collection_method_concept_id INTEGER NULL , + assisted_source_value VARCHAR(50) NULL , + respondent_type_source_value VARCHAR(100) NULL , + timing_source_value VARCHAR(100) NULL , + collection_method_source_value VARCHAR(100) NULL , + survey_source_value VARCHAR(100) NULL , + survey_source_concept_id INTEGER NULL , + survey_source_identifier VARCHAR(100) NULL , + validated_survey_concept_id INTEGER NULL , + validated_survey_source_value VARCHAR(100) NULL , + survey_version_number VARCHAR(20) NULL , + visit_occurrence_id NUMBER(19) NULL , + visit_detail_id NUMBER(19) NULL , + response_visit_occurrence_id NUMBER(19) NULL ) ; @@ -592,10 +552,10 @@ CREATE TABLE survey_conduct --Table added CREATE TABLE fact_relationship ( domain_concept_id_1 INTEGER NOT NULL , - fact_id_1 NUMBER(19) NOT NULL , + fact_id_1 NUMBER(19) NOT NULL , domain_concept_id_2 INTEGER NOT NULL , - fact_id_2 NUMBER(19) NOT NULL , - relationship_concept_id INTEGER NOT NULL + fact_id_2 NUMBER(19) NOT NULL , + relationship_concept_id INTEGER NOT NULL ) ; @@ -611,17 +571,17 @@ Standardized health system data --HINT DISTRIBUTE ON RANDOM CREATE TABLE location ( - location_id NUMBER(19) NOT NULL , - address_1 VARCHAR(50) NULL , - address_2 VARCHAR(50) NULL , - city VARCHAR(50) NULL , - state VARCHAR(2) NULL , - zip VARCHAR(9) NULL , - county VARCHAR(20) NULL , - country VARCHAR(100) NULL , + location_id NUMBER(19) NOT NULL , + address_1 VARCHAR(50) NULL , + address_2 VARCHAR(50) NULL , + city VARCHAR(50) NULL , + state VARCHAR(2) NULL , + zip VARCHAR(9) NULL , + county VARCHAR(20) NULL , + country VARCHAR(100) NULL , location_source_value VARCHAR(50) NULL , - latitude FLOAT NULL , - longitude FLOAT NULL + latitude FLOAT NULL , + longitude FLOAT NULL ) ; @@ -629,13 +589,13 @@ CREATE TABLE location --HINT DISTRIBUTE ON RANDOM CREATE TABLE location_history --Table added ( - location_history_id NUMBER(19) NOT NULL , - location_id NUMBER(19) NOT NULL , - relationship_type_concept_id INTEGER NULL , --Recent addition based on github discussion - domain_id VARCHAR(50) NOT NULL , - entity_id NUMBER(19) NOT NULL , - start_date DATE NOT NULL , - end_date DATE NULL + location_history_id NUMBER(19) NOT NULL , + location_id NUMBER(19) NOT NULL , + relationship_type_concept_id INTEGER NULL , --Recent addition based on github discussion + domain_id VARCHAR(50) NOT NULL , + entity_id NUMBER(19) NOT NULL , + start_date DATE NOT NULL , + end_date DATE NULL ) ; @@ -643,12 +603,12 @@ CREATE TABLE location_history --Table added --HINT DISTRIBUTE ON RANDOM CREATE TABLE care_site ( - care_site_id NUMBER(19) NOT NULL , - care_site_name VARCHAR(255) NULL , - place_of_service_concept_id INTEGER NULL , - location_id NUMBER(19) NULL , - care_site_source_value VARCHAR(50) NULL , - place_of_service_source_value VARCHAR(50) NULL + care_site_id NUMBER(19) NOT NULL , + care_site_name VARCHAR(255) NULL , + place_of_service_concept_id INTEGER NULL , + location_id NUMBER(19) NULL , + care_site_source_value VARCHAR(50) NULL , + place_of_service_source_value VARCHAR(50) NULL ) ; @@ -656,19 +616,19 @@ CREATE TABLE care_site --HINT DISTRIBUTE ON RANDOM CREATE TABLE provider ( - provider_id NUMBER(19) NOT NULL , - provider_name VARCHAR(255) NULL , - NPI VARCHAR(20) NULL , - DEA VARCHAR(20) NULL , - specialty_concept_id INTEGER NULL , - care_site_id NUMBER(19) NULL , - year_of_birth INTEGER NULL , - gender_concept_id INTEGER NULL , - provider_source_value VARCHAR(50) NULL , - specialty_source_value VARCHAR(50) NULL , - specialty_source_concept_id INTEGER NULL , - gender_source_value VARCHAR(50) NULL , - gender_source_concept_id INTEGER NULL + provider_id NUMBER(19) NOT NULL , + provider_name VARCHAR(255) NULL , + NPI VARCHAR(20) NULL , + DEA VARCHAR(20) NULL , + specialty_concept_id INTEGER NULL , + care_site_id NUMBER(19) NULL , + year_of_birth INTEGER NULL , + gender_concept_id INTEGER NULL , + provider_source_value VARCHAR(50) NULL , + specialty_source_value VARCHAR(50) NULL , + specialty_source_concept_id INTEGER NULL , + gender_source_value VARCHAR(50) NULL , + gender_source_concept_id INTEGER NULL ) ; @@ -683,25 +643,25 @@ Standardized health economics --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE payer_plan_period ( - payer_plan_period_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - contract_person_id NUMBER(19) NULL , - payer_plan_period_start_date DATE NOT NULL , - payer_plan_period_end_date DATE NOT NULL , + payer_plan_period_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + contract_person_id NUMBER(19) NULL , + payer_plan_period_start_date DATE NOT NULL , + payer_plan_period_end_date DATE NOT NULL , payer_concept_id INTEGER NULL , plan_concept_id INTEGER NULL , contract_concept_id INTEGER NULL , sponsor_concept_id INTEGER NULL , stop_reason_concept_id INTEGER NULL , - payer_source_value VARCHAR(50) NULL , + payer_source_value VARCHAR(50) NULL , payer_source_concept_id INTEGER NULL , - plan_source_value VARCHAR(50) NULL , + plan_source_value VARCHAR(50) NULL , plan_source_concept_id INTEGER NULL , contract_source_value VARCHAR(50) NULL , contract_source_concept_id INTEGER NULL , sponsor_source_value VARCHAR(50) NULL , sponsor_source_concept_id INTEGER NULL , - family_source_value VARCHAR(50) NULL , + family_source_value VARCHAR(50) NULL , stop_reason_source_value VARCHAR(50) NULL , stop_reason_source_concept_id INTEGER NULL ) @@ -711,25 +671,24 @@ CREATE TABLE payer_plan_period --HINT DISTRIBUTE ON KEY(person_id) CREATE TABLE cost ( - cost_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL, - cost_event_id NUMBER(19) NOT NULL , - cost_domain_id VARCHAR(20) NOT NULL , ---cost_event_table_concept_id INTEGER NOT NULL , /*This is still in discussion and most likely will replace cost_domain_id at 9/4 meeting*/ - cost_concept_id INTEGER NOT NULL , - cost_type_concept_id INTEGER NOT NULL , - currency_concept_id INTEGER NULL , - cost FLOAT NULL , - incurred_date DATE NOT NULL , - billed_date DATE NULL , - paid_date DATE NULL , - revenue_code_concept_id INTEGER NULL , - drg_concept_id INTEGER NULL , - cost_source_value VARCHAR(50) NULL , - cost_source_concept_id INTEGER NULL , - revenue_code_source_value VARCHAR(50) NULL , + cost_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL, + cost_event_id NUMBER(19) NOT NULL , + cost_event_field_concept_id INTEGER NOT NULL , + cost_concept_id INTEGER NOT NULL , + cost_type_concept_id INTEGER NOT NULL , + currency_concept_id INTEGER NULL , + cost FLOAT NULL , + incurred_date DATE NOT NULL , + billed_date DATE NULL , + paid_date DATE NULL , + revenue_code_concept_id INTEGER NULL , + drg_concept_id INTEGER NULL , + cost_source_value VARCHAR(50) NULL , + cost_source_concept_id INTEGER NULL , + revenue_code_source_value VARCHAR(50) NULL , drg_source_value VARCHAR(3) NULL , - payer_plan_period_id NUMBER(19) NULL + payer_plan_period_id NUMBER(19) NULL ) ; @@ -741,41 +700,16 @@ Standardized derived elements ************************/ ---HINT DISTRIBUTE_ON_KEY(subject_id) -CREATE TABLE cohort -( - cohort_definition_id NUMBER(19) NOT NULL , - subject_id NUMBER(19) NOT NULL , - cohort_start_date DATE NOT NULL , - cohort_end_date DATE NOT NULL -) -; - - ---HINT DISTRIBUTE_ON_KEY(subject_id) -CREATE TABLE cohort_attribute -( - cohort_definition_id NUMBER(19) NOT NULL , - subject_id NUMBER(19) NOT NULL , - cohort_start_date DATE NOT NULL , - cohort_end_date DATE NOT NULL , - attribute_definition_id NUMBER(19) NOT NULL , - value_as_number FLOAT NULL , - value_as_concept_id INTEGER NULL -) -; - - --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE drug_era ( - drug_era_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - drug_concept_id INTEGER NOT NULL , - drug_era_start_date DATE NOT NULL , - drug_era_end_date DATE NOT NULL , + drug_era_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + drug_concept_id INTEGER NOT NULL , + drug_era_start_date DATE NOT NULL , + drug_era_end_date DATE NOT NULL , drug_exposure_count INTEGER NULL , - gap_days INTEGER NULL + gap_days INTEGER NULL ) ; @@ -783,13 +717,13 @@ CREATE TABLE drug_era --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE dose_era ( - dose_era_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - drug_concept_id INTEGER NOT NULL , - unit_concept_id INTEGER NOT NULL , - dose_value FLOAT NOT NULL , - dose_era_start_date DATE NOT NULL , - dose_era_end_date DATE NOT NULL + dose_era_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + drug_concept_id INTEGER NOT NULL , + unit_concept_id INTEGER NOT NULL , + dose_value FLOAT NOT NULL , + dose_era_start_date DATE NOT NULL , + dose_era_end_date DATE NOT NULL ) ; @@ -797,11 +731,11 @@ CREATE TABLE dose_era --HINT DISTRIBUTE_ON_KEY(person_id) CREATE TABLE condition_era ( - condition_era_id NUMBER(19) NOT NULL , - person_id NUMBER(19) NOT NULL , - condition_concept_id INTEGER NOT NULL , - condition_era_start_date DATE NOT NULL , - condition_era_end_date DATE NOT NULL , + condition_era_id NUMBER(19) NOT NULL , + person_id NUMBER(19) NOT NULL , + condition_concept_id INTEGER NOT NULL , + condition_era_start_date DATE NOT NULL , + condition_era_end_date DATE NOT NULL , condition_occurrence_count INTEGER NULL ) ; diff --git a/Oracle/OMOP CDM oracle pk indexes.txt b/Oracle/OMOP CDM oracle pk indexes.txt index e6ed606..ee5b2f2 100644 --- a/Oracle/OMOP CDM oracle pk indexes.txt +++ b/Oracle/OMOP CDM oracle pk indexes.txt @@ -77,10 +77,6 @@ ALTER TABLE source_to_concept_map ADD CONSTRAINT xpk_source_to_concept_map PRIMA ALTER TABLE drug_strength ADD CONSTRAINT xpk_drug_strength PRIMARY KEY (drug_concept_id, ingredient_concept_id); -ALTER TABLE cohort_definition ADD CONSTRAINT xpk_cohort_definition PRIMARY KEY (cohort_definition_id); - -ALTER TABLE attribute_definition ADD CONSTRAINT xpk_attribute_definition PRIMARY KEY (attribute_definition_id); - /************************** @@ -127,7 +123,7 @@ ALTER TABLE note_nlp ADD CONSTRAINT xpk_note_nlp PRIMARY KEY ( note_nlp_id ) ; ALTER TABLE observation ADD CONSTRAINT xpk_observation PRIMARY KEY ( observation_id ) ; -ALTER TABLE survey ADD CONSTRAINT xpk_survey PRIMARY KEY ( survey_occurrence_id ) ; +ALTER TABLE survey_conduct ADD CONSTRAINT xpk_survey_conduct PRIMARY KEY ( survey_conduct_id ) ; /************************ @@ -139,7 +135,7 @@ Standardized health system data ALTER TABLE location ADD CONSTRAINT xpk_location PRIMARY KEY ( location_id ) ; -ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ; --Assuming this should be added +ALTER TABLE location_history ADD CONSTRAINT xpk_location_history PRIMARY KEY ( location_history_id ) ; ALTER TABLE care_site ADD CONSTRAINT xpk_care_site PRIMARY KEY ( care_site_id ) ; @@ -165,10 +161,6 @@ Standardized derived elements ************************/ -ALTER TABLE cohort ADD CONSTRAINT xpk_cohort PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date ) ; - -ALTER TABLE cohort_attribute ADD CONSTRAINT xpk_cohort_attribute PRIMARY KEY ( cohort_definition_id, subject_id, cohort_start_date, cohort_end_date, attribute_definition_id ) ; - ALTER TABLE drug_era ADD CONSTRAINT xpk_drug_era PRIMARY KEY ( drug_era_id ) ; ALTER TABLE dose_era ADD CONSTRAINT xpk_dose_era PRIMARY KEY ( dose_era_id ) ; @@ -260,10 +252,6 @@ CREATE INDEX idx_source_to_concept_map_code ON source_to_concept_map (source_cod CREATE INDEX idx_drug_strength_id_1 ON drug_strength (drug_concept_id ASC); CREATE INDEX idx_drug_strength_id_2 ON drug_strength (ingredient_concept_id ASC); -CREATE INDEX idx_cohort_definition_id ON cohort_definition (cohort_definition_id ASC); - -CREATE INDEX idx_attribute_definition_id ON attribute_definition (attribute_definition_id ASC); - /************************** @@ -370,12 +358,6 @@ Standardized derived elements ************************/ -CREATE INDEX idx_cohort_subject_id ON cohort (subject_id ASC); -CREATE INDEX idx_cohort_c_definition_id ON cohort (cohort_definition_id ASC); - -CREATE INDEX idx_ca_subject_id ON cohort_attribute (subject_id ASC); -CREATE INDEX idx_ca_definition_id ON cohort_attribute (cohort_definition_id ASC); - CREATE INDEX idx_drug_era_person_id ON drug_era (person_id ASC); CREATE INDEX idx_drug_era_concept_id ON drug_era (drug_concept_id ASC); diff --git a/Oracle/README.md b/Oracle/README.md index 22505e6..2eb73a7 100644 --- a/Oracle/README.md +++ b/Oracle/README.md @@ -7,7 +7,7 @@ In order to create your instantiation of the Common Data Model, we recommend fol 1. Create an empty schema. -2. Execute the script `OMOP CDM oracle ddl.txt` to create the tables and fields. +2. Execute the script `OMOP CDM oracle ddl.txt` and `OMOP CDM Results oracle ddl.txt` to create the tables and fields. 3. Load your data into the schema.