From f9f432e9965421874987c41c47d348326106fd59 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Fri, 6 Sep 2024 18:54:28 +0530 Subject: [PATCH] Improve terminology: ~`recordable`~ `measurable` --- ...ound_bp_alter_dailyround_feeds_and_more.py | 22 ++++++------ .../models/json_schema/daily_round.py | 10 +++--- .../tests/test_patient_daily_rounds_api.py | 36 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/care/facility/migrations/0454_alter_dailyround_bp_alter_dailyround_feeds_and_more.py b/care/facility/migrations/0454_alter_dailyround_bp_alter_dailyround_feeds_and_more.py index 29d5e91736..1322f1f9e0 100644 --- a/care/facility/migrations/0454_alter_dailyround_bp_alter_dailyround_feeds_and_more.py +++ b/care/facility/migrations/0454_alter_dailyround_bp_alter_dailyround_feeds_and_more.py @@ -31,7 +31,7 @@ class Migration(migrations.Migration): 2. Fills name with "Unknown" for I/O balance field items for ones with empty string. 3. Update blood pressure column to `None` for empty objects (`{}`). - 4. Backfill systolic_not_recordable and diastolic_not_recordable attributes. + 4. Backfill systolic_not_measurable and diastolic_not_measurable attributes. """ dependencies = [ @@ -90,7 +90,7 @@ def reverse_set_empty_bp_to_null(apps, schema_editor): DailyRound = apps.get_model("facility", "DailyRound") DailyRound.objects.filter(bp=None).update(bp={}) - def backfill_blood_pressure_recordable(apps, schema_editor): + def backfill_blood_pressure_not_measurable(apps, schema_editor): DailyRound = apps.get_model("facility", "DailyRound") paginator = Paginator( @@ -101,8 +101,8 @@ def backfill_blood_pressure_recordable(apps, schema_editor): bulk = [] for instance in paginator.page(page_number).object_list: bp = instance.bp - bp["systolic_not_recordable"] = bp.get("systolic") is None - bp["diastolic_not_recordable"] = bp.get("diastolic") is None + bp["systolic_not_measurable"] = bp.get("systolic") is None + bp["diastolic_not_measurable"] = bp.get("diastolic") is None bulk.append(instance) DailyRound.objects.bulk_update(bulk, ["bp"]) @@ -129,7 +129,7 @@ def backfill_blood_pressure_recordable(apps, schema_editor): }, "if": { "properties": { - "systolic_not_recordable": {"const": False} + "systolic_not_measurable": {"const": False} } }, "then": { @@ -147,7 +147,7 @@ def backfill_blood_pressure_recordable(apps, schema_editor): }, "if": { "properties": { - "diastolic_not_recordable": {"const": False} + "diastolic_not_measurable": {"const": False} } }, "then": { @@ -169,13 +169,13 @@ def backfill_blood_pressure_recordable(apps, schema_editor): }, "properties": { "diastolic": {}, - "diastolic_not_recordable": {"type": "boolean"}, + "diastolic_not_measurable": {"type": "boolean"}, "systolic": {}, - "systolic_not_recordable": {"type": "boolean"}, + "systolic_not_measurable": {"type": "boolean"}, }, "required": [ - "systolic_not_recordable", - "diastolic_not_recordable", + "systolic_not_measurable", + "diastolic_not_measurable", ], "type": "object", } @@ -188,7 +188,7 @@ def backfill_blood_pressure_recordable(apps, schema_editor): reverse_code=reverse_set_empty_bp_to_null, ), migrations.RunPython( - backfill_blood_pressure_recordable, + backfill_blood_pressure_not_measurable, reverse_code=migrations.RunPython.noop, ), migrations.AlterField( diff --git a/care/facility/models/json_schema/daily_round.py b/care/facility/models/json_schema/daily_round.py index 3b7d67280c..09639c7577 100644 --- a/care/facility/models/json_schema/daily_round.py +++ b/care/facility/models/json_schema/daily_round.py @@ -7,14 +7,14 @@ "properties": { "systolic": {}, "diastolic": {}, - "systolic_not_recordable": {"type": "boolean"}, - "diastolic_not_recordable": {"type": "boolean"}, + "systolic_not_measurable": {"type": "boolean"}, + "diastolic_not_measurable": {"type": "boolean"}, }, - "required": ["systolic_not_recordable", "diastolic_not_recordable"], + "required": ["systolic_not_measurable", "diastolic_not_measurable"], "allOf": [ { "if": { - "properties": {"systolic_not_recordable": {"const": False}}, + "properties": {"systolic_not_measurable": {"const": False}}, }, "then": { "properties": {"systolic": {"$ref": "#/definitions/blood-pressure"}}, @@ -26,7 +26,7 @@ }, { "if": { - "properties": {"diastolic_not_recordable": {"const": False}}, + "properties": {"diastolic_not_measurable": {"const": False}}, }, "then": { "properties": {"diastolic": {"$ref": "#/definitions/blood-pressure"}}, diff --git a/care/facility/tests/test_patient_daily_rounds_api.py b/care/facility/tests/test_patient_daily_rounds_api.py index 9112752276..df2c700e1b 100644 --- a/care/facility/tests/test_patient_daily_rounds_api.py +++ b/care/facility/tests/test_patient_daily_rounds_api.py @@ -122,7 +122,7 @@ def test_create_log_update_blood_pressure_empty(self): response = self.create_log_update(bp={}) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - def test_create_log_update_blood_pressure_without_recordable_fields(self): + def test_create_log_update_blood_pressure_without_measurable_fields(self): response = self.create_log_update( bp={ "systolic": 90, @@ -131,21 +131,21 @@ def test_create_log_update_blood_pressure_without_recordable_fields(self): ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) - def test_create_log_update_blood_pressure_not_recordable(self): + def test_create_log_update_blood_pressure_not_measurable(self): response = self.create_log_update( bp={ - "systolic_not_recordable": True, - "diastolic_not_recordable": True, + "systolic_not_measurable": True, + "diastolic_not_measurable": True, } ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) - def test_create_log_update_blood_pressure_not_recordable_with_value(self): + def test_create_log_update_blood_pressure_not_measurable_with_value(self): response = self.create_log_update( bp={ - "systolic_not_recordable": True, + "systolic_not_measurable": True, "systolic": 60, - "diastolic_not_recordable": True, + "diastolic_not_measurable": True, } ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) @@ -153,8 +153,8 @@ def test_create_log_update_blood_pressure_not_recordable_with_value(self): def test_create_log_update_blood_pressure_recordable_without_value(self): response = self.create_log_update( bp={ - "systolic_not_recordable": False, - "diastolic_not_recordable": True, + "systolic_not_measurable": False, + "diastolic_not_measurable": True, } ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) @@ -162,9 +162,9 @@ def test_create_log_update_blood_pressure_recordable_without_value(self): def test_create_log_update_blood_pressure_partially_recordable(self): response = self.create_log_update( bp={ - "systolic_not_recordable": False, + "systolic_not_measurable": False, "systolic": 60, - "diastolic_not_recordable": True, + "diastolic_not_measurable": True, } ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) @@ -172,9 +172,9 @@ def test_create_log_update_blood_pressure_partially_recordable(self): def test_create_log_update_with_out_of_range_blood_pressure(self): response = self.create_log_update( bp={ - "systolic_not_recordable": False, + "systolic_not_measurable": False, "systolic": 1000, - "diastolic_not_recordable": True, + "diastolic_not_measurable": True, } ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) @@ -182,7 +182,7 @@ def test_create_log_update_with_out_of_range_blood_pressure(self): def test_create_log_update_with_missing_systolic_blood_pressure(self): response = self.create_log_update( bp={ - "diastolic_not_recordable": False, + "diastolic_not_measurable": False, "diastolic": 100, } ) @@ -191,9 +191,9 @@ def test_create_log_update_with_missing_systolic_blood_pressure(self): def test_create_log_update_with_systolic_below_diastolic_blood_pressure(self): response = self.create_log_update( bp={ - "systolic_not_recordable": False, + "systolic_not_measurable": False, "systolic": 60, - "diastolic_not_recordable": False, + "diastolic_not_measurable": False, "diastolic": 90, }, ) @@ -202,9 +202,9 @@ def test_create_log_update_with_systolic_below_diastolic_blood_pressure(self): def test_create_log_update_with_valid_blood_pressure(self): response = self.create_log_update( bp={ - "systolic_not_recordable": False, + "systolic_not_measurable": False, "systolic": 90, - "diastolic_not_recordable": False, + "diastolic_not_measurable": False, "diastolic": 60, }, )