From ba986563e8d5de1c3470cf2b5a5b6df1c0cbe191 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Wed, 22 May 2024 13:05:02 +0530 Subject: [PATCH] Renamed patient category labels (#2187) * rename patient category labels * rename the categories in the events * rename categories for patient_category events --- ...er_dailyround_patient_category_and_more.py | 58 +++++++++++++++++++ care/facility/models/patient_base.py | 4 +- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py diff --git a/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py b/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py new file mode 100644 index 0000000000..021802db0b --- /dev/null +++ b/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py @@ -0,0 +1,58 @@ +# Generated by Django 4.2.10 on 2024-05-21 12:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + def rename_categories_in_events(apps, schema_editor): + PatientConsultationEvent = apps.get_model( + "facility", "PatientConsultationEvent" + ) + + PatientConsultationEvent.objects.filter( + event_type__name="CATEGORY", value__category="Stable" + ).update(value={"category": "Mild"}) + PatientConsultationEvent.objects.filter( + event_type__name="PATIENT_CATEGORY", value__category="Stable" + ).update(value={"patient_category": "Mild"}) + PatientConsultationEvent.objects.filter( + event_type__name="CATEGORY", value__category="Abnormal" + ).update(value={"category": "Moderate"}) + PatientConsultationEvent.objects.filter( + event_type__name="PATIENT_CATEGORY", value__category="Abnormal" + ).update(value={"patient_category": "Moderate"}) + + dependencies = [ + ("facility", "0437_alter_dailyround_rounds_type"), + ] + + operations = [ + migrations.AlterField( + model_name="dailyround", + name="patient_category", + field=models.CharField( + choices=[ + ("Comfort", "Comfort Care"), + ("Stable", "Mild"), + ("Moderate", "Moderate"), + ("Critical", "Critical"), + ], + max_length=8, + null=True, + ), + ), + migrations.AlterField( + model_name="patientconsultation", + name="category", + field=models.CharField( + choices=[ + ("Comfort", "Comfort Care"), + ("Stable", "Mild"), + ("Moderate", "Moderate"), + ("Critical", "Critical"), + ], + max_length=8, + null=True, + ), + ), + ] diff --git a/care/facility/models/patient_base.py b/care/facility/models/patient_base.py index 73bbcfaacb..976b38d320 100644 --- a/care/facility/models/patient_base.py +++ b/care/facility/models/patient_base.py @@ -70,8 +70,8 @@ def reverse_choices(choices): CATEGORY_CHOICES = [ ("Comfort", "Comfort Care"), - ("Stable", "Stable"), - ("Moderate", "Abnormal"), + ("Stable", "Mild"), + ("Moderate", "Moderate"), ("Critical", "Critical"), ]