Marwan Alwali 4d06ca4b5e update
2025-09-20 14:26:19 +03:00

469 lines
16 KiB
Python

# Generated by Django 5.2.6 on 2025-09-19 10:58
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("appointments", "0002_initial"),
("core", "0001_initial"),
("emr", "0001_initial"),
("inpatients", "0001_initial"),
("patients", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name="encounter",
name="admission",
field=models.ForeignKey(
blank=True,
help_text="Related admission",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="encounters",
to="inpatients.admission",
),
),
migrations.AddField(
model_name="encounter",
name="appointment",
field=models.ForeignKey(
blank=True,
help_text="Related appointment",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="encounters",
to="appointments.appointmentrequest",
),
),
migrations.AddField(
model_name="encounter",
name="created_by",
field=models.ForeignKey(
blank=True,
help_text="User who created the encounter",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_encounters",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="encounter",
name="patient",
field=models.ForeignKey(
help_text="Patient for this encounter",
on_delete=django.db.models.deletion.CASCADE,
related_name="encounters",
to="patients.patientprofile",
),
),
migrations.AddField(
model_name="encounter",
name="provider",
field=models.ForeignKey(
help_text="Primary provider for this encounter",
on_delete=django.db.models.deletion.CASCADE,
related_name="encounters",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="encounter",
name="signed_by",
field=models.ForeignKey(
blank=True,
help_text="Provider who signed off",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="signed_encounters",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="encounter",
name="tenant",
field=models.ForeignKey(
help_text="Organization tenant",
on_delete=django.db.models.deletion.CASCADE,
related_name="encounters",
to="core.tenant",
),
),
migrations.AddField(
model_name="clinicalnote",
name="encounter",
field=models.ForeignKey(
help_text="Associated encounter",
on_delete=django.db.models.deletion.CASCADE,
related_name="clinical_notes",
to="emr.encounter",
),
),
migrations.AddField(
model_name="icd10",
name="parent",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="children",
to="emr.icd10",
),
),
migrations.AddField(
model_name="notetemplate",
name="created_by",
field=models.ForeignKey(
blank=True,
help_text="User who created the template",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_note_templates",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="notetemplate",
name="previous_version",
field=models.ForeignKey(
blank=True,
help_text="Previous version of this template",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="newer_versions",
to="emr.notetemplate",
),
),
migrations.AddField(
model_name="notetemplate",
name="tenant",
field=models.ForeignKey(
help_text="Organization tenant",
on_delete=django.db.models.deletion.CASCADE,
related_name="note_templates",
to="core.tenant",
),
),
migrations.AddField(
model_name="clinicalnote",
name="template",
field=models.ForeignKey(
blank=True,
help_text="Template used for this note",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="notes",
to="emr.notetemplate",
),
),
migrations.AddField(
model_name="problemlist",
name="created_by",
field=models.ForeignKey(
blank=True,
help_text="User who created the problem",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_problems",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="problemlist",
name="diagnosing_provider",
field=models.ForeignKey(
help_text="Provider who diagnosed the problem",
on_delete=django.db.models.deletion.CASCADE,
related_name="diagnosed_problems",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="problemlist",
name="managing_provider",
field=models.ForeignKey(
blank=True,
help_text="Provider managing the problem",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="managed_problems",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="problemlist",
name="patient",
field=models.ForeignKey(
help_text="Patient",
on_delete=django.db.models.deletion.CASCADE,
related_name="problems",
to="patients.patientprofile",
),
),
migrations.AddField(
model_name="problemlist",
name="related_encounter",
field=models.ForeignKey(
blank=True,
help_text="Encounter where problem was identified",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="problems_identified",
to="emr.encounter",
),
),
migrations.AddField(
model_name="problemlist",
name="tenant",
field=models.ForeignKey(
help_text="Organization tenant",
on_delete=django.db.models.deletion.CASCADE,
related_name="problem_lists",
to="core.tenant",
),
),
migrations.AddField(
model_name="problemlist",
name="verified_by",
field=models.ForeignKey(
blank=True,
help_text="Provider who verified the problem",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="verified_problems",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="clinicalnote",
name="related_problems",
field=models.ManyToManyField(
blank=True,
help_text="Related problems",
related_name="related_clinical_notes",
to="emr.problemlist",
),
),
migrations.AddField(
model_name="careplan",
name="related_problems",
field=models.ManyToManyField(
blank=True,
help_text="Related problems addressed by this plan",
related_name="care_plans",
to="emr.problemlist",
),
),
migrations.AddField(
model_name="vitalsigns",
name="encounter",
field=models.ForeignKey(
help_text="Associated encounter",
on_delete=django.db.models.deletion.CASCADE,
related_name="vital_signs",
to="emr.encounter",
),
),
migrations.AddField(
model_name="vitalsigns",
name="measured_by",
field=models.ForeignKey(
help_text="Staff member who took measurements",
on_delete=django.db.models.deletion.CASCADE,
related_name="vital_signs_measurements",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddField(
model_name="vitalsigns",
name="patient",
field=models.ForeignKey(
help_text="Patient",
on_delete=django.db.models.deletion.CASCADE,
related_name="vital_signs",
to="patients.patientprofile",
),
),
migrations.AddField(
model_name="vitalsigns",
name="verified_by",
field=models.ForeignKey(
blank=True,
help_text="Staff member who verified measurements",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="verified_vital_signs",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AddIndex(
model_name="encounter",
index=models.Index(
fields=["tenant", "status"], name="emr_encount_tenant__6734f5_idx"
),
),
migrations.AddIndex(
model_name="encounter",
index=models.Index(
fields=["patient", "start_datetime"],
name="emr_encount_patient_c0f443_idx",
),
),
migrations.AddIndex(
model_name="encounter",
index=models.Index(
fields=["provider"], name="emr_encount_provide_5e06b3_idx"
),
),
migrations.AddIndex(
model_name="encounter",
index=models.Index(
fields=["encounter_type"], name="emr_encount_encount_019f80_idx"
),
),
migrations.AddIndex(
model_name="encounter",
index=models.Index(
fields=["start_datetime"], name="emr_encount_start_d_a01018_idx"
),
),
migrations.AddIndex(
model_name="notetemplate",
index=models.Index(
fields=["tenant", "is_active"], name="emr_note_te_tenant__caa5d3_idx"
),
),
migrations.AddIndex(
model_name="notetemplate",
index=models.Index(
fields=["note_type", "specialty"], name="emr_note_te_note_ty_d18594_idx"
),
),
migrations.AddIndex(
model_name="notetemplate",
index=models.Index(
fields=["is_default"], name="emr_note_te_is_defa_7b5223_idx"
),
),
migrations.AlterUniqueTogether(
name="notetemplate",
unique_together={("tenant", "note_type", "specialty", "is_default")},
),
migrations.AddIndex(
model_name="problemlist",
index=models.Index(
fields=["tenant", "status"], name="emr_problem_tenant__bb0abf_idx"
),
),
migrations.AddIndex(
model_name="problemlist",
index=models.Index(
fields=["patient", "status"], name="emr_problem_patient_d732d2_idx"
),
),
migrations.AddIndex(
model_name="problemlist",
index=models.Index(
fields=["problem_type"], name="emr_problem_problem_90c9f8_idx"
),
),
migrations.AddIndex(
model_name="problemlist",
index=models.Index(
fields=["priority"], name="emr_problem_priorit_327dd3_idx"
),
),
migrations.AddIndex(
model_name="problemlist",
index=models.Index(
fields=["onset_date"], name="emr_problem_onset_d_de94bd_idx"
),
),
migrations.AddIndex(
model_name="clinicalnote",
index=models.Index(
fields=["patient", "note_datetime"],
name="emr_clinica_patient_442718_idx",
),
),
migrations.AddIndex(
model_name="clinicalnote",
index=models.Index(
fields=["encounter"], name="emr_clinica_encount_751749_idx"
),
),
migrations.AddIndex(
model_name="clinicalnote",
index=models.Index(
fields=["author"], name="emr_clinica_author__85ec13_idx"
),
),
migrations.AddIndex(
model_name="clinicalnote",
index=models.Index(
fields=["note_type"], name="emr_clinica_note_ty_e6c13c_idx"
),
),
migrations.AddIndex(
model_name="clinicalnote",
index=models.Index(fields=["status"], name="emr_clinica_status_0ba513_idx"),
),
migrations.AddIndex(
model_name="careplan",
index=models.Index(
fields=["tenant", "status"], name="emr_care_pl_tenant__46659b_idx"
),
),
migrations.AddIndex(
model_name="careplan",
index=models.Index(
fields=["patient", "status"], name="emr_care_pl_patient_a85a8d_idx"
),
),
migrations.AddIndex(
model_name="careplan",
index=models.Index(
fields=["primary_provider"], name="emr_care_pl_primary_7b0b7d_idx"
),
),
migrations.AddIndex(
model_name="careplan",
index=models.Index(
fields=["start_date", "end_date"], name="emr_care_pl_start_d_1183e0_idx"
),
),
migrations.AddIndex(
model_name="careplan",
index=models.Index(
fields=["priority"], name="emr_care_pl_priorit_0a41d3_idx"
),
),
migrations.AddIndex(
model_name="vitalsigns",
index=models.Index(
fields=["patient", "measured_datetime"],
name="emr_vital_s_patient_0fc206_idx",
),
),
migrations.AddIndex(
model_name="vitalsigns",
index=models.Index(
fields=["encounter"], name="emr_vital_s_encount_6b9829_idx"
),
),
migrations.AddIndex(
model_name="vitalsigns",
index=models.Index(
fields=["measured_datetime"], name="emr_vital_s_measure_8badac_idx"
),
),
]