Skip to content

Commit 26cd2d6

Browse files
authored
VED-837 Refactor get imms by identifier and search endpoints (#988)
* Refactored get imms by identifier and the search endpoint
1 parent a7470c3 commit 26cd2d6

26 files changed

+1498
-2464
lines changed

infrastructure/instance/oas.yaml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,28 +128,6 @@ paths:
128128
httpMethod: "POST"
129129
timeoutInMillis: 30000
130130
type: "AWS_PROXY"
131-
parameters:
132-
- name: patient.identifier
133-
in: query
134-
required: true
135-
schema:
136-
type: string
137-
- name: -immunization.target
138-
in: query
139-
schema:
140-
type: string
141-
- name: -date.from
142-
in: query
143-
schema:
144-
type: string
145-
- name: -date.to
146-
in: query
147-
schema:
148-
type: string
149-
- name: _include
150-
in: query
151-
schema:
152-
type: string
153131
responses:
154132
"201":
155133
description: An Immunisation search event

lambdas/backend/src/controller/aws_apig_event_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
from utils import dict_utils
1010

1111

12+
def get_multi_value_query_params(event: APIGatewayProxyEventV1) -> dict:
13+
return dict_utils.get_field(dict(event), "multiValueQueryStringParameters", default={})
14+
15+
1216
def get_path_parameter(event: APIGatewayProxyEventV1, param_name: str) -> str:
1317
return dict_utils.get_field(event["pathParameters"], param_name, default="")
1418

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
"""FHIR Controller constants"""
22

3+
from enum import StrEnum
4+
35
SUPPLIER_SYSTEM_HEADER_NAME = "SupplierSystem"
46
E_TAG_HEADER_NAME = "E-Tag"
7+
8+
SEARCH_IMMS_POST_PATH = "/Immunization/_search"
9+
10+
11+
class IdentifierSearchParameterName(StrEnum):
12+
IDENTIFIER = "identifier"
13+
ELEMENTS = "_elements"
14+
15+
16+
class ImmunizationSearchParameterName(StrEnum):
17+
PATIENT_IDENTIFIER = "patient.identifier"
18+
IMMUNIZATION_TARGET = "-immunization.target"
19+
DATE_FROM = "-date.from"
20+
DATE_TO = "-date.to"
21+
INCLUDE = "_include"
22+
23+
24+
class IdentifierSearchElement(StrEnum):
25+
"""Valid elements which can be requested to include in the identifier search response"""
26+
27+
ID = "id"
28+
META = "meta"
29+
30+
31+
IMMUNIZATION_TARGET_LEGACY_KEY_NAME = "immunization-target"

lambdas/backend/src/controller/fhir_api_exception_handler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
InvalidJsonError,
2222
InvalidResourceVersionError,
2323
InvalidStoredDataError,
24+
ParameterExceptionError,
2425
ResourceVersionNotProvidedError,
2526
Severity,
27+
TooManyResultsError,
2628
UnauthorizedError,
2729
UnauthorizedVaxError,
2830
UnhandledResponseError,
@@ -38,6 +40,8 @@
3840
InvalidResourceVersionError: 400,
3941
CustomValidationError: 400,
4042
ResourceVersionNotProvidedError: 400,
43+
ParameterExceptionError: 400,
44+
TooManyResultsError: 400,
4145
UnauthorizedError: 403,
4246
UnauthorizedVaxError: 403,
4347
ResourceNotFoundError: 404,

0 commit comments

Comments
 (0)