Closed johngrimes closed 8 months ago
Yes, you're right, as per FHIRPath documentation.
If the result of evaluating the condition is other than a single boolean value, the evaluation will end and signal an error to the calling environment, consistent with singleton evaluation of collections behavior.
Thanks for pointing out, test fixed in e89eb10, an implementation fix will follow soon.
Agreed on this.
Additionally, I have corrected all instances where the where.path
expression depended on a true
or an empty value. Therefore, deceased.ofType(boolean) = true
will result in an error, but deceased.ofType(boolean).exists() and deceased.ofType(boolean) = true
will not.
Hmm, I'm actually not sure if the former example should be an error.
Perhaps this should be an item for discussion.
@johngrimes Yes, that's why I highlighted it.
The spec currently says:
A series of zero or more FHIRPath constraints to filter resources for the view. Every constraint must evaluate to true for the resource to be included in the view.
A FHIRPath expression that defines a filter that must evaluate to true for a resource to be included in the output. The input context is the collection of resources of the type specified in the resource element. Constants defined in Reference({constant}) can be referenced as %[name]. The result of the expression must of type Boolean.
Maybe the only change we need is to remove "The result of the expression must of type Boolean."
The following test is incorrect, as it does not match the definition of
where.path
in the specification:I would expect this to return an empty result, or possibly even an error considering that the type of the
name.family
element isString
and is not possible to beBoolean
.