Skip to content

Commit 51ced50

Browse files
committed
VED-736: refactor response for search identifier
1 parent addf75a commit 51ced50

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

backend/src/models/utils/generic_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ def form_json(response, _element, identifier, baseurl):
153153
if identifier and not _element:
154154
resource = response["resource"]
155155

156+
# --- filtering: drop contained and add use=official to identifiers ---
157+
resource.pop("contained", None)
158+
if isinstance(resource.get("identifier"), list):
159+
for item in resource["identifier"]:
160+
if isinstance(item, dict):
161+
item["use"] = "official"
162+
156163
elif identifier and _element:
157164
element = {e.strip().lower() for e in _element.split(",") if e.strip()}
158165
resource = {"resourceType": "Immunization"}

0 commit comments

Comments
 (0)