Skip to content

Commit 3b96e29

Browse files
committed
VED-350: refactor response to return full imms resource for identifier params
1 parent fdef8a1 commit 3b96e29

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

backend/src/models/utils/generic_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ def form_json(response, _element, identifier, baseurl):
162162
],
163163
"total": 1,
164164
}
165+
166+
# Full Immunization payload to be returned if only the identifier parameter was provided
167+
if identifier and (not _element):
168+
json["entry"].append({
169+
"fullUrl": f"https://api.service.nhs.uk/immunisation-fhir-api/Immunization/{response.get('id')}",
170+
"resource": response,
171+
})
172+
return json
173+
165174
__elements = _element.lower()
166175
element = __elements.split(",")
167176
# Add 'id' if specified

0 commit comments

Comments
 (0)