|
36 | 36 | from parameter_parser import process_params, process_search_params, create_query_string |
37 | 37 | import urllib.parse |
38 | 38 |
|
39 | | - |
40 | 39 | sqs_client = boto3_client("sqs", region_name="eu-west-2") |
41 | 40 | queue_url = os.getenv("SQS_QUEUE_URL", "Queue_url") |
42 | 41 |
|
@@ -392,10 +391,10 @@ def delete_immunization(self, aws_event): |
392 | 391 | except UnauthorizedVaxError as unauthorized: |
393 | 392 | return self.create_response(403, unauthorized.to_operation_outcome()) |
394 | 393 |
|
395 | | - def search_immunizations(self, aws_event: APIGatewayProxyEventV1) -> dict: |
396 | | - |
| 394 | + def search_immunizations(self, aws_event: APIGatewayProxyEventV1) -> dict: |
397 | 395 | if response := self.authorize_request(aws_event): |
398 | 396 | return response |
| 397 | + |
399 | 398 | try: |
400 | 399 | search_params = process_search_params(process_params(aws_event)) |
401 | 400 | except ParameterException as e: |
@@ -429,6 +428,7 @@ def search_immunizations(self, aws_event: APIGatewayProxyEventV1) -> dict: |
429 | 428 | except UnauthorizedVaxError as unauthorized: |
430 | 429 | return self.create_response(403, unauthorized.to_operation_outcome()) |
431 | 430 | # Check vaxx type permissions on the existing record - end |
| 431 | + |
432 | 432 | result = self.fhir_service.search_immunizations( |
433 | 433 | search_params.patient_identifier, |
434 | 434 | vax_type_perm, |
@@ -657,8 +657,7 @@ def create_response(status_code, body=None, headers=None): |
657 | 657 |
|
658 | 658 | @staticmethod |
659 | 659 | def _identify_supplier_system(aws_event): |
660 | | - headers = aws_event.get("headers", {}) |
661 | | - supplier_system = headers.get("SupplierSystem") |
| 660 | + supplier_system = aws_event["headers"]["SupplierSystem"] |
662 | 661 | if not supplier_system: |
663 | 662 | raise UnauthorizedError("SupplierSystem header is missing") |
664 | 663 | return supplier_system |
0 commit comments