# 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', '0004_initial'),
        ('conditions', '0003_initial'),
        ('devices', '0001_initial'),
        ('diagnosticreports', '0002_initial'),
        ('encounters', '0003_initial'),
        ('observations', '0002_initial'),
        ('patients', '0001_initial'),
        ('practitionerroles', '0001_initial'),
        ('practitioners', '0001_initial'),
        ('relatedpersons', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='RiskAssessmentPerformerReference',
            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)),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_performer_references_device', to='devices.device')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_performer_references_identifier', to='base.identifier')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_performer_references_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_performer_references_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_performer_references_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_performer_references_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RiskAssessmentPrediction',
            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)),
                ('probability_decimal', models.DecimalField(decimal_places=10, max_digits=10, null=True)),
                ('relative_risk', models.DecimalField(decimal_places=10, max_digits=10, null=True)),
                ('rationale', models.TextField(null=True)),
                ('outcome', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_predictions_outcome', to='base.codeableconcept')),
                ('probability_range', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_predictions_probability_range', to='base.range')),
                ('qualitative_risk', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_predictions_qualitative_risk', to='base.codeableconcept')),
                ('when_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_predictions_when_period', to='base.period')),
                ('when_range', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_predictions_when_range', to='base.range')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RiskAssessmentReasonCodeableConcept',
            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)),
                ('concept', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_reason_codeable_concepts_code', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RiskAssessment',
            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)),
                ('status', models.CharField(choices=[('registered', 'Registered'), ('specimen-in-progress', 'Specimen in Progress'), ('preliminary', 'Preliminary'), ('final', 'Final'), ('amended', 'Amended'), ('corrected', 'Corrected'), ('appended', 'Appended'), ('cancelled', 'Cancelled'), ('entered-in-error', 'Entered in Error'), ('unknown', 'Unknown'), ('cannot-be-obtained', 'Con not be Obtained')], max_length=200, null=True)),
                ('occurrence_date_time', models.DateTimeField(null=True)),
                ('mitigation', models.CharField(max_length=200, null=True)),
                ('based_on', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_based_on', to='base.reference')),
                ('basis', models.ManyToManyField(blank=True, related_name='risk_assessments_basis', to='base.reference')),
                ('code', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_code', to='base.codeableconcept')),
                ('condition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_condition', to='conditions.conditionreference')),
                ('encounter', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_encounter', to='encounters.encounterreference')),
                ('identifier', models.ManyToManyField(blank=True, related_name='risk_assessments_identifier', to='base.identifier')),
                ('method', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_method', to='base.codeableconcept')),
                ('note', models.ManyToManyField(blank=True, related_name='risk_assessments_note', to='base.annotation')),
                ('occurrence_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_occurrence_period', to='base.period')),
                ('parent', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_parent', to='base.reference')),
                ('subject', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_subject', to='patients.patientgroupreference')),
                ('performer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessments_performer', to='riskassessments.riskassessmentperformerreference')),
                ('prediction', models.ManyToManyField(blank=True, related_name='risk_assessments_prediction', to='riskassessments.riskassessmentprediction')),
                ('reason', models.ManyToManyField(blank=True, related_name='risk_assessments_reason', to='riskassessments.riskassessmentreasoncodeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RiskAssessmentReasonReference',
            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)),
                ('condition', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_reason_references_condition', to='conditions.condition')),
                ('diagnostic_report', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_reason_references_diagnostic_report', to='diagnosticreports.diagnosticreport')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_reason_references_identifier', to='base.identifier')),
                ('observation', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_reason_references_observation', to='observations.observation')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='riskassessmentreasoncodeableconcept',
            name='reference',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='risk_assessment_reason_codeable_concepts_reference', to='riskassessments.riskassessmentreasonreference'),
        ),
    ]
