Skip to content

Commit 1060a1c

Browse files
committed
debug
1 parent b2317a2 commit 1060a1c

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

backend/src/fhir_controller.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,13 @@ def search_immunizations(self, aws_event: APIGatewayProxyEventV1) -> dict:
405405
if search_params is None:
406406
raise Exception("Failed to parse parameters.")
407407

408+
logger.info("SAW: fhir_controller. search_params: %s", search_params)
408409
# Check vaxx type permissions- start
409410
try:
410411
if aws_event.get("headers"):
411412
supplier_system = self._identify_supplier_system(aws_event)
413+
logger.info("SAW: Supplier system identified: %s", supplier_system)
414+
logger.info("SAW: Get supplier permissions for: %s", supplier_system)
412415
imms_vax_type_perms = get_supplier_permissions(supplier_system)
413416
if len(imms_vax_type_perms) == 0:
414417
raise UnauthorizedVaxError()

backend/src/fhir_service.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -288,42 +288,42 @@ def search_immunizations(
288288
Finds all instances of Immunization(s) for a specified patient which are for the specified vaccine type(s).
289289
Bundles the resources with the relevant patient resource and returns the bundle.
290290
"""
291-
logger.info("SAW: search_immunizations for nhs_number: %s, vaccine_types: %s, date_from: %s, date_to: %s",
291+
logger.info("SAW: search_immunizations...1 nhs_number: %s, vaccine_types: %s, date_from: %s, date_to: %s",
292292
nhs_number, vaccine_types, date_from, date_to)
293293
# TODO: is disease type a mandatory field? (I assumed it is)
294294
# i.e. Should we provide a search option for getting Patient's entire imms history?
295295

296-
logger.info("checking nhs_number_mod11_check for nhs_number: %s", nhs_number)
296+
logger.info("SAW: search_immunizations...2 check nhs_number_mod11_check for nhs_number: %s", nhs_number)
297297
if not nhs_number_mod11_check(nhs_number):
298298
return create_diagnostics()
299299

300-
logger.info("SAW:obtain resources for nhs_number: %s, vaccine_types: %s, date_from: %s, date_to: %s",
300+
logger.info("SAW: search_immunizations...3 obtain resources for nhs_number: %s, vaccine_types: %s, date_from: %s, date_to: %s",
301301
nhs_number, vaccine_types, date_from, date_to)
302302
# Obtain all resources which are for the requested nhs number and vaccine type(s) and within the date range
303303
resources = [
304304
r
305305
for r in self.immunization_repo.find_immunizations(nhs_number, vaccine_types)
306306
if self.is_valid_date_from(r, date_from) and self.is_valid_date_to(r, date_to)
307307
]
308-
308+
logger.info("SAW: search_immunizations...4 no of resources found: %d", len(resources))
309309
# Create the patient URN for the fullUrl field.
310310
# NOTE: This UUID is assigned when a SEARCH request is received and used only for referencing the patient
311311
# resource from immunisation resources within the bundle. The fullUrl value we are using is a urn (hence the
312312
# FHIR key name of "fullUrl" is somewhat misleading) which cannot be used to locate any externally stored
313313
# patient resource. This is as agreed with VDS team for backwards compatibility with Immunisation History API.
314314
patient_full_url = f"urn:uuid:{str(uuid4())}"
315315

316-
logger.info("SAW: call get_contained_patient")
316+
logger.info("SAW: search_immunizations...5 call get_contained_patient")
317317
imms_patient_record = get_contained_patient(resources[-1]) if resources else None
318318

319-
logger.info("SAW: filter resources for search")
319+
logger.info("SAW: search_immunizations...6 filter resources for search")
320320
# log pretty resources for debug
321-
logger.info("SAW: resources: %s", [
321+
logger.info("SAW: search_immunizations...7 resources: %s", [
322322
Immunization.parse_obj(r).json(indent=2) for r in resources
323323
])
324324
# Filter and amend the immunization resources for the SEARCH response
325325
resources_filtered_for_search = [Filter.search(imms, patient_full_url) for imms in resources]
326-
logger.info("SAW: no of items in filtered resources: %d", len(resources_filtered_for_search))
326+
logger.info("SAW: search_immunizations...8 no of items in filtered resources: %d", len(resources_filtered_for_search))
327327
# Add bundle entries for each of the immunization resources
328328
entries = [
329329
BundleEntry(
@@ -336,11 +336,11 @@ def search_immunizations(
336336
]
337337

338338

339-
logger.info("SAW: entries created for bundle: %d", len(entries))
340-
339+
logger.info("SAW: search_immunizations...9 entries created for bundle: %d", len(entries))
340+
341341
for entry in entries:
342-
logger.debug("SAW: entry: %s", entry.resource.json(indent=2))
343-
342+
logger.debug("SAW: search_immunizations...10 entry: %s", entry.resource.json(indent=2))
343+
344344
# Add patient resource if there is at least one immunization resource
345345
if len(resources) > 0:
346346
entries.append(

0 commit comments

Comments
 (0)