Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The default context for FhirPath evaluation is leaving out %resource #2177

Open
ewoutkramer opened this issue Aug 2, 2022 · 2 comments · May be fixed by #2841
Open

The default context for FhirPath evaluation is leaving out %resource #2177

ewoutkramer opened this issue Aug 2, 2022 · 2 comments · May be fixed by #2841
Assignees

Comments

@ewoutkramer
Copy link
Member

ewoutkramer commented Aug 2, 2022

Is your feature request related to a problem? Please describe.
When you execute one of the extension methods for FhirPath on POCO or ITypedElement - and you don't supply the optional parameter for the context, a default, empty context is provided. This means that %resource and %rootResource will return null. Although these environment variables are not used often, they are not expected to be null. In fact, the constructor for FhirEvaluationContext that takes a ScopedNode as a parameter, will try to locate the nearest resource in the input data and then set the %resource accordingly. It makes total sense that this is the default. In fact, when we ourselves invoke the FP engine in the validator, we are always supplying the correct parameters.

Describe the solution you'd like
Pick a sensible default, instead of null. Preferably the same approach as the constructor taking ScopedNode.

@ewoutkramer ewoutkramer changed the title The default context for FhirPath evaluation is leaving out %resource The default context for FhirPath evaluation is leaving out %resource Aug 2, 2022
@ewoutkramer
Copy link
Member Author

Note that finding defaults is only possible if the caller supplies input data that is itself a resource, or a node within a ScopedNode - otherwise we won't be able to find a sensible default "resource" node within the parents of the data passed in.

@mmsmits
Copy link
Member

mmsmits commented Jul 25, 2024

See also:
#327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants