# Generated by Django 5.2 on 2025-04-23 12:46

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('base', '0001_initial'),
        ('devicedefinitions', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='ObservationDefinitionQualifiedValue',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('gender', models.CharField(choices=[('male', 'Male'), ('female', 'Female'), ('other', 'Other'), ('unknown', 'Unknown')], max_length=255, null=True)),
                ('condition', models.CharField(max_length=255, null=True)),
                ('range_category', models.CharField(choices=[('reference', 'Reference'), ('critical', 'Critical'), ('absolute', 'Absolute')], max_length=255, null=True)),
                ('age', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_qualified_value_age', to='base.range')),
                ('applies_to', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_qualified_value_applies_to', to='base.codeableconcept')),
                ('context', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_qualified_value_context', to='base.codeableconcept')),
                ('gestational_age', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_qualified_value_gestational_age', to='base.range')),
                ('interpretation', models.ManyToManyField(blank=True, related_name='observation_definition_qualified_value_interpretation', to='base.codeableconcept')),
                ('range', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_qualified_value_range', to='base.range')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ObservationDefinitionComponent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('permitted_data_type', models.CharField(choices=[('Quantity', 'Quantity'), ('codeableconcept', 'Codeable Concept'), ('string', 'String'), ('boolean', 'Boolean'), ('integer', 'Integer'), ('range', 'Range'), ('ratio', 'Ratio'), ('sampled_data', 'Sampled Data'), ('time', 'Time'), ('date', 'Date'), ('datetime', 'Datetime'), ('period', 'Period')], max_length=255, null=True)),
                ('code', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='base.codeableconcept')),
                ('permitted_unit', models.ManyToManyField(blank=True, related_name='observation_definition_component_permitted_unit', to='base.coding')),
                ('qulaified_value', models.ManyToManyField(blank=True, related_name='observation_definition_component_qualified_value', to='observationdefinitions.observationdefinitionqualifiedvalue')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ObservationDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('url', models.URLField(null=True)),
                ('version', models.CharField(max_length=255, null=True)),
                ('version_algorithm_string', models.CharField(max_length=255, null=True)),
                ('name', models.CharField(max_length=255, null=True)),
                ('title', models.CharField(max_length=255, null=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('active', 'Active'), ('retired', 'Retired'), ('unknown', 'Unknown')], max_length=255, null=True)),
                ('experimental', models.BooleanField(default=False)),
                ('date', models.DateTimeField(null=True)),
                ('publisher', models.CharField(max_length=255, null=True)),
                ('description', models.TextField(null=True)),
                ('purpose', models.TextField(null=True)),
                ('copyright', models.TextField(null=True)),
                ('copyright_label', models.CharField(max_length=255, null=True)),
                ('approval_date', models.DateTimeField(null=True)),
                ('last_review_date', models.DateTimeField(null=True)),
                ('derived_from_uri', models.URLField(null=True)),
                ('permitted_data_type', models.CharField(choices=[('Quantity', 'Quantity'), ('codeableconcept', 'Codeable Concept'), ('string', 'String'), ('boolean', 'Boolean'), ('integer', 'Integer'), ('range', 'Range'), ('ratio', 'Ratio'), ('sampled_data', 'Sampled Data'), ('time', 'Time'), ('date', 'Date'), ('datetime', 'Datetime'), ('period', 'Period')], max_length=255, null=True)),
                ('multiple_results_allowed', models.BooleanField(default=False)),
                ('preferred_report_name', models.CharField(max_length=255, null=True)),
                ('body_site', models.ManyToManyField(blank=True, related_name='observation_definition_body_site', to='base.codeableconcept')),
                ('category', models.ManyToManyField(blank=True, related_name='observation_definition_category', to='base.codeableconcept')),
                ('code', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_code', to='base.codeableconcept')),
                ('contact', models.ManyToManyField(blank=True, related_name='observation_definition_contact', to='base.contactdetail')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_device', to='devicedefinitions.devicedefinition')),
                ('effective_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_effective_period', to='base.period')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_identifier', to='base.identifier')),
                ('jurisdiction', models.ManyToManyField(blank=True, related_name='observation_definition_jurisdiction', to='base.codeableconcept')),
                ('method', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_method', to='base.codeableconcept')),
                ('performer_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_performer_type', to='base.codeableconcept')),
                ('permitted_unit', models.ManyToManyField(blank=True, related_name='observation_definition_permitted_unit', to='base.coding')),
                ('subject', models.ManyToManyField(blank=True, related_name='observation_definition_subject', to='base.codeableconcept')),
                ('use_context', models.ManyToManyField(blank=True, related_name='observation_definition_use_context', to='base.usagecontext')),
                ('version_algorithm_coding', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_version_algorithm_coding', to='base.coding')),
                ('component', models.ManyToManyField(blank=True, related_name='observation_definition_component', to='observationdefinitions.observationdefinitioncomponent')),
                ('qualified_value', models.ManyToManyField(blank=True, related_name='observation_definition_qualified_value', to='observationdefinitions.observationdefinitionqualifiedvalue')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ObservationDefinitionQuestionnaireReference',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_questionnaire_reference_identifier', to='base.identifier')),
                ('observatoin_definition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='observationdefinitions.observationdefinition')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='observationdefinition',
            name='has_member',
            field=models.ManyToManyField(blank=True, related_name='observation_definition_has_member', to='observationdefinitions.observationdefinitionquestionnairereference'),
        ),
        migrations.CreateModel(
            name='ObservationDefinitionReference',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('reference', models.CharField(max_length=255, null=True)),
                ('type', models.CharField(max_length=255, null=True)),
                ('display', models.CharField(max_length=255, null=True)),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_reference_identifier', to='base.identifier')),
                ('observation_definition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='observation_definition_reference_observation_definition', to='observationdefinitions.observationdefinition')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
