FHIR Chat · Items that have both answers and nested items in Q.Response · implementers

Stream: implementers

Topic: Items that have both answers and nested items in Q.Response


view this post on Zulip Martin Grundberg (Oct 02 2019 at 08:46):

When implementing POSTing of QuestionnaireResponse resource we have come across a problem with the fact that there is a validation rule on the QuestionnaireResponse.item "+ Rule: Nested item can't be beneath both item and answer" (qrs-1). This means we cannot find a way to implement a QuestionnaireResponse that has something like this:

Have you had fever? Yes/No
-How long (if yes)?

The item "Have you had fever?" both has an answer Yes/No, and a follow up question/item nested with its own answer.

This seems to me a very common use case, how should we handle this? What is the reason for this validation rule?

view this post on Zulip Sarah Gaunt (Oct 02 2019 at 08:54):

Do you have to nest it? Can't you just leave it as a sibling and use "enable-when" to only ask the second question if the answer to the first question is "yes"?

view this post on Zulip Sarah Gaunt (Oct 02 2019 at 09:02):

See example: pasted image
We use the Group (i.e. no answer) to group sets of questions and enable-when logic to skip questions.

view this post on Zulip Martin Grundberg (Oct 02 2019 at 09:34):

@Sarah Gaunt , isn't "enable-when" applicable in a Questionnaire context, as in when filling in the questionnaire form in the UI, not when posting the response? The outcome of the questionnaire would still be an answer Yes on the parent question? Or have I missed something?

view this post on Zulip Sarah Gaunt (Oct 02 2019 at 09:44):

Maybe I'm not really understanding the question! Yes, the enable-when is on the questionnaire, but the questionnaireResponse follows the same structure as the related Questionnaire. So if you have the enable when on the question that looks back at your fever question to see if it was yes or no, then when you have the Qresponse as yes, you'd just have the "how long' question as a sibling to the fever question.

view this post on Zulip Sarah Gaunt (Oct 02 2019 at 09:47):

Is this what you are looking for: https://www.hl7.org/fhir/questionnaireresponse-example-bluebook.xml.html - see the end of that example with the <linkId value="hepBgiven"/>

view this post on Zulip Sarah Gaunt (Oct 02 2019 at 09:48):

NOTE (nothing to do with your question!) Gotta love our example writers - hahaha:

<item>
        <linkId value="abnormalitiesAtBirth"/>
        <text value="Abnormalities noted at birth"/>
        <answer>
         <valueString value="Already able to speak Chinese"/>
     </answer>
 </item>

view this post on Zulip Tim Berezny (Oct 02 2019 at 12:26):

You can have questions with nested answers in QuestionnaireResponse, take a look at some of the examples here:
https://questionnaireresponse-parser.herokuapp.com/

view this post on Zulip Lloyd McKenzie (Oct 02 2019 at 14:35):

If you have an answer, you must nest children within the answer. (That's because if you have an answer that can repeat, nested questions are answered for each answer.)

view this post on Zulip Martin Grundberg (Oct 30 2019 at 13:36):

@Lloyd McKenzie , what if we have a use case where the child question is not related to the parent item answer but instead only related to the item?

We at least support forms like this in our EHR which we now cannot map to FHIR due to this validation. I dont see any reasons why we really shouldnt allow it? Removing the validation would still allow you to nest your individual items to each item.answer?

view this post on Zulip Lloyd McKenzie (Oct 30 2019 at 13:37):

We have the ability to be dependent on whether an answer exists at all. Other than that, I don't understand how a dependency could exist on an item. Can you explain further?

view this post on Zulip Martin Grundberg (Oct 30 2019 at 13:49):

Is it correct to see it as you should only have to type of parent/child relationships?
1) Item is a header with no answer, and it contains child items
2) Child item is enabled only for a specific answer for parent item

And a third case is fundamentally incorrect, so it should be prevented with a validation rule:
3) Item has an answer (or you can see it as header has an answer), and it also has child items that have no strong dependency to the parent answer, but they instead have a dependency (of some sort) to the parent question?

To be honest, I cant come up with what an example actual questionnaire would be, but this is supported in our EHR, and I dont really see why it shouldnt be allowed.

What is the benefit of this validation?

view this post on Zulip Martin Grundberg (Oct 30 2019 at 15:54):

I spoke briefly to a colleague who has more knowledge about the way our customers (everything from small GP clinics to large university hospitals) set up their questionnaire forms.

She gave an example where they would have a question item like "Coronary" where they could write something a bit more generic, probably in free text. Then they would have more specialized sub-items/child questions to "Coronary" where those who want to fill in more specialized information could do that. It could be specialists that would always want to be more granular, or it could be that the use case (patient case) dictates whether you would want to use those more specialized items.

For this use case, the child items do not depend on the item.answer, but instead on the item, and it is also relevant for them to record both on item.answer and item.item.answer.

I can see an argument for "shouldnt this be a header with no answer" or "shouldnt this use enableWhen", but I also see no benefit of restricting this use case. I feel this validation should lie in a profile instead of the base resource. Especially with the overall strategy of being very careful with forcing implementers in one direction or the other in the base resources (such as almost never having cardinality 1..x).

view this post on Zulip Lloyd McKenzie (Oct 30 2019 at 16:12):

Can you be more specific about what you mean by a dependency on a parent "question" as opposed to an answer?
In the example given, what is the dependency? If the parent question is free text, what determines whether the child questions are enabled or not? Just whether the parent has an answer? (Because if so, that's supported)

view this post on Zulip Martin Grundberg (Oct 30 2019 at 16:37):

Apologies for being unclear :)

The child question is always enabled. It is independent of the answer of the parent question, and it is also independent of whether there is an answer to the parent at all.

view this post on Zulip Lloyd McKenzie (Oct 30 2019 at 17:56):

Why is it treated as a child?

view this post on Zulip Lloyd McKenzie (Oct 30 2019 at 17:57):

If the parent item is a group, then the child questions will automatically be displayed. If the parent is a question, then the child questions are displayed for each answer selected for the parent. If the parent is a question and you want the children displayed regardless of whether the parent is answered, then just don't make them children

view this post on Zulip Lloyd McKenzie (Oct 30 2019 at 17:58):

Alternatively, treat the parent as a group and make the first question a simple "details" question or something like that.

view this post on Zulip Lee Surprenant (Oct 30 2019 at 18:19):

[Deleted] <- had accidentally posted in wrong channel and couldn't find how to delete it, sorry


Last updated: Apr 12 2022 at 19:14 UTC