FHIR Chat · variable expressions in the IG · IG creation

Stream: IG creation

Topic: variable expressions in the IG


view this post on Zulip Diane (Feb 09 2022 at 21:48):

Our questionnaires have a parent questionnaire and child questionnaires. The child questionnnaires contain a variable that uses an expression to get the data from the parent questionnaire response.

When publishing the IG, can the variable expression refer to a generic example FHIR server? Or does it need to be a live FHIR server so that the expression actually brings back data and the validator doesn't think it is a broken link?

 "extension": [ {
    "url": "http://hl7.org/fhir/StructureDefinition/variable",
    "valueExpression": {
      "description": "response to get the data from",
      "name": "dataFromTheParentQR",
      "language": "application/x-fhir-query",
      "expression": "https://www.examplefhirserver.com/hapi-fhir-jpaserver/fhir/QuestionnaireResponse/parentQuestionnaireResponse1234"
    }
  }

view this post on Zulip Lloyd McKenzie (Feb 09 2022 at 23:50):

The expression needs to be a live query. If it's 'relative', then it'll run on the same server the QuestionnaireResponse is stored on.

view this post on Zulip Diane (Feb 10 2022 at 04:23):

For the IG, we can set it up as a relative reference like: QuestionnaireResponse/parentQuestionnaireResponse1234

The questionnaire response ID itself (parentQuestionnaireResponse1234), is dynamic. Our software application wipes out parentQuestionnaireResponse1234 and replaces it with the actual questionnaire response ID number (eg. 6789) before it calls the script to render the next questionnaire. Since the software application is not part of the IG, do we just hard-code with a valid example such as QuestionnaireResponse/6789?

For a relative reference, how/where do we tell the IG what FHIR server to use? Do we use a test server like hapi.fhir.org? Do we put that in the variable expression instead of using a relative expression?

"expression": "http://hapi.fhir.org/baseR4/QuestionnaireResponse/2804160"

Do we create another variable for the FHIR server?

view this post on Zulip Lloyd McKenzie (Feb 10 2022 at 04:30):

That's not kosher. The reference is expected to exist and wiping it wouldn't be appropriate. If you want to have a variable passed in to your processing engine, then just declare it as a 'launch-context' extension. It'll be up to the form renderer to support the parameter and pass it (or not). Alternatively, combine the parent and children into a single Questionnaire using the assemble operation and then everything you need will be right there. (You can use page groups if you want it to 'appear' as multiple forms.)

view this post on Zulip Lloyd McKenzie (Feb 10 2022 at 04:30):

That latter approach is more likely to be widely supported.

view this post on Zulip Diane (Feb 10 2022 at 18:01):

The reason right now that we are doing the

"name": "dataFromTheParentQR",
 "language": "application/x-fhir-query",
 "expression": "https://www.examplefhirserver.com/hapi-fhir-jpaserver/fhir/QuestionnaireResponse/parentQuestionnaireResponse"

is because it is a workaround. The launchContext only allows certain resource types (see https://build.fhir.org/ig/HL7/sdc/ValueSet-launchContext.html) to be passed. This issue is discussed in
https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/launchContext.20off-list.20.22names.22

If this issue is resolved, then I would like to convert our questionnaires to the "launchContext" way of doing things so that it is in alignment with FHIR standards.

view this post on Zulip Lloyd McKenzie (Feb 10 2022 at 21:08):

LaunchContext has an extensible binding, so you can define your own - just be aware they won't necessarily be widely supported


Last updated: Apr 12 2022 at 19:14 UTC