Skip to content

Commit a751502

Browse files
committed
Refactored get imms by identifier and the search endpoint
1 parent 30fb156 commit a751502

23 files changed

+1470
-2460
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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
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_USING_POST_PATH = "/Immunization/_search"
9+
10+
# TODO - could create string enum for different parameters
11+
# Once parameter parser is tidier, consider moving it there
12+
13+
14+
class IdentifierSearchParameterName(StrEnum):
15+
IDENTIFIER = "identifier"
16+
ELEMENTS = "_elements"
17+
18+
19+
class ImmunizationSearchParameterName(StrEnum):
20+
PATIENT_IDENTIFIER = "patient.identifier"
21+
IMMUNIZATION_TARGET = "-immunization.target"
22+
DATE_FROM = "-date.from"
23+
DATE_TO = "-date.to"
24+
INCLUDE = "_include"
25+
26+
27+
class IdentifierSearchElement(StrEnum):
28+
"""Valid elements which can be requested to include in the identifier search response"""
29+
30+
ID = "id"
31+
META = "meta"
32+
33+
34+
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
@@ -20,8 +20,10 @@
2020
InvalidImmunizationId,
2121
InvalidJsonError,
2222
InvalidResourceVersion,
23+
ParameterException,
2324
ResourceVersionNotProvided,
2425
Severity,
26+
TooManyResultsError,
2527
UnauthorizedError,
2628
UnauthorizedVaxError,
2729
UnhandledResponseError,
@@ -36,7 +38,9 @@
3638
InvalidJsonError: 400,
3739
InvalidResourceVersion: 400,
3840
CustomValidationError: 400,
41+
ParameterException: 400,
3942
ResourceVersionNotProvided: 400,
43+
TooManyResultsError: 400,
4044
UnauthorizedError: 403,
4145
UnauthorizedVaxError: 403,
4246
ResourceNotFoundError: 404,

0 commit comments

Comments
 (0)