From 01c4aa0eecc7ac997d52e42de24ed63683a70a59 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Mon, 20 May 2024 21:45:08 +0530 Subject: [PATCH] Adds support for "Doctors Log Update" round type (#2173) * Adds support for "Doctors Log Update" round type * add tests --- .../0437_alter_dailyround_rounds_type.py | 27 +++++++++++++++++++ care/facility/models/daily_round.py | 1 + .../tests/test_patient_daily_rounds_api.py | 7 +++++ 3 files changed, 35 insertions(+) create mode 100644 care/facility/migrations/0437_alter_dailyround_rounds_type.py diff --git a/care/facility/migrations/0437_alter_dailyround_rounds_type.py b/care/facility/migrations/0437_alter_dailyround_rounds_type.py new file mode 100644 index 0000000000..95ed6611d2 --- /dev/null +++ b/care/facility/migrations/0437_alter_dailyround_rounds_type.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.8 on 2024-05-17 04:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("facility", "0436_remove_dailyround_temperature_measured_at"), + ] + + operations = [ + migrations.AlterField( + model_name="dailyround", + name="rounds_type", + field=models.IntegerField( + choices=[ + (0, "NORMAL"), + (50, "DOCTORS_LOG"), + (100, "VENTILATOR"), + (200, "ICU"), + (300, "AUTOMATED"), + (400, "TELEMEDICINE"), + ], + default=0, + ), + ), + ] diff --git a/care/facility/models/daily_round.py b/care/facility/models/daily_round.py index 7958bc9b39..afb05147fb 100644 --- a/care/facility/models/daily_round.py +++ b/care/facility/models/daily_round.py @@ -34,6 +34,7 @@ class DailyRound(PatientBaseModel): class RoundsType(enum.Enum): NORMAL = 0 + DOCTORS_LOG = 50 VENTILATOR = 100 ICU = 200 AUTOMATED = 300 diff --git a/care/facility/tests/test_patient_daily_rounds_api.py b/care/facility/tests/test_patient_daily_rounds_api.py index 7c5686275a..06195fecb0 100644 --- a/care/facility/tests/test_patient_daily_rounds_api.py +++ b/care/facility/tests/test_patient_daily_rounds_api.py @@ -95,3 +95,10 @@ def test_log_update_without_bed_for_domiciliary( format="json", ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) + + def test_doctors_log_update(self): + response = self.client.post( + f"/api/v1/consultation/{self.consultation_with_bed.external_id}/daily_rounds/", + data={**self.log_update, "rounds_type": "DOCTORS_LOG"}, + ) + self.assertEqual(response.status_code, status.HTTP_201_CREATED)