22import logging
33import os
44import uuid
5- from enum import Enum
65from typing import Optional , Union , cast
76from uuid import uuid4
87
@@ -70,11 +69,6 @@ def get_service_url(
7069 return f"https://{ subdomain } api.service.nhs.uk/{ service_base_path } "
7170
7271
73- class UpdateOutcome (Enum ):
74- UPDATE = 0
75- CREATE = 1
76-
77-
7872class FhirService :
7973 def __init__ (
8074 self ,
@@ -168,13 +162,13 @@ def update_immunization(
168162 existing_resource_version : int ,
169163 existing_resource_vacc_type : str ,
170164 supplier_system : str ,
171- ) -> tuple [Optional [ UpdateOutcome ] , Immunization | dict , Optional [int ]]:
165+ ) -> tuple [bool , Immunization | dict , Optional [int ]]:
172166 # VED-747 - TODO - this and the below 2 methods are duplicated. We should streamline the update journey
173167 immunization ["id" ] = imms_id
174168
175169 patient = self ._validate_patient (immunization )
176170 if "diagnostics" in patient :
177- return None , patient , None
171+ return False , patient , None
178172
179173 vaccination_type = get_vaccine_type (immunization )
180174
@@ -191,7 +185,7 @@ def update_immunization(
191185 imms_id , immunization , patient , existing_resource_version , supplier_system
192186 )
193187
194- return UpdateOutcome . UPDATE , Immunization .parse_obj (imms ), updated_version
188+ return True , Immunization .parse_obj (imms ), updated_version
195189
196190 def reinstate_immunization (
197191 self ,
@@ -200,11 +194,11 @@ def reinstate_immunization(
200194 existing_resource_version : int ,
201195 existing_resource_vacc_type : str ,
202196 supplier_system : str ,
203- ) -> tuple [Optional [ UpdateOutcome ] , Immunization | dict , Optional [int ]]:
197+ ) -> tuple [bool , Immunization | dict , Optional [int ]]:
204198 immunization ["id" ] = imms_id
205199 patient = self ._validate_patient (immunization )
206200 if "diagnostics" in patient :
207- return None , patient , None
201+ return False , patient , None
208202
209203 vaccination_type = get_vaccine_type (immunization )
210204
@@ -219,7 +213,7 @@ def reinstate_immunization(
219213 imms_id , immunization , patient , existing_resource_version , supplier_system
220214 )
221215
222- return UpdateOutcome . UPDATE , Immunization .parse_obj (imms ), updated_version
216+ return True , Immunization .parse_obj (imms ), updated_version
223217
224218 def update_reinstated_immunization (
225219 self ,
@@ -228,11 +222,11 @@ def update_reinstated_immunization(
228222 existing_resource_version : int ,
229223 existing_resource_vacc_type : str ,
230224 supplier_system : str ,
231- ) -> tuple [Optional [ UpdateOutcome ] , Immunization | dict , Optional [int ]]:
225+ ) -> tuple [bool , Immunization | dict , Optional [int ]]:
232226 immunization ["id" ] = imms_id
233227 patient = self ._validate_patient (immunization )
234228 if "diagnostics" in patient :
235- return None , patient , None
229+ return False , patient , None
236230
237231 vaccination_type = get_vaccine_type (immunization )
238232
@@ -251,7 +245,7 @@ def update_reinstated_immunization(
251245 supplier_system ,
252246 )
253247
254- return UpdateOutcome . UPDATE , Immunization .parse_obj (imms ), updated_version
248+ return True , Immunization .parse_obj (imms ), updated_version
255249
256250 def delete_immunization (self , imms_id : str , supplier_system : str ) -> None :
257251 """
0 commit comments