diff --git a/app/operations/utils.py b/app/operations/utils.py index 2c9aa9f..c4905a0 100644 --- a/app/operations/utils.py +++ b/app/operations/utils.py @@ -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