Skip to content

Commit

Permalink
Convert expression result list to comma-separated string
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryashutov committed Jul 27, 2022
1 parent 95e92ca commit ba70310
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/operations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ def resolve_string_template(i, env, encode_result=False):
for exp in exprs:
data = fhirpath({}, exp["var"][2:-2], env)
if len(data) > 0:
# TODO: pass comma separated values for x-fhir-query
vs[exp["var"]] = quote(str(data[0])) if encode_result else str(data[0])
# NOTE: http://build.fhir.org/ig/HL7/sdc/expressions.html#x-fhir-query-enhancements
# If the expression resolves to a collection of more than one value,
# the substitution will be a list of comma-separated values (i.e. behaving as 'or').
search_str = ",".join(data)
vs[exp["var"]] = quote(search_str) if encode_result else search_str
else:
vs[exp["var"]] = ""
res = i
Expand Down

0 comments on commit ba70310

Please sign in to comment.