# Generated by Django 5.2 on 2024-09-16 12:22

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies: list = []

    operations = [
        migrations.CreateModel(
            name="Cohort",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("cohort_definition_id", models.IntegerField()),
                ("subject_id", models.IntegerField()),
                ("cohort_start_date", models.DateField()),
                ("cohort_end_date", models.DateField()),
            ],
            options={
                "db_table": "cohort",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Concept",
            fields=[
                ("concept_id", models.IntegerField(primary_key=True, serialize=False)),
                ("concept_name", models.CharField(max_length=255)),
                ("domain_id", models.CharField(max_length=255)),
                ("vocabulary_id", models.CharField(max_length=255)),
                ("concept_class", models.CharField(max_length=255)),
                (
                    "standard_concept",
                    models.CharField(blank=True, max_length=1, null=True),
                ),
                ("concept_code", models.CharField(max_length=50)),
                ("valid_start_date", models.DateField()),
                ("valid_end_date", models.DateField()),
                (
                    "invalid_reason",
                    models.CharField(blank=True, max_length=1, null=True),
                ),
            ],
            options={
                "db_table": "concept",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="CohortDefinition",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("cohort_definition_id", models.IntegerField()),
                ("cohort_definition_name", models.CharField(max_length=255)),
                (
                    "cohort_definition_description",
                    models.TextField(blank=True, null=True),
                ),
                ("cohort_definition_syntax", models.TextField(blank=True, null=True)),
                ("cohort_initiation_date", models.DateField(blank=True, null=True)),
                (
                    "definition_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "subject_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="cohortdefinition_subject_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "cohort_definition",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="CdmSource",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("cdm_source_name", models.CharField(max_length=255)),
                ("cdm_source_abbreviation", models.CharField(max_length=25)),
                ("cdm_holder", models.CharField(max_length=255)),
                ("source_description", models.TextField(blank=True, null=True)),
                (
                    "source_documentation_reference",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "cdm_etl_reference",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("source_release_date", models.DateField()),
                ("cdm_release_date", models.DateField()),
                ("cdm_version", models.CharField(blank=True, max_length=10, null=True)),
                ("vocabulary_version", models.CharField(max_length=20)),
                (
                    "cdm_version_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "cdm_source",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ConceptAncestor",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("min_levels_of_separation", models.IntegerField()),
                ("max_levels_of_separation", models.IntegerField()),
                (
                    "ancestor_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "descendant_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="conceptancestor_descendant_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "concept_ancestor",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ConceptSynonym",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("concept_synonym_name", models.CharField(max_length=1000)),
                (
                    "concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "language_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="conceptsynonym_language_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "concept_synonym",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Domain",
            fields=[
                (
                    "domain_id",
                    models.CharField(max_length=20, primary_key=True, serialize=False),
                ),
                ("domain_name", models.CharField(max_length=255)),
                (
                    "domain_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "domain",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Cost",
            fields=[
                ("cost_id", models.IntegerField(primary_key=True, serialize=False)),
                ("cost_event_id", models.IntegerField()),
                (
                    "total_charge",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "total_cost",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "total_paid",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_by_payer",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_by_patient",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_patient_copay",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_patient_coinsurance",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_patient_deductible",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_by_primary",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_ingredient_cost",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "paid_dispensing_fee",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                ("payer_plan_period_id", models.IntegerField(blank=True, null=True)),
                (
                    "amount_allowed",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "revenue_code_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "drg_source_value",
                    models.CharField(blank=True, max_length=3, null=True),
                ),
                (
                    "cost_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "currency_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="cost_currency_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "drg_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="cost_drg_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "revenue_code_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="cost_revenue_code_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "cost_domain",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.domain"
                    ),
                ),
            ],
            options={
                "db_table": "cost",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="DrugStrength",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "amount_value",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "numerator_value",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "denominator_value",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                ("box_size", models.IntegerField(blank=True, null=True)),
                ("valid_start_date", models.DateField()),
                ("valid_end_date", models.DateField()),
                (
                    "invalid_reason",
                    models.CharField(blank=True, max_length=1, null=True),
                ),
                (
                    "amount_unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugstrength_amount_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "denominator_unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugstrength_denominator_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "drug_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "ingredient_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugstrength_ingredient_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "numerator_unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugstrength_numerator_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "drug_strength",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Episode",
            fields=[
                ("episode_id", models.IntegerField(primary_key=True, serialize=False)),
                ("episode_start_date", models.DateField()),
                ("episode_start_datetime", models.DateTimeField(blank=True, null=True)),
                ("episode_end_date", models.DateField(blank=True, null=True)),
                ("episode_end_datetime", models.DateTimeField(blank=True, null=True)),
                ("episode_parent_id", models.IntegerField(blank=True, null=True)),
                ("episode_number", models.IntegerField(blank=True, null=True)),
                (
                    "episode_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "episode_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "episode_object_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="episode_episode_object_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "episode_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="episode_episode_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "episode_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="episode_episode_type_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "episode",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="EpisodeEvent",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("event_id", models.IntegerField()),
                (
                    "episode",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.episode",
                    ),
                ),
                (
                    "episode_event_field_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "episode_event",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="FactRelationship",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("fact_id_1", models.IntegerField()),
                ("fact_id_2", models.IntegerField()),
                (
                    "domain_concept_id_1",
                    models.ForeignKey(
                        db_column="domain_concept_id_1",
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "domain_concept_id_2",
                    models.ForeignKey(
                        db_column="domain_concept_id_2",
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="factrelationship_domain_concept_id_2_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "relationship_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="factrelationship_relationship_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "fact_relationship",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Location",
            fields=[
                ("location_id", models.IntegerField(primary_key=True, serialize=False)),
                ("address_1", models.CharField(blank=True, max_length=50, null=True)),
                ("address_2", models.CharField(blank=True, max_length=50, null=True)),
                ("city", models.CharField(blank=True, max_length=50, null=True)),
                ("state", models.CharField(blank=True, max_length=2, null=True)),
                ("zip", models.CharField(blank=True, max_length=9, null=True)),
                ("county", models.CharField(blank=True, max_length=20, null=True)),
                (
                    "location_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "country_source_value",
                    models.CharField(blank=True, max_length=80, null=True),
                ),
                (
                    "latitude",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "longitude",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "country_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "location",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="CareSite",
            fields=[
                (
                    "care_site_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                (
                    "care_site_name",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "care_site_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "place_of_service_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "place_of_service_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "location",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.location",
                    ),
                ),
            ],
            options={
                "db_table": "care_site",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Metadata",
            fields=[
                ("metadata_id", models.IntegerField(primary_key=True, serialize=False)),
                ("name", models.CharField(max_length=250)),
                (
                    "value_as_string",
                    models.CharField(blank=True, max_length=250, null=True),
                ),
                (
                    "value_as_number",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                ("metadata_date", models.DateField(blank=True, null=True)),
                ("metadata_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "metadata_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "metadata_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="metadata_metadata_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "value_as_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="metadata_value_as_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "metadata",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="NoteNlp",
            fields=[
                ("note_nlp_id", models.IntegerField(primary_key=True, serialize=False)),
                ("note_id", models.IntegerField()),
                ("snippet", models.CharField(blank=True, max_length=250, null=True)),
                ("offset", models.CharField(blank=True, max_length=50, null=True)),
                ("lexical_variant", models.CharField(max_length=250)),
                ("nlp_system", models.CharField(blank=True, max_length=250, null=True)),
                ("nlp_date", models.DateField()),
                ("nlp_datetime", models.DateTimeField(blank=True, null=True)),
                ("term_exists", models.CharField(blank=True, max_length=1, null=True)),
                (
                    "term_temporal",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "term_modifiers",
                    models.CharField(blank=True, max_length=2000, null=True),
                ),
                (
                    "note_nlp_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="notenlp_note_nlp_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "note_nlp_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="notenlp_note_nlp_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "section_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "note_nlp",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Person",
            fields=[
                ("person_id", models.IntegerField(primary_key=True, serialize=False)),
                ("year_of_birth", models.IntegerField()),
                ("month_of_birth", models.IntegerField(blank=True, null=True)),
                ("day_of_birth", models.IntegerField(blank=True, null=True)),
                ("birth_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "person_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "gender_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "race_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "ethnicity_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "care_site",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.caresite",
                    ),
                ),
                (
                    "ethnicity_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="person_ethnicity_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "ethnicity_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="person_ethnicity_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "gender_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "gender_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="person_gender_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "location",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.location",
                    ),
                ),
                (
                    "race_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="person_race_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "race_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="person_race_source_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "person",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="PayerPlanPeriod",
            fields=[
                (
                    "payer_plan_period_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("payer_plan_period_start_date", models.DateField()),
                ("payer_plan_period_end_date", models.DateField()),
                (
                    "payer_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "plan_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "sponsor_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "family_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "stop_reason_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "payer_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "payer_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_payer_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "plan_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_plan_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "plan_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_plan_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "sponsor_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_sponsor_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "sponsor_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_sponsor_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "stop_reason_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_stop_reason_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "stop_reason_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="payerplanperiod_stop_reason_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
            ],
            options={
                "db_table": "payer_plan_period",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ObservationPeriod",
            fields=[
                (
                    "observation_period_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("observation_period_start_date", models.DateField()),
                ("observation_period_end_date", models.DateField()),
                (
                    "period_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
            ],
            options={
                "db_table": "observation_period",
                "managed": True,
            },
        ),
        migrations.AddField(
            model_name="episode",
            name="person",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
            ),
        ),
        migrations.CreateModel(
            name="DrugEra",
            fields=[
                ("drug_era_id", models.IntegerField(primary_key=True, serialize=False)),
                ("drug_era_start_date", models.DateField()),
                ("drug_era_end_date", models.DateField()),
                ("drug_exposure_count", models.IntegerField(blank=True, null=True)),
                ("gap_days", models.IntegerField(blank=True, null=True)),
                (
                    "drug_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
            ],
            options={
                "db_table": "drug_era",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="DoseEra",
            fields=[
                ("dose_era_id", models.IntegerField(primary_key=True, serialize=False)),
                (
                    "dose_value",
                    models.DecimalField(decimal_places=1000, max_digits=1000),
                ),
                ("dose_era_start_date", models.DateField()),
                ("dose_era_end_date", models.DateField()),
                (
                    "drug_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="doseera_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
            ],
            options={
                "db_table": "dose_era",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Death",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("death_date", models.DateField()),
                ("death_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "cause_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "cause_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="death_cause_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "cause_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="death_cause_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "death_type_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
            ],
            options={
                "db_table": "death",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ConditionEra",
            fields=[
                (
                    "condition_era_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("condition_era_start_date", models.DateField()),
                ("condition_era_end_date", models.DateField()),
                (
                    "condition_occurrence_count",
                    models.IntegerField(blank=True, null=True),
                ),
                (
                    "condition_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
            ],
            options={
                "db_table": "condition_era",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Provider",
            fields=[
                ("provider_id", models.IntegerField(primary_key=True, serialize=False)),
                (
                    "provider_name",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("npi", models.CharField(blank=True, max_length=20, null=True)),
                ("dea", models.CharField(blank=True, max_length=20, null=True)),
                ("year_of_birth", models.IntegerField(blank=True, null=True)),
                (
                    "provider_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "specialty_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "gender_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "care_site",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.caresite",
                    ),
                ),
                (
                    "gender_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="provider_gender_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "gender_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="provider_gender_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "specialty_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "specialty_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="provider_specialty_source_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "provider",
                "managed": True,
            },
        ),
        migrations.AddField(
            model_name="person",
            name="provider",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.DO_NOTHING,
                to="omop.provider",
            ),
        ),
        migrations.CreateModel(
            name="Relationship",
            fields=[
                (
                    "relationship_id",
                    models.CharField(max_length=20, primary_key=True, serialize=False),
                ),
                ("relationship_name", models.CharField(max_length=255)),
                ("is_hierarchical", models.CharField(max_length=1)),
                ("defines_ancestry", models.CharField(max_length=1)),
                ("reverse_relationship_id", models.CharField(max_length=20)),
                (
                    "relationship_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "relationship",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ConceptRelationship",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("valid_start_date", models.DateField()),
                ("valid_end_date", models.DateField()),
                (
                    "invalid_reason",
                    models.CharField(blank=True, max_length=1, null=True),
                ),
                (
                    "concept_id_1",
                    models.ForeignKey(
                        db_column="concept_id_1",
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "concept_id_2",
                    models.ForeignKey(
                        db_column="concept_id_2",
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="conceptrelationship_concept_id_2_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "relationship",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.relationship",
                    ),
                ),
            ],
            options={
                "db_table": "concept_relationship",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Specimen",
            fields=[
                ("specimen_id", models.IntegerField(primary_key=True, serialize=False)),
                ("specimen_date", models.DateField()),
                ("specimen_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "quantity",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "specimen_source_id",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "specimen_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "unit_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "anatomic_site_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "disease_status_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "anatomic_site_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="specimen_anatomic_site_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "disease_status_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="specimen_disease_status_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "specimen_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "specimen_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="specimen_specimen_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="specimen_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "specimen",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="VisitOccurrence",
            fields=[
                (
                    "visit_occurrence_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("visit_start_date", models.DateField()),
                ("visit_start_datetime", models.DateTimeField(blank=True, null=True)),
                ("visit_end_date", models.DateField()),
                ("visit_end_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "visit_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "admitted_from_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "discharged_to_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "admitted_from_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitoccurrence_admitted_from_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "care_site",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.caresite",
                    ),
                ),
                (
                    "discharged_to_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitoccurrence_discharged_to_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "preceding_visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "visit_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitoccurrence_visit_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "visit_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitoccurrence_visit_type_concept_set",
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "visit_occurrence",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="VisitDetail",
            fields=[
                (
                    "visit_detail_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("visit_detail_start_date", models.DateField()),
                (
                    "visit_detail_start_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                ("visit_detail_end_date", models.DateField()),
                (
                    "visit_detail_end_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                (
                    "visit_detail_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "admitted_from_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "discharged_to_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "admitted_from_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitdetail_admitted_from_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "care_site",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.caresite",
                    ),
                ),
                (
                    "discharged_to_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitdetail_discharged_to_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "parent_visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitdetail_parent_visit_detail_set",
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "preceding_visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "visit_detail_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitdetail_visit_detail_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "visit_detail_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="visitdetail_visit_detail_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "visit_detail",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ProcedureOccurrence",
            fields=[
                (
                    "procedure_occurrence_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("procedure_date", models.DateField()),
                ("procedure_datetime", models.DateTimeField(blank=True, null=True)),
                ("procedure_end_date", models.DateField(blank=True, null=True)),
                ("procedure_end_datetime", models.DateTimeField(blank=True, null=True)),
                ("quantity", models.IntegerField(blank=True, null=True)),
                (
                    "procedure_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "modifier_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "modifier_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="procedureoccurrence_modifier_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "procedure_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "procedure_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="procedureoccurrence_procedure_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "procedure_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="procedureoccurrence_procedure_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "procedure_occurrence",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Observation",
            fields=[
                (
                    "observation_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("observation_date", models.DateField()),
                ("observation_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "value_as_number",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "value_as_string",
                    models.CharField(blank=True, max_length=60, null=True),
                ),
                (
                    "observation_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "unit_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "qualifier_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "value_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                ("observation_event_id", models.IntegerField(blank=True, null=True)),
                (
                    "obs_event_field_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="observation_obs_event_field_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "observation_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "observation_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="observation_observation_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "observation_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="observation_observation_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "qualifier_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="observation_qualifier_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="observation_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "value_as_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="observation_value_as_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "observation",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Note",
            fields=[
                ("note_id", models.IntegerField(primary_key=True, serialize=False)),
                ("note_date", models.DateField()),
                ("note_datetime", models.DateTimeField(blank=True, null=True)),
                ("note_title", models.CharField(blank=True, max_length=250, null=True)),
                ("note_text", models.TextField()),
                (
                    "note_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                ("note_event_id", models.IntegerField(blank=True, null=True)),
                (
                    "encoding_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="note_encoding_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "language_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="note_language_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "note_class_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="note_note_class_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "note_event_field_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="note_note_event_field_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "note_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "note",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Measurement",
            fields=[
                (
                    "measurement_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("measurement_date", models.DateField()),
                ("measurement_datetime", models.DateTimeField(blank=True, null=True)),
                (
                    "measurement_time",
                    models.CharField(blank=True, max_length=10, null=True),
                ),
                (
                    "value_as_number",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "range_low",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "range_high",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                (
                    "measurement_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "unit_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "value_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                ("measurement_event_id", models.IntegerField(blank=True, null=True)),
                (
                    "meas_event_field_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_meas_event_field_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "measurement_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "measurement_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_measurement_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "measurement_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_measurement_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "operator_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_operator_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_unit_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "value_as_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="measurement_value_as_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "measurement",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="DrugExposure",
            fields=[
                (
                    "drug_exposure_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("drug_exposure_start_date", models.DateField()),
                (
                    "drug_exposure_start_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                ("drug_exposure_end_date", models.DateField()),
                (
                    "drug_exposure_end_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                ("verbatim_end_date", models.DateField(blank=True, null=True)),
                ("stop_reason", models.CharField(blank=True, max_length=20, null=True)),
                ("refills", models.IntegerField(blank=True, null=True)),
                (
                    "quantity",
                    models.DecimalField(
                        blank=True, decimal_places=1000, max_digits=1000, null=True
                    ),
                ),
                ("days_supply", models.IntegerField(blank=True, null=True)),
                ("sig", models.TextField(blank=True, null=True)),
                ("lot_number", models.CharField(blank=True, max_length=50, null=True)),
                (
                    "drug_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "route_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "dose_unit_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "drug_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "drug_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugexposure_drug_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "drug_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugexposure_drug_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "route_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="drugexposure_route_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "drug_exposure",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="DeviceExposure",
            fields=[
                (
                    "device_exposure_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("device_exposure_start_date", models.DateField()),
                (
                    "device_exposure_start_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                ("device_exposure_end_date", models.DateField(blank=True, null=True)),
                (
                    "device_exposure_end_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                (
                    "unique_device_id",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "production_id",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("quantity", models.IntegerField(blank=True, null=True)),
                (
                    "device_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "unit_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "device_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "device_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="deviceexposure_device_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "device_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="deviceexposure_device_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="deviceexposure_unit_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "unit_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="deviceexposure_unit_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "device_exposure",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ConditionOccurrence",
            fields=[
                (
                    "condition_occurrence_id",
                    models.IntegerField(primary_key=True, serialize=False),
                ),
                ("condition_start_date", models.DateField()),
                (
                    "condition_start_datetime",
                    models.DateTimeField(blank=True, null=True),
                ),
                ("condition_end_date", models.DateField(blank=True, null=True)),
                ("condition_end_datetime", models.DateTimeField(blank=True, null=True)),
                ("stop_reason", models.CharField(blank=True, max_length=20, null=True)),
                (
                    "condition_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "condition_status_source_value",
                    models.CharField(blank=True, max_length=50, null=True),
                ),
                (
                    "condition_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "condition_source_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="conditionoccurrence_condition_source_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "condition_status_concept",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="conditionoccurrence_condition_status_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "condition_type_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="conditionoccurrence_condition_type_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "person",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING, to="omop.person"
                    ),
                ),
                (
                    "provider",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.provider",
                    ),
                ),
                (
                    "visit_detail",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitdetail",
                    ),
                ),
                (
                    "visit_occurrence",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.visitoccurrence",
                    ),
                ),
            ],
            options={
                "db_table": "condition_occurrence",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="Vocabulary",
            fields=[
                (
                    "vocabulary_id",
                    models.CharField(max_length=20, primary_key=True, serialize=False),
                ),
                ("vocabulary_name", models.CharField(max_length=255)),
                (
                    "vocabulary_reference",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "vocabulary_version",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "vocabulary_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
            ],
            options={
                "db_table": "vocabulary",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="SourceToConceptMap",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("source_code", models.CharField(max_length=50)),
                ("source_vocabulary_id", models.CharField(max_length=20)),
                (
                    "source_code_description",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                ("valid_start_date", models.DateField()),
                ("valid_end_date", models.DateField()),
                (
                    "invalid_reason",
                    models.CharField(blank=True, max_length=1, null=True),
                ),
                (
                    "source_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.concept",
                    ),
                ),
                (
                    "target_concept",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="sourcetoconceptmap_target_concept_set",
                        to="omop.concept",
                    ),
                ),
                (
                    "target_vocabulary",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        to="omop.vocabulary",
                    ),
                ),
            ],
            options={
                "db_table": "source_to_concept_map",
                "managed": True,
            },
        ),
    ]
