HH/apps/complaints/migrations/0017_add_patient_contact_status.py
ismail 7369d08012
All checks were successful
Build and Push Docker Image / build (push) Successful in 4m14s
feat: unified reference numbers + feedback modules QA audit
Reference numbers (unified scheme PREFIX-YYYYMM-HOSP-NNNN, e.g. CMP-202606-HHN-0001):
- new ReferenceSequence model + generate_reference() helper (apps/core)
- Complaint/Inquiry/Observation/Appreciation/Suggestion emit unified refs via save()
- prefix-based auto-routing in public track API (CMP/INQ/OBS trackable; APR/SGT internal-only)
- removed legacy CMP-/INQ- generators in ui_views, integrations, px_sources
- migrations: core.0003_referencesequence, appreciation.0006, feedback.0008, observations.0012
- unit tests (format, sanitization, monthly reset, 40-thread concurrency)

QA audit:
- isolated E2E hospital sandbox mirroring HH-N + 10 role users (create_e2e_isolated_env)
- feedback-modules-audit.spec.ts + audit helper (headed, run-to-completion)
- reports/feedback-modules-qa-report.md

Also bundles accumulated in-progress work across complaints, observations,
organizations, templates, and other modules.
2026-06-14 14:29:23 +03:00

50 lines
2.3 KiB
Python

# Generated by Django 6.0.1 on 2026-06-10 20:48
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
def migrate_contacted_statuses(apps, schema_editor):
Complaint = apps.get_model("complaints", "Complaint")
Complaint.objects.filter(status="contacted").update(
status="in_progress",
patient_contact_status="contacted",
)
Complaint.objects.filter(status="contacted_no_response").update(
status="in_progress",
patient_contact_status="contacted_no_response",
)
class Migration(migrations.Migration):
dependencies = [
('complaints', '0016_champion_investigation'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.AddField(
model_name='complaint',
name='patient_contact_status',
field=models.CharField(choices=[('not_contacted', 'Not Contacted'), ('contacted', 'Contacted'), ('contacted_no_response', 'Contacted, No Response')], db_index=True, default='not_contacted', help_text='Tracks whether the patient has been contacted regarding this complaint', max_length=30),
),
migrations.AddField(
model_name='complaint',
name='patient_contact_status_at',
field=models.DateTimeField(blank=True, help_text='When the patient contact status was last updated', null=True),
),
migrations.AddField(
model_name='complaint',
name='patient_contact_status_by',
field=models.ForeignKey(blank=True, help_text='User who last updated the patient contact status', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='patient_contact_updated_complaints', to=settings.AUTH_USER_MODEL),
),
migrations.AlterField(
model_name='complaint',
name='status',
field=models.CharField(choices=[('open', 'Open'), ('in_progress', 'In Progress'), ('partially_resolved', 'Partially Resolved'), ('resolved', 'Resolved'), ('closed', 'Closed'), ('cancelled', 'Cancelled'), ('pending_external', 'Pending External'), ('ovr_pending', 'OVR Pending Approval')], db_index=True, default='open', max_length=25),
),
migrations.RunPython(migrate_contacted_statuses, migrations.RunPython.noop),
]