# 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', '0005_initial'),
        ('biologicallyderivedproducts', '0001_initial'),
        ('devices', '0001_initial'),
        ('groups', '0002_initial'),
        ('locations', '0001_initial'),
        ('organizations', '0001_initial'),
        ('patients', '0002_initial'),
        ('practitionerroles', '0002_initial'),
        ('practitioners', '0001_initial'),
        ('procedures', '0001_initial'),
        ('relatedpersons', '0001_initial'),
        ('servicerequests', '0001_initial'),
        ('substances', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='SpecimenCollectorReference',
            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.DO_NOTHING, related_name='specimen_collector_reference_identifier', to='base.identifier')),
                ('organization', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collector_reference_organization', to='organizations.organization')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collector_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collector_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collector_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collector_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SpecimenCollection',
            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)),
                ('collected_date', models.DateTimeField(null=True)),
                ('collected_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_collected_period', to='base.period')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_device', to='devices.devicecodeablereference')),
                ('duration', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_duration', to='base.duration')),
                ('fasting_status_codeable_concept', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_fasting_status_codeable_concept', to='base.codeableconcept')),
                ('fasting_status_duration', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_fasting_status_duration', to='base.duration')),
                ('method', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_method', to='base.codeableconcept')),
                ('procedure', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_procedure', to='procedures.procedurereference')),
                ('quantity', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_method', to='base.simplequantity')),
                ('collector', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections_collector', to='specimens.specimencollectorreference')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SpecimenContainer',
            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)),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_container_device', to='devices.devicereference')),
                ('specimen_quantity', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_container_specimen_quantity', to='base.simplequantity')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SpecimenFeature',
            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)),
                ('description', models.TextField(null=True)),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_feature_type', to='base.codeableconcept')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SpecimenProcessing',
            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)),
                ('description', models.TextField(null=True)),
                ('time_date_time', models.DateTimeField(null=True)),
                ('additive', models.ManyToManyField(blank=True, related_name='specimen_processing_additive', to='substances.substancereference')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_processing_device', to='devices.devicereference')),
                ('method', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_processing_method', to='base.codeableconcept')),
                ('time_duration', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_processing_time_duration', to='base.duration')),
                ('time_period', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_processing_time_period', to='base.period')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Specimen',
            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=[('available', 'Available'), ('unavailable', 'Unavailable'), ('unsatisfactory', 'Unsatisfactory'), ('entered-in-error', 'Entered in Error')], max_length=255, null=True)),
                ('received_time', models.DateTimeField(null=True)),
                ('combined', models.CharField(choices=[('grouped', 'Grouped'), ('pooled', 'Pooled')], max_length=255, null=True)),
                ('accession_identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_accession_identifier', to='base.identifier')),
                ('condition', models.ManyToManyField(blank=True, related_name='specimen_condition', to='base.codeableconcept')),
                ('identifier', models.ManyToManyField(blank=True, related_name='specimen_identifier', to='base.identifier')),
                ('note', models.ManyToManyField(blank=True, related_name='specimen_note', to='base.annotation')),
                ('request', models.ManyToManyField(blank=True, related_name='specimen_request', to='servicerequests.servicerequestreference')),
                ('role', models.ManyToManyField(blank=True, related_name='specimen_role', to='base.codeableconcept')),
                ('type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_type', to='base.codeableconcept')),
                ('collections', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_collections', to='specimens.specimencollection')),
                ('container', models.ManyToManyField(blank=True, related_name='specimen_container', to='specimens.specimencontainer')),
                ('feature', models.ManyToManyField(blank=True, related_name='specimen_feature', to='specimens.specimenfeature')),
                ('processing', models.ManyToManyField(blank=True, related_name='specimen_processing', to='specimens.specimenprocessing')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SpecimenProcessingPerformerReference',
            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.DO_NOTHING, related_name='specimen_performer_reference_identifier', to='base.identifier')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_performer_reference_patient', to='patients.patient')),
                ('practitioner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_performer_reference_practitioner', to='practitioners.practitioner')),
                ('practitioner_role', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_performer_reference_practitioner_role', to='practitionerroles.practitionerrole')),
                ('related_person', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_performer_reference_related_person', to='relatedpersons.relatedperson')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='specimenprocessing',
            name='performer',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_processing_performer', to='specimens.specimenprocessingperformerreference'),
        ),
        migrations.CreateModel(
            name='SpecimenReference',
            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.DO_NOTHING, related_name='specimen_reference_identifier', to='base.identifier')),
                ('specimen', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_reference_specimen', to='specimens.specimen')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='specimen',
            name='parent',
            field=models.ManyToManyField(blank=True, related_name='specimen_parent', to='specimens.specimenreference'),
        ),
        migrations.CreateModel(
            name='SpecimenSubjectReference',
            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)),
                ('biologically_driven_product', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_biologically_driven_product', to='biologicallyderivedproducts.biologicallyderivedproduct')),
                ('device', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_device', to='devices.device')),
                ('group', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_group', to='groups.group')),
                ('identifier', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_identifier', to='base.identifier')),
                ('location', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_location', to='locations.location')),
                ('patient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_patient', to='patients.patient')),
                ('substance', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject_reference_substance', to='substances.substance')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='specimen',
            name='subject',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='specimen_subject', to='specimens.specimensubjectreference'),
        ),
    ]
