Stream: implementers
Topic: Questionnaire itemControl on display items
Alexander Henket (Dec 16 2021 at 21:46):
We have markup in our display items. R4 cannot handle any markup in item.text. For that we use the itemControl extension. The itemControl extension goes onto a child item of the item it should control. When the item is a display item however, invariant que-1 kicks in:
que-1 Rule Questionnaire.item Group items must have nested items, display items cannot have nested items
Are we using the extension in the wrong way or did que-1 just never anticipate itemControl?
{
"linkId": "2.16.840.1.113883.2.4.3.11.60.114.2.1.2--20210603151524",
"definition": "http://decor.nictiz.nl/fhir/StructureDefinition/2.16.840.1.113883.2.4.3.11.60.114.4.2--20210603160554#2.16.840.1.113883.2.4.3.11.60.114.2.1.2--20210603151524",
"text": "instructies",
"type": "display",
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": [
{
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "help",
"display": "Help-Button"
}
],
"text": "Help-Button"
}
]
}
],
"linkId": "2.16.840.1.113883.2.4.3.11.60.114.2.1.2--20210603151524-help",
"text": "Selecteer het antwoord dat het beste beschrijft hoe u zich de afgelopen week heeft gevoeld.(Slechts één antwoord per vraag)",
"_text": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/rendering-xhtml",
"valueString": "<div>Selecteer het antwoord dat het beste beschrijft hoe u zich de <strong>afgelopen week</strong> heeft gevoeld.<br/>(Slechts één antwoord per vraag)</div>"
}
]
},
"type": "display"
}
]
},
Lloyd McKenzie (Dec 16 2021 at 23:14):
You're using it wrong :) The itemControl extension needs to appear on the 'display' item itself, not a nested item. You can't nest one display inside another. If you have multiple displays, they have to be sequential.
Alexander Henket (Dec 17 2021 at 08:08):
I'm trying to wrap around how to apply what you are saying. The way I understand the itemControl is that if you want a help button/text on something, you need to create child item that you mark with that extension. That is what I did above. If I make the item marked with itemControl a sibling of the thing it needs to be a Help text on, then how does one know what it belongs with?
LHC Forms renders the item[type = display] + child help text exactly as I expect. LHC Forms does not render the Help text at all when I make them siblings. I think I would agree with LHC here. What do I miss?
Lloyd McKenzie (Dec 17 2021 at 15:50):
There's no mechanism to have help text 'on' a display item. It can be before or after, but not 'inside'.
Alexander Henket (Dec 17 2021 at 22:10):
So this LHC feature is wrong then? The presumed way to display it, is attached to the question mark icon also visible in the screenshot
image.png
Brian Postlethwaite (Dec 17 2021 at 23:06):
For using markdown on the text use the markdown extension on the text rather than item control.
Brian Postlethwaite (Dec 17 2021 at 23:07):
Alex, that help control thing is correct in lhcforms .
Lloyd McKenzie (Dec 18 2021 at 03:08):
LHC forms is incorrect. The rule is clearly that display items cannot contain nested items. (At least for R4 - we could theoretically relax and allow nested display items in R5+ if someone were to submit a change request.) @Paul Lynch
Alexander Henket (Dec 19 2021 at 14:33):
The usual case is a question and an explanation thereof. The question normally is plain text, but could have markup in which case item.text + markdown extension could suffice. The additional explanation though, cannot really go anywhere else than under itemControl. All works fine for items other than display. For display items, LHC Forms still works fine, but the core invariant says it is wrong.
LHC Forms does not support the item.text.extension for markdown unfortunately (I put in html there as LHC Forms does not do markdown at all). Since LHC Forms is the only viable open source implementation of Questionnaire out there, that makes being LHC Forms compatible more important than being FHIR compatible. I do we get those two goals to align?
Lloyd McKenzie (Dec 19 2021 at 16:04):
If you have a question, then it's not a display item, it's a question. The only thing we prohibit is display under display.
Lloyd McKenzie (Dec 19 2021 at 16:05):
You're free to have markdown on the text of a question or a display item.
Brian Postlethwaite (Dec 19 2021 at 20:29):
This isn't helped by the tooltip text moving from the extension as it was back in DSTU2 (don't recall stu3) and to a child item. Means you lost the ability to have tooltip text on display items.
Brian Postlethwaite (Dec 19 2021 at 20:29):
(and I guess help text too?)
Lloyd McKenzie (Dec 19 2021 at 22:01):
Correct. We could relax the rule in R5 to allow displays to have child displays (do we limit how deep?), but it's definitely prohibited in R4. Feel free to submit a change request.
Paul Lynch (Dec 20 2021 at 15:18):
I would like to see an example of a questionnaire where it makes sense to have help text on a display item (as opposed to a question or group).
Paul Lynch (Dec 20 2021 at 15:22):
Alexander Henket said:
LHC Forms does not support the item.text.extension for markdown unfortunately (I put in html there as LHC Forms does not do markdown at all). Since LHC Forms is the only viable open source implementation of Questionnaire out there, that makes being LHC Forms compatible more important than being FHIR compatible. I do we get those two goals to align?
You can submit a request for markdown support here: https://github.com/lhncbc/lforms/issues. Or, you can submit a pull request for markdown support (though I suggest waiting until version 30 is out of beta, as we are reorganizing the code).
Brian Postlethwaite (Dec 24 2021 at 08:14):
I just might do that PR...
Brian Postlethwaite (Dec 24 2021 at 08:20):
With the right lib, that's no harder than the HTML extension. (which is how I've done it)
Last updated: Apr 12 2022 at 19:14 UTC