2715 lines
103 KiB
Python
2715 lines
103 KiB
Python
# Generated by Django 5.2.7 on 2025-10-06 21:15
|
|
|
|
import django.core.validators
|
|
import django.db.models.deletion
|
|
import django.utils.timezone
|
|
import uuid
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
("appointments", "0002_initial"),
|
|
("core", "0001_initial"),
|
|
("inpatients", "0001_initial"),
|
|
("patients", "0001_initial"),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="CarePlan",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"care_plan_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique care plan identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"title",
|
|
models.CharField(help_text="Care plan title", max_length=200),
|
|
),
|
|
("description", models.TextField(help_text="Care plan description")),
|
|
(
|
|
"plan_type",
|
|
models.CharField(
|
|
choices=[
|
|
("COMPREHENSIVE", "Comprehensive Care Plan"),
|
|
("DISEASE_SPECIFIC", "Disease-Specific Plan"),
|
|
("PREVENTIVE", "Preventive Care Plan"),
|
|
("CHRONIC_CARE", "Chronic Care Management"),
|
|
("ACUTE_CARE", "Acute Care Plan"),
|
|
("DISCHARGE", "Discharge Planning"),
|
|
("REHABILITATION", "Rehabilitation Plan"),
|
|
("PALLIATIVE", "Palliative Care Plan"),
|
|
("MENTAL_HEALTH", "Mental Health Plan"),
|
|
("MEDICATION", "Medication Management"),
|
|
("NUTRITION", "Nutrition Plan"),
|
|
("EXERCISE", "Exercise Plan"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Type of care plan",
|
|
max_length=30,
|
|
),
|
|
),
|
|
(
|
|
"category",
|
|
models.CharField(
|
|
choices=[
|
|
("ASSESSMENT", "Assessment and Monitoring"),
|
|
("TREATMENT", "Treatment"),
|
|
("EDUCATION", "Patient Education"),
|
|
("COORDINATION", "Care Coordination"),
|
|
("PREVENTION", "Prevention"),
|
|
("LIFESTYLE", "Lifestyle Modification"),
|
|
("MEDICATION", "Medication Management"),
|
|
("FOLLOW_UP", "Follow-up Care"),
|
|
("EMERGENCY", "Emergency Planning"),
|
|
("SUPPORT", "Support Services"),
|
|
],
|
|
help_text="Care plan category",
|
|
max_length=50,
|
|
),
|
|
),
|
|
("start_date", models.DateField(help_text="Care plan start date")),
|
|
(
|
|
"end_date",
|
|
models.DateField(
|
|
blank=True, help_text="Care plan end date", null=True
|
|
),
|
|
),
|
|
(
|
|
"target_completion_date",
|
|
models.DateField(
|
|
blank=True, help_text="Target completion date", null=True
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("DRAFT", "Draft"),
|
|
("ACTIVE", "Active"),
|
|
("ON_HOLD", "On Hold"),
|
|
("COMPLETED", "Completed"),
|
|
("CANCELLED", "Cancelled"),
|
|
("ERROR", "Entered in Error"),
|
|
("UNKNOWN", "Unknown"),
|
|
],
|
|
default="DRAFT",
|
|
help_text="Care plan status",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"priority",
|
|
models.CharField(
|
|
choices=[
|
|
("LOW", "Low"),
|
|
("ROUTINE", "Routine"),
|
|
("URGENT", "Urgent"),
|
|
("STAT", "STAT"),
|
|
],
|
|
default="ROUTINE",
|
|
help_text="Care plan priority",
|
|
max_length=20,
|
|
),
|
|
),
|
|
("goals", models.JSONField(default=list, help_text="Care plan goals")),
|
|
(
|
|
"objectives",
|
|
models.JSONField(
|
|
default=list, help_text="Specific objectives and targets"
|
|
),
|
|
),
|
|
(
|
|
"interventions",
|
|
models.JSONField(default=list, help_text="Planned interventions"),
|
|
),
|
|
(
|
|
"activities",
|
|
models.JSONField(
|
|
default=list, help_text="Specific activities and tasks"
|
|
),
|
|
),
|
|
(
|
|
"monitoring_parameters",
|
|
models.JSONField(default=list, help_text="Parameters to monitor"),
|
|
),
|
|
(
|
|
"evaluation_criteria",
|
|
models.JSONField(
|
|
default=list, help_text="Criteria for evaluating progress"
|
|
),
|
|
),
|
|
(
|
|
"patient_goals",
|
|
models.TextField(
|
|
blank=True, help_text="Patient-identified goals", null=True
|
|
),
|
|
),
|
|
(
|
|
"patient_preferences",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Patient preferences and concerns",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"patient_barriers",
|
|
models.TextField(
|
|
blank=True, help_text="Identified barriers to care", null=True
|
|
),
|
|
),
|
|
(
|
|
"resources_needed",
|
|
models.JSONField(
|
|
default=list,
|
|
help_text="Resources needed for plan implementation",
|
|
),
|
|
),
|
|
(
|
|
"support_systems",
|
|
models.JSONField(
|
|
default=list, help_text="Available support systems"
|
|
),
|
|
),
|
|
(
|
|
"progress_notes",
|
|
models.TextField(blank=True, help_text="Progress notes", null=True),
|
|
),
|
|
(
|
|
"last_reviewed",
|
|
models.DateField(
|
|
blank=True, help_text="Date of last review", null=True
|
|
),
|
|
),
|
|
(
|
|
"next_review_date",
|
|
models.DateField(
|
|
blank=True, help_text="Next scheduled review date", null=True
|
|
),
|
|
),
|
|
(
|
|
"outcomes_achieved",
|
|
models.JSONField(default=list, help_text="Outcomes achieved"),
|
|
),
|
|
(
|
|
"completion_percentage",
|
|
models.PositiveIntegerField(
|
|
default=0,
|
|
help_text="Completion percentage",
|
|
validators=[
|
|
django.core.validators.MinValueValidator(0),
|
|
django.core.validators.MaxValueValidator(100),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"approved",
|
|
models.BooleanField(
|
|
default=False, help_text="Care plan has been approved"
|
|
),
|
|
),
|
|
(
|
|
"approved_date",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Date of approval", null=True
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"approved_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who approved the plan",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="approved_care_plans",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"care_team",
|
|
models.ManyToManyField(
|
|
blank=True,
|
|
help_text="Care team members",
|
|
related_name="care_team_plans",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"created_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="User who created the care plan",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="created_care_plans",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="care_plans",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"primary_provider",
|
|
models.ForeignKey(
|
|
help_text="Primary provider responsible for care plan",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="primary_care_plans",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="care_plans",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Care Plan",
|
|
"verbose_name_plural": "Care Plans",
|
|
"db_table": "emr_care_plan",
|
|
"ordering": ["-created_at"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Encounter",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"encounter_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique encounter identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"encounter_type",
|
|
models.CharField(
|
|
choices=[
|
|
("INPATIENT", "Inpatient"),
|
|
("OUTPATIENT", "Outpatient"),
|
|
("EMERGENCY", "Emergency"),
|
|
("URGENT_CARE", "Urgent Care"),
|
|
("OBSERVATION", "Observation"),
|
|
("TELEMEDICINE", "Telemedicine"),
|
|
("HOME_VISIT", "Home Visit"),
|
|
("CONSULTATION", "Consultation"),
|
|
("FOLLOW_UP", "Follow-up"),
|
|
("PROCEDURE", "Procedure"),
|
|
("SURGERY", "Surgery"),
|
|
("DIAGNOSTIC", "Diagnostic"),
|
|
("PREVENTIVE", "Preventive Care"),
|
|
],
|
|
help_text="Type of encounter",
|
|
max_length=30,
|
|
),
|
|
),
|
|
(
|
|
"encounter_class",
|
|
models.CharField(
|
|
choices=[
|
|
("AMB", "Ambulatory"),
|
|
("EMER", "Emergency"),
|
|
("FLD", "Field"),
|
|
("HH", "Home Health"),
|
|
("IMP", "Inpatient"),
|
|
("ACUTE", "Inpatient Acute"),
|
|
("NONAC", "Inpatient Non-Acute"),
|
|
("OBSENC", "Observation Encounter"),
|
|
("PRENC", "Pre-Admission"),
|
|
("SS", "Short Stay"),
|
|
("VR", "Virtual"),
|
|
],
|
|
help_text="Encounter class (HL7 standard)",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"start_datetime",
|
|
models.DateTimeField(help_text="Encounter start date and time"),
|
|
),
|
|
(
|
|
"end_datetime",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Encounter end date and time", null=True
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("PLANNED", "Planned"),
|
|
("ARRIVED", "Arrived"),
|
|
("TRIAGED", "Triaged"),
|
|
("IN_PROGRESS", "In Progress"),
|
|
("ON_HOLD", "On Hold"),
|
|
("COMPLETED", "Completed"),
|
|
("CANCELLED", "Cancelled"),
|
|
("ENTERED_IN_ERROR", "Entered in Error"),
|
|
("UNKNOWN", "Unknown"),
|
|
],
|
|
default="PLANNED",
|
|
help_text="Current encounter status",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"location",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Encounter location",
|
|
max_length=100,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"room_number",
|
|
models.CharField(
|
|
blank=True, help_text="Room number", max_length=20, null=True
|
|
),
|
|
),
|
|
(
|
|
"chief_complaint",
|
|
models.TextField(
|
|
blank=True, help_text="Chief complaint", null=True
|
|
),
|
|
),
|
|
(
|
|
"reason_for_visit",
|
|
models.TextField(
|
|
blank=True, help_text="Reason for visit", null=True
|
|
),
|
|
),
|
|
(
|
|
"priority",
|
|
models.CharField(
|
|
choices=[
|
|
("ROUTINE", "Routine"),
|
|
("URGENT", "Urgent"),
|
|
("STAT", "STAT"),
|
|
("EMERGENCY", "Emergency"),
|
|
],
|
|
default="ROUTINE",
|
|
help_text="Encounter priority",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"acuity_level",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Patient acuity level (1-5, 5 being highest)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(1),
|
|
django.core.validators.MaxValueValidator(5),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"documentation_complete",
|
|
models.BooleanField(
|
|
default=False, help_text="Documentation is complete"
|
|
),
|
|
),
|
|
(
|
|
"signed_off",
|
|
models.BooleanField(
|
|
default=False, help_text="Encounter has been signed off"
|
|
),
|
|
),
|
|
(
|
|
"signed_datetime",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Date and time of sign-off", null=True
|
|
),
|
|
),
|
|
(
|
|
"billable",
|
|
models.BooleanField(
|
|
default=True, help_text="Encounter is billable"
|
|
),
|
|
),
|
|
(
|
|
"billing_codes",
|
|
models.JSONField(
|
|
blank=True, default=list, help_text="Associated billing codes"
|
|
),
|
|
),
|
|
(
|
|
"quality_measures",
|
|
models.JSONField(
|
|
blank=True, default=dict, help_text="Quality measure data"
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"admission",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Related admission",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="encounters",
|
|
to="inpatients.admission",
|
|
),
|
|
),
|
|
(
|
|
"appointment",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Related appointment",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="encounters",
|
|
to="appointments.appointmentrequest",
|
|
),
|
|
),
|
|
(
|
|
"created_by",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient for this encounter",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="encounters",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"provider",
|
|
models.ForeignKey(
|
|
help_text="Primary provider for this encounter",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="encounters",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"signed_by",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="encounters",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Encounter",
|
|
"verbose_name_plural": "Encounters",
|
|
"db_table": "emr_encounter",
|
|
"ordering": ["-start_datetime"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="CriticalAlert",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"alert_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique alert identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
("title", models.CharField(help_text="Alert title", max_length=200)),
|
|
("description", models.TextField(help_text="Alert description")),
|
|
(
|
|
"priority",
|
|
models.CharField(
|
|
choices=[
|
|
("HIGH", "High"),
|
|
("URGENT", "Urgent"),
|
|
("CRITICAL", "Critical"),
|
|
],
|
|
default="HIGH",
|
|
help_text="Alert priority level",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"recommendation",
|
|
models.TextField(
|
|
blank=True, help_text="Recommended actions", null=True
|
|
),
|
|
),
|
|
(
|
|
"acknowledged",
|
|
models.BooleanField(
|
|
default=False, help_text="Alert has been acknowledged"
|
|
),
|
|
),
|
|
(
|
|
"acknowledged_at",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Date and time alert was acknowledged",
|
|
null=True,
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"expires_at",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Alert expiration date", null=True
|
|
),
|
|
),
|
|
(
|
|
"acknowledged_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who acknowledged the alert",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="emr_acknowledged_alerts",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"created_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="User who created the alert",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="created_alerts",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="critical_alerts",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="critical_alerts",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
(
|
|
"related_encounter",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Related encounter",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="critical_alerts",
|
|
to="emr.encounter",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Critical Alert",
|
|
"verbose_name_plural": "Critical Alerts",
|
|
"db_table": "emr_critical_alert",
|
|
"ordering": ["-created_at"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Icd10",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
("code", models.CharField(db_index=True, max_length=10, unique=True)),
|
|
("description", models.TextField(blank=True, null=True)),
|
|
(
|
|
"chapter_name",
|
|
models.CharField(blank=True, max_length=255, null=True),
|
|
),
|
|
(
|
|
"section_name",
|
|
models.CharField(blank=True, max_length=255, null=True),
|
|
),
|
|
("is_header", models.BooleanField(default=False)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"parent",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="children",
|
|
to="emr.icd10",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "ICD-10 Code",
|
|
"verbose_name_plural": "ICD-10 Codes",
|
|
"db_table": "emr_icd10",
|
|
"ordering": ["code"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="NoteTemplate",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"template_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique template identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
("name", models.CharField(help_text="Template name", max_length=200)),
|
|
(
|
|
"description",
|
|
models.TextField(
|
|
blank=True, help_text="Template description", null=True
|
|
),
|
|
),
|
|
(
|
|
"note_type",
|
|
models.CharField(
|
|
choices=[
|
|
("PROGRESS", "Progress Note"),
|
|
("ADMISSION", "Admission Note"),
|
|
("DISCHARGE", "Discharge Note"),
|
|
("CONSULTATION", "Consultation Note"),
|
|
("PROCEDURE", "Procedure Note"),
|
|
("OPERATIVE", "Operative Note"),
|
|
("NURSING", "Nursing Note"),
|
|
("THERAPY", "Therapy Note"),
|
|
("SOCIAL_WORK", "Social Work Note"),
|
|
("PSYCHOLOGY", "Psychology Note"),
|
|
("NUTRITION", "Nutrition Note"),
|
|
("PHARMACY", "Pharmacy Note"),
|
|
("CASE_MANAGEMENT", "Case Management Note"),
|
|
("EDUCATION", "Patient Education Note"),
|
|
("TELEPHONE", "Telephone Note"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Type of note this template is for",
|
|
max_length=30,
|
|
),
|
|
),
|
|
(
|
|
"specialty",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("GENERAL_MEDICINE", "General Medicine"),
|
|
("SURGERY", "Surgery"),
|
|
("CARDIOLOGY", "Cardiology"),
|
|
("NEUROLOGY", "Neurology"),
|
|
("ONCOLOGY", "Oncology"),
|
|
("PEDIATRICS", "Pediatrics"),
|
|
("OBSTETRICS", "Obstetrics"),
|
|
("GYNECOLOGY", "Gynecology"),
|
|
("ORTHOPEDICS", "Orthopedics"),
|
|
("PSYCHIATRY", "Psychiatry"),
|
|
("EMERGENCY", "Emergency Medicine"),
|
|
("CRITICAL_CARE", "Critical Care"),
|
|
("REHABILITATION", "Rehabilitation"),
|
|
("NURSING", "Nursing"),
|
|
("THERAPY", "Therapy"),
|
|
("SOCIAL_WORK", "Social Work"),
|
|
("NUTRITION", "Nutrition"),
|
|
("PHARMACY", "Pharmacy"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Medical specialty",
|
|
max_length=100,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"template_content",
|
|
models.TextField(help_text="Template content with placeholders"),
|
|
),
|
|
(
|
|
"structured_fields",
|
|
models.JSONField(
|
|
default=list, help_text="Structured fields definition"
|
|
),
|
|
),
|
|
(
|
|
"is_active",
|
|
models.BooleanField(
|
|
default=True,
|
|
help_text="Template is active and available for use",
|
|
),
|
|
),
|
|
(
|
|
"is_default",
|
|
models.BooleanField(
|
|
default=False, help_text="Default template for this note type"
|
|
),
|
|
),
|
|
(
|
|
"usage_count",
|
|
models.PositiveIntegerField(
|
|
default=0, help_text="Number of times template has been used"
|
|
),
|
|
),
|
|
(
|
|
"version",
|
|
models.CharField(
|
|
default="1.0", help_text="Template version", max_length=20
|
|
),
|
|
),
|
|
(
|
|
"quality_indicators",
|
|
models.JSONField(
|
|
default=list, help_text="Quality indicators to track"
|
|
),
|
|
),
|
|
(
|
|
"compliance_requirements",
|
|
models.JSONField(default=list, help_text="Compliance requirements"),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"created_by",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"previous_version",
|
|
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",
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="note_templates",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Note Template",
|
|
"verbose_name_plural": "Note Templates",
|
|
"db_table": "emr_note_template",
|
|
"ordering": ["note_type", "name"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="ProblemList",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"problem_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique problem identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"problem_name",
|
|
models.CharField(
|
|
help_text="Problem name or description", max_length=200
|
|
),
|
|
),
|
|
(
|
|
"problem_code",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="ICD-10 or SNOMED code",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"coding_system",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("ICD10", "ICD-10"),
|
|
("ICD9", "ICD-9"),
|
|
("SNOMED", "SNOMED CT"),
|
|
("CPT", "CPT"),
|
|
("LOINC", "LOINC"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Coding system used",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"problem_type",
|
|
models.CharField(
|
|
choices=[
|
|
("DIAGNOSIS", "Diagnosis"),
|
|
("SYMPTOM", "Symptom"),
|
|
("FINDING", "Finding"),
|
|
("COMPLAINT", "Complaint"),
|
|
("CONDITION", "Condition"),
|
|
("DISORDER", "Disorder"),
|
|
("SYNDROME", "Syndrome"),
|
|
("INJURY", "Injury"),
|
|
("ALLERGY", "Allergy"),
|
|
("INTOLERANCE", "Intolerance"),
|
|
("RISK_FACTOR", "Risk Factor"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Type of problem",
|
|
max_length=30,
|
|
),
|
|
),
|
|
(
|
|
"onset_date",
|
|
models.DateField(blank=True, help_text="Date of onset", null=True),
|
|
),
|
|
(
|
|
"onset_description",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Description of onset",
|
|
max_length=100,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"severity",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("MILD", "Mild"),
|
|
("MODERATE", "Moderate"),
|
|
("SEVERE", "Severe"),
|
|
("CRITICAL", "Critical"),
|
|
("UNKNOWN", "Unknown"),
|
|
],
|
|
help_text="Problem severity",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"priority",
|
|
models.CharField(
|
|
choices=[
|
|
("LOW", "Low"),
|
|
("MEDIUM", "Medium"),
|
|
("HIGH", "High"),
|
|
("URGENT", "Urgent"),
|
|
],
|
|
default="MEDIUM",
|
|
help_text="Problem priority",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("ACTIVE", "Active"),
|
|
("INACTIVE", "Inactive"),
|
|
("RESOLVED", "Resolved"),
|
|
("REMISSION", "In Remission"),
|
|
("RECURRENCE", "Recurrence"),
|
|
("RELAPSE", "Relapse"),
|
|
("UNKNOWN", "Unknown"),
|
|
("OTHER", "Other"),
|
|
],
|
|
default="ACTIVE",
|
|
help_text="Current problem status",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"resolution_date",
|
|
models.DateField(
|
|
blank=True, help_text="Date problem was resolved", null=True
|
|
),
|
|
),
|
|
(
|
|
"resolution_notes",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Notes about problem resolution",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"body_site",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Body site affected",
|
|
max_length=100,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"laterality",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("LEFT", "Left"),
|
|
("RIGHT", "Right"),
|
|
("BILATERAL", "Bilateral"),
|
|
("UNILATERAL", "Unilateral"),
|
|
("NOT_APPLICABLE", "Not Applicable"),
|
|
],
|
|
help_text="Laterality",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"clinical_notes",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Clinical notes about the problem",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"patient_concerns",
|
|
models.TextField(
|
|
blank=True, help_text="Patient concerns and comments", null=True
|
|
),
|
|
),
|
|
(
|
|
"treatment_goals",
|
|
models.JSONField(
|
|
blank=True,
|
|
default=list,
|
|
help_text="Treatment goals for this problem",
|
|
),
|
|
),
|
|
(
|
|
"outcome_measures",
|
|
models.JSONField(
|
|
blank=True,
|
|
default=list,
|
|
help_text="Outcome measures being tracked",
|
|
),
|
|
),
|
|
(
|
|
"verified",
|
|
models.BooleanField(
|
|
default=False, help_text="Problem has been verified"
|
|
),
|
|
),
|
|
(
|
|
"verified_date",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Date problem was verified", null=True
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"created_by",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"diagnosing_provider",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"managing_provider",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="problems",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"related_encounter",
|
|
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",
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="problem_lists",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
(
|
|
"verified_by",
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Problem",
|
|
"verbose_name_plural": "Problem List",
|
|
"db_table": "emr_problem_list",
|
|
"ordering": ["-created_at"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="ClinicalRecommendation",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"recommendation_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique recommendation identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"title",
|
|
models.CharField(help_text="Recommendation title", max_length=200),
|
|
),
|
|
(
|
|
"description",
|
|
models.TextField(help_text="Detailed recommendation description"),
|
|
),
|
|
(
|
|
"category",
|
|
models.CharField(
|
|
choices=[
|
|
("PREVENTIVE", "Preventive Care"),
|
|
("DIAGNOSTIC", "Diagnostic"),
|
|
("TREATMENT", "Treatment"),
|
|
("MONITORING", "Monitoring"),
|
|
("LIFESTYLE", "Lifestyle"),
|
|
("MEDICATION", "Medication"),
|
|
("FOLLOW_UP", "Follow-up"),
|
|
("REFERRAL", "Referral"),
|
|
("EDUCATION", "Patient Education"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Recommendation category",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"priority",
|
|
models.CharField(
|
|
choices=[
|
|
("LOW", "Low"),
|
|
("MEDIUM", "Medium"),
|
|
("HIGH", "High"),
|
|
("URGENT", "Urgent"),
|
|
("CRITICAL", "Critical"),
|
|
],
|
|
default="MEDIUM",
|
|
help_text="Recommendation priority",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"evidence_level",
|
|
models.CharField(
|
|
help_text="Level of evidence (1A, 1B, 2A, etc.)", max_length=10
|
|
),
|
|
),
|
|
(
|
|
"source",
|
|
models.CharField(
|
|
help_text="Source of recommendation (guideline, study, etc.)",
|
|
max_length=100,
|
|
),
|
|
),
|
|
(
|
|
"rationale",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Clinical rationale for recommendation",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("PENDING", "Pending"),
|
|
("ACTIVE", "Active"),
|
|
("ACCEPTED", "Accepted"),
|
|
("DEFERRED", "Deferred"),
|
|
("DISMISSED", "Dismissed"),
|
|
("COMPLETED", "Completed"),
|
|
("EXPIRED", "Expired"),
|
|
],
|
|
default="PENDING",
|
|
help_text="Current recommendation status",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"accepted_at",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Date and time recommendation was accepted",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"deferred_at",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Date and time recommendation was deferred",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"dismissed_at",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Date and time recommendation was dismissed",
|
|
null=True,
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"expires_at",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Recommendation expiration date",
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"accepted_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who accepted the recommendation",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="accepted_recommendations",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"created_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="User who created the recommendation",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="created_recommendations",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"deferred_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who deferred the recommendation",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="deferred_recommendations",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"dismissed_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who dismissed the recommendation",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="dismissed_recommendations",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="clinical_recommendations",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="clinical_recommendations",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
(
|
|
"related_encounter",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Related encounter",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="recommendations",
|
|
to="emr.encounter",
|
|
),
|
|
),
|
|
(
|
|
"related_problems",
|
|
models.ManyToManyField(
|
|
blank=True,
|
|
help_text="Related problems",
|
|
related_name="recommendations",
|
|
to="emr.problemlist",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Clinical Recommendation",
|
|
"verbose_name_plural": "Clinical Recommendations",
|
|
"db_table": "emr_clinical_recommendation",
|
|
"ordering": ["-created_at"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="ClinicalNote",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"note_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique note identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"note_type",
|
|
models.CharField(
|
|
choices=[
|
|
("PROGRESS", "Progress"),
|
|
("ADMISSION", "Admission Note"),
|
|
("DISCHARGE", "Discharge Note"),
|
|
("CONSULTATION", "Consultation Note"),
|
|
("PROCEDURE", "Procedure Note"),
|
|
("OPERATIVE", "Operative Note"),
|
|
("NURSING", "Nursing Note"),
|
|
("THERAPY", "Therapy Note"),
|
|
("SOCIAL_WORK", "Social Work Note"),
|
|
("PSYCHOLOGY", "Psychology Note"),
|
|
("NUTRITION", "Nutrition Note"),
|
|
("PHARMACY", "Pharmacy Note"),
|
|
("CASE_MANAGEMENT", "Case Management Note"),
|
|
("EDUCATION", "Patient Education Note"),
|
|
("TELEPHONE", "Telephone Note"),
|
|
("ADDENDUM", "Addendum"),
|
|
("CORRECTION", "Correction"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Type of clinical note",
|
|
max_length=30,
|
|
),
|
|
),
|
|
("title", models.CharField(help_text="Note title", max_length=200)),
|
|
("content", models.TextField(help_text="Note content")),
|
|
(
|
|
"structured_data",
|
|
models.JSONField(
|
|
blank=True,
|
|
default=dict,
|
|
help_text="Structured data from template",
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("DRAFT", "Draft"),
|
|
("IN_PROGRESS", "In Progress"),
|
|
("COMPLETED", "Completed"),
|
|
("SIGNED", "Signed"),
|
|
("AMENDED", "Amended"),
|
|
("CORRECTED", "Corrected"),
|
|
("CANCELLED", "Cancelled"),
|
|
("ERROR", "Entered in Error"),
|
|
("UNKNOWN", "Unknown"),
|
|
],
|
|
default="DRAFT",
|
|
help_text="Note status",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"electronically_signed",
|
|
models.BooleanField(
|
|
default=False, help_text="Note has been electronically signed"
|
|
),
|
|
),
|
|
(
|
|
"signed_datetime",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Date and time of signature", null=True
|
|
),
|
|
),
|
|
(
|
|
"signature_method",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("ELECTRONIC", "Electronic"),
|
|
("DIGITAL", "Digital Signature"),
|
|
("BIOMETRIC", "Biometric Signature"),
|
|
("PASSWORD", "Password"),
|
|
("TOKEN", "Token Authentication"),
|
|
("OTHER", "Other"),
|
|
],
|
|
help_text="Method of signature",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"amendment_reason",
|
|
models.TextField(
|
|
blank=True, help_text="Reason for amendment", null=True
|
|
),
|
|
),
|
|
(
|
|
"quality_score",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Documentation quality score",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(0),
|
|
django.core.validators.MaxValueValidator(100),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"compliance_flags",
|
|
models.JSONField(
|
|
blank=True,
|
|
default=list,
|
|
help_text="Compliance flags and issues",
|
|
),
|
|
),
|
|
(
|
|
"note_datetime",
|
|
models.DateTimeField(
|
|
default=django.utils.timezone.now,
|
|
help_text="Date and time note was written",
|
|
),
|
|
),
|
|
(
|
|
"confidential",
|
|
models.BooleanField(
|
|
default=False,
|
|
help_text="Note contains confidential information",
|
|
),
|
|
),
|
|
(
|
|
"restricted_access",
|
|
models.BooleanField(
|
|
default=False, help_text="Access to note is restricted"
|
|
),
|
|
),
|
|
(
|
|
"access_restrictions",
|
|
models.JSONField(
|
|
blank=True,
|
|
default=list,
|
|
help_text="Specific access restrictions",
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"amended_note",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Original note if this is an amendment",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="amendments",
|
|
to="emr.clinicalnote",
|
|
),
|
|
),
|
|
(
|
|
"author",
|
|
models.ForeignKey(
|
|
help_text="Note author",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="authored_notes",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"co_signers",
|
|
models.ManyToManyField(
|
|
blank=True,
|
|
help_text="Co-signers for this note",
|
|
related_name="co_signed_notes",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="clinical_notes",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"related_care_plans",
|
|
models.ManyToManyField(
|
|
blank=True,
|
|
help_text="Related care plans",
|
|
related_name="clinical_notes",
|
|
to="emr.careplan",
|
|
),
|
|
),
|
|
(
|
|
"encounter",
|
|
models.ForeignKey(
|
|
help_text="Associated encounter",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="clinical_notes",
|
|
to="emr.encounter",
|
|
),
|
|
),
|
|
(
|
|
"template",
|
|
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",
|
|
),
|
|
),
|
|
(
|
|
"related_problems",
|
|
models.ManyToManyField(
|
|
blank=True,
|
|
help_text="Related problems",
|
|
related_name="related_clinical_notes",
|
|
to="emr.problemlist",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Clinical Note",
|
|
"verbose_name_plural": "Clinical Notes",
|
|
"db_table": "emr_clinical_note",
|
|
"ordering": ["-note_datetime"],
|
|
},
|
|
),
|
|
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.CreateModel(
|
|
name="TreatmentProtocol",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"protocol_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique protocol identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
("name", models.CharField(help_text="Protocol name", max_length=200)),
|
|
("description", models.TextField(help_text="Protocol description")),
|
|
(
|
|
"indication",
|
|
models.TextField(help_text="Clinical indications for use"),
|
|
),
|
|
("goals", models.JSONField(default=list, help_text="Treatment goals")),
|
|
(
|
|
"interventions",
|
|
models.JSONField(default=list, help_text="Required interventions"),
|
|
),
|
|
(
|
|
"monitoring_parameters",
|
|
models.JSONField(default=list, help_text="Parameters to monitor"),
|
|
),
|
|
(
|
|
"success_rate",
|
|
models.DecimalField(
|
|
decimal_places=2,
|
|
help_text="Protocol success rate (%)",
|
|
max_digits=5,
|
|
),
|
|
),
|
|
(
|
|
"average_duration",
|
|
models.PositiveIntegerField(
|
|
help_text="Average treatment duration in days"
|
|
),
|
|
),
|
|
(
|
|
"is_active",
|
|
models.BooleanField(
|
|
default=True, help_text="Protocol is active and available"
|
|
),
|
|
),
|
|
(
|
|
"usage_count",
|
|
models.PositiveIntegerField(
|
|
default=0, help_text="Number of times protocol has been used"
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"created_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="User who created the protocol",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="created_protocols",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="treatment_protocols",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Treatment Protocol",
|
|
"verbose_name_plural": "Treatment Protocols",
|
|
"db_table": "emr_treatment_protocol",
|
|
"ordering": ["-success_rate", "name"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="VitalSigns",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"measurement_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique measurement identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"measured_datetime",
|
|
models.DateTimeField(
|
|
default=django.utils.timezone.now,
|
|
help_text="Date and time of measurement",
|
|
),
|
|
),
|
|
(
|
|
"temperature",
|
|
models.DecimalField(
|
|
blank=True,
|
|
decimal_places=1,
|
|
help_text="Temperature in Celsius",
|
|
max_digits=4,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"temperature_method",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("ORAL", "Oral"),
|
|
("RECTAL", "Rectal"),
|
|
("AXILLARY", "Axillary"),
|
|
("TYMPANIC", "Tympanic"),
|
|
("TEMPORAL", "Temporal"),
|
|
("CORE", "Core"),
|
|
],
|
|
help_text="Temperature measurement method",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"systolic_bp",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Systolic blood pressure (mmHg)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(50),
|
|
django.core.validators.MaxValueValidator(300),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"diastolic_bp",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Diastolic blood pressure (mmHg)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(30),
|
|
django.core.validators.MaxValueValidator(200),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"bp_position",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("SITTING", "Sitting"),
|
|
("STANDING", "Standing"),
|
|
("LYING", "Lying"),
|
|
("SUPINE", "Supine"),
|
|
],
|
|
help_text="Patient position during BP measurement",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"bp_cuff_size",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("SMALL", "Small"),
|
|
("REGULAR", "Regular"),
|
|
("LARGE", "Large"),
|
|
("EXTRA_LARGE", "Extra Large"),
|
|
("PEDIATRIC", "Pediatric"),
|
|
],
|
|
help_text="Blood pressure cuff size",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"heart_rate",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Heart rate (beats per minute)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(20),
|
|
django.core.validators.MaxValueValidator(300),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"heart_rhythm",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("REGULAR", "Regular"),
|
|
("REGULARLY_IRREGULAR", "Regularly irregular"),
|
|
("IRREGULARLY_IRREGULAR", "Irregularly irregular"),
|
|
("IRREGULAR_UNSPECIFIED", "Irregular (unspecified)"),
|
|
],
|
|
help_text="Heart rhythm",
|
|
max_length=25,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"respiratory_rate",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Respiratory rate (breaths per minute)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(5),
|
|
django.core.validators.MaxValueValidator(60),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"oxygen_saturation",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Oxygen saturation (%)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(50),
|
|
django.core.validators.MaxValueValidator(100),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"oxygen_delivery",
|
|
models.CharField(
|
|
choices=[
|
|
("ROOM_AIR", "Room Air"),
|
|
("NASAL_CANNULA", "Nasal Cannula"),
|
|
("SIMPLE_MASK", "Simple Mask"),
|
|
("NON_REBREATHER", "Non-Rebreather Mask"),
|
|
("VENTURI_MASK", "Venturi Mask"),
|
|
("CPAP", "CPAP"),
|
|
("BIPAP", "BiPAP"),
|
|
("MECHANICAL_VENTILATION", "Mechanical Ventilation"),
|
|
("OTHER", "Other"),
|
|
],
|
|
default="ROOM_AIR",
|
|
help_text="Oxygen delivery method",
|
|
max_length=30,
|
|
),
|
|
),
|
|
(
|
|
"oxygen_flow_rate",
|
|
models.DecimalField(
|
|
blank=True,
|
|
decimal_places=1,
|
|
help_text="Oxygen flow rate (L/min)",
|
|
max_digits=4,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"pain_scale",
|
|
models.PositiveIntegerField(
|
|
blank=True,
|
|
help_text="Pain scale (0-10)",
|
|
null=True,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(0),
|
|
django.core.validators.MaxValueValidator(10),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"pain_location",
|
|
models.CharField(
|
|
blank=True, help_text="Pain location", max_length=100, null=True
|
|
),
|
|
),
|
|
(
|
|
"pain_quality",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Pain quality description",
|
|
max_length=50,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"weight",
|
|
models.DecimalField(
|
|
blank=True,
|
|
decimal_places=1,
|
|
help_text="Weight in pounds",
|
|
max_digits=5,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"height",
|
|
models.DecimalField(
|
|
blank=True,
|
|
decimal_places=1,
|
|
help_text="Height in inches",
|
|
max_digits=5,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"bmi",
|
|
models.DecimalField(
|
|
blank=True,
|
|
decimal_places=1,
|
|
help_text="Body Mass Index",
|
|
max_digits=4,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"head_circumference",
|
|
models.DecimalField(
|
|
blank=True,
|
|
decimal_places=1,
|
|
help_text="Head circumference in cm (pediatric)",
|
|
max_digits=4,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"device_used",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Device used for measurements",
|
|
max_length=100,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"device_calibrated",
|
|
models.BooleanField(
|
|
default=True, help_text="Device was calibrated"
|
|
),
|
|
),
|
|
(
|
|
"critical_values",
|
|
models.JSONField(
|
|
blank=True, default=list, help_text="Critical values identified"
|
|
),
|
|
),
|
|
(
|
|
"alerts_generated",
|
|
models.JSONField(
|
|
blank=True,
|
|
default=list,
|
|
help_text="Alerts generated from measurements",
|
|
),
|
|
),
|
|
(
|
|
"notes",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Additional notes about measurements",
|
|
null=True,
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"encounter",
|
|
models.ForeignKey(
|
|
help_text="Associated encounter",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="vital_signs",
|
|
to="emr.encounter",
|
|
),
|
|
),
|
|
(
|
|
"measured_by",
|
|
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,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="vital_signs",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"verified_by",
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Vital Signs",
|
|
"verbose_name_plural": "Vital Signs",
|
|
"db_table": "emr_vital_signs",
|
|
"ordering": ["-measured_datetime"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="AllergyAlert",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"alert_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique alert identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"allergen",
|
|
models.CharField(help_text="Allergen name", max_length=100),
|
|
),
|
|
(
|
|
"reaction_type",
|
|
models.CharField(
|
|
help_text="Type of allergic reaction", max_length=100
|
|
),
|
|
),
|
|
(
|
|
"severity",
|
|
models.CharField(
|
|
choices=[
|
|
("MILD", "Mild"),
|
|
("MODERATE", "Moderate"),
|
|
("SEVERE", "Severe"),
|
|
("LIFE_THREATENING", "Life-threatening"),
|
|
],
|
|
help_text="Alert severity",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"symptoms",
|
|
models.TextField(
|
|
blank=True, help_text="Allergic reaction symptoms", null=True
|
|
),
|
|
),
|
|
(
|
|
"onset",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Reaction onset timing",
|
|
max_length=50,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"resolved",
|
|
models.BooleanField(
|
|
default=False, help_text="Alert has been resolved"
|
|
),
|
|
),
|
|
(
|
|
"resolved_at",
|
|
models.DateTimeField(
|
|
blank=True, help_text="Date alert was resolved", null=True
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"detected_at",
|
|
models.DateTimeField(
|
|
default=django.utils.timezone.now,
|
|
help_text="When alert was detected",
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="allergy_alerts",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"resolved_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who resolved the alert",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="resolved_allergy_alerts",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="allergy_alerts",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Allergy Alert",
|
|
"verbose_name_plural": "Allergy Alerts",
|
|
"db_table": "emr_allergy_alert",
|
|
"ordering": ["-detected_at"],
|
|
"indexes": [
|
|
models.Index(
|
|
fields=["tenant", "resolved"],
|
|
name="emr_allergy_tenant__da9219_idx",
|
|
),
|
|
models.Index(
|
|
fields=["patient", "resolved"],
|
|
name="emr_allergy_patient_674c53_idx",
|
|
),
|
|
models.Index(
|
|
fields=["severity"], name="emr_allergy_severit_38d8dd_idx"
|
|
),
|
|
models.Index(
|
|
fields=["detected_at"], name="emr_allergy_detecte_97c184_idx"
|
|
),
|
|
],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="ClinicalGuideline",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"guideline_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique guideline identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"title",
|
|
models.CharField(help_text="Guideline title", max_length=300),
|
|
),
|
|
(
|
|
"organization",
|
|
models.CharField(
|
|
help_text="Publishing organization", max_length=100
|
|
),
|
|
),
|
|
("summary", models.TextField(help_text="Guideline summary")),
|
|
(
|
|
"url",
|
|
models.URLField(
|
|
blank=True, help_text="Link to full guideline", null=True
|
|
),
|
|
),
|
|
(
|
|
"publication_date",
|
|
models.DateField(help_text="Guideline publication date"),
|
|
),
|
|
(
|
|
"last_updated",
|
|
models.DateField(auto_now=True, help_text="Last updated date"),
|
|
),
|
|
(
|
|
"version",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Guideline version",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
(
|
|
"is_active",
|
|
models.BooleanField(
|
|
default=True, help_text="Guideline is current and active"
|
|
),
|
|
),
|
|
(
|
|
"keywords",
|
|
models.JSONField(default=list, help_text="Keywords for searching"),
|
|
),
|
|
(
|
|
"specialties",
|
|
models.JSONField(
|
|
default=list, help_text="Relevant medical specialties"
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="clinical_guidelines",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Clinical Guideline",
|
|
"verbose_name_plural": "Clinical Guidelines",
|
|
"db_table": "emr_clinical_guideline",
|
|
"ordering": ["-last_updated", "title"],
|
|
"indexes": [
|
|
models.Index(
|
|
fields=["tenant", "is_active"],
|
|
name="emr_clinica_tenant__08a1f7_idx",
|
|
),
|
|
models.Index(
|
|
fields=["organization"], name="emr_clinica_organiz_107f8d_idx"
|
|
),
|
|
models.Index(
|
|
fields=["publication_date"],
|
|
name="emr_clinica_publica_4e35d0_idx",
|
|
),
|
|
],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="DiagnosticSuggestion",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"suggestion_id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
help_text="Unique suggestion identifier",
|
|
unique=True,
|
|
),
|
|
),
|
|
(
|
|
"test_name",
|
|
models.CharField(help_text="Suggested test name", max_length=200),
|
|
),
|
|
(
|
|
"test_code",
|
|
models.CharField(
|
|
help_text="Test code or identifier", max_length=20
|
|
),
|
|
),
|
|
(
|
|
"indication",
|
|
models.TextField(help_text="Clinical indication for the test"),
|
|
),
|
|
(
|
|
"confidence",
|
|
models.DecimalField(
|
|
decimal_places=2,
|
|
help_text="AI confidence score (%)",
|
|
max_digits=5,
|
|
validators=[
|
|
django.core.validators.MinValueValidator(0),
|
|
django.core.validators.MaxValueValidator(100),
|
|
],
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("PENDING", "Pending"),
|
|
("ORDERED", "Ordered"),
|
|
("COMPLETED", "Completed"),
|
|
("CANCELLED", "Cancelled"),
|
|
],
|
|
default="ORDERED",
|
|
help_text="Suggestion status",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"ordered_at",
|
|
models.DateTimeField(
|
|
blank=True,
|
|
help_text="Date and time test was ordered",
|
|
null=True,
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"created_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="User who created the suggestion",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="created_suggestions",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"ordered_by",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
help_text="Provider who ordered the test",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name="ordered_suggestions",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
(
|
|
"patient",
|
|
models.ForeignKey(
|
|
help_text="Patient",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="diagnostic_suggestions",
|
|
to="patients.patientprofile",
|
|
),
|
|
),
|
|
(
|
|
"tenant",
|
|
models.ForeignKey(
|
|
help_text="Organization tenant",
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="diagnostic_suggestions",
|
|
to="core.tenant",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Diagnostic Suggestion",
|
|
"verbose_name_plural": "Diagnostic Suggestions",
|
|
"db_table": "emr_diagnostic_suggestion",
|
|
"ordering": ["-confidence", "-created_at"],
|
|
"indexes": [
|
|
models.Index(
|
|
fields=["tenant", "status"],
|
|
name="emr_diagnos_tenant__77e6f8_idx",
|
|
),
|
|
models.Index(
|
|
fields=["patient", "status"],
|
|
name="emr_diagnos_patient_8c5470_idx",
|
|
),
|
|
models.Index(
|
|
fields=["confidence"], name="emr_diagnos_confide_f7447d_idx"
|
|
),
|
|
models.Index(
|
|
fields=["created_at"], name="emr_diagnos_created_34cc79_idx"
|
|
),
|
|
],
|
|
},
|
|
),
|
|
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="criticalalert",
|
|
index=models.Index(
|
|
fields=["tenant", "acknowledged"], name="emr_critica_tenant__a7de09_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="criticalalert",
|
|
index=models.Index(
|
|
fields=["patient", "acknowledged"],
|
|
name="emr_critica_patient_3f3d88_idx",
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="criticalalert",
|
|
index=models.Index(
|
|
fields=["priority"], name="emr_critica_priorit_06ad08_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="criticalalert",
|
|
index=models.Index(
|
|
fields=["created_at"], name="emr_critica_created_3acbe1_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="clinicalrecommendation",
|
|
index=models.Index(
|
|
fields=["tenant", "status"], name="emr_clinica_tenant__9ac4a3_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="clinicalrecommendation",
|
|
index=models.Index(
|
|
fields=["patient", "status"], name="emr_clinica_patient_6a41b7_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="clinicalrecommendation",
|
|
index=models.Index(
|
|
fields=["category"], name="emr_clinica_categor_44bb6e_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="clinicalrecommendation",
|
|
index=models.Index(
|
|
fields=["priority"], name="emr_clinica_priorit_d52001_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="clinicalrecommendation",
|
|
index=models.Index(
|
|
fields=["created_at"], name="emr_clinica_created_d816a2_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="treatmentprotocol",
|
|
index=models.Index(
|
|
fields=["tenant", "is_active"], name="emr_treatme_tenant__1f3aaa_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="treatmentprotocol",
|
|
index=models.Index(
|
|
fields=["success_rate"], name="emr_treatme_success_d8024a_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"
|
|
),
|
|
),
|
|
]
|