OMOP/BigQuery/OMOP CDM bigquery ddl.txt

654 lines
20 KiB
Plaintext
Raw Normal View History

2018-06-14 20:15:03 +00:00
/*OMOP CDM v5.3.1 14June2018*/
#standardsql
create table concept (
2018-03-19 20:39:52 +00:00
concept_id INT64 not null ,
concept_name STRING not null ,
domain_id STRING not null ,
vocabulary_id STRING not null ,
concept_class_id STRING not null ,
standard_concept STRING ,
2018-03-19 20:39:52 +00:00
concept_code STRING not null ,
valid_start_DATE DATE not null ,
valid_end_DATE DATE not null ,
2018-06-14 20:15:03 +00:00
invalid_reason STRING
)
;
create table vocabulary (
2018-03-19 20:39:52 +00:00
vocabulary_id STRING not null,
vocabulary_name STRING not null,
vocabulary_reference STRING not null,
vocabulary_version STRING ,
2018-03-19 20:39:52 +00:00
vocabulary_concept_id INT64 not null
)
;
create table domain (
2018-03-19 20:39:52 +00:00
domain_id STRING not null,
domain_name STRING not null,
domain_concept_id INT64 not null
)
;
create table concept_class (
2018-03-19 20:39:52 +00:00
concept_class_id STRING not null,
concept_class_name STRING not null,
concept_class_concept_id INT64 not null
)
;
create table concept_relationship (
2018-03-19 20:39:52 +00:00
concept_id_1 INT64 not null,
concept_id_2 INT64 not null,
relationship_id STRING not null,
valid_start_DATE DATE not null,
valid_end_DATE DATE not null,
2018-06-14 20:15:03 +00:00
invalid_reason STRING
)
;
create table relationship (
2018-03-19 20:39:52 +00:00
relationship_id STRING not null,
relationship_name STRING not null,
is_hierarchical STRING not null,
defines_ancestry STRING not null,
reverse_relationship_id STRING not null,
relationship_concept_id INT64 not null
)
;
create table concept_synonym (
2018-03-19 20:39:52 +00:00
concept_id INT64 not null,
concept_synonym_name STRING not null,
language_concept_id INT64 not null
)
;
create table concept_ancestor (
2018-03-19 20:39:52 +00:00
ancestor_concept_id INT64 not null,
descendant_concept_id INT64 not null,
min_levels_of_separation INT64 not null,
max_levels_of_separation INT64 not null
)
;
create table source_to_concept_map (
2018-03-19 20:39:52 +00:00
source_code STRING not null,
source_concept_id INT64 not null,
source_vocabulary_id STRING not null,
source_code_description STRING ,
2018-03-19 20:39:52 +00:00
target_concept_id INT64 not null,
target_vocabulary_id STRING not null,
valid_start_DATE DATE not null,
valid_end_DATE DATE not null,
2018-06-14 20:15:03 +00:00
invalid_reason STRING
)
;
create table drug_strength (
2018-03-19 20:39:52 +00:00
drug_concept_id INT64 not null,
ingredient_concept_id INT64 not null,
amount_value FLOAT64 ,
amount_unit_concept_id INT64 ,
numerator_value FLOAT64 ,
numerator_unit_concept_id INT64 ,
denominator_value FLOAT64 ,
denominator_unit_concept_id INT64 ,
box_size INT64 ,
valid_start_DATE DATE not null,
valid_end_DATE DATE not null,
2018-06-14 20:15:03 +00:00
invalid_reason STRING
)
;
create table cohort_definition (
2018-03-19 20:39:52 +00:00
cohort_definition_id INT64 not null,
cohort_definition_name STRING not null,
cohort_definition_description STRING ,
2018-03-19 20:39:52 +00:00
definition_type_concept_id INT64 not null,
cohort_definition_syntax STRING ,
2018-03-19 20:39:52 +00:00
subject_concept_id INT64 not null,
2018-06-14 20:15:03 +00:00
cohort_initiation_DATE DATE
)
;
create table attribute_definition (
2018-03-19 20:39:52 +00:00
attribute_definition_id INT64 not null,
attribute_name STRING not null,
attribute_description STRING ,
2018-03-19 20:39:52 +00:00
attribute_type_concept_id INT64 not null,
2018-06-14 20:15:03 +00:00
attribute_syntax STRING
)
;
create table cdm_source
(
2018-03-19 20:39:52 +00:00
cdm_source_name STRING not null ,
cdm_source_abbreviation STRING ,
cdm_holder STRING ,
source_description STRING ,
source_documentation_reference STRING ,
cdm_etl_reference STRING ,
source_release_DATE DATE ,
cdm_release_DATE DATE ,
cdm_version STRING ,
2018-06-14 20:15:03 +00:00
vocabulary_version STRING
)
;
create table metadata
(
2018-03-19 20:39:52 +00:00
metadata_concept_id INT64 not null ,
metadata_type_concept_id INT64 not null ,
name STRING not null ,
value_as_string STRING ,
value_as_concept_id INT64 ,
metadata_DATE DATE ,
2018-06-14 20:15:03 +00:00
metadata_DATETIME DATETIME
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table person
(
2018-03-19 20:39:52 +00:00
person_id INT64 not null ,
gender_concept_id INT64 not null ,
year_of_birth INT64 not null ,
month_of_birth INT64 ,
day_of_birth INT64 ,
birth_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
race_concept_id INT64 not null,
ethnicity_concept_id INT64 not null,
location_id INT64 ,
provider_id INT64 ,
care_site_id INT64 ,
person_source_value STRING ,
gender_source_value STRING ,
gender_source_concept_id INT64 ,
race_source_value STRING ,
race_source_concept_id INT64 ,
ethnicity_source_value STRING ,
2018-06-14 20:15:03 +00:00
ethnicity_source_concept_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table observation_period
(
2018-03-19 20:39:52 +00:00
observation_period_id INT64 not null ,
person_id INT64 not null ,
observation_period_start_DATE DATE not null ,
observation_period_end_DATE DATE not null ,
2018-03-19 20:39:52 +00:00
period_type_concept_id INT64 not null
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table specimen
(
2018-03-19 20:39:52 +00:00
specimen_id INT64 not null ,
person_id INT64 not null ,
specimen_concept_id INT64 not null ,
specimen_type_concept_id INT64 not null ,
specimen_DATE DATE not null ,
specimen_DATETIME DATETIME ,
quantity FLOAT64 ,
unit_concept_id INT64 ,
anatomic_site_concept_id INT64 ,
disease_status_concept_id INT64 ,
specimen_source_id STRING ,
specimen_source_value STRING ,
unit_source_value STRING ,
anatomic_site_source_value STRING ,
2018-06-14 20:15:03 +00:00
disease_status_source_value STRING
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table death
(
2018-03-19 20:39:52 +00:00
person_id INT64 not null ,
death_DATE DATE not null ,
death_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
death_type_concept_id INT64 not null ,
cause_concept_id INT64 ,
cause_source_value STRING ,
2018-06-14 20:15:03 +00:00
cause_source_concept_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table visit_occurrence
(
2018-03-19 20:39:52 +00:00
visit_occurrence_id INT64 not null ,
person_id INT64 not null ,
visit_concept_id INT64 not null ,
visit_start_DATE DATE not null ,
visit_start_DATETIME DATETIME ,
visit_end_DATE DATE not null ,
visit_end_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
visit_type_concept_id INT64 not null ,
provider_id INT64 ,
care_site_id INT64 ,
visit_source_value STRING ,
visit_source_concept_id INT64 ,
admitting_source_concept_id INT64 ,
admitting_source_value STRING ,
discharge_to_concept_id INT64 ,
discharge_to_source_value STRING ,
2018-06-14 20:15:03 +00:00
preceding_visit_occurrence_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table visit_detail
(
2018-06-14 20:15:03 +00:00
visit_detail_id INT64 not null ,
person_id INT64 not null ,
visit_detail_concept_id INT64 not null ,
visit_detail_start_DATE DATE not null ,
visit_detail_start_DATETIME DATETIME ,
visit_detail_end_DATE DATE not null ,
visit_detail_end_DATETIME DATETIME ,
visit_deatil_type_concept_id INT64 not null ,
provider_id INT64 ,
care_site_id INT64 ,
admitting_source_concept_id INT64 ,
discharge_to_concept_id INT64 ,
preceding_visit_detail_id INT64 ,
visit_detail_source_value STRING ,
visit_deatil_source_concept_id INT64 ,
admitting_source_value STRING ,
discharge_to_source_value STRING ,
visit_detail_parent_id INT64 ,
visit_occurrence_id INT64 not null
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table procedure_occurrence
(
2018-03-19 20:39:52 +00:00
procedure_occurrence_id INT64 not null ,
person_id INT64 not null ,
procedure_concept_id INT64 not null ,
procedure_DATE DATE not null ,
procedure_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
procedure_type_concept_id INT64 not null ,
modifier_concept_id INT64 ,
quantity INT64 ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
procedure_source_value STRING ,
procedure_source_concept_id INT64 ,
2018-06-14 20:15:03 +00:00
modifier_source_value STRING
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table drug_exposure
(
2018-03-19 20:39:52 +00:00
drug_exposure_id INT64 not null ,
person_id INT64 not null ,
drug_concept_id INT64 not null ,
drug_exposure_start_DATE DATE not null ,
drug_exposure_start_DATETIME DATETIME ,
drug_exposure_end_DATE DATE not null ,
drug_exposure_end_DATETIME DATETIME ,
verbatim_end_DATE DATE ,
2018-03-19 20:39:52 +00:00
drug_type_concept_id INT64 not null ,
stop_reason STRING ,
refills INT64 ,
quantity FLOAT64 ,
days_supply INT64 ,
sig STRING ,
route_concept_id INT64 ,
lot_number STRING ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
drug_source_value STRING ,
drug_source_concept_id INT64 ,
route_source_value STRING ,
2018-06-14 20:15:03 +00:00
dose_unit_source_value STRING
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table device_exposure
(
2018-03-19 20:39:52 +00:00
device_exposure_id INT64 not null ,
person_id INT64 not null ,
device_concept_id INT64 not null ,
device_exposure_start_DATE DATE not null ,
device_exposure_start_DATETIME DATETIME ,
device_exposure_end_DATE DATE ,
device_exposure_end_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
device_type_concept_id INT64 not null ,
unique_device_id STRING ,
quantity INT64 ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
device_source_value STRING ,
2018-06-14 20:15:03 +00:00
device_source_concept_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table condition_occurrence
(
2018-03-19 20:39:52 +00:00
condition_occurrence_id INT64 not null ,
person_id INT64 not null ,
condition_concept_id INT64 not null ,
condition_start_DATE DATE not null ,
condition_start_DATETIME DATETIME ,
condition_end_DATE DATE ,
condition_end_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
condition_type_concept_id INT64 not null ,
stop_reason STRING ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
condition_source_value STRING ,
condition_source_concept_id INT64 ,
condition_status_source_value STRING ,
2018-06-14 20:15:03 +00:00
condition_status_concept_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table measurement
(
2018-03-19 20:39:52 +00:00
measurement_id INT64 not null ,
person_id INT64 not null ,
measurement_concept_id INT64 not null ,
measurement_DATE DATE not null ,
measurement_DATETIME DATETIME ,
measurement_time STRING ,
2018-03-19 20:39:52 +00:00
measurement_type_concept_id INT64 not null ,
operator_concept_id INT64 ,
value_as_number FLOAT64 ,
value_as_concept_id INT64 ,
unit_concept_id INT64 ,
range_low FLOAT64 ,
range_high FLOAT64 ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
measurement_source_value STRING ,
measurement_source_concept_id INT64 ,
unit_source_value STRING ,
2018-06-14 20:15:03 +00:00
value_source_value STRING
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table note
(
2018-03-19 20:39:52 +00:00
note_id INT64 not null ,
person_id INT64 not null ,
note_DATE DATE not null ,
note_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
note_type_concept_id INT64 not null ,
note_class_concept_id INT64 not null ,
note_title STRING ,
note_text STRING ,
2018-03-19 20:39:52 +00:00
encoding_concept_id INT64 not null ,
language_concept_id INT64 not null ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
2018-06-14 20:15:03 +00:00
note_source_value STRING
)
;
create table note_nlp
(
note_nlp_id INT64 ,
note_id INT64 ,
section_concept_id INT64 ,
snippet STRING ,
"offset" STRING ,
2018-03-19 20:39:52 +00:00
lexical_variant STRING not null ,
note_nlp_concept_id INT64 ,
note_nlp_source_concept_id INT64 ,
nlp_system STRING ,
nlp_DATE DATE not null ,
nlp_DATETIME DATETIME ,
term_exists STRING ,
term_temporal STRING ,
2018-06-14 20:15:03 +00:00
term_modifiers STRING
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table observation
(
2018-03-19 20:39:52 +00:00
observation_id INT64 not null ,
person_id INT64 not null ,
observation_concept_id INT64 not null ,
observation_DATE DATE not null ,
observation_DATETIME DATETIME ,
2018-03-19 20:39:52 +00:00
observation_type_concept_id INT64 not null ,
value_as_number FLOAT64 ,
value_as_string STRING ,
value_as_concept_id INT64 ,
qualifier_concept_id INT64 ,
unit_concept_id INT64 ,
provider_id INT64 ,
visit_occurrence_id INT64 ,
visit_detail_id INT64 ,
observation_source_value STRING ,
observation_source_concept_id INT64 ,
unit_source_value STRING ,
2018-06-14 20:15:03 +00:00
qualifier_source_value STRING
)
;
create table fact_relationship
(
2018-03-19 20:39:52 +00:00
domain_concept_id_1 INT64 not null ,
fact_id_1 INT64 not null ,
domain_concept_id_2 INT64 not null ,
fact_id_2 INT64 not null ,
relationship_concept_id INT64 not null
)
;
create table location
(
location_id INT64 not null ,
address_1 STRING ,
address_2 STRING ,
city STRING ,
state STRING ,
zip STRING ,
county STRING ,
2018-06-14 20:15:03 +00:00
location_source_value STRING
)
;
create table care_site
(
2018-03-19 20:39:52 +00:00
care_site_id INT64 not null ,
care_site_name STRING ,
place_of_service_concept_id INT64 ,
location_id INT64 ,
care_site_source_value STRING ,
2018-06-14 20:15:03 +00:00
place_of_service_source_value STRING
)
;
create table provider
(
2018-03-19 20:39:52 +00:00
provider_id INT64 not null ,
provider_name STRING ,
npi STRING ,
dea STRING ,
specialty_concept_id INT64 ,
care_site_id INT64 ,
year_of_birth INT64 ,
gender_concept_id INT64 ,
provider_source_value STRING ,
specialty_source_value STRING ,
specialty_source_concept_id INT64 ,
gender_source_value STRING ,
2018-06-14 20:15:03 +00:00
gender_source_concept_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table payer_plan_period
(
payer_plan_period_id INT64 not null ,
person_id INT64 not null ,
payer_plan_period_start_DATE DATE not null ,
payer_plan_period_end_DATE DATE not null ,
payer_concept_id INT64 ,
payer_source_value STRING ,
payer_source_concept_id INT64 ,
plan_concept_id INT64 ,
plan_source_value STRING ,
plan_source_concept_id INT64 ,
sponsor_concept_id INT64 ,
sponsor_source_value STRING ,
sponsor_source_concept_id INT64 ,
family_source_value STRING ,
stop_reason_concept_id INT64 ,
stop_reason_source_value STRING ,
2018-06-14 20:15:03 +00:00
stop_reason_source_concept_id INT64
)
;
create table cost
(
2018-03-19 20:39:52 +00:00
cost_id INT64 not null ,
cost_event_id INT64 not null ,
cost_domain_id STRING not null ,
2018-03-19 20:39:52 +00:00
cost_type_concept_id INT64 not null ,
currency_concept_id INT64 ,
total_charge FLOAT64 ,
total_cost FLOAT64 ,
total_paid FLOAT64 ,
paid_by_payer FLOAT64 ,
paid_by_patient FLOAT64 ,
paid_patient_copay FLOAT64 ,
paid_patient_coinsurance FLOAT64 ,
paid_patient_deductible FLOAT64 ,
paid_by_primary FLOAT64 ,
paid_ingredient_cost FLOAT64 ,
paid_dispensing_fee FLOAT64 ,
payer_plan_period_id INT64 ,
amount_allowed FLOAT64 ,
revenue_code_concept_id INT64 ,
revenue_code_source_value STRING ,
drg_concept_id INT64 ,
2018-06-14 20:15:03 +00:00
drg_source_value STRING
)
;
--HINT DISTRIBUTE_ON_KEY(subject_id)
create table cohort
(
2018-03-19 20:39:52 +00:00
cohort_definition_id INT64 not null ,
subject_id INT64 not null ,
cohort_start_DATE DATE not null ,
cohort_end_DATE DATE not null
)
;
--HINT DISTRIBUTE_ON_KEY(subject_id)
create table cohort_attribute
(
cohort_definition_id INT64 not null ,
subject_id INT64 not null ,
2018-03-19 20:39:52 +00:00
cohort_start_DATE DATE not null ,
cohort_end_DATE DATE not null ,
attribute_definition_id INT64 not null ,
value_as_number FLOAT64 ,
2018-06-14 20:15:03 +00:00
value_as_concept_id INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table drug_era
(
2018-03-19 20:39:52 +00:00
drug_era_id INT64 not null ,
person_id INT64 not null ,
drug_concept_id INT64 not null ,
drug_era_start_DATE DATE not null ,
drug_era_end_DATE DATE not null ,
drug_exposure_count INT64 ,
2018-06-14 20:15:03 +00:00
gap_days INT64
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table dose_era
(
2018-03-19 20:39:52 +00:00
dose_era_id INT64 not null ,
person_id INT64 not null ,
drug_concept_id INT64 not null ,
unit_concept_id INT64 not null ,
dose_value FLOAT64 not null ,
dose_era_start_DATE DATE not null ,
dose_era_end_DATE DATE not null
)
;
--HINT DISTRIBUTE_ON_KEY(person_id)
create table condition_era
(
2018-03-19 20:39:52 +00:00
condition_era_id INT64 not null ,
person_id INT64 not null ,
condition_concept_id INT64 not null ,
condition_era_start_DATE DATE not null ,
condition_era_end_DATE DATE not null ,
2018-06-14 20:15:03 +00:00
condition_occurrence_count INT64
)
;