From b22061b8c23d0a50e7b5d69ca807ced0ccc0220b Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Tue, 21 May 2024 18:02:32 +0530 Subject: [PATCH 1/3] rename patient category labels --- ...er_dailyround_patient_category_and_more.py | 40 +++++++++++++++++++ care/facility/models/patient_base.py | 4 +- 2 files changed, 42 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..b0b36d615d --- /dev/null +++ b/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py @@ -0,0 +1,40 @@ +# Generated by Django 4.2.10 on 2024-05-21 12:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + 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"), ] From a9a1ec33d69898030a014e6375a1202937f75871 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Tue, 21 May 2024 22:42:14 +0530 Subject: [PATCH 2/3] rename the categories in the events --- ...438_alter_dailyround_patient_category_and_more.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 index b0b36d615d..21e0f961d7 100644 --- a/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py +++ b/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py @@ -4,6 +4,18 @@ 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="CATEGORY", value__category="Abnormal" + ).update(value={"category": "Moderate"}) + dependencies = [ ("facility", "0437_alter_dailyround_rounds_type"), ] From bed4d0caa0e09f353c733ec577c686301e85e394 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Tue, 21 May 2024 22:53:32 +0530 Subject: [PATCH 3/3] rename categories for patient_category events --- .../0438_alter_dailyround_patient_category_and_more.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 index 21e0f961d7..021802db0b 100644 --- a/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py +++ b/care/facility/migrations/0438_alter_dailyround_patient_category_and_more.py @@ -12,9 +12,15 @@ def rename_categories_in_events(apps, schema_editor): 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"),