FHIR Chat · Order of evaluation or questionnaire-calculatedExpression? · questionnaire

Stream: questionnaire

Topic: Order of evaluation or questionnaire-calculatedExpression?


view this post on Zulip Paul Lynch (Nov 29 2018 at 22:42):

Is there documentation somewhere about what order the expressions found in questionnaire-calculatedExpression for different items are to be run? It is not hard to construct a set of expressions that produce different results depending on which order they are run. I think I read somewhere that they should be run in order of their appearance on the form, but I can't find that statement on http://hl7.org/fhir/2018Sep/extension-questionnaire-calculatedexpression.html. I think the same concern applies to questionnaire-initialExpression.

view this post on Zulip Lloyd McKenzie (Dec 10 2018 at 22:19):

@Bryn Rhodes the same issue probably shows up in PlanDefinition. Do you have a practice there?

view this post on Zulip Bryn Rhodes (Dec 10 2018 at 22:32):

In realizing an ActivityDefinition, there is explicit reference to the order of evaluation for the "dynamicValue" elements: http://build.fhir.org/activitydefinition.html

view this post on Zulip Bryn Rhodes (Dec 10 2018 at 22:32):

"in the order in which they appear in the ActivityDefinition"

view this post on Zulip Lloyd McKenzie (Dec 10 2018 at 22:44):

I guess you have the benefit of no user intervention. In the case of Questionnaire, there isn't a guarantee tha questions will be completed in order. For form fillers that use an event-based approach to propagating answers, order of appearance in the form is likely to be a pain. But I'm not sure what else to do. @Paul Lynch Can you add a tracker for this and we can discuss on a call? We might need to do some playing at a connectathon before we land how it should best work.

view this post on Zulip Bryn Rhodes (Dec 10 2018 at 22:57):

But if every change to the inputs constitutes a recalculation, doesn't order of evaluation not matter? You'd have to track dependencies (and prevent recursion), but wouldn't that address the issue?

view this post on Zulip Paul Lynch (Dec 10 2018 at 22:57):

I don't think the answer to this depends on the order which the user fills out the form.

view this post on Zulip Paul Lynch (Dec 10 2018 at 23:02):

@Bryn Rhodes How would one track dependencies? FHIRPath seems very opaque as what the source items are.

view this post on Zulip Paul Lynch (Dec 10 2018 at 23:07):

GF#19747

view this post on Zulip Paul Lynch (Dec 13 2018 at 19:53):

Note that the presence of group-level variables (which can reference these fields, which can reference the variables) further complicates things. I'm assuming we'll disallow cycles (in the spec, anyway) but trying to decide what needs to be run next is complicated.


Last updated: Apr 12 2022 at 19:14 UTC