FHIR Chat · Custom Business Rules · questionnaire

Stream: questionnaire

Topic: Custom Business Rules


view this post on Zulip Rajesh B (Jan 14 2021 at 17:57):

I would like to see if there is any standard defined to include multiple custom business rules and apply on item level and at Questionnaire level .
Example: 1. If Patient is living in NewYork then I need to show or hide the item. (The patient living location is not available in Questionnaire)

  1. I need to show set of items related to pregnancy if Patient Gender is Female and age is greater than 18. Both Gender and Age won't be available inside Questionnaire, how ever the data is available in the respective application when the QuestionnaireResponse is collected.

Please note that, I have explored EnableWhen and EnableWhenExpression extensions, both of them works based on FHIR Path expressions, and the expression will be evaluated as and when we are filling out Questionnaire based on answers selected. In our case, we would like to define some rules at Questionnaire, item level and they should be evaluated at runtime(NOT based on the answers selected from Questionnaire).

view this post on Zulip Brian Postlethwaite (Jan 14 2021 at 18:03):

The EnableWhenExpression is what you're looking for, which are evaluated at runtime, not sure what you mean in the last sentance.
The expression can refer to anything, not just results to questions.

view this post on Zulip Brian Postlethwaite (Jan 14 2021 at 18:06):

To do that you would need to include the pre-population context information to be provided into the rendering so that the information was made available to the form as a context variable, which is then available to the fhirpath engine.

view this post on Zulip Lloyd McKenzie (Jan 14 2021 at 18:54):

Note that enableWhen is driven only by questions answered in the context of this Questionnaire. If you're wanting to display information conditionally based on data elsewhere in the patient's record, you could have auto-populated hidden questions. You could also use the enableWhenExpression extension to make things conditional on a direct query, but the challenge there is that the validity of the questionnaire response could change over time. E.g. a QuestionnaireResponse filled out a year ago might now say it's invalid because the patient no longer resides in New York, even though they might have at the time the response was completed.

view this post on Zulip Rajesh B (Jan 14 2021 at 20:27):

Hi Lloyd and Brian,

Thanks for your response.
Can you please share any references/examples based on your response.

view this post on Zulip Paul Lynch (Jan 14 2021 at 23:22):

For those specific examples, you might use launchContext to get a "patient" variable loaded with the Patient resource, and then use that variable in an expression (variable and/or enableWhenExpression) to get the address, gender, or birthDate. An example of that is https://lforms-smart-fhir.nlm.nih.gov/v/r4/fhir/Questionnaire/54127-6-x

view this post on Zulip Sravanti Cherukuri (Jan 19 2021 at 17:50):

Hi Paul,
LaunchContext only supports 4 resources like Patient,encounter,location and user.If we prefer to go with custom resources.How can we implement.Will there be any other approach alternative to launchcontext

view this post on Zulip Paul Lynch (Jan 20 2021 at 00:12):

@Sravanti Cherukuri Please see the resolution of https://jira.hl7.org/browse/FHIR-29664, which is approved but not yet applied, and which changed launchContext a bit.


Last updated: Apr 12 2022 at 19:14 UTC