diff --git a/.gitignore b/.gitignore index 8318b436..20d6890e 100644 --- a/.gitignore +++ b/.gitignore @@ -153,3 +153,5 @@ docs/temp/* *.yaml.gz *_stories.py + +/examples/opiates/* diff --git a/examples/mimic_omop/README.md b/examples/mimic_omop/README.md new file mode 100644 index 00000000..bd048837 --- /dev/null +++ b/examples/mimic_omop/README.md @@ -0,0 +1,21 @@ +# How to run datafaker process on omop schema + +1. Make a YAML file representing the tables in the schema + +`poetry run datafaker make-tables --orm-file ./examples/mimic_omop/orm.yaml` + +1. Create schema from the ORM YAML file + +`poetry run datafaker create-tables --orm-file ./examples/mimic_omop/orm.yaml --config-file ./examples/mimic_omop/config.yaml` + +1. Create generator table + +`poetry run datafaker create-generators --orm-file ./examples/mimic_omop/orm.yaml --config-file ./examples/mimic_omop/config.yaml --df-file ./examples/mimic_omop/df.py` + +1. Create data + +`poetry run datafaker create-data --orm-file ./examples/mimic_omop/orm.yaml --config-file ./examples/mimic_omop/config.yaml --df-file .\examples\mimic_omop\df.py` + +1. Remove data + +`poetry run datafaker remove-data --orm-file ./examples/mimic_omop/orm.yaml --config-file ./examples/mimic_omop/config.yaml` diff --git a/examples/mimic_omop/config.yaml b/examples/mimic_omop/config.yaml new file mode 100644 index 00000000..34c7009a --- /dev/null +++ b/examples/mimic_omop/config.yaml @@ -0,0 +1,121 @@ +tables: + # Unnecessary tables + _measurement_links: + ignore: true + _observation_links: + ignore: true + _person_links: + ignore: true + _procedure_occurrence_links: + ignore: true + _visit_occurrence_links: + ignore: true + + # Vocab tables + concept: + # This one is a vocab, but its too big to handle the usual way + ignore: true + # vocabulary_table: true + concept_ancestor: + # This one is a vocab, but its too big to handle the usual way + ignore: true + # vocabulary_table: true + vocabulary: + vocabulary_table: true + domain: + vocabulary_table: true + concept_class: + vocabulary_table: true + concept_synonym: + # This one is a vocab, but its too big to handle the usual way + ignore: true + # vocabulary_table: true + concept_relationship: + # This one is a vocab, but its too big to handle the usual way + ignore: true + # vocabulary_table: true + drug_strength: + # This one is a vocab, but its too big to handle the usual way + ignore: true + # vocabulary_table: true + relationship: + vocabulary_table: true + source_to_concept_map: + vocabulary_table: true + location: + vocabulary_table: true + care_site: + vocabulary_table: true + provider: + vocabulary_table: true + cdm_source: + vocabulary_table: true + + attribute_definition: + num_rows_per_pass: 0 + + cohort_definition: + num_rows_per_pass: 0 + + condition_era: + num_rows_per_pass: 0 + + cost: + num_rows_per_pass: 0 + + device_exposure: + num_rows_per_pass: 0 + + dose_era: + num_rows_per_pass: 0 + + drug_era: + num_rows_per_pass: 0 + + drug_exposure: + num_rows_per_pass: 0 + + fact_relationship: + num_rows_per_pass: 0 + + measurement: + num_rows_per_pass: 0 + + metadata: + num_rows_per_pass: 0 + + note: + num_rows_per_pass: 0 + + note_nlp: + num_rows_per_pass: 0 + + observation: + num_rows_per_pass: 0 + + observation_period: + num_rows_per_pass: 0 + + payer_plan_period: + num_rows_per_pass: 0 + + procedure_occurrence: + num_rows_per_pass: 0 + + specimen: + num_rows_per_pass: 0 + + visit_detail: + num_rows_per_pass: 0 + + visit_occurrence: + num_rows_per_pass: 0 + + person: + num_rows_per_pass: 0 + + death: + num_rows_per_pass: 0 + + condition_occurrence: + num_rows_per_pass: 0 diff --git a/examples/mimic_omop/df.py b/examples/mimic_omop/df.py new file mode 100644 index 00000000..d5a1dbd4 --- /dev/null +++ b/examples/mimic_omop/df.py @@ -0,0 +1,1733 @@ +"""This file was auto-generated by datafaker but can be edited manually.""" +from mimesis import Generic, Numeric, Person +from mimesis.locales import Locale +import sqlalchemy +import sys +from datafaker.base import FileUploader, TableGenerator, ColumnPresence +from datafaker.providers import DistributionProvider + +generic = Generic(locale=Locale.EN_GB) +numeric = Numeric() +person = Person() +dist_gen = DistributionProvider() +column_presence = ColumnPresence() + +sys.path.append("") + +from datafaker.providers import ( + BytesProvider, + ColumnValueProvider, + DistributionProvider, + NullProvider, + SQLGroupByProvider, + TimedeltaProvider, + TimespanProvider, + WeightedBooleanProvider, +) + +generic.add_provider(BytesProvider) +generic.add_provider(ColumnValueProvider) +generic.add_provider(DistributionProvider) +generic.add_provider(NullProvider) +generic.add_provider(SQLGroupByProvider) +generic.add_provider(TimedeltaProvider) +generic.add_provider(TimespanProvider) +generic.add_provider(WeightedBooleanProvider) + + +class CohortGenerator(TableGenerator): + num_rows_per_pass = 1 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "cohort_start_date", + "cohort_end_date", + "cohort_definition_id", + "subject_id", + } + ) + while columns_to_generate: + if "cohort_definition_id" in columns_to_generate: + result["cohort_definition_id"] = generic.numeric.integer_number() + if "cohort_end_date" in columns_to_generate: + result["cohort_end_date"] = generic.datetime.date() + if "cohort_start_date" in columns_to_generate: + result["cohort_start_date"] = generic.datetime.date() + if "subject_id" in columns_to_generate: + result["subject_id"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +class Cohort_DefinitionGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "cohort_initiation_date", + "definition_type_concept_id", + "cohort_definition_syntax", + "cohort_definition_id", + "cohort_definition_description", + "subject_concept_id", + "cohort_definition_name", + } + ) + while columns_to_generate: + if "cohort_definition_description" in columns_to_generate: + result["cohort_definition_description"] = generic.text.color() + if "cohort_definition_id" in columns_to_generate: + result["cohort_definition_id"] = generic.numeric.integer_number() + if "cohort_definition_name" in columns_to_generate: + result["cohort_definition_name"] = generic.person.password(length=255) + if "cohort_definition_syntax" in columns_to_generate: + result["cohort_definition_syntax"] = generic.text.color() + if "cohort_initiation_date" in columns_to_generate: + result["cohort_initiation_date"] = generic.datetime.date() + if "definition_type_concept_id" in columns_to_generate: + result["definition_type_concept_id"] = generic.numeric.integer_number() + if "subject_concept_id" in columns_to_generate: + result["subject_concept_id"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +class Condition_EraGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "condition_era_id", + "person_id", + "condition_era_start_date", + "condition_era_end_date", + "condition_occurrence_count", + "condition_concept_id", + } + ) + while columns_to_generate: + if "condition_concept_id" in columns_to_generate: + result["condition_concept_id"] = generic.numeric.integer_number() + if "condition_era_end_date" in columns_to_generate: + result["condition_era_end_date"] = generic.datetime.date() + if "condition_era_id" in columns_to_generate: + result["condition_era_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["condition_era"].columns["condition_era_id"], + ) + if "condition_era_start_date" in columns_to_generate: + result["condition_era_start_date"] = generic.datetime.date() + if "condition_occurrence_count" in columns_to_generate: + result["condition_occurrence_count"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + columns_to_generate = set() + return result + + +class Condition_OccurrenceGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "visit_detail_id", + "condition_occurrence_id", + "condition_start_datetime", + "condition_status_concept_id", + "condition_source_value", + "person_id", + "provider_id", + "condition_start_date", + "stop_reason", + "condition_end_date", + "condition_status_source_value", + "condition_end_datetime", + "visit_occurrence_id", + "condition_type_concept_id", + "condition_concept_id", + "condition_source_concept_id", + } + ) + while columns_to_generate: + if "condition_concept_id" in columns_to_generate: + result["condition_concept_id"] = generic.numeric.integer_number() + if "condition_end_date" in columns_to_generate: + result["condition_end_date"] = generic.datetime.date() + if "condition_end_datetime" in columns_to_generate: + result["condition_end_datetime"] = generic.datetime.datetime() + if "condition_occurrence_id" in columns_to_generate: + result[ + "condition_occurrence_id" + ] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["condition_occurrence"].columns[ + "condition_occurrence_id" + ], + ) + if "condition_source_concept_id" in columns_to_generate: + result["condition_source_concept_id"] = generic.numeric.integer_number() + if "condition_source_value" in columns_to_generate: + result["condition_source_value"] = generic.person.password(length=50) + if "condition_start_date" in columns_to_generate: + result["condition_start_date"] = generic.datetime.date() + if "condition_start_datetime" in columns_to_generate: + result["condition_start_datetime"] = generic.datetime.datetime() + if "condition_status_concept_id" in columns_to_generate: + result["condition_status_concept_id"] = generic.person.password( + length=50 + ) + if "condition_status_source_value" in columns_to_generate: + result["condition_status_source_value"] = generic.person.password( + length=50 + ) + if "condition_type_concept_id" in columns_to_generate: + result["condition_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "stop_reason" in columns_to_generate: + result["stop_reason"] = generic.person.password(length=20) + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class CostGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "paid_patient_deductible", + "drg_concept_id", + "currency_concept_id", + "amount_allowed", + "cost_type_concept_id", + "total_charge", + "total_paid", + "revenue_code_concept_id", + "drg_source_value", + "paid_patient_copay", + "cost_event_id", + "paid_by_patient", + "paid_by_payer", + "cost_id", + "paid_patient_coinsurance", + "total_cost", + "paid_by_primary", + "payer_plan_period_id", + "cost_domain_id", + "revenue_code_source_value", + "paid_dispensing_fee", + "paid_ingredient_cost", + } + ) + while columns_to_generate: + if "amount_allowed" in columns_to_generate: + result["amount_allowed"] = generic.numeric.float_number() + if "cost_domain_id" in columns_to_generate: + result["cost_domain_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["domain"], "domain_id" + ) + if "cost_event_id" in columns_to_generate: + result["cost_event_id"] = generic.numeric.integer_number() + if "cost_id" in columns_to_generate: + result["cost_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["cost"].columns["cost_id"], + ) + if "cost_type_concept_id" in columns_to_generate: + result["cost_type_concept_id"] = generic.numeric.integer_number() + if "currency_concept_id" in columns_to_generate: + result["currency_concept_id"] = generic.numeric.integer_number() + if "drg_concept_id" in columns_to_generate: + result["drg_concept_id"] = generic.numeric.integer_number() + if "drg_source_value" in columns_to_generate: + result["drg_source_value"] = generic.person.password(length=3) + if "paid_by_patient" in columns_to_generate: + result["paid_by_patient"] = generic.numeric.float_number() + if "paid_by_payer" in columns_to_generate: + result["paid_by_payer"] = generic.numeric.float_number() + if "paid_by_primary" in columns_to_generate: + result["paid_by_primary"] = generic.numeric.float_number() + if "paid_dispensing_fee" in columns_to_generate: + result["paid_dispensing_fee"] = generic.numeric.float_number() + if "paid_ingredient_cost" in columns_to_generate: + result["paid_ingredient_cost"] = generic.numeric.float_number() + if "paid_patient_coinsurance" in columns_to_generate: + result["paid_patient_coinsurance"] = generic.numeric.float_number() + if "paid_patient_copay" in columns_to_generate: + result["paid_patient_copay"] = generic.numeric.float_number() + if "paid_patient_deductible" in columns_to_generate: + result["paid_patient_deductible"] = generic.numeric.float_number() + if "payer_plan_period_id" in columns_to_generate: + result["payer_plan_period_id"] = generic.numeric.integer_number() + if "revenue_code_concept_id" in columns_to_generate: + result["revenue_code_concept_id"] = generic.numeric.integer_number() + if "revenue_code_source_value" in columns_to_generate: + result["revenue_code_source_value"] = generic.person.password(length=50) + if "total_charge" in columns_to_generate: + result["total_charge"] = generic.numeric.float_number() + if "total_cost" in columns_to_generate: + result["total_cost"] = generic.numeric.float_number() + if "total_paid" in columns_to_generate: + result["total_paid"] = generic.numeric.float_number() + columns_to_generate = set() + return result + + +class DeathGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "death_datetime", + "cause_concept_id", + "cause_source_concept_id", + "person_id", + "cause_source_value", + "death_type_concept_id", + "death_date", + } + ) + while columns_to_generate: + if "cause_concept_id" in columns_to_generate: + result["cause_concept_id"] = generic.numeric.integer_number() + if "cause_source_concept_id" in columns_to_generate: + result["cause_source_concept_id"] = generic.numeric.integer_number() + if "cause_source_value" in columns_to_generate: + result["cause_source_value"] = generic.person.password(length=50) + if "death_date" in columns_to_generate: + result["death_date"] = generic.datetime.date() + if "death_datetime" in columns_to_generate: + result["death_datetime"] = generic.datetime.datetime() + if "death_type_concept_id" in columns_to_generate: + result["death_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + columns_to_generate = set() + return result + + +class Device_ExposureGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "device_exposure_start_date", + "visit_detail_id", + "unique_device_id", + "person_id", + "device_source_value", + "provider_id", + "quantity", + "device_concept_id", + "device_exposure_end_datetime", + "device_exposure_end_date", + "device_source_concept_id", + "device_type_concept_id", + "visit_occurrence_id", + "device_exposure_id", + "device_exposure_start_datetime", + } + ) + while columns_to_generate: + if "device_concept_id" in columns_to_generate: + result["device_concept_id"] = generic.numeric.integer_number() + if "device_exposure_end_date" in columns_to_generate: + result["device_exposure_end_date"] = generic.datetime.date() + if "device_exposure_end_datetime" in columns_to_generate: + result["device_exposure_end_datetime"] = generic.datetime.datetime() + if "device_exposure_id" in columns_to_generate: + result["device_exposure_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["device_exposure"].columns[ + "device_exposure_id" + ], + ) + if "device_exposure_start_date" in columns_to_generate: + result["device_exposure_start_date"] = generic.datetime.date() + if "device_exposure_start_datetime" in columns_to_generate: + result["device_exposure_start_datetime"] = generic.datetime.datetime() + if "device_source_concept_id" in columns_to_generate: + result["device_source_concept_id"] = generic.numeric.integer_number() + if "device_source_value" in columns_to_generate: + result["device_source_value"] = generic.person.password(length=50) + if "device_type_concept_id" in columns_to_generate: + result["device_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "quantity" in columns_to_generate: + result["quantity"] = generic.numeric.integer_number() + if "unique_device_id" in columns_to_generate: + result["unique_device_id"] = generic.person.password(length=255) + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class Dose_EraGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "drug_concept_id", + "unit_concept_id", + "dose_era_start_date", + "person_id", + "dose_era_end_date", + "dose_value", + "dose_era_id", + } + ) + while columns_to_generate: + if "dose_era_end_date" in columns_to_generate: + result["dose_era_end_date"] = generic.datetime.date() + if "dose_era_id" in columns_to_generate: + result["dose_era_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["dose_era"].columns["dose_era_id"], + ) + if "dose_era_start_date" in columns_to_generate: + result["dose_era_start_date"] = generic.datetime.date() + if "dose_value" in columns_to_generate: + result["dose_value"] = generic.numeric.float_number() + if "drug_concept_id" in columns_to_generate: + result["drug_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "unit_concept_id" in columns_to_generate: + result["unit_concept_id"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +class Drug_EraGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "drug_concept_id", + "person_id", + "drug_exposure_count", + "drug_era_id", + "drug_era_end_date", + "gap_days", + "drug_era_start_date", + } + ) + while columns_to_generate: + if "drug_concept_id" in columns_to_generate: + result["drug_concept_id"] = generic.numeric.integer_number() + if "drug_era_end_date" in columns_to_generate: + result["drug_era_end_date"] = generic.datetime.date() + if "drug_era_id" in columns_to_generate: + result["drug_era_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["drug_era"].columns["drug_era_id"], + ) + if "drug_era_start_date" in columns_to_generate: + result["drug_era_start_date"] = generic.datetime.date() + if "drug_exposure_count" in columns_to_generate: + result["drug_exposure_count"] = generic.numeric.integer_number() + if "gap_days" in columns_to_generate: + result["gap_days"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + columns_to_generate = set() + return result + + +class Drug_ExposureGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "sig", + "drug_source_concept_id", + "drug_exposure_end_datetime", + "stop_reason", + "lot_number", + "drug_exposure_end_date", + "route_concept_id", + "days_supply", + "route_source_value", + "dose_unit_source_value", + "drug_source_value", + "provider_id", + "drug_exposure_start_datetime", + "drug_concept_id", + "person_id", + "drug_type_concept_id", + "drug_exposure_id", + "verbatim_end_date", + "drug_exposure_start_date", + "visit_detail_id", + "refills", + "quantity", + "visit_occurrence_id", + } + ) + while columns_to_generate: + if "days_supply" in columns_to_generate: + result["days_supply"] = generic.numeric.integer_number() + if "dose_unit_source_value" in columns_to_generate: + result["dose_unit_source_value"] = generic.person.password(length=50) + if "drug_concept_id" in columns_to_generate: + result["drug_concept_id"] = generic.numeric.integer_number() + if "drug_exposure_end_date" in columns_to_generate: + result["drug_exposure_end_date"] = generic.datetime.date() + if "drug_exposure_end_datetime" in columns_to_generate: + result["drug_exposure_end_datetime"] = generic.datetime.datetime() + if "drug_exposure_id" in columns_to_generate: + result["drug_exposure_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["drug_exposure"].columns["drug_exposure_id"], + ) + if "drug_exposure_start_date" in columns_to_generate: + result["drug_exposure_start_date"] = generic.datetime.date() + if "drug_exposure_start_datetime" in columns_to_generate: + result["drug_exposure_start_datetime"] = generic.datetime.datetime() + if "drug_source_concept_id" in columns_to_generate: + result["drug_source_concept_id"] = generic.numeric.integer_number() + if "drug_source_value" in columns_to_generate: + result["drug_source_value"] = generic.person.password(length=255) + if "drug_type_concept_id" in columns_to_generate: + result["drug_type_concept_id"] = generic.numeric.integer_number() + if "lot_number" in columns_to_generate: + result["lot_number"] = generic.person.password(length=50) + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "quantity" in columns_to_generate: + result["quantity"] = generic.numeric.float_number() + if "refills" in columns_to_generate: + result["refills"] = generic.numeric.integer_number() + if "route_concept_id" in columns_to_generate: + result["route_concept_id"] = generic.numeric.integer_number() + if "route_source_value" in columns_to_generate: + result["route_source_value"] = generic.person.password(length=50) + if "sig" in columns_to_generate: + result["sig"] = generic.text.color() + if "stop_reason" in columns_to_generate: + result["stop_reason"] = generic.person.password(length=20) + if "verbatim_end_date" in columns_to_generate: + result["verbatim_end_date"] = generic.datetime.date() + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class EpisodeGenerator(TableGenerator): + num_rows_per_pass = 1 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "episode_end_datetime", + "episode_end_date", + "episode_source_value", + "episode_id", + "person_id", + "episode_number", + "episode_start_datetime", + "episode_parent_id", + "episode_type_concept_id", + "episode_source_concept_id", + "episode_object_concept_id", + "episode_start_date", + "episode_concept_id", + } + ) + while columns_to_generate: + if "episode_concept_id" in columns_to_generate: + result["episode_concept_id"] = generic.numeric.integer_number() + if "episode_end_date" in columns_to_generate: + result["episode_end_date"] = generic.datetime.date() + if "episode_end_datetime" in columns_to_generate: + result["episode_end_datetime"] = generic.datetime.datetime() + if "episode_id" in columns_to_generate: + result["episode_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["episode"].columns["episode_id"], + ) + if "episode_number" in columns_to_generate: + result["episode_number"] = generic.numeric.integer_number() + if "episode_object_concept_id" in columns_to_generate: + result["episode_object_concept_id"] = generic.numeric.integer_number() + if "episode_parent_id" in columns_to_generate: + result["episode_parent_id"] = generic.numeric.integer_number() + if "episode_source_concept_id" in columns_to_generate: + result["episode_source_concept_id"] = generic.numeric.integer_number() + if "episode_source_value" in columns_to_generate: + result["episode_source_value"] = generic.person.password(length=50) + if "episode_start_date" in columns_to_generate: + result["episode_start_date"] = generic.datetime.date() + if "episode_start_datetime" in columns_to_generate: + result["episode_start_datetime"] = generic.datetime.datetime() + if "episode_type_concept_id" in columns_to_generate: + result["episode_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + columns_to_generate = set() + return result + + +class Episode_EventGenerator(TableGenerator): + num_rows_per_pass = 1 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + {"event_id", "episode_event_field_concept_id", "episode_id"} + ) + while columns_to_generate: + if "episode_event_field_concept_id" in columns_to_generate: + result[ + "episode_event_field_concept_id" + ] = generic.numeric.integer_number() + if "episode_id" in columns_to_generate: + result["episode_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["episode"], "episode_id" + ) + if "event_id" in columns_to_generate: + result["event_id"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +class Fact_RelationshipGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "domain_concept_id_1", + "fact_id_1", + "domain_concept_id_2", + "fact_id_2", + "relationship_concept_id", + } + ) + while columns_to_generate: + if "domain_concept_id_1" in columns_to_generate: + result["domain_concept_id_1"] = generic.numeric.integer_number() + if "domain_concept_id_2" in columns_to_generate: + result["domain_concept_id_2"] = generic.numeric.integer_number() + if "fact_id_1" in columns_to_generate: + result["fact_id_1"] = generic.numeric.integer_number() + if "fact_id_2" in columns_to_generate: + result["fact_id_2"] = generic.numeric.integer_number() + if "relationship_concept_id" in columns_to_generate: + result["relationship_concept_id"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +class MeasurementGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "value_as_number", + "measurement_time", + "range_high", + "provider_id", + "value_as_concept_id", + "measurement_type_concept_id", + "measurement_date", + "person_id", + "measurement_id", + "range_low", + "measurement_datetime", + "measurement_source_concept_id", + "visit_detail_id", + "unit_concept_id", + "measurement_concept_id", + "unit_source_value", + "operator_concept_id", + "visit_occurrence_id", + "value_source_value", + "measurement_source_value", + } + ) + while columns_to_generate: + if "measurement_concept_id" in columns_to_generate: + result["measurement_concept_id"] = generic.numeric.integer_number() + if "measurement_date" in columns_to_generate: + result["measurement_date"] = generic.datetime.date() + if "measurement_datetime" in columns_to_generate: + result["measurement_datetime"] = generic.datetime.datetime() + if "measurement_id" in columns_to_generate: + result["measurement_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["measurement"].columns["measurement_id"], + ) + if "measurement_source_concept_id" in columns_to_generate: + result[ + "measurement_source_concept_id" + ] = generic.numeric.integer_number() + if "measurement_source_value" in columns_to_generate: + result["measurement_source_value"] = generic.person.password(length=50) + if "measurement_time" in columns_to_generate: + result["measurement_time"] = generic.person.password(length=10) + if "measurement_type_concept_id" in columns_to_generate: + result["measurement_type_concept_id"] = generic.numeric.integer_number() + if "operator_concept_id" in columns_to_generate: + result["operator_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "range_high" in columns_to_generate: + result["range_high"] = generic.numeric.float_number() + if "range_low" in columns_to_generate: + result["range_low"] = generic.numeric.float_number() + if "unit_concept_id" in columns_to_generate: + result["unit_concept_id"] = generic.numeric.integer_number() + if "unit_source_value" in columns_to_generate: + result["unit_source_value"] = generic.person.password(length=50) + if "value_as_concept_id" in columns_to_generate: + result["value_as_concept_id"] = generic.numeric.integer_number() + if "value_as_number" in columns_to_generate: + result["value_as_number"] = generic.numeric.float_number() + if "value_source_value" in columns_to_generate: + result["value_source_value"] = generic.person.password(length=50) + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class MetadataGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "value_as_string", + "metadata_id", + "value_as_number", + "value_as_concept_id", + "name", + "metadata_concept_id", + "metadata_date", + "metadata_type_concept_id", + "metadata_datetime", + } + ) + while columns_to_generate: + if "metadata_concept_id" in columns_to_generate: + result["metadata_concept_id"] = generic.numeric.integer_number() + if "metadata_date" in columns_to_generate: + result["metadata_date"] = generic.datetime.date() + if "metadata_datetime" in columns_to_generate: + result["metadata_datetime"] = generic.datetime.datetime() + if "metadata_id" in columns_to_generate: + result["metadata_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["metadata"].columns["metadata_id"], + ) + if "metadata_type_concept_id" in columns_to_generate: + result["metadata_type_concept_id"] = generic.numeric.integer_number() + if "name" in columns_to_generate: + result["name"] = generic.person.password(length=250) + if "value_as_concept_id" in columns_to_generate: + result["value_as_concept_id"] = generic.numeric.integer_number() + if "value_as_number" in columns_to_generate: + result["value_as_number"] = generic.numeric.float_number() + if "value_as_string" in columns_to_generate: + result["value_as_string"] = generic.person.password(length=250) + columns_to_generate = set() + return result + + +class NoteGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "note_text", + "visit_detail_id", + "encoding_concept_id", + "note_class_concept_id", + "person_id", + "provider_id", + "note_date", + "note_id", + "note_title", + "note_type_concept_id", + "note_event_id", + "visit_occurrence_id", + "note_event_field_concept_id", + "note_datetime", + "note_source_value", + "language_concept_id", + } + ) + while columns_to_generate: + if "encoding_concept_id" in columns_to_generate: + result["encoding_concept_id"] = generic.numeric.integer_number() + if "language_concept_id" in columns_to_generate: + result["language_concept_id"] = generic.numeric.integer_number() + if "note_class_concept_id" in columns_to_generate: + result["note_class_concept_id"] = generic.numeric.integer_number() + if "note_date" in columns_to_generate: + result["note_date"] = generic.datetime.date() + if "note_datetime" in columns_to_generate: + result["note_datetime"] = generic.datetime.datetime() + if "note_event_field_concept_id" in columns_to_generate: + result["note_event_field_concept_id"] = generic.numeric.integer_number() + if "note_event_id" in columns_to_generate: + result["note_event_id"] = generic.numeric.integer_number() + if "note_id" in columns_to_generate: + result["note_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["note"].columns["note_id"], + ) + if "note_source_value" in columns_to_generate: + result["note_source_value"] = generic.person.password(length=50) + if "note_text" in columns_to_generate: + result["note_text"] = generic.text.color() + if "note_title" in columns_to_generate: + result["note_title"] = generic.person.password(length=250) + if "note_type_concept_id" in columns_to_generate: + result["note_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class Note_NlpGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "offset", + "lexical_variant", + "term_modifiers", + "nlp_datetime", + "nlp_system", + "note_id", + "nlp_date", + "snippet", + "note_nlp_source_concept_id", + "section_concept_id", + "term_temporal", + "term_exists", + "note_nlp_id", + "note_nlp_concept_id", + } + ) + while columns_to_generate: + if "lexical_variant" in columns_to_generate: + result["lexical_variant"] = generic.person.password(length=250) + if "nlp_date" in columns_to_generate: + result["nlp_date"] = generic.datetime.date() + if "nlp_datetime" in columns_to_generate: + result["nlp_datetime"] = generic.datetime.datetime() + if "nlp_system" in columns_to_generate: + result["nlp_system"] = generic.person.password(length=250) + if "note_id" in columns_to_generate: + result["note_id"] = generic.numeric.integer_number() + if "note_nlp_concept_id" in columns_to_generate: + result["note_nlp_concept_id"] = generic.numeric.integer_number() + if "note_nlp_id" in columns_to_generate: + result["note_nlp_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["note_nlp"].columns["note_nlp_id"], + ) + if "note_nlp_source_concept_id" in columns_to_generate: + result["note_nlp_source_concept_id"] = generic.numeric.integer_number() + if "offset" in columns_to_generate: + result["offset"] = generic.person.password(length=50) + if "section_concept_id" in columns_to_generate: + result["section_concept_id"] = generic.numeric.integer_number() + if "snippet" in columns_to_generate: + result["snippet"] = generic.person.password(length=250) + if "term_exists" in columns_to_generate: + result["term_exists"] = generic.person.password(length=1) + if "term_modifiers" in columns_to_generate: + result["term_modifiers"] = generic.person.password(length=2000) + if "term_temporal" in columns_to_generate: + result["term_temporal"] = generic.person.password(length=50) + columns_to_generate = set() + return result + + +class ObservationGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "observation_source_concept_id", + "value_as_string", + "qualifier_source_value", + "unit_concept_id", + "observation_source_value", + "visit_detail_id", + "person_id", + "observation_concept_id", + "provider_id", + "value_as_number", + "observation_type_concept_id", + "qualifier_concept_id", + "unit_source_value", + "value_as_concept_id", + "observation_id", + "visit_occurrence_id", + "observation_datetime", + "observation_date", + } + ) + while columns_to_generate: + if "observation_concept_id" in columns_to_generate: + result["observation_concept_id"] = generic.numeric.integer_number() + if "observation_date" in columns_to_generate: + result["observation_date"] = generic.datetime.date() + if "observation_datetime" in columns_to_generate: + result["observation_datetime"] = generic.datetime.datetime() + if "observation_id" in columns_to_generate: + result["observation_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["observation"].columns["observation_id"], + ) + if "observation_source_concept_id" in columns_to_generate: + result[ + "observation_source_concept_id" + ] = generic.numeric.integer_number() + if "observation_source_value" in columns_to_generate: + result["observation_source_value"] = generic.person.password(length=50) + if "observation_type_concept_id" in columns_to_generate: + result["observation_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "qualifier_concept_id" in columns_to_generate: + result["qualifier_concept_id"] = generic.numeric.integer_number() + if "qualifier_source_value" in columns_to_generate: + result["qualifier_source_value"] = generic.person.password(length=50) + if "unit_concept_id" in columns_to_generate: + result["unit_concept_id"] = generic.numeric.integer_number() + if "unit_source_value" in columns_to_generate: + result["unit_source_value"] = generic.person.password(length=50) + if "value_as_concept_id" in columns_to_generate: + result["value_as_concept_id"] = generic.numeric.integer_number() + if "value_as_number" in columns_to_generate: + result["value_as_number"] = generic.numeric.float_number() + if "value_as_string" in columns_to_generate: + result["value_as_string"] = generic.person.password(length=120) + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class Observation_PeriodGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "observation_period_id", + "person_id", + "period_type_concept_id", + "observation_period_start_date", + "observation_period_end_date", + } + ) + while columns_to_generate: + if "observation_period_end_date" in columns_to_generate: + result["observation_period_end_date"] = generic.datetime.date() + if "observation_period_id" in columns_to_generate: + result[ + "observation_period_id" + ] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["observation_period"].columns[ + "observation_period_id" + ], + ) + if "observation_period_start_date" in columns_to_generate: + result["observation_period_start_date"] = generic.datetime.date() + if "period_type_concept_id" in columns_to_generate: + result["period_type_concept_id"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + columns_to_generate = set() + return result + + +class Payer_Plan_PeriodGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "plan_source_value", + "plan_concept_id", + "plan_source_concept_id", + "person_id", + "family_source_value", + "sponsor_source_concept_id", + "payer_plan_period_id", + "sponsor_source_value", + "payer_concept_id", + "stop_reason_source_value", + "payer_plan_period_start_date", + "payer_source_value", + "stop_reason_concept_id", + "sponsor_concept_id", + "stop_reason_source_concept_id", + "payer_plan_period_end_date", + "payer_source_concept_id", + } + ) + while columns_to_generate: + if "family_source_value" in columns_to_generate: + result["family_source_value"] = generic.person.password(length=50) + if "payer_concept_id" in columns_to_generate: + result["payer_concept_id"] = generic.numeric.integer_number() + if "payer_plan_period_end_date" in columns_to_generate: + result["payer_plan_period_end_date"] = generic.datetime.date() + if "payer_plan_period_id" in columns_to_generate: + result[ + "payer_plan_period_id" + ] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["payer_plan_period"].columns[ + "payer_plan_period_id" + ], + ) + if "payer_plan_period_start_date" in columns_to_generate: + result["payer_plan_period_start_date"] = generic.datetime.date() + if "payer_source_concept_id" in columns_to_generate: + result["payer_source_concept_id"] = generic.numeric.integer_number() + if "payer_source_value" in columns_to_generate: + result["payer_source_value"] = generic.person.password(length=50) + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "plan_concept_id" in columns_to_generate: + result["plan_concept_id"] = generic.numeric.integer_number() + if "plan_source_concept_id" in columns_to_generate: + result["plan_source_concept_id"] = generic.numeric.integer_number() + if "plan_source_value" in columns_to_generate: + result["plan_source_value"] = generic.person.password(length=50) + if "sponsor_concept_id" in columns_to_generate: + result["sponsor_concept_id"] = generic.numeric.integer_number() + if "sponsor_source_concept_id" in columns_to_generate: + result["sponsor_source_concept_id"] = generic.numeric.integer_number() + if "sponsor_source_value" in columns_to_generate: + result["sponsor_source_value"] = generic.person.password(length=50) + if "stop_reason_concept_id" in columns_to_generate: + result["stop_reason_concept_id"] = generic.numeric.integer_number() + if "stop_reason_source_concept_id" in columns_to_generate: + result[ + "stop_reason_source_concept_id" + ] = generic.numeric.integer_number() + if "stop_reason_source_value" in columns_to_generate: + result["stop_reason_source_value"] = generic.person.password(length=50) + columns_to_generate = set() + return result + + +class PersonGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "gender_source_value", + "person_source_value", + "day_of_birth", + "race_source_concept_id", + "birth_datetime", + "ethnicity_concept_id", + "person_id", + "ethnicity_source_value", + "provider_id", + "race_source_value", + "gender_source_concept_id", + "care_site_id", + "month_of_birth", + "location_id", + "ethnicity_source_concept_id", + "race_concept_id", + "gender_concept_id", + "year_of_birth", + } + ) + while columns_to_generate: + if "birth_datetime" in columns_to_generate: + result["birth_datetime"] = generic.datetime.datetime() + if "care_site_id" in columns_to_generate: + result["care_site_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["care_site"], "care_site_id" + ) + if "day_of_birth" in columns_to_generate: + result["day_of_birth"] = generic.numeric.integer_number() + if "ethnicity_concept_id" in columns_to_generate: + result["ethnicity_concept_id"] = generic.numeric.integer_number() + if "ethnicity_source_concept_id" in columns_to_generate: + result["ethnicity_source_concept_id"] = generic.numeric.integer_number() + if "ethnicity_source_value" in columns_to_generate: + result["ethnicity_source_value"] = generic.person.password(length=50) + if "gender_concept_id" in columns_to_generate: + result["gender_concept_id"] = generic.numeric.integer_number() + if "gender_source_concept_id" in columns_to_generate: + result["gender_source_concept_id"] = generic.numeric.integer_number() + if "gender_source_value" in columns_to_generate: + result["gender_source_value"] = generic.person.password(length=50) + if "location_id" in columns_to_generate: + result["location_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["location"], "location_id" + ) + if "month_of_birth" in columns_to_generate: + result["month_of_birth"] = generic.numeric.integer_number() + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["person"].columns["person_id"], + ) + if "person_source_value" in columns_to_generate: + result["person_source_value"] = generic.person.password(length=50) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "race_concept_id" in columns_to_generate: + result["race_concept_id"] = generic.numeric.integer_number() + if "race_source_concept_id" in columns_to_generate: + result["race_source_concept_id"] = generic.numeric.integer_number() + if "race_source_value" in columns_to_generate: + result["race_source_value"] = generic.person.password(length=50) + if "year_of_birth" in columns_to_generate: + result["year_of_birth"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +class Procedure_OccurrenceGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "procedure_datetime", + "visit_detail_id", + "procedure_source_value", + "person_id", + "provider_id", + "modifier_concept_id", + "procedure_source_concept_id", + "quantity", + "procedure_concept_id", + "procedure_type_concept_id", + "modifier_source_value", + "visit_occurrence_id", + "procedure_occurrence_id", + "procedure_date", + } + ) + while columns_to_generate: + if "modifier_concept_id" in columns_to_generate: + result["modifier_concept_id"] = generic.numeric.integer_number() + if "modifier_source_value" in columns_to_generate: + result["modifier_source_value"] = generic.person.password(length=50) + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "procedure_concept_id" in columns_to_generate: + result["procedure_concept_id"] = generic.numeric.integer_number() + if "procedure_date" in columns_to_generate: + result["procedure_date"] = generic.datetime.date() + if "procedure_datetime" in columns_to_generate: + result["procedure_datetime"] = generic.datetime.datetime() + if "procedure_occurrence_id" in columns_to_generate: + result[ + "procedure_occurrence_id" + ] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["procedure_occurrence"].columns[ + "procedure_occurrence_id" + ], + ) + if "procedure_source_concept_id" in columns_to_generate: + result["procedure_source_concept_id"] = generic.numeric.integer_number() + if "procedure_source_value" in columns_to_generate: + result["procedure_source_value"] = generic.person.password(length=50) + if "procedure_type_concept_id" in columns_to_generate: + result["procedure_type_concept_id"] = generic.numeric.integer_number() + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "quantity" in columns_to_generate: + result["quantity"] = generic.numeric.integer_number() + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class SpecimenGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "specimen_date", + "specimen_source_value", + "specimen_type_concept_id", + "unit_concept_id", + "specimen_source_id", + "person_id", + "anatomic_site_source_value", + "quantity", + "specimen_concept_id", + "disease_status_concept_id", + "unit_source_value", + "anatomic_site_concept_id", + "specimen_id", + "specimen_datetime", + "disease_status_source_value", + } + ) + while columns_to_generate: + if "anatomic_site_concept_id" in columns_to_generate: + result["anatomic_site_concept_id"] = generic.numeric.integer_number() + if "anatomic_site_source_value" in columns_to_generate: + result["anatomic_site_source_value"] = generic.person.password( + length=50 + ) + if "disease_status_concept_id" in columns_to_generate: + result["disease_status_concept_id"] = generic.numeric.integer_number() + if "disease_status_source_value" in columns_to_generate: + result["disease_status_source_value"] = generic.person.password( + length=50 + ) + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "quantity" in columns_to_generate: + result["quantity"] = generic.numeric.float_number() + if "specimen_concept_id" in columns_to_generate: + result["specimen_concept_id"] = generic.numeric.integer_number() + if "specimen_date" in columns_to_generate: + result["specimen_date"] = generic.datetime.date() + if "specimen_datetime" in columns_to_generate: + result["specimen_datetime"] = generic.datetime.datetime() + if "specimen_id" in columns_to_generate: + result["specimen_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["specimen"].columns["specimen_id"], + ) + if "specimen_source_id" in columns_to_generate: + result["specimen_source_id"] = generic.person.password(length=255) + if "specimen_source_value" in columns_to_generate: + result["specimen_source_value"] = generic.person.password(length=50) + if "specimen_type_concept_id" in columns_to_generate: + result["specimen_type_concept_id"] = generic.numeric.integer_number() + if "unit_concept_id" in columns_to_generate: + result["unit_concept_id"] = generic.numeric.integer_number() + if "unit_source_value" in columns_to_generate: + result["unit_source_value"] = generic.person.password(length=50) + columns_to_generate = set() + return result + + +class Visit_DetailGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "visit_detail_type_concept_id", + "visit_detail_start_date", + "visit_detail_start_datetime", + "visit_detail_source_concept_id", + "admitting_source_value", + "provider_id", + "visit_detail_end_date", + "visit_detail_source_value", + "visit_detail_parent_id", + "visit_detail_end_datetime", + "visit_detail_concept_id", + "person_id", + "discharge_to_source_value", + "admitting_source_concept_id", + "visit_detail_id", + "care_site_id", + "preceding_visit_detail_id", + "visit_occurrence_id", + "discharge_to_concept_id", + } + ) + while columns_to_generate: + if "admitting_source_concept_id" in columns_to_generate: + result["admitting_source_concept_id"] = generic.numeric.integer_number() + if "admitting_source_value" in columns_to_generate: + result["admitting_source_value"] = generic.person.password(length=50) + if "care_site_id" in columns_to_generate: + result["care_site_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["care_site"], "care_site_id" + ) + if "discharge_to_concept_id" in columns_to_generate: + result["discharge_to_concept_id"] = generic.numeric.integer_number() + if "discharge_to_source_value" in columns_to_generate: + result["discharge_to_source_value"] = generic.person.password(length=50) + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "preceding_visit_detail_id" in columns_to_generate: + result[ + "preceding_visit_detail_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["visit_detail"], "visit_detail_id" + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "visit_detail_concept_id" in columns_to_generate: + result["visit_detail_concept_id"] = generic.numeric.integer_number() + if "visit_detail_end_date" in columns_to_generate: + result["visit_detail_end_date"] = generic.datetime.date() + if "visit_detail_end_datetime" in columns_to_generate: + result["visit_detail_end_datetime"] = generic.datetime.datetime() + if "visit_detail_id" in columns_to_generate: + result["visit_detail_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["visit_detail"].columns["visit_detail_id"], + ) + if "visit_detail_parent_id" in columns_to_generate: + result["visit_detail_parent_id"] = generic.person.password(length=50) + if "visit_detail_source_concept_id" in columns_to_generate: + result["visit_detail_source_concept_id"] = generic.person.password( + length=50 + ) + if "visit_detail_source_value" in columns_to_generate: + result["visit_detail_source_value"] = generic.person.password( + length=120 + ) + if "visit_detail_start_date" in columns_to_generate: + result["visit_detail_start_date"] = generic.datetime.date() + if "visit_detail_start_datetime" in columns_to_generate: + result["visit_detail_start_datetime"] = generic.datetime.datetime() + if "visit_detail_type_concept_id" in columns_to_generate: + result[ + "visit_detail_type_concept_id" + ] = generic.numeric.integer_number() + if "visit_occurrence_id" in columns_to_generate: + result[ + "visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + columns_to_generate = set() + return result + + +class Visit_OccurrenceGenerator(TableGenerator): + num_rows_per_pass = 0 + + def __init__(self): + self.initialized = False + + def __call__(self, dst_db_conn, metadata): + if not self.initialized: + self.initialized = True + result = {} + columns_to_generate = set( + { + "visit_source_value", + "preceding_visit_occurrence_id", + "visit_type_concept_id", + "person_id", + "admitted_from_concept_id", + "discharged_to_concept_id", + "admitted_from_source_value", + "provider_id", + "visit_end_date", + "visit_end_datetime", + "care_site_id", + "visit_source_concept_id", + "visit_start_datetime", + "visit_occurrence_id", + "discharged_to_source_value", + "visit_start_date", + "visit_concept_id", + } + ) + while columns_to_generate: + if "admitted_from_concept_id" in columns_to_generate: + result["admitted_from_concept_id"] = generic.numeric.integer_number() + if "admitted_from_source_value" in columns_to_generate: + result["admitted_from_source_value"] = generic.person.password( + length=50 + ) + if "care_site_id" in columns_to_generate: + result["care_site_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["care_site"], "care_site_id" + ) + if "discharged_to_concept_id" in columns_to_generate: + result["discharged_to_concept_id"] = generic.numeric.integer_number() + if "discharged_to_source_value" in columns_to_generate: + result["discharged_to_source_value"] = generic.person.password( + length=50 + ) + if "person_id" in columns_to_generate: + result["person_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["person"], "person_id" + ) + if "preceding_visit_occurrence_id" in columns_to_generate: + result[ + "preceding_visit_occurrence_id" + ] = generic.column_value_provider.column_value( + dst_db_conn, + metadata.tables["visit_occurrence"], + "visit_occurrence_id", + ) + if "provider_id" in columns_to_generate: + result["provider_id"] = generic.column_value_provider.column_value( + dst_db_conn, metadata.tables["provider"], "provider_id" + ) + if "visit_concept_id" in columns_to_generate: + result["visit_concept_id"] = generic.numeric.integer_number() + if "visit_end_date" in columns_to_generate: + result["visit_end_date"] = generic.datetime.date() + if "visit_end_datetime" in columns_to_generate: + result["visit_end_datetime"] = generic.datetime.datetime() + if "visit_occurrence_id" in columns_to_generate: + result["visit_occurrence_id"] = generic.column_value_provider.increment( + db_connection=dst_db_conn, + column=metadata.tables["visit_occurrence"].columns[ + "visit_occurrence_id" + ], + ) + if "visit_source_concept_id" in columns_to_generate: + result["visit_source_concept_id"] = generic.numeric.integer_number() + if "visit_source_value" in columns_to_generate: + result["visit_source_value"] = generic.person.password(length=50) + if "visit_start_date" in columns_to_generate: + result["visit_start_date"] = generic.datetime.date() + if "visit_start_datetime" in columns_to_generate: + result["visit_start_datetime"] = generic.datetime.datetime() + if "visit_type_concept_id" in columns_to_generate: + result["visit_type_concept_id"] = generic.numeric.integer_number() + columns_to_generate = set() + return result + + +table_generator_dict = { + "cohort": CohortGenerator(), + "cohort_definition": Cohort_DefinitionGenerator(), + "condition_era": Condition_EraGenerator(), + "condition_occurrence": Condition_OccurrenceGenerator(), + "cost": CostGenerator(), + "death": DeathGenerator(), + "device_exposure": Device_ExposureGenerator(), + "dose_era": Dose_EraGenerator(), + "drug_era": Drug_EraGenerator(), + "drug_exposure": Drug_ExposureGenerator(), + "episode": EpisodeGenerator(), + "episode_event": Episode_EventGenerator(), + "fact_relationship": Fact_RelationshipGenerator(), + "measurement": MeasurementGenerator(), + "metadata": MetadataGenerator(), + "note": NoteGenerator(), + "note_nlp": Note_NlpGenerator(), + "observation": ObservationGenerator(), + "observation_period": Observation_PeriodGenerator(), + "payer_plan_period": Payer_Plan_PeriodGenerator(), + "person": PersonGenerator(), + "procedure_occurrence": Procedure_OccurrenceGenerator(), + "specimen": SpecimenGenerator(), + "visit_detail": Visit_DetailGenerator(), + "visit_occurrence": Visit_OccurrenceGenerator(), +} + + +story_generator_list = [] diff --git a/examples/mimic_omop/orm.yaml b/examples/mimic_omop/orm.yaml new file mode 100644 index 00000000..a400553a --- /dev/null +++ b/examples/mimic_omop/orm.yaml @@ -0,0 +1,2092 @@ +dsn: postgresql://postgres@localhost:5432/omop5.4 +schema: mimic +tables: + care_site: + columns: + care_site_id: + nullable: false + primary: true + type: BIGINT + care_site_name: + nullable: true + primary: false + type: VARCHAR(255) + care_site_source_value: + nullable: true + primary: false + type: VARCHAR(50) + location_id: + foreign_keys: + - location.location_id + nullable: true + primary: false + type: BIGINT + place_of_service_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + place_of_service_source_value: + nullable: true + primary: false + type: VARCHAR(50) + unique: [] + cdm_source: + columns: + cdm_etl_reference: + nullable: true + primary: false + type: VARCHAR(255) + cdm_holder: + nullable: false + primary: false + type: VARCHAR(255) + cdm_release_date: + nullable: false + primary: false + type: DATE + cdm_source_abbreviation: + nullable: false + primary: false + type: VARCHAR(25) + cdm_source_name: + nullable: false + primary: false + type: VARCHAR(255) + cdm_version: + nullable: true + primary: false + type: VARCHAR(10) + source_description: + nullable: true + primary: false + type: TEXT + source_documentation_reference: + nullable: true + primary: false + type: VARCHAR(255) + source_release_date: + nullable: false + primary: false + type: DATE + vocabulary_version: + nullable: false + primary: false + type: VARCHAR(20) + unique: [] + cohort: + columns: + cohort_definition_id: + nullable: false + primary: false + type: BIGINT + cohort_end_date: + nullable: false + primary: false + type: DATE + cohort_start_date: + nullable: false + primary: false + type: DATE + subject_id: + nullable: false + primary: false + type: BIGINT + unique: [] + cohort_definition: + columns: + cohort_definition_description: + nullable: true + primary: false + type: TEXT + cohort_definition_id: + nullable: false + primary: false + type: BIGINT + cohort_definition_name: + nullable: false + primary: false + type: VARCHAR(255) + cohort_definition_syntax: + nullable: true + primary: false + type: TEXT + cohort_initiation_date: + nullable: true + primary: false + type: DATE + definition_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + subject_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + unique: [] + concept: + columns: + concept_class_id: + foreign_keys: + - concept_class.concept_class_id + nullable: false + primary: false + type: VARCHAR(20) + concept_code: + nullable: false + primary: false + type: VARCHAR(255) + concept_id: + nullable: false + primary: true + type: BIGINT + concept_name: + nullable: false + primary: false + type: VARCHAR(255) + domain_id: + foreign_keys: + - domain.domain_id + nullable: false + primary: false + type: VARCHAR(20) + invalid_reason: + nullable: true + primary: false + type: VARCHAR(1) + standard_concept: + nullable: true + primary: false + type: VARCHAR(1) + valid_end_date: + nullable: false + primary: false + type: DATE + valid_start_date: + nullable: false + primary: false + type: DATE + vocabulary_id: + foreign_keys: + - vocabulary.vocabulary_id + nullable: false + primary: false + type: VARCHAR(50) + unique: [] + concept_ancestor: + columns: + ancestor_concept_id: + nullable: false + primary: false + type: BIGINT + descendant_concept_id: + nullable: false + primary: false + type: BIGINT + max_levels_of_separation: + nullable: false + primary: false + type: BIGINT + min_levels_of_separation: + nullable: false + primary: false + type: BIGINT + unique: [] + concept_class: + columns: + concept_class_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + concept_class_id: + nullable: false + primary: true + type: VARCHAR(20) + concept_class_name: + nullable: false + primary: false + type: VARCHAR(255) + unique: [] + concept_relationship: + columns: + concept_id_1: + nullable: false + primary: false + type: BIGINT + concept_id_2: + nullable: false + primary: false + type: BIGINT + invalid_reason: + nullable: true + primary: false + type: VARCHAR(1) + relationship_id: + foreign_keys: + - relationship.relationship_id + nullable: false + primary: false + type: VARCHAR(20) + valid_end_date: + nullable: false + primary: false + type: DATE + valid_start_date: + nullable: false + primary: false + type: DATE + unique: [] + concept_synonym: + columns: + concept_id: + nullable: false + primary: false + type: BIGINT + concept_synonym_name: + nullable: false + primary: false + type: VARCHAR(1000) + language_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + unique: [] + condition_era: + columns: + condition_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + condition_era_end_date: + nullable: false + primary: false + type: DATE + condition_era_id: + nullable: false + primary: true + type: BIGINT + condition_era_start_date: + nullable: false + primary: false + type: DATE + condition_occurrence_count: + nullable: true + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + unique: [] + condition_occurrence: + columns: + condition_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + condition_end_date: + nullable: true + primary: false + type: DATE + condition_end_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + condition_occurrence_id: + nullable: false + primary: true + type: BIGINT + condition_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + condition_source_value: + nullable: true + primary: false + type: VARCHAR(50) + condition_start_date: + nullable: false + primary: false + type: DATE + condition_start_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + condition_status_concept_id: + nullable: true + primary: false + type: VARCHAR(50) + condition_status_source_value: + nullable: true + primary: false + type: VARCHAR(50) + condition_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + stop_reason: + nullable: true + primary: false + type: VARCHAR(20) + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + cost: + columns: + amount_allowed: + nullable: true + primary: false + type: NUMERIC + cost_domain_id: + foreign_keys: + - domain.domain_id + nullable: false + primary: false + type: VARCHAR(20) + cost_event_id: + nullable: false + primary: false + type: BIGINT + cost_id: + nullable: false + primary: true + type: BIGINT + cost_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + currency_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + drg_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + drg_source_value: + nullable: true + primary: false + type: VARCHAR(3) + paid_by_patient: + nullable: true + primary: false + type: NUMERIC + paid_by_payer: + nullable: true + primary: false + type: NUMERIC + paid_by_primary: + nullable: true + primary: false + type: NUMERIC + paid_dispensing_fee: + nullable: true + primary: false + type: NUMERIC + paid_ingredient_cost: + nullable: true + primary: false + type: NUMERIC + paid_patient_coinsurance: + nullable: true + primary: false + type: NUMERIC + paid_patient_copay: + nullable: true + primary: false + type: NUMERIC + paid_patient_deductible: + nullable: true + primary: false + type: NUMERIC + payer_plan_period_id: + nullable: true + primary: false + type: BIGINT + revenue_code_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + revenue_code_source_value: + nullable: true + primary: false + type: VARCHAR(50) + total_charge: + nullable: true + primary: false + type: NUMERIC + total_cost: + nullable: true + primary: false + type: NUMERIC + total_paid: + nullable: true + primary: false + type: NUMERIC + unique: [] + death: + columns: + cause_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + cause_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + cause_source_value: + nullable: true + primary: false + type: VARCHAR(50) + death_date: + nullable: false + primary: false + type: DATE + death_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + death_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + unique: [] + device_exposure: + columns: + device_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + device_exposure_end_date: + nullable: true + primary: false + type: DATE + device_exposure_end_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + device_exposure_id: + nullable: false + primary: true + type: BIGINT + device_exposure_start_date: + nullable: false + primary: false + type: DATE + device_exposure_start_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + device_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + device_source_value: + nullable: true + primary: false + type: VARCHAR(50) + device_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + quantity: + nullable: true + primary: false + type: BIGINT + unique_device_id: + nullable: true + primary: false + type: VARCHAR(255) + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + domain: + columns: + domain_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + domain_id: + nullable: false + primary: true + type: VARCHAR(20) + domain_name: + nullable: false + primary: false + type: VARCHAR(255) + unique: [] + dose_era: + columns: + dose_era_end_date: + nullable: false + primary: false + type: DATE + dose_era_id: + nullable: false + primary: true + type: BIGINT + dose_era_start_date: + nullable: false + primary: false + type: DATE + dose_value: + nullable: false + primary: false + type: NUMERIC + drug_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + unique: [] + drug_era: + columns: + drug_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + drug_era_end_date: + nullable: false + primary: false + type: DATE + drug_era_id: + nullable: false + primary: true + type: BIGINT + drug_era_start_date: + nullable: false + primary: false + type: DATE + drug_exposure_count: + nullable: true + primary: false + type: BIGINT + gap_days: + nullable: true + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + unique: [] + drug_exposure: + columns: + days_supply: + nullable: true + primary: false + type: BIGINT + dose_unit_source_value: + nullable: true + primary: false + type: VARCHAR(50) + drug_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + drug_exposure_end_date: + nullable: false + primary: false + type: DATE + drug_exposure_end_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + drug_exposure_id: + nullable: false + primary: true + type: BIGINT + drug_exposure_start_date: + nullable: false + primary: false + type: DATE + drug_exposure_start_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + drug_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + drug_source_value: + nullable: true + primary: false + type: VARCHAR(255) + drug_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + lot_number: + nullable: true + primary: false + type: VARCHAR(50) + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + quantity: + nullable: true + primary: false + type: NUMERIC + refills: + nullable: true + primary: false + type: BIGINT + route_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + route_source_value: + nullable: true + primary: false + type: VARCHAR(50) + sig: + nullable: true + primary: false + type: TEXT + stop_reason: + nullable: true + primary: false + type: VARCHAR(20) + verbatim_end_date: + nullable: true + primary: false + type: DATE + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + drug_strength: + columns: + amount_unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + amount_value: + nullable: true + primary: false + type: NUMERIC + box_size: + nullable: true + primary: false + type: BIGINT + denominator_unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + denominator_value: + nullable: true + primary: false + type: NUMERIC + drug_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + ingredient_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + invalid_reason: + nullable: true + primary: false + type: VARCHAR(1) + numerator_unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + numerator_value: + nullable: true + primary: false + type: NUMERIC + valid_end_date: + nullable: false + primary: false + type: DATE + valid_start_date: + nullable: false + primary: false + type: DATE + unique: [] + episode: + columns: + episode_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + episode_end_date: + nullable: true + primary: false + type: DATE + episode_end_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + episode_id: + nullable: false + primary: true + type: BIGINT + episode_number: + nullable: true + primary: false + type: BIGINT + episode_object_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + episode_parent_id: + nullable: true + primary: false + type: BIGINT + episode_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + episode_source_value: + nullable: true + primary: false + type: VARCHAR(50) + episode_start_date: + nullable: false + primary: false + type: DATE + episode_start_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + episode_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + unique: [] + episode_event: + columns: + episode_event_field_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + episode_id: + foreign_keys: + - episode.episode_id + nullable: false + primary: false + type: BIGINT + event_id: + nullable: false + primary: false + type: BIGINT + unique: [] + fact_relationship: + columns: + domain_concept_id_1: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + domain_concept_id_2: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + fact_id_1: + nullable: false + primary: false + type: BIGINT + fact_id_2: + nullable: false + primary: false + type: BIGINT + relationship_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + unique: [] + location: + columns: + address_1: + nullable: true + primary: false + type: VARCHAR(50) + address_2: + nullable: true + primary: false + type: VARCHAR(50) + city: + nullable: true + primary: false + type: VARCHAR(50) + county: + nullable: true + primary: false + type: VARCHAR(20) + location_id: + nullable: false + primary: true + type: BIGINT + location_source_value: + nullable: true + primary: false + type: VARCHAR(50) + state: + nullable: true + primary: false + type: VARCHAR(2) + zip: + nullable: true + primary: false + type: VARCHAR(9) + unique: [] + measurement: + columns: + measurement_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + measurement_date: + nullable: false + primary: false + type: DATE + measurement_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + measurement_id: + nullable: false + primary: true + type: BIGINT + measurement_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + measurement_source_value: + nullable: true + primary: false + type: VARCHAR(50) + measurement_time: + nullable: true + primary: false + type: VARCHAR(10) + measurement_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + operator_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + range_high: + nullable: true + primary: false + type: NUMERIC + range_low: + nullable: true + primary: false + type: NUMERIC + unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + unit_source_value: + nullable: true + primary: false + type: VARCHAR(50) + value_as_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + value_as_number: + nullable: true + primary: false + type: NUMERIC + value_source_value: + nullable: true + primary: false + type: VARCHAR(50) + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + metadata: + columns: + metadata_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + metadata_date: + nullable: true + primary: false + type: DATE + metadata_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + metadata_id: + nullable: false + primary: true + type: BIGINT + metadata_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + name: + nullable: false + primary: false + type: VARCHAR(250) + value_as_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + value_as_number: + nullable: true + primary: false + type: NUMERIC + value_as_string: + nullable: true + primary: false + type: VARCHAR(250) + unique: [] + note: + columns: + encoding_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + language_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + note_class_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + note_date: + nullable: false + primary: false + type: DATE + note_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + note_event_field_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + note_event_id: + nullable: true + primary: false + type: BIGINT + note_id: + nullable: false + primary: true + type: BIGINT + note_source_value: + nullable: true + primary: false + type: VARCHAR(50) + note_text: + nullable: false + primary: false + type: TEXT + note_title: + nullable: true + primary: false + type: VARCHAR(250) + note_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + note_nlp: + columns: + lexical_variant: + nullable: false + primary: false + type: VARCHAR(250) + nlp_date: + nullable: false + primary: false + type: DATE + nlp_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + nlp_system: + nullable: true + primary: false + type: VARCHAR(250) + note_id: + nullable: false + primary: false + type: BIGINT + note_nlp_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + note_nlp_id: + nullable: false + primary: true + type: BIGINT + note_nlp_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + offset: + nullable: true + primary: false + type: VARCHAR(50) + section_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + snippet: + nullable: true + primary: false + type: VARCHAR(250) + term_exists: + nullable: true + primary: false + type: VARCHAR(1) + term_modifiers: + nullable: true + primary: false + type: VARCHAR(2000) + term_temporal: + nullable: true + primary: false + type: VARCHAR(50) + unique: [] + observation: + columns: + observation_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + observation_date: + nullable: false + primary: false + type: DATE + observation_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + observation_id: + nullable: false + primary: true + type: BIGINT + observation_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + observation_source_value: + nullable: true + primary: false + type: VARCHAR(50) + observation_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + qualifier_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + qualifier_source_value: + nullable: true + primary: false + type: VARCHAR(50) + unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + unit_source_value: + nullable: true + primary: false + type: VARCHAR(50) + value_as_concept_id: + nullable: true + primary: false + type: BIGINT + value_as_number: + nullable: true + primary: false + type: NUMERIC + value_as_string: + nullable: true + primary: false + type: VARCHAR(120) + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + observation_period: + columns: + observation_period_end_date: + nullable: false + primary: false + type: DATE + observation_period_id: + nullable: false + primary: true + type: BIGINT + observation_period_start_date: + nullable: false + primary: false + type: DATE + period_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + unique: [] + payer_plan_period: + columns: + family_source_value: + nullable: true + primary: false + type: VARCHAR(50) + payer_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + payer_plan_period_end_date: + nullable: false + primary: false + type: DATE + payer_plan_period_id: + nullable: false + primary: true + type: BIGINT + payer_plan_period_start_date: + nullable: false + primary: false + type: DATE + payer_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + payer_source_value: + nullable: true + primary: false + type: VARCHAR(50) + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + plan_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + plan_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + plan_source_value: + nullable: true + primary: false + type: VARCHAR(50) + sponsor_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + sponsor_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + sponsor_source_value: + nullable: true + primary: false + type: VARCHAR(50) + stop_reason_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + stop_reason_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + stop_reason_source_value: + nullable: true + primary: false + type: VARCHAR(50) + unique: [] + person: + columns: + birth_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + care_site_id: + foreign_keys: + - care_site.care_site_id + nullable: true + primary: false + type: BIGINT + day_of_birth: + nullable: true + primary: false + type: BIGINT + ethnicity_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + ethnicity_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + ethnicity_source_value: + nullable: true + primary: false + type: VARCHAR(50) + gender_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + gender_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + gender_source_value: + nullable: true + primary: false + type: VARCHAR(50) + location_id: + foreign_keys: + - location.location_id + nullable: true + primary: false + type: BIGINT + month_of_birth: + nullable: true + primary: false + type: BIGINT + person_id: + nullable: false + primary: true + type: BIGINT + person_source_value: + nullable: true + primary: false + type: VARCHAR(50) + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + race_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + race_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + race_source_value: + nullable: true + primary: false + type: VARCHAR(50) + year_of_birth: + nullable: false + primary: false + type: BIGINT + unique: [] + procedure_occurrence: + columns: + modifier_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + modifier_source_value: + nullable: true + primary: false + type: VARCHAR(50) + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + procedure_concept_id: + nullable: false + primary: false + type: BIGINT + procedure_date: + nullable: false + primary: false + type: DATE + procedure_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + procedure_occurrence_id: + nullable: false + primary: true + type: BIGINT + procedure_source_concept_id: + nullable: true + primary: false + type: BIGINT + procedure_source_value: + nullable: true + primary: false + type: VARCHAR(50) + procedure_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + quantity: + nullable: true + primary: false + type: BIGINT + visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + unique: [] + provider: + columns: + care_site_id: + foreign_keys: + - care_site.care_site_id + nullable: true + primary: false + type: BIGINT + dea: + nullable: true + primary: false + type: VARCHAR(20) + gender_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + gender_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + gender_source_value: + nullable: true + primary: false + type: VARCHAR(50) + npi: + nullable: true + primary: false + type: VARCHAR(20) + provider_id: + nullable: false + primary: true + type: BIGINT + provider_name: + nullable: true + primary: false + type: VARCHAR(255) + provider_source_value: + nullable: true + primary: false + type: VARCHAR(50) + specialty_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + specialty_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + specialty_source_value: + nullable: true + primary: false + type: VARCHAR(50) + year_of_birth: + nullable: true + primary: false + type: BIGINT + unique: [] + relationship: + columns: + defines_ancestry: + nullable: false + primary: false + type: VARCHAR(1) + is_hierarchical: + nullable: false + primary: false + type: VARCHAR(1) + relationship_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + relationship_id: + nullable: false + primary: true + type: VARCHAR(20) + relationship_name: + nullable: false + primary: false + type: VARCHAR(255) + reverse_relationship_id: + nullable: false + primary: false + type: VARCHAR(20) + unique: [] + source_to_concept_map: + columns: + invalid_reason: + nullable: true + primary: false + type: VARCHAR(1) + source_code: + nullable: false + primary: false + type: VARCHAR(50) + source_code_description: + nullable: true + primary: false + type: VARCHAR(255) + source_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + source_vocabulary_id: + nullable: false + primary: false + type: VARCHAR(20) + target_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + target_vocabulary_id: + foreign_keys: + - vocabulary.vocabulary_id + nullable: false + primary: false + type: VARCHAR(20) + valid_end_date: + nullable: false + primary: false + type: DATE + valid_start_date: + nullable: false + primary: false + type: DATE + unique: [] + specimen: + columns: + anatomic_site_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + anatomic_site_source_value: + nullable: true + primary: false + type: VARCHAR(50) + disease_status_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + disease_status_source_value: + nullable: true + primary: false + type: VARCHAR(50) + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + quantity: + nullable: true + primary: false + type: NUMERIC + specimen_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + specimen_date: + nullable: false + primary: false + type: DATE + specimen_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + specimen_id: + nullable: false + primary: true + type: BIGINT + specimen_source_id: + nullable: true + primary: false + type: VARCHAR(255) + specimen_source_value: + nullable: true + primary: false + type: VARCHAR(50) + specimen_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + unit_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + unit_source_value: + nullable: true + primary: false + type: VARCHAR(50) + unique: [] + visit_detail: + columns: + admitting_source_concept_id: + nullable: true + primary: false + type: BIGINT + admitting_source_value: + nullable: true + primary: false + type: VARCHAR(50) + care_site_id: + foreign_keys: + - care_site.care_site_id + nullable: true + primary: false + type: BIGINT + discharge_to_concept_id: + nullable: true + primary: false + type: BIGINT + discharge_to_source_value: + nullable: true + primary: false + type: VARCHAR(50) + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + preceding_visit_detail_id: + foreign_keys: + - visit_detail.visit_detail_id + nullable: true + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + visit_detail_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + visit_detail_end_date: + nullable: false + primary: false + type: DATE + visit_detail_end_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + visit_detail_id: + nullable: false + primary: true + type: BIGINT + visit_detail_parent_id: + nullable: true + primary: false + type: VARCHAR(50) + visit_detail_source_concept_id: + nullable: true + primary: false + type: VARCHAR(50) + visit_detail_source_value: + nullable: true + primary: false + type: VARCHAR(120) + visit_detail_start_date: + nullable: false + primary: false + type: DATE + visit_detail_start_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + visit_detail_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: false + primary: false + type: BIGINT + unique: [] + visit_occurrence: + columns: + admitted_from_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + admitted_from_source_value: + nullable: true + primary: false + type: VARCHAR(50) + care_site_id: + foreign_keys: + - care_site.care_site_id + nullable: true + primary: false + type: BIGINT + discharged_to_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + discharged_to_source_value: + nullable: true + primary: false + type: VARCHAR(50) + person_id: + foreign_keys: + - person.person_id + nullable: false + primary: false + type: BIGINT + preceding_visit_occurrence_id: + foreign_keys: + - visit_occurrence.visit_occurrence_id + nullable: true + primary: false + type: BIGINT + provider_id: + foreign_keys: + - provider.provider_id + nullable: true + primary: false + type: BIGINT + visit_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + visit_end_date: + nullable: false + primary: false + type: DATE + visit_end_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + visit_occurrence_id: + nullable: false + primary: true + type: BIGINT + visit_source_concept_id: + foreign_keys: + - concept.concept_id + nullable: true + primary: false + type: BIGINT + visit_source_value: + nullable: true + primary: false + type: VARCHAR(50) + visit_start_date: + nullable: false + primary: false + type: DATE + visit_start_datetime: + nullable: true + primary: false + type: TIMESTAMP WITHOUT TIME ZONE + visit_type_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + unique: [] + vocabulary: + columns: + vocabulary_concept_id: + foreign_keys: + - concept.concept_id + nullable: false + primary: false + type: BIGINT + vocabulary_id: + nullable: false + primary: true + type: VARCHAR(30) + vocabulary_name: + nullable: false + primary: false + type: VARCHAR(255) + vocabulary_reference: + nullable: true + primary: false + type: VARCHAR(255) + vocabulary_version: + nullable: true + primary: false + type: VARCHAR(255) + unique: []