Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed patient category labels #2187

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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"})
Comment on lines +12 to +23
Copy link
Member

@sainak sainak May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is to change the labels, as we serialize the labels while creating events


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,
),
),
]
4 changes: 2 additions & 2 deletions care/facility/models/patient_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def reverse_choices(choices):

CATEGORY_CHOICES = [
("Comfort", "Comfort Care"),
("Stable", "Stable"),
("Moderate", "Abnormal"),
("Stable", "Mild"),
("Moderate", "Moderate"),
("Critical", "Critical"),
]

Expand Down
Loading