# Generated by Django 5.2.5 on 2025-09-15 11:52

import django.core.validators
import django.db.models.deletion
import pathlib
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AiModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('model_subtype', models.CharField(blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='CaseTemplateRuleType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='CaseTemplateRuleValue',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('fk_value', models.CharField(blank=True, max_length=255, null=True)),
                ('numeric_value', models.FloatField(blank=True, null=True)),
                ('text_value', models.CharField(blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='CaseTemplateRuleValueType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('distribution_type', models.CharField(choices=[('single_categorical', 'single_categorical'), ('multiple_categorical', 'multiple_categorical'), ('numeric', 'numeric')], max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='CaseTemplateType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Center',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Contraindication',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='DateValueDistribution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True, null=True)),
                ('distribution_type', models.CharField(choices=[('uniform', 'Uniform'), ('normal', 'Normal')], max_length=20)),
                ('mode', models.CharField(choices=[('date', 'Date'), ('timedelta', 'Timedelta')], max_length=20)),
                ('date_min', models.DateField(blank=True, null=True)),
                ('date_max', models.DateField(blank=True, null=True)),
                ('date_mean', models.DateField(blank=True, null=True)),
                ('date_std_dev', models.IntegerField(blank=True, null=True)),
                ('timedelta_days_min', models.IntegerField(blank=True, null=True)),
                ('timedelta_days_max', models.IntegerField(blank=True, null=True)),
                ('timedelta_days_mean', models.IntegerField(blank=True, null=True)),
                ('timedelta_days_std_dev', models.IntegerField(blank=True, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Disease',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('subcategories', models.JSONField(default=dict)),
                ('numerical_descriptors', models.JSONField(default=dict)),
            ],
        ),
        migrations.CreateModel(
            name='DocumentType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Document Type',
                'verbose_name_plural': 'Document Types',
            },
        ),
        migrations.CreateModel(
            name='EmissionFactor',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('value', models.FloatField()),
            ],
        ),
        migrations.CreateModel(
            name='EmployeeType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='EndoscopeType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
            options={
                'verbose_name': 'Endoscope Type',
                'verbose_name_plural': 'Endoscope Types',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='EventClassification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Examination',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('name_de', models.CharField(max_length=100, null=True, unique=True)),
                ('name_en', models.CharField(max_length=100, null=True, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('description_de', models.TextField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Examination',
                'verbose_name_plural': 'Examinations',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='ExaminationType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='FFMpegMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('width', models.IntegerField(blank=True, null=True)),
                ('height', models.IntegerField(blank=True, null=True)),
                ('duration', models.FloatField(blank=True, null=True)),
                ('frame_rate_num', models.IntegerField(blank=True, null=True)),
                ('frame_rate_den', models.IntegerField(blank=True, null=True)),
                ('codec_name', models.CharField(blank=True, max_length=50, null=True)),
                ('pixel_format', models.CharField(blank=True, max_length=50, null=True)),
                ('bit_rate', models.BigIntegerField(blank=True, null=True)),
                ('raw_probe_data', models.JSONField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='FindingClassificationChoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('name_de', models.CharField(max_length=255, null=True, unique=True)),
                ('name_en', models.CharField(max_length=255, null=True, unique=True)),
                ('description', models.TextField(blank=True)),
                ('description_de', models.TextField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True, null=True)),
                ('subcategories', models.JSONField(default=dict)),
                ('numerical_descriptors', models.JSONField(default=dict)),
            ],
        ),
        migrations.CreateModel(
            name='FindingClassificationType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='FindingInterventionType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='FindingType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='FirstName',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Gender',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('abbreviation', models.CharField(max_length=255, null=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Label',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='LabelType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='LastName',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Medication',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('adapt_to_renal_function', models.BooleanField(default=False)),
                ('adapt_to_hepatic_function', models.BooleanField(default=False)),
                ('adapt_to_indication', models.BooleanField(default=False)),
                ('adapt_to_age', models.BooleanField(default=False)),
                ('adapt_to_weight', models.BooleanField(default=False)),
                ('adapt_to_risk', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='MedicationIndicationType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='MedicationIntakeTime',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('repeats', models.CharField(default='daily', max_length=20)),
                ('time', models.TimeField()),
            ],
        ),
        migrations.CreateModel(
            name='ModelType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='MultipleCategoricalValueDistribution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('categories', models.JSONField()),
                ('min_count', models.IntegerField()),
                ('max_count', models.IntegerField()),
                ('count_distribution_type', models.CharField(choices=[('uniform', 'Uniform'), ('normal', 'Normal')], max_length=20)),
                ('count_mean', models.FloatField(blank=True, null=True)),
                ('count_std_dev', models.FloatField(blank=True, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='NumericValueDistribution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('distribution_type', models.CharField(choices=[('uniform', 'Uniform'), ('normal', 'Normal'), ('skewed_normal', 'Skewed Normal')], max_length=20)),
                ('min_descriptor', models.CharField(max_length=20)),
                ('max_descriptor', models.CharField(max_length=20)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PatientLabSampleType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='PdfType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='ProductGroup',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Profession',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Qualification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='QualificationType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='RawPdfState',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text_meta_extracted', models.BooleanField(default=False, help_text='True if text metadata (OCR) has been extracted.')),
                ('initial_prediction_completed', models.BooleanField(default=False, help_text='True if initial AI prediction has run.')),
                ('sensitive_meta_processed', models.BooleanField(default=False, help_text='True if the video has been fully processed, meaning a anonymized person was created.')),
                ('anonymized', models.BooleanField(default=False, help_text='True if the anonymized video file has been created.')),
                ('anonymization_validated', models.BooleanField(default=False, help_text='True if the anonymization process has been validated and confirmed.')),
                ('processing_started', models.BooleanField(default=False, help_text='True if the processing has started, but not yet completed.')),
                ('processing_error', models.BooleanField(default=False, help_text='True if an error occurred during processing.')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('was_created', models.BooleanField(default=True, help_text='True if this state was created for the first time.')),
                ('pdf_meta_extracted', models.BooleanField(default=False, help_text='True if PDF metadata has been extracted.')),
            ],
            options={
                'verbose_name': 'Raw PDF Processing State',
                'verbose_name_plural': 'Raw PDF Processing States',
            },
        ),
        migrations.CreateModel(
            name='ReportReaderFlag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('value', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='RequirementOperator',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('evaluation_function_name', models.CharField(blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='RequirementSetType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='RequirementType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='RiskType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='RuleAttributeDType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='RuleType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
            ],
            options={
                'verbose_name': 'Rule Type',
                'verbose_name_plural': 'Rule Types',
            },
        ),
        migrations.CreateModel(
            name='ScheduledDays',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of the scheduled days.', max_length=255, unique=True)),
                ('working_days', models.BooleanField(blank=True, default=True, null=True)),
                ('non_working_days', models.BooleanField(blank=True, default=False, null=True)),
                ('limited_time', models.BooleanField(blank=True, default=False, null=True)),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='ShiftType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='SingleCategoricalValueDistribution',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('categories', models.JSONField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
            ],
            options={
                'verbose_name': 'Tag',
                'verbose_name_plural': 'Tags',
            },
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('description', models.CharField(blank=True, max_length=100, null=True)),
                ('abbreviation', models.CharField(blank=True, max_length=25, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='VideoImportMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file_name', models.CharField(blank=True, max_length=255, null=True)),
                ('video_anonymized', models.BooleanField(default=False)),
                ('video_patient_data_detected', models.BooleanField(default=False)),
                ('outside_detected', models.BooleanField(default=False)),
                ('patient_data_removed', models.BooleanField(default=False)),
                ('outside_removed', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='VideoSegmentationLabel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('color', models.CharField(blank=True, max_length=255, null=True)),
                ('order_priority', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='VideoState',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('frames_extracted', models.BooleanField(default=False, help_text='True if raw frames have been extracted to files.')),
                ('frames_initialized', models.BooleanField(default=False, help_text='True if Frame DB objects have been created.')),
                ('frame_count', models.PositiveIntegerField(blank=True, help_text='Number of frames extracted/initialized.', null=True)),
                ('video_meta_extracted', models.BooleanField(default=False, help_text='True if VideoMeta (technical specs) has been extracted.')),
                ('text_meta_extracted', models.BooleanField(default=False, help_text='True if text metadata (OCR) has been extracted.')),
                ('initial_prediction_completed', models.BooleanField(default=False, help_text='True if initial AI prediction has run.')),
                ('lvs_created', models.BooleanField(default=False, help_text='True if LabelVideoSegments have been created from predictions.')),
                ('frame_annotations_generated', models.BooleanField(default=False, help_text='True if frame-level annotations have been generated from segments.')),
                ('sensitive_meta_processed', models.BooleanField(default=False, help_text='True if the video has been fully processed, meaning a anonymized person was created.')),
                ('anonymized', models.BooleanField(default=False, help_text='True if the anonymized video file has been created.')),
                ('anonymization_validated', models.BooleanField(default=False, help_text='True if the anonymization process has been validated and confirmed.')),
                ('processing_started', models.BooleanField(default=False, help_text='True if the processing has started, but not yet completed.')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('segment_annotations_created', models.BooleanField(default=False, help_text='True if segment annotations have been created from LabelVideoSegments.')),
                ('segment_annotations_validated', models.BooleanField(default=False, help_text='True if segment annotations have been validated.')),
                ('was_created', models.BooleanField(default=True, help_text='True if this state was created for the first time.')),
            ],
            options={
                'verbose_name': 'Video Processing State',
                'verbose_name_plural': 'Video Processing States',
            },
        ),
        migrations.CreateModel(
            name='Waste',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='CaseTemplateRule',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('parent_model', models.CharField(blank=True, max_length=255, null=True)),
                ('parent_field', models.CharField(blank=True, max_length=255, null=True)),
                ('target_field', models.CharField(blank=True, max_length=255, null=True)),
                ('target_model', models.CharField(blank=True, max_length=255, null=True)),
                ('rule_values', models.JSONField(blank=True, null=True)),
                ('extra_parameters', models.JSONField(blank=True, null=True)),
                ('chained_rules', models.ManyToManyField(related_name='calling_rules', to='endoreg_db.casetemplaterule')),
                ('rule_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.casetemplateruletype')),
                ('value_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.casetemplaterulevaluetype')),
                ('date_value_distribution', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.datevaluedistribution')),
                ('multiple_categorical_value_distribution', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.multiplecategoricalvaluedistribution')),
                ('numerical_value_distribution', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.numericvaluedistribution')),
                ('single_categorical_value_distribution', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.singlecategoricalvaluedistribution')),
            ],
        ),
        migrations.CreateModel(
            name='CaseTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('rules', models.ManyToManyField(to='endoreg_db.casetemplaterule')),
                ('secondary_rules', models.ManyToManyField(related_name='secondary_rules', to='endoreg_db.casetemplaterule')),
                ('template_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='case_templates', to='endoreg_db.casetemplatetype')),
            ],
        ),
        migrations.CreateModel(
            name='DiseaseClassification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('disease', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disease_classifications', to='endoreg_db.disease')),
            ],
        ),
        migrations.CreateModel(
            name='DiseaseClassificationChoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('disease_classification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='disease_classification_choices', to='endoreg_db.diseaseclassification')),
            ],
        ),
        migrations.CreateModel(
            name='Endoscope',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('sn', models.CharField(max_length=255)),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='endoscopes', to='endoreg_db.center')),
                ('endoscope_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='endoscopes', to='endoreg_db.endoscopetype')),
            ],
            options={
                'verbose_name': 'Endoscope',
                'verbose_name_plural': 'Endoscopes',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='EndoscopyProcessor',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('image_width', models.IntegerField()),
                ('image_height', models.IntegerField()),
                ('endoscope_image_x', models.IntegerField()),
                ('endoscope_image_y', models.IntegerField()),
                ('endoscope_image_width', models.IntegerField()),
                ('endoscope_image_height', models.IntegerField()),
                ('examination_date_x', models.IntegerField()),
                ('examination_date_y', models.IntegerField()),
                ('examination_date_width', models.IntegerField()),
                ('examination_date_height', models.IntegerField()),
                ('examination_time_x', models.IntegerField(blank=True, null=True)),
                ('examination_time_y', models.IntegerField(blank=True, null=True)),
                ('examination_time_width', models.IntegerField(blank=True, null=True)),
                ('examination_time_height', models.IntegerField(blank=True, null=True)),
                ('patient_first_name_x', models.IntegerField()),
                ('patient_first_name_y', models.IntegerField()),
                ('patient_first_name_width', models.IntegerField()),
                ('patient_first_name_height', models.IntegerField()),
                ('patient_last_name_x', models.IntegerField()),
                ('patient_last_name_y', models.IntegerField()),
                ('patient_last_name_width', models.IntegerField()),
                ('patient_last_name_height', models.IntegerField()),
                ('patient_dob_x', models.IntegerField()),
                ('patient_dob_y', models.IntegerField()),
                ('patient_dob_width', models.IntegerField()),
                ('patient_dob_height', models.IntegerField()),
                ('endoscope_type_x', models.IntegerField(blank=True, null=True)),
                ('endoscope_type_y', models.IntegerField(blank=True, null=True)),
                ('endoscope_type_width', models.IntegerField(blank=True, null=True)),
                ('endoscope_type_height', models.IntegerField(blank=True, null=True)),
                ('endoscope_sn_x', models.IntegerField(blank=True, null=True)),
                ('endoscope_sn_y', models.IntegerField(blank=True, null=True)),
                ('endoscope_sn_width', models.IntegerField(blank=True, null=True)),
                ('endoscope_sn_height', models.IntegerField(blank=True, null=True)),
                ('centers', models.ManyToManyField(blank=True, related_name='endoscopy_processors', to='endoreg_db.center')),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('event_classification', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='events', to='endoreg_db.eventclassification')),
            ],
        ),
        migrations.CreateModel(
            name='EventClassificationChoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('subcategories', models.JSONField(default=dict)),
                ('numerical_descriptors', models.JSONField(default=dict)),
                ('event_classification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='event_classification_choices', to='endoreg_db.eventclassification')),
            ],
        ),
        migrations.CreateModel(
            name='ExaminationIndicationClassification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('examinations', models.ManyToManyField(blank=True, related_name='indication_classifications', to='endoreg_db.examination')),
            ],
        ),
        migrations.CreateModel(
            name='ExaminationIndicationClassificationChoice',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('subcategories', models.JSONField(default=dict)),
                ('numerical_descriptors', models.JSONField(default=dict)),
                ('classification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='choices', to='endoreg_db.examinationindicationclassification')),
            ],
        ),
        migrations.CreateModel(
            name='ExaminationRequirementSet',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('enabled_by_default', models.BooleanField(default=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('examinations', models.ManyToManyField(blank=True, related_name='exam_reqset_links', to='endoreg_db.examination')),
            ],
        ),
        migrations.CreateModel(
            name='ExaminationTimeType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('examinations', models.ManyToManyField(blank=True, to='endoreg_db.examination')),
            ],
            options={
                'verbose_name': 'Examination Time Type',
                'verbose_name_plural': 'Examination Time Types',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='ExaminationTime',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('start_time', models.TimeField(blank=True, null=True)),
                ('end_time', models.TimeField(blank=True, null=True)),
                ('time_types', models.ManyToManyField(blank=True, to='endoreg_db.examinationtimetype')),
            ],
            options={
                'verbose_name': 'Examination Time',
                'verbose_name_plural': 'Examination Times',
                'ordering': ['name'],
            },
        ),
        migrations.AddField(
            model_name='examination',
            name='examination_types',
            field=models.ManyToManyField(blank=True, to='endoreg_db.examinationtype'),
        ),
        migrations.CreateModel(
            name='Examiner',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=255)),
                ('last_name', models.CharField(max_length=255)),
                ('dob', models.DateField(blank=True, null=True, verbose_name='Date of Birth')),
                ('email', models.EmailField(blank=True, max_length=255, null=True)),
                ('phone', models.CharField(blank=True, max_length=255, null=True)),
                ('is_real_person', models.BooleanField(default=True)),
                ('hash', models.CharField(max_length=255, unique=True)),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.center')),
                ('gender', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.gender')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='FindingIntervention',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('name_de', models.CharField(max_length=100, null=True, unique=True)),
                ('name_en', models.CharField(max_length=100, null=True, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('description_de', models.TextField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True, null=True)),
                ('contraindications', models.ManyToManyField(blank=True, related_name='contraindicating_finding_interventions', to='endoreg_db.contraindication')),
                ('intervention_types', models.ManyToManyField(blank=True, related_name='interventions', to='endoreg_db.findinginterventiontype')),
            ],
        ),
        migrations.CreateModel(
            name='Finding',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('name_de', models.CharField(max_length=100, null=True, unique=True)),
                ('name_en', models.CharField(max_length=100, null=True, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('description_de', models.TextField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True, null=True)),
                ('examinations', models.ManyToManyField(blank=True, related_name='findings', to='endoreg_db.examination')),
                ('finding_interventions', models.ManyToManyField(blank=True, related_name='findings', to='endoreg_db.findingintervention')),
                ('finding_types', models.ManyToManyField(blank=True, related_name='findings', to='endoreg_db.findingtype')),
            ],
        ),
        migrations.CreateModel(
            name='ExaminationIndication',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('examinations', models.ManyToManyField(blank=True, related_name='indications', to='endoreg_db.examination')),
                ('classifications', models.ManyToManyField(blank=True, related_name='indications', to='endoreg_db.examinationindicationclassification')),
                ('expected_interventions', models.ManyToManyField(blank=True, related_name='indications', to='endoreg_db.findingintervention')),
            ],
        ),
        migrations.CreateModel(
            name='FindingClassification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('name_de', models.CharField(max_length=255, null=True, unique=True)),
                ('name_en', models.CharField(max_length=255, null=True, unique=True)),
                ('description', models.TextField(blank=True)),
                ('description_de', models.TextField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True, null=True)),
                ('examinations', models.ManyToManyField(blank=True, related_name='finding_classifications', to='endoreg_db.examination')),
                ('findings', models.ManyToManyField(blank=True, related_name='finding_classifications', to='endoreg_db.finding')),
                ('choices', models.ManyToManyField(blank=True, related_name='classifications', to='endoreg_db.findingclassificationchoice')),
                ('classification_types', models.ManyToManyField(to='endoreg_db.findingclassificationtype')),
                ('finding_types', models.ManyToManyField(blank=True, related_name='finding_classifications', to='endoreg_db.findingtype')),
            ],
        ),
        migrations.AddField(
            model_name='center',
            name='first_names',
            field=models.ManyToManyField(related_name='centers', to='endoreg_db.firstname'),
        ),
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=255)),
                ('last_name', models.CharField(max_length=255)),
                ('dob', models.DateField(blank=True, null=True, verbose_name='Date of Birth')),
                ('email', models.EmailField(blank=True, max_length=255, null=True)),
                ('phone', models.CharField(blank=True, max_length=255, null=True)),
                ('is_real_person', models.BooleanField(default=True)),
                ('employee_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='employees', to='endoreg_db.employeetype')),
                ('gender', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.gender')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='InformationSource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('url', models.URLField(blank=True, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('date', models.DateField(blank=True, null=True)),
                ('date_created', models.DateField(auto_now_add=True)),
                ('date_modified', models.DateField(auto_now=True)),
                ('abbreviation', models.CharField(blank=True, max_length=100, null=True, unique=True)),
            ],
            options={
                'verbose_name': 'Information Source',
                'verbose_name_plural': 'Information Sources',
                'indexes': [models.Index(fields=['name'], name='endoreg_db__name_febac5_idx'), models.Index(fields=['abbreviation'], name='endoreg_db__abbrevi_5a07c4_idx')],
            },
        ),
        migrations.CreateModel(
            name='InformationSourceType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('information_sources', models.ManyToManyField(blank=True, related_name='information_source_types', to='endoreg_db.informationsource')),
            ],
            options={
                'verbose_name': 'Information Source Type',
                'verbose_name_plural': 'Information Source Types',
            },
        ),
        migrations.CreateModel(
            name='LabelSet',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('version', models.IntegerField()),
                ('labels', models.ManyToManyField(related_name='label_sets', to='endoreg_db.label')),
            ],
        ),
        migrations.AddField(
            model_name='label',
            name='label_type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='labels', to='endoreg_db.labeltype'),
        ),
        migrations.CreateModel(
            name='LabelVideoSegment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_frame_number', models.IntegerField()),
                ('end_frame_number', models.IntegerField()),
                ('label', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.label')),
                ('source', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.informationsource')),
            ],
        ),
        migrations.CreateModel(
            name='LabelVideoSegmentState',
            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)),
                ('prediction', models.BooleanField(default=False)),
                ('annotation', models.BooleanField(default=False)),
                ('frames_extracted', models.BooleanField(default=False)),
                ('is_validated', models.BooleanField(default=False)),
                ('origin', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='state', to='endoreg_db.labelvideosegment')),
            ],
            options={
                'verbose_name': 'Label Video Segment State',
                'verbose_name_plural': 'Label Video Segment States',
            },
        ),
        migrations.CreateModel(
            name='LabValue',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('abbreviation', models.CharField(blank=True, max_length=10, null=True)),
                ('numeric_precision', models.IntegerField(default=3)),
                ('default_normal_range', models.JSONField(blank=True, null=True)),
                ('normal_range_age_dependent', models.BooleanField(default=False)),
                ('normal_range_gender_dependent', models.BooleanField(default=False)),
                ('normal_range_special_case', models.BooleanField(default=False)),
                ('bound_adjustment_factor', models.FloatField(default=0.1, help_text='Factor for adjusting bounds when generating increased/decreased values, e.g., 0.1 for 10%.')),
                ('default_date_value_distribution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='default_date_value_distribution', to='endoreg_db.datevaluedistribution')),
                ('default_multiple_categorical_value_distribution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='default_multiple_categorical_value_distribution', to='endoreg_db.multiplecategoricalvaluedistribution')),
                ('default_numerical_value_distribution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='default_numerical_value_distribution', to='endoreg_db.numericvaluedistribution')),
                ('default_single_categorical_value_distribution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='default_single_categorical_value_distribution', to='endoreg_db.singlecategoricalvaluedistribution')),
                ('default_unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit')),
            ],
        ),
        migrations.AddField(
            model_name='findingintervention',
            name='required_lab_values',
            field=models.ManyToManyField(blank=True, related_name='required_by_finding_interventions', to='endoreg_db.labvalue'),
        ),
        migrations.AddField(
            model_name='center',
            name='last_names',
            field=models.ManyToManyField(related_name='centers', to='endoreg_db.lastname'),
        ),
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('emission_factor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.emissionfactor')),
            ],
        ),
        migrations.CreateModel(
            name='MedicationSchedule',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('therapy_duration_d', models.FloatField(blank=True, null=True)),
                ('dose', models.FloatField()),
                ('intake_times', models.ManyToManyField(to='endoreg_db.medicationintaketime')),
                ('medication', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.medication')),
                ('unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit')),
            ],
        ),
        migrations.CreateModel(
            name='MedicationIndication',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('disease_classification_choices', models.ManyToManyField(to='endoreg_db.diseaseclassificationchoice')),
                ('diseases', models.ManyToManyField(to='endoreg_db.disease')),
                ('events', models.ManyToManyField(to='endoreg_db.event')),
                ('sources', models.ManyToManyField(to='endoreg_db.informationsource')),
                ('indication_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='medication_indications', to='endoreg_db.medicationindicationtype')),
                ('medication_schedules', models.ManyToManyField(to='endoreg_db.medicationschedule')),
            ],
        ),
        migrations.CreateModel(
            name='ModelMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text="User-defined name for this specific model metadata set (e.g., 'segmentation_base').", max_length=255)),
                ('version', models.CharField(help_text="Version identifier for this metadata set (e.g., '1', '2a').", max_length=255)),
                ('activation', models.CharField(default='sigmoid', help_text="Output activation function (e.g., 'sigmoid', 'softmax', 'none').", max_length=50)),
                ('weights', models.FileField(blank=True, help_text='Path to the model weights file (.ckpt), relative to MEDIA_ROOT.', null=True, upload_to='model_weights', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['ckpt'])])),
                ('mean', models.CharField(default='0.45211223,0.27139644,0.19264949', help_text='Comma-separated mean values for input normalization.', max_length=255)),
                ('std', models.CharField(default='0.31418097,0.21088019,0.16059452', help_text='Comma-separated standard deviation values for input normalization.', max_length=255)),
                ('size_x', models.IntegerField(default=716, help_text='Expected input image width.')),
                ('size_y', models.IntegerField(default=716, help_text='Expected input image height.')),
                ('axes', models.CharField(default='2,0,1', help_text="Comma-separated target axis order (e.g., '2,0,1' for CHW).", max_length=10)),
                ('batchsize', models.IntegerField(default=16, help_text='Default batch size for inference.')),
                ('num_workers', models.IntegerField(default=0, help_text='Default number of workers for data loading.')),
                ('description', models.TextField(blank=True, help_text='Optional description.', null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('labelset', models.ForeignKey(help_text='The set of labels this model version predicts.', on_delete=django.db.models.deletion.CASCADE, related_name='model_metadata', to='endoreg_db.labelset')),
                ('model', models.ForeignKey(help_text='The base AI model architecture this metadata belongs to.', on_delete=django.db.models.deletion.CASCADE, related_name='metadata_versions', to='endoreg_db.aimodel')),
            ],
        ),
        migrations.AddField(
            model_name='aimodel',
            name='active_meta',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='active_model', to='endoreg_db.modelmeta'),
        ),
        migrations.CreateModel(
            name='ActiveModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('model_meta', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.modelmeta')),
            ],
        ),
        migrations.AddField(
            model_name='aimodel',
            name='model_type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ai_models', to='endoreg_db.modeltype'),
        ),
        migrations.CreateModel(
            name='Organ',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('location_choices', models.ManyToManyField(blank=True, related_name='organs', to='endoreg_db.findingclassificationchoice')),
            ],
        ),
        migrations.CreateModel(
            name='Patient',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(blank=True, max_length=255, null=True)),
                ('phone', models.CharField(blank=True, max_length=255, null=True)),
                ('is_real_person', models.BooleanField(default=True)),
                ('first_name', models.CharField(max_length=100)),
                ('last_name', models.CharField(max_length=100)),
                ('dob', models.DateField(blank=True, null=True)),
                ('patient_hash', models.CharField(blank=True, max_length=255, null=True)),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.center')),
                ('gender', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.gender')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PatientDisease',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_date', models.DateField(blank=True, null=True)),
                ('end_date', models.DateField(blank=True, null=True)),
                ('numerical_descriptors', models.JSONField(default=dict)),
                ('subcategories', models.JSONField(default=dict)),
                ('last_update', models.DateTimeField(auto_now=True)),
                ('classification_choices', models.ManyToManyField(to='endoreg_db.diseaseclassificationchoice')),
                ('disease', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_diseases', to='endoreg_db.disease')),
                ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='diseases', to='endoreg_db.patient')),
            ],
            options={
                'verbose_name': 'Patient Disease',
                'verbose_name_plural': 'Patient Diseases',
            },
        ),
        migrations.CreateModel(
            name='PatientEvent',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_start', models.DateField()),
                ('date_end', models.DateField(blank=True, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('subcategories', models.JSONField(default=dict)),
                ('numerical_descriptors', models.JSONField(default=dict)),
                ('last_update', models.DateTimeField(auto_now=True)),
                ('classification_choice', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.eventclassificationchoice')),
                ('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_events', to='endoreg_db.event')),
                ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='events', to='endoreg_db.patient')),
            ],
        ),
        migrations.CreateModel(
            name='PatientExamination',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_start', models.DateField(blank=True, null=True)),
                ('date_end', models.DateField(blank=True, null=True)),
                ('hash', models.CharField(max_length=255, unique=True)),
                ('examination', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.examination')),
                ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_examinations', to='endoreg_db.patient')),
            ],
            options={
                'verbose_name': 'Patient Examination',
                'verbose_name_plural': 'Patient Examinations',
                'ordering': ['patient', 'examination', 'date_start'],
            },
        ),
        migrations.CreateModel(
            name='Case',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hash', models.CharField(blank=True, help_text='An optional hash value associated with the case.', max_length=255, null=True)),
                ('start_date', models.DateTimeField(db_index=True, help_text='The start date and time of the case.')),
                ('end_date', models.DateTimeField(blank=True, help_text='The end date and time of the case (optional).', null=True)),
                ('is_active', models.BooleanField(db_index=True, default=True, help_text='Flag indicating if the case is currently active.')),
                ('is_closed', models.BooleanField(db_index=True, default=False, help_text='Flag indicating if the case has been closed.')),
                ('is_deleted', models.BooleanField(db_index=True, default=False, help_text='Flag indicating if the case is marked as deleted.')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='The date and time the case was created.')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='The date and time the case was last updated.')),
                ('patient', models.ForeignKey(help_text='The patient associated with this case.', on_delete=django.db.models.deletion.CASCADE, related_name='cases', to='endoreg_db.patient')),
                ('patient_examinations', models.ManyToManyField(help_text='The examinations included in this case.', related_name='cases', to='endoreg_db.patientexamination')),
            ],
            options={
                'verbose_name': 'Case',
                'verbose_name_plural': 'Cases',
                'ordering': ['-start_date', 'patient'],
            },
        ),
        migrations.CreateModel(
            name='AnonymExaminationReport',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('meta', models.JSONField(blank=True, null=True)),
                ('text', models.TextField(blank=True, null=True)),
                ('date', models.DateField(blank=True, null=True)),
                ('time', models.TimeField(blank=True, null=True)),
                ('file', models.FileField(blank=True, null=True, upload_to=pathlib.PurePosixPath('pdfs'))),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.center')),
                ('type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.documenttype')),
                ('examiners', models.ManyToManyField(blank=True, to='endoreg_db.examiner')),
                ('patient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='endoreg_db.patient')),
                ('patient_examination', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.patientexamination')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PatientExaminationIndication',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('examination_indication', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.examinationindication')),
                ('indication_choice', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.examinationindicationclassificationchoice')),
                ('patient_examination', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='indications', to='endoreg_db.patientexamination')),
            ],
        ),
        migrations.CreateModel(
            name='PatientFinding',
            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)),
                ('is_active', models.BooleanField(default=True, help_text='Deaktiviert statt gelöscht für Audit-Trail')),
                ('deactivated_at', models.DateTimeField(blank=True, null=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='created_findings', to=settings.AUTH_USER_MODEL)),
                ('deactivated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='deactivated_findings', to=settings.AUTH_USER_MODEL)),
                ('finding', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='finding_patient_findings', to='endoreg_db.finding')),
                ('patient_examination', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_findings', to='endoreg_db.patientexamination')),
                ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='updated_findings', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Patient Finding',
                'verbose_name_plural': 'Patient Findings',
                'ordering': ['patient_examination', 'finding'],
            },
        ),
        migrations.AddField(
            model_name='labelvideosegment',
            name='patient_findings',
            field=models.ManyToManyField(blank=True, related_name='video_segments', to='endoreg_db.patientfinding'),
        ),
        migrations.CreateModel(
            name='PatientFindingClassification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField(default=True, help_text='Indicates if the classification is currently active.')),
                ('subcategories', models.JSONField(blank=True, null=True)),
                ('numerical_descriptors', models.JSONField(blank=True, null=True)),
                ('classification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_finding_classifications', to='endoreg_db.findingclassification')),
                ('classification_choice', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_finding_classifications', to='endoreg_db.findingclassificationchoice')),
                ('finding', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='classifications', to='endoreg_db.patientfinding')),
            ],
            options={
                'verbose_name': 'Patient Finding Classification',
                'verbose_name_plural': 'Patient Finding Classifications',
                'ordering': ['finding', 'classification', 'classification_choice'],
            },
        ),
        migrations.CreateModel(
            name='PatientFindingIntervention',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField(default=True, help_text='Indicates if the intervention is currently active.')),
                ('state', models.CharField(blank=True, max_length=100, null=True)),
                ('time_start', models.DateTimeField(blank=True, null=True)),
                ('time_end', models.DateTimeField(blank=True, null=True)),
                ('date', models.DateField(blank=True, null=True)),
                ('finding', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interventions', to='endoreg_db.patientfinding')),
                ('intervention', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='patient_finding_interventions', to='endoreg_db.findingintervention')),
            ],
        ),
        migrations.CreateModel(
            name='PatientLabSample',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateTimeField()),
                ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lab_samples', to='endoreg_db.patient')),
                ('sample_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.patientlabsampletype')),
            ],
        ),
        migrations.CreateModel(
            name='PatientMedication',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dosage', models.JSONField(blank=True, null=True)),
                ('active', models.BooleanField(default=True)),
                ('intake_times', models.ManyToManyField(blank=True, related_name='intake_time_patient_medications', to='endoreg_db.medicationintaketime')),
                ('medication', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='medication_patient_medications', to='endoreg_db.medication')),
                ('medication_indication', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='indication_patient_medications', to='endoreg_db.medicationindication')),
                ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.patient')),
                ('unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit')),
            ],
            options={
                'verbose_name': 'Patient Medication',
                'verbose_name_plural': 'Patient Medications',
            },
        ),
        migrations.CreateModel(
            name='PatientMedicationSchedule',
            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)),
                ('medication', models.ManyToManyField(blank=True, related_name='patient_medication_schedules', to='endoreg_db.patientmedication')),
                ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.patient')),
            ],
        ),
        migrations.CreateModel(
            name='PdfMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField()),
                ('time', models.TimeField()),
                ('pdf_hash', models.CharField(max_length=255, unique=True)),
                ('pdf_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.pdftype')),
            ],
        ),
        migrations.CreateModel(
            name='CenterProduct',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_used', models.DateField()),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='center_products', to='endoreg_db.center')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='center_products', to='endoreg_db.product')),
            ],
            options={
                'verbose_name': 'Center Product Usage',
                'verbose_name_plural': 'Center Product Usages',
                'ordering': ['center', '-date_used', 'product'],
            },
        ),
        migrations.AddField(
            model_name='product',
            name='product_group',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='endoreg_db.productgroup'),
        ),
        migrations.CreateModel(
            name='PortalUserInfo',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('works_in_endoscopy', models.BooleanField(blank=True, null=True)),
                ('examiner', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='portal_user_info', to='endoreg_db.examiner')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('profession', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='portal_user_infos', to='endoreg_db.profession')),
            ],
        ),
        migrations.AddField(
            model_name='employeetype',
            name='qualifications',
            field=models.ManyToManyField(related_name='employee_types', to='endoreg_db.qualification'),
        ),
        migrations.CreateModel(
            name='EmployeeQualification',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('employee', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='qualification', to='endoreg_db.employee')),
                ('qualifications', models.ManyToManyField(related_name='employee_qualifications', to='endoreg_db.qualification')),
            ],
        ),
        migrations.AddField(
            model_name='qualification',
            name='qualification_types',
            field=models.ManyToManyField(related_name='qualifications', to='endoreg_db.qualificationtype'),
        ),
        migrations.CreateModel(
            name='ReferenceProduct',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('emission_factor_package', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reference_product_package', to='endoreg_db.emissionfactor')),
                ('emission_factor_product', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reference_product_product', to='endoreg_db.emissionfactor')),
                ('emission_factor_total', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reference_products', to='endoreg_db.emissionfactor')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reference_products', to='endoreg_db.product')),
                ('product_group', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='reference_product', to='endoreg_db.productgroup')),
            ],
        ),
        migrations.CreateModel(
            name='ReportReaderConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('locale', models.CharField(default='de_DE', max_length=10)),
                ('text_date_format', models.CharField(default='%d.%m.%Y', max_length=10)),
                ('first_names', models.ManyToManyField(related_name='report_reader_configs', to='endoreg_db.firstname')),
                ('last_names', models.ManyToManyField(related_name='report_reader_configs', to='endoreg_db.lastname')),
                ('cut_off_above', models.ManyToManyField(related_name='report_reader_configs_cut_off_above', to='endoreg_db.reportreaderflag')),
                ('cut_off_below', models.ManyToManyField(related_name='report_reader_configs_cut_off_below', to='endoreg_db.reportreaderflag')),
                ('endoscope_info_line_flag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='report_reader_configs_endoscope_info_line', to='endoreg_db.reportreaderflag')),
                ('examiner_info_line_flag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='report_reader_configs_examiner_info_line', to='endoreg_db.reportreaderflag')),
                ('patient_info_line_flag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='report_reader_configs_patient_info_line', to='endoreg_db.reportreaderflag')),
            ],
        ),
        migrations.AddField(
            model_name='pdftype',
            name='cut_off_above_lines',
            field=models.ManyToManyField(related_name='pdf_type_cut_off_above_lines', to='endoreg_db.reportreaderflag'),
        ),
        migrations.AddField(
            model_name='pdftype',
            name='cut_off_below_lines',
            field=models.ManyToManyField(related_name='pdf_type_cut_off_below_lines', to='endoreg_db.reportreaderflag'),
        ),
        migrations.AddField(
            model_name='pdftype',
            name='endoscope_info_line',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pdf_type_endoscopy_info_line', to='endoreg_db.reportreaderflag'),
        ),
        migrations.AddField(
            model_name='pdftype',
            name='examiner_info_line',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pdf_type_examiner_info_line', to='endoreg_db.reportreaderflag'),
        ),
        migrations.AddField(
            model_name='pdftype',
            name='patient_info_line',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pdf_type_patient_info_line', to='endoreg_db.reportreaderflag'),
        ),
        migrations.CreateModel(
            name='Requirement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('numeric_value', models.FloatField(blank=True, help_text='Numeric value for the requirement. If not set, the requirement is not used in calculations.', null=True)),
                ('numeric_value_min', models.FloatField(blank=True, help_text='Minimum numeric value for the requirement. If not set, the requirement is not used in calculations.', null=True)),
                ('numeric_value_max', models.FloatField(blank=True, help_text='Maximum numeric value for the requirement. If not set, the requirement is not used in calculations.', null=True)),
                ('string_value', models.CharField(blank=True, help_text='String value for the requirement. If not set, the requirement is not used in calculations.', max_length=100, null=True)),
                ('string_values', models.TextField(blank=True, help_text=" ','-separated list of string values for the requirement.If not set, the requirement is not used in calculations.", null=True)),
                ('disease_classification_choices', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.diseaseclassificationchoice')),
                ('diseases', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.disease')),
                ('events', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.event')),
                ('examination_indications', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.examinationindication')),
                ('examinations', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.examination')),
                ('finding_classification_choices', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.findingclassificationchoice')),
                ('finding_classifications', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.findingclassification')),
                ('finding_interventions', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.findingintervention')),
                ('findings', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.finding')),
                ('genders', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.gender')),
                ('lab_values', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.labvalue')),
                ('medication_indications', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.medicationindication')),
                ('medication_intake_times', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.medicationintaketime')),
                ('medication_schedules', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.medicationschedule')),
                ('medications', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.medication')),
                ('operators', models.ManyToManyField(blank=True, related_name='required_in', to='endoreg_db.requirementoperator')),
                ('requirement_types', models.ManyToManyField(blank=True, related_name='linked_requirements', to='endoreg_db.requirementtype')),
                ('unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='required_in', to='endoreg_db.unit')),
            ],
        ),
        migrations.CreateModel(
            name='Risk',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('name_de', models.CharField(blank=True, max_length=100, null=True)),
                ('name_en', models.CharField(blank=True, max_length=100, null=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('risk_value', models.FloatField(blank=True, help_text='Risk value for the risk. If not set, the risk is not used in calculations.', null=True)),
                ('risk_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='risks', to='endoreg_db.risktype')),
            ],
        ),
        migrations.CreateModel(
            name='Rule',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('attribute_key', models.CharField(max_length=255)),
                ('attribute_dtype', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.ruleattributedtype')),
                ('rule_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.ruletype')),
            ],
            options={
                'verbose_name': 'Rule',
                'verbose_name_plural': 'Rules',
            },
        ),
        migrations.CreateModel(
            name='Ruleset',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('rules', models.ManyToManyField(to='endoreg_db.rule')),
            ],
        ),
        migrations.CreateModel(
            name='SensitiveMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('examination_date', models.DateField(blank=True, null=True)),
                ('patient_first_name', models.CharField(blank=True, max_length=255, null=True)),
                ('patient_last_name', models.CharField(blank=True, max_length=255, null=True)),
                ('patient_dob', models.DateTimeField(blank=True, help_text='Date of birth (can be auto-generated if missing).', null=True)),
                ('examiner_first_name', models.CharField(blank=True, editable=False, max_length=255, null=True)),
                ('examiner_last_name', models.CharField(blank=True, editable=False, max_length=255, null=True)),
                ('examination_hash', models.CharField(blank=True, db_index=True, editable=False, max_length=64, null=True)),
                ('patient_hash', models.CharField(blank=True, db_index=True, editable=False, max_length=64, null=True)),
                ('endoscope_type', models.CharField(blank=True, max_length=255, null=True)),
                ('endoscope_sn', models.CharField(blank=True, max_length=255, null=True)),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.center')),
                ('examiners', models.ManyToManyField(blank=True, help_text='Pseudo-anonymized examiner(s) associated with the examination.', to='endoreg_db.examiner')),
                ('patient_gender', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.gender')),
                ('pseudo_examination', models.ForeignKey(blank=True, help_text='FK to the pseudo-anonymized PatientExamination record.', null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.patientexamination')),
                ('pseudo_patient', models.ForeignKey(blank=True, help_text='FK to the pseudo-anonymized Patient record.', null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.patient')),
            ],
        ),
        migrations.CreateModel(
            name='RawPdfFile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pdf_hash', models.CharField(max_length=255, unique=True)),
                ('text', models.TextField(blank=True, null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('anonymized', models.BooleanField(default=False, help_text='True if the PDF has been anonymized.')),
                ('file', models.FileField(upload_to='raw_pdfs', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['pdf'])])),
                ('anonymized_file', models.FileField(blank=True, null=True, upload_to='raw_pdfs', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['pdf'])])),
                ('state_report_processing_required', models.BooleanField(default=True)),
                ('state_report_processed', models.BooleanField(default=False)),
                ('raw_meta', models.JSONField(blank=True, null=True)),
                ('anonymized_text', models.TextField(blank=True, null=True)),
                ('anonym_examination_report', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='raw_pdf_file', to='endoreg_db.anonymexaminationreport')),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.center')),
                ('examination', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='raw_pdf_files', to='endoreg_db.patientexamination')),
                ('examiner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.examiner')),
                ('patient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='raw_pdf_files', to='endoreg_db.patient')),
                ('pdf_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.pdftype')),
                ('state', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='raw_pdf_file', to='endoreg_db.rawpdfstate')),
                ('sensitive_meta', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='raw_pdf_files', to='endoreg_db.sensitivemeta')),
            ],
        ),
        migrations.CreateModel(
            name='AnonymHistologyReport',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('meta', models.JSONField(blank=True, null=True)),
                ('text', models.TextField(blank=True, null=True)),
                ('date', models.DateField(blank=True, null=True)),
                ('time', models.TimeField(blank=True, null=True)),
                ('file', models.FileField(blank=True, null=True, upload_to=pathlib.PurePosixPath('pdfs'))),
                ('center', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.center')),
                ('type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.documenttype')),
                ('examiners', models.ManyToManyField(blank=True, to='endoreg_db.examiner')),
                ('patient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='endoreg_db.patient')),
                ('patient_examination', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.patientexamination')),
                ('sensitive_meta', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.sensitivemeta')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='anonymexaminationreport',
            name='sensitive_meta',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.sensitivemeta'),
        ),
        migrations.CreateModel(
            name='SensitiveMetaState',
            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)),
                ('dob_verified', models.BooleanField(default=False)),
                ('names_verified', models.BooleanField(default=False)),
                ('origin', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='state', to='endoreg_db.sensitivemeta')),
            ],
            options={
                'verbose_name': 'Sensitive Meta State',
                'verbose_name_plural': 'Sensitive Meta States',
            },
        ),
        migrations.CreateModel(
            name='Shift',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('required_qualifications', models.ManyToManyField(related_name='shifts', to='endoreg_db.qualification')),
                ('shift_types', models.ManyToManyField(related_name='shifts', to='endoreg_db.shifttype')),
            ],
        ),
        migrations.CreateModel(
            name='CenterShift',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('start_time', models.TimeField()),
                ('end_time', models.TimeField()),
                ('estimated_presence_fraction', models.DecimalField(decimal_places=4, default=0.0, max_digits=5)),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='center_shifts', to='endoreg_db.center')),
                ('scheduled_days', models.ManyToManyField(related_name='center_shifts', to='endoreg_db.scheduleddays')),
                ('shift', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='center_shifts', to='endoreg_db.shift')),
            ],
        ),
        migrations.CreateModel(
            name='RequirementSet',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('information_sources', models.ManyToManyField(blank=True, related_name='requirement_sets', to='endoreg_db.informationsource')),
                ('links_to_sets', models.ManyToManyField(blank=True, related_name='links_from_sets', to='endoreg_db.requirementset')),
                ('reqset_exam_links', models.ManyToManyField(blank=True, related_name='requirement_set', to='endoreg_db.examinationrequirementset')),
                ('requirements', models.ManyToManyField(blank=True, related_name='requirement_sets', to='endoreg_db.requirement')),
                ('requirement_set_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='requirement_sets', to='endoreg_db.requirementsettype')),
                ('tags', models.ManyToManyField(blank=True, related_name='requirement_sets', to='endoreg_db.tag')),
            ],
        ),
        migrations.CreateModel(
            name='TransportRoute',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('distance', models.FloatField()),
                ('name', models.CharField(max_length=255)),
                ('emission_factor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.emissionfactor')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.unit')),
            ],
        ),
        migrations.AddField(
            model_name='product',
            name='transport_route',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.transportroute'),
        ),
        migrations.CreateModel(
            name='ProductWeight',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, null=True)),
                ('measured', models.FloatField(null=True)),
                ('verified', models.FloatField(null=True)),
                ('manufacturer', models.FloatField(null=True)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.product')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.unit')),
            ],
        ),
        migrations.CreateModel(
            name='ProductMaterial',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('component', models.CharField(max_length=255)),
                ('quantity', models.FloatField()),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_product_materials', to='endoreg_db.material')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_product_materials', to='endoreg_db.product')),
                ('unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='unit_product_materials', to='endoreg_db.unit')),
            ],
        ),
        migrations.CreateModel(
            name='PatientLabValue',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.FloatField(blank=True, null=True)),
                ('value_str', models.CharField(blank=True, max_length=255, null=True)),
                ('datetime', models.DateTimeField(auto_now_add=True)),
                ('normal_range', models.JSONField(default=dict)),
                ('lab_value', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.labvalue')),
                ('patient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='lab_values', to='endoreg_db.patient')),
                ('sample', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='values', to='endoreg_db.patientlabsample')),
                ('unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit')),
            ],
        ),
        migrations.AddField(
            model_name='medication',
            name='default_unit',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.unit'),
        ),
        migrations.AddField(
            model_name='emissionfactor',
            name='unit',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.unit'),
        ),
        migrations.CreateModel(
            name='CenterResource',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, null=True)),
                ('quantity', models.FloatField()),
                ('year', models.IntegerField()),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='center_resources', to='endoreg_db.center')),
                ('transport_emission_factor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='center_resource_transport_emission_factor', to='endoreg_db.emissionfactor')),
                ('use_emission_factor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='center_resource_use_emission_factor', to='endoreg_db.emissionfactor')),
                ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.resource')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.unit')),
            ],
        ),
        migrations.CreateModel(
            name='UploadJob',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, help_text='Unique identifier for the upload job', primary_key=True, serialize=False)),
                ('file', models.FileField(help_text='Uploaded file (PDF or video)', upload_to='uploads/%Y/%m/%d/')),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('anonymized', 'Anonymized'), ('error', 'Error')], default='pending', help_text='Current processing status of the upload', max_length=20)),
                ('content_type', models.CharField(blank=True, help_text='MIME type of the uploaded file', max_length=100)),
                ('error_detail', models.TextField(blank=True, help_text='Error message if processing failed')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='When the upload job was created')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='When the upload job was last updated')),
                ('sensitive_meta', models.ForeignKey(blank=True, help_text='Link to the created SensitiveMeta record after processing', null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.sensitivemeta')),
            ],
            options={
                'verbose_name': 'Upload Job',
                'verbose_name_plural': 'Upload Jobs',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='VideoFile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('raw_file', models.FileField(blank=True, null=True, upload_to='videos', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['mp4'])])),
                ('processed_file', models.FileField(blank=True, null=True, upload_to='videos', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['mp4'])])),
                ('video_hash', models.CharField(help_text='Hash of the raw video file.', max_length=255, unique=True)),
                ('processed_video_hash', models.CharField(blank=True, help_text='Hash of the processed video file, unique if not null.', max_length=255, null=True, unique=True)),
                ('original_file_name', models.CharField(blank=True, max_length=255, null=True)),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('frame_dir', models.CharField(blank=True, help_text='Path to frames extracted from the raw video.', max_length=512)),
                ('fps', models.FloatField(blank=True, null=True)),
                ('duration', models.FloatField(blank=True, null=True)),
                ('frame_count', models.IntegerField(blank=True, null=True)),
                ('width', models.IntegerField(blank=True, null=True)),
                ('height', models.IntegerField(blank=True, null=True)),
                ('suffix', models.CharField(blank=True, max_length=10, null=True)),
                ('sequences', models.JSONField(blank=True, default=dict, help_text='AI prediction sequences based on raw frames.')),
                ('date', models.DateField(blank=True, null=True)),
                ('meta', models.JSONField(blank=True, null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('ai_model_meta', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.modelmeta')),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='endoreg_db.center')),
                ('examination', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_files', to='endoreg_db.patientexamination')),
                ('patient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_files', to='endoreg_db.patient')),
                ('processor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='endoreg_db.endoscopyprocessor')),
                ('sensitive_meta', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_file', to='endoreg_db.sensitivemeta')),
                ('import_meta', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.videoimportmeta')),
            ],
        ),
        migrations.AddField(
            model_name='patientexamination',
            name='video',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='patient_examination', to='endoreg_db.videofile'),
        ),
        migrations.AddField(
            model_name='labelvideosegment',
            name='video_file',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='label_video_segments', to='endoreg_db.videofile'),
        ),
        migrations.CreateModel(
            name='Frame',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('frame_number', models.PositiveIntegerField()),
                ('relative_path', models.CharField(max_length=512)),
                ('timestamp', models.FloatField(blank=True, null=True)),
                ('is_extracted', models.BooleanField(default=False)),
                ('video', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='frames', to='endoreg_db.videofile')),
            ],
            options={
                'ordering': ['video', 'frame_number'],
            },
        ),
        migrations.CreateModel(
            name='VideoMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.center')),
                ('endoscope', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.endoscope')),
                ('ffmpeg_meta', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.ffmpegmeta')),
                ('import_meta', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.videoimportmeta')),
                ('processor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.endoscopyprocessor')),
            ],
        ),
        migrations.AddField(
            model_name='videofile',
            name='video_meta',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_file', to='endoreg_db.videometa'),
        ),
        migrations.CreateModel(
            name='VideoPredictionMeta',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('prediction_array', models.BinaryField(blank=True, null=True)),
                ('model_meta', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.modelmeta')),
                ('video_file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='video_prediction_meta', to='endoreg_db.videofile')),
            ],
        ),
        migrations.AddField(
            model_name='labelvideosegment',
            name='prediction_meta',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='label_video_segments', to='endoreg_db.videopredictionmeta'),
        ),
        migrations.CreateModel(
            name='VideoSegmentationAnnotation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_time', models.FloatField()),
                ('stop_time', models.FloatField()),
                ('is_true', models.BooleanField(default=True)),
                ('video_file', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='video_segmentation_annotations', to='endoreg_db.videofile')),
                ('label', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.videosegmentationlabel')),
            ],
        ),
        migrations.CreateModel(
            name='VideoSegmentationLabelSet',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('labels', models.ManyToManyField(related_name='labelsets', to='endoreg_db.videosegmentationlabel')),
            ],
        ),
        migrations.AddField(
            model_name='aimodel',
            name='video_segmentation_labelset',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ai_models', to='endoreg_db.videosegmentationlabelset'),
        ),
        migrations.AddField(
            model_name='videofile',
            name='state',
            field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_file', to='endoreg_db.videostate'),
        ),
        migrations.CreateModel(
            name='CenterWaste',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField()),
                ('quantity', models.FloatField()),
                ('center', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='center_wastes', to='endoreg_db.center')),
                ('emission_factor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.emissionfactor')),
                ('unit', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='endoreg_db.unit')),
                ('waste', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='endoreg_db.waste')),
            ],
        ),
        migrations.CreateModel(
            name='ImageClassificationAnnotation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.BooleanField()),
                ('float_value', models.FloatField(blank=True, null=True)),
                ('annotator', models.CharField(blank=True, max_length=255, null=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_modified', models.DateTimeField(auto_now=True)),
                ('frame', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='image_classification_annotations', to='endoreg_db.frame')),
                ('information_source', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_classification_annotations', to='endoreg_db.informationsource')),
                ('label', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='image_classification_annotations', to='endoreg_db.label')),
                ('model_meta', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_classification_annotations', to='endoreg_db.modelmeta')),
            ],
            options={
                'indexes': [models.Index(fields=['frame', 'label'], name='endoreg_db__frame_i_47f916_idx'), models.Index(fields=['frame'], name='endoreg_db__frame_i_92c75a_idx')],
            },
        ),
        migrations.AddIndex(
            model_name='patientfinding',
            index=models.Index(fields=['patient_examination', 'finding'], name='endoreg_db__patient_54869f_idx'),
        ),
        migrations.AddIndex(
            model_name='patientfinding',
            index=models.Index(fields=['patient_examination', 'is_active'], name='endoreg_db__patient_9359f8_idx'),
        ),
        migrations.AddIndex(
            model_name='patientfinding',
            index=models.Index(fields=['created_at'], name='endoreg_db__created_b44d86_idx'),
        ),
        migrations.AddIndex(
            model_name='patientfinding',
            index=models.Index(fields=['finding', 'is_active'], name='endoreg_db__finding_2f036b_idx'),
        ),
        migrations.AddConstraint(
            model_name='patientfinding',
            constraint=models.UniqueConstraint(condition=models.Q(('is_active', True)), fields=('patient_examination', 'finding'), name='unique_active_finding_per_examination'),
        ),
        migrations.AddConstraint(
            model_name='patientfinding',
            constraint=models.CheckConstraint(condition=models.Q(models.Q(('deactivated_at__isnull', True), ('deactivated_by__isnull', True)), models.Q(('deactivated_at__isnull', False), ('deactivated_by__isnull', False), ('is_active', False)), _connector='OR'), name='deactivation_fields_consistency'),
        ),
        migrations.AlterUniqueTogether(
            name='frame',
            unique_together={('video', 'frame_number')},
        ),
        migrations.AddIndex(
            model_name='videopredictionmeta',
            index=models.Index(fields=['model_meta', 'video_file'], name='endoreg_db__model_m_208dee_idx'),
        ),
        migrations.AddConstraint(
            model_name='videopredictionmeta',
            constraint=models.UniqueConstraint(fields=('model_meta', 'video_file'), name='unique_prediction_per_video_model'),
        ),
        migrations.AddIndex(
            model_name='labelvideosegment',
            index=models.Index(fields=['video_file', 'label', 'start_frame_number'], name='endoreg_db__video_f_fa9326_idx'),
        ),
        migrations.AddIndex(
            model_name='labelvideosegment',
            index=models.Index(fields=['prediction_meta', 'label'], name='endoreg_db__predict_2bfba4_idx'),
        ),
        migrations.AddConstraint(
            model_name='labelvideosegment',
            constraint=models.CheckConstraint(condition=models.Q(('start_frame_number__lt', models.F('end_frame_number'))), name='segment_start_lt_end'),
        ),
        migrations.AddConstraint(
            model_name='videosegmentationannotation',
            constraint=models.CheckConstraint(condition=models.Q(('start_time__lt', models.F('stop_time'))), name='start_time_less_than_stop_time'),
        ),
    ]
