From e51523ab28d06604462571f89cbe83e9d7818539 Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:19:05 -0800 Subject: [PATCH] WIP: changing active from bool to str --- isacc_messaging/api/isacc_record_creator.py | 2 +- isacc_messaging/api/views.py | 6 +++--- isacc_messaging/models/isacc_patient.py | 2 +- tests/test_models/practitioner_57.json | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/isacc_messaging/api/isacc_record_creator.py b/isacc_messaging/api/isacc_record_creator.py index 71a29f63..1f886a2a 100644 --- a/isacc_messaging/api/isacc_record_creator.py +++ b/isacc_messaging/api/isacc_record_creator.py @@ -236,7 +236,7 @@ def generate_incoming_message(self, message, time: datetime = None, patient: Pat if priority is None: priority = "routine" - if patient is None or not patient.active: + if patient is None or patient.active != "true": return "Need active patient" care_plan = self.get_careplan(patient) diff --git a/isacc_messaging/api/views.py b/isacc_messaging/api/views.py index 93c360e9..68994adc 100644 --- a/isacc_messaging/api/views.py +++ b/isacc_messaging/api/views.py @@ -212,7 +212,7 @@ def update_patient_params(): all_patients = Patient.all_patients() for json_patient in next_in_bundle(all_patients): patient = Patient(json_patient) - patient.active = True + patient.active = "true" audit_entry( f"Patient ID{patient.id}", level='info' @@ -229,8 +229,8 @@ def deactivate_patient(patient_id): active_patients = Patient.all_patients() for json_patient in next_in_bundle(active_patients): patient = Patient(json_patient) - if patient.id == "52": - patient.active = False + if patient.id == str(patient_id): + patient.active = "false" patient.persist() audit_entry( f"Deactivated a patient {patient_id}", diff --git a/isacc_messaging/models/isacc_patient.py b/isacc_messaging/models/isacc_patient.py index 34bb5359..05a671d0 100644 --- a/isacc_messaging/models/isacc_patient.py +++ b/isacc_messaging/models/isacc_patient.py @@ -35,7 +35,7 @@ def active_patients(): NB, returns only patients with active set to true """ response = HAPI_request('GET', 'Patient', params={ - "active": True + "active": "true" }) return response diff --git a/tests/test_models/practitioner_57.json b/tests/test_models/practitioner_57.json index 83f275db..8cc60b64 100644 --- a/tests/test_models/practitioner_57.json +++ b/tests/test_models/practitioner_57.json @@ -6,7 +6,6 @@ "lastUpdated": "2023-05-18T23:51:27.443+00:00", "source": "#P7hLhUI3piOun2Ii" }, - "active": true, "name": [ { "family": "McRainodes", "given": [ "J.R." ],