Stream: implementers
Topic: Nested QuestionnaireResposne items
Josh Mandel (Aug 20 2016 at 12:57):
Can someone explain to me how the following:
QuestionnaireResponse.item.answer.item
QuestionnaireResponse.item.item
are both different/necessary, and how each would be used?
Josh Mandel (Aug 20 2016 at 12:59):
Also, why is QuestionnaireResponse.item.linkId
optional and missing in the primary example?
Brian Postlethwaite (Aug 20 2016 at 13:02):
The linkId is optional as some don't care about linking the values to the questions (such as going into a PDF or non structured result)
(and yes, I think its pointless to do this without those too)
Brian Postlethwaite (Aug 20 2016 at 13:02):
(just rechecking the spec on the answer.item one - assuming you were meaning the current STU3 ballot release.)
Josh Mandel (Aug 20 2016 at 13:03):
Wait, so you @Brian Postlethwaite agree that it's pointless to omit linkId
?
Brian Postlethwaite (Aug 20 2016 at 13:04):
I sure do (agree that linkid is a must).
Can't relate questions back to answers without them (unless all questions were mandatory, and order important, but don't think is very safe without it)
Josh Mandel (Aug 20 2016 at 13:04):
And it's not a huge effort to include them. OK, ballot comment :-)
Josh Mandel (Aug 20 2016 at 13:06):
On the nested answers.items, .. I think it has something to do with accommodating repeating answers with groups below them -- but I don't know why we need to two recursive embedding points.
Brian Postlethwaite (Aug 20 2016 at 13:08):
Agreed. I'll have to go back and check what I did in my STU3 port of that stuff from May.
Josh Mandel (Aug 20 2016 at 13:09):
Also, with linkId
: is it incorrect to flatten out a QuestionnaireResponse (from a Questionnaire with nested/grouped questions) and just tie them back with linkId? Just trying to get a handle on the expected Reponse-processing logic.
Josh Mandel (Aug 20 2016 at 13:11):
Also, can anyone explain what the following means, in terms of concrete changes? I'm hoping to understand how QuestionnaireResponse works.
QuestionnaireResponse is one of the Event resources in the FHIR Workflow specification. As such, it is expected to be adjusted to align with the event workflow pattern. Any concerns about performing such alignment are welcome as ballot comments and/or tracker items.
Brian Postlethwaite (Aug 20 2016 at 13:21):
No, don't flatten them out, will make things hard to reassociate grouped items, such as rows in a table (or worse tables on repeatable sections)
Brian Postlethwaite (Aug 20 2016 at 13:21):
(Sorry for the double negative there)
Brian Postlethwaite (Aug 20 2016 at 13:22):
I haven't looked into that part yet, but wouldn't expect any actual change to the Q/QR resources.
Josh Mandel (Aug 20 2016 at 13:24):
OK, so I should ignore the warning note? @Lloyd McKenzie do you agree with this assessment? Any "adjusting" would be good to know about in advance.
Brian Postlethwaite (Aug 20 2016 at 13:33):
I would very much like to know if any further adjustment was going to occur...
Grahame Grieve (Aug 20 2016 at 13:36):
I think linkId is optional to support capturing of legacy questionnaires
Brian Postlethwaite (Aug 20 2016 at 13:44):
If I was creating those, I'd just put in a sequential value. But understand the point.
Brian Postlethwaite (Aug 20 2016 at 13:44):
We can always profile it up right.
Lloyd McKenzie (Aug 20 2016 at 19:18):
The reason for dual nesting is that groups need to have nested items (and won't have answers), while questions with nesting may have nesting inside each answer
Lloyd McKenzie (Aug 20 2016 at 19:19):
linkId was indeed optional to support legacy, though we've discussed in the past whether it would be that hard to invent a linkId based on question sequence/nesting or something like that. So I'd be ok with making it mandatory.
Josh Mandel (Aug 21 2016 at 04:33):
This double nesting is basically impossible for me to understand. Why can't we just have nesting in answere.item?
Josh Mandel (Aug 21 2016 at 04:35):
"groups need to have nested items" -- but isn't this confusing the requirements of QuestionnaireResponse with the requirements of Questionnaire?
Josh Mandel (Aug 21 2016 at 04:37):
In other words, if you need to represent nested responses, use answer.item. You can do this even if the answer is blank.
Josh Mandel (Aug 21 2016 at 04:37):
But having two points of recursive nesting is beyond my comprehension.
Josh Mandel (Aug 21 2016 at 04:38):
@Pascal Pfiffner do you have experience working with nested items here?
Lloyd McKenzie (Aug 21 2016 at 07:06):
The response mirrors the questionnaire. So if the questionnaire has a repeating group with 5 questions, then the QuestionnaireResponse will also have a repeating group item with 5 question items (and those questions would have their respective answers). There's no "answer" at the group level to nest questions within.
Pascal Pfiffner (Aug 21 2016 at 08:54):
A) I'm also not sure I understand the difference between QuestionnaireResponse.item.answer.item
and QuestionnaireResponse.item.item
, the samples don't manage to enlighten me, I'd have to invest more time than I have ATM.
Pascal Pfiffner (Aug 21 2016 at 08:56):
B) I'm not sure making linkId
mandatory is so clear-cut. Groups can also be used for logic reasons, e.g. if I'm going to skip 3 questions after a certain answer, I'll group these three questions and set the group's enableWhen
accordingly, I won't care for linkId
.
Lloyd McKenzie (Aug 21 2016 at 13:36):
Why would you not have a linkId on the group?
Pascal Pfiffner (Aug 21 2016 at 14:55):
In a questionnaire with 4 questions, where I'll only ask questions 2, 3 and 4 if, say, the answer is YES to the first one, I'm still only interested in the 4 questions, I don't really care that questions 2, 3 and 4 are in a group.
Lloyd McKenzie (Aug 21 2016 at 18:31):
But if the group repeats, you have to care.
Josh Mandel (Aug 22 2016 at 11:21):
@Lloyd McKenzie I'm still not getting it. Which by itself probably means this structure is too complicated. Why can't there be a single recursion point (embedded within item.answer, recognizing that sometimes item.answer.value could be missing)?
Josh Mandel (Aug 22 2016 at 11:24):
Otherwise put: How can we say that the current QuestionnaireResponse mirrors Questionnaire when the former has two recursion points and the latter has just one?
Brian Postlethwaite (Aug 22 2016 at 11:38):
I'd actually suggest using the one outside the answer, which means you don't need the answer for the replicating group.
I must create some examples...
Josh Mandel (Aug 22 2016 at 11:40):
Agreed, @Brian Postlethwaite -- after reading the spec carefully, I was just returning here to make this same point!
Josh Mandel (Aug 22 2016 at 11:41):
And then the "mirrored" structure is clear.
Josh Mandel (Aug 22 2016 at 11:42):
@Lloyd McKenzie if there is a specific case where this breaks down, could you sketch an example to explain?
Pascal Pfiffner (Aug 22 2016 at 12:44):
But if the group repeats, you have to care.
Sure, then I do. But in the questionnaires I've used so far that was never the case. However, in questionnaires of 30-40 questions, I have easily 4 or 5 non-repeating groups that merely exist to skip two or three questions. So if linkId
becomes mandatory I'll be creating random group identifiers that nobody cares about for most questionnaires.
Brian Postlethwaite (Aug 22 2016 at 12:45):
And none of those questions are tables? (that's the most common case I see)
Josh Mandel (Aug 22 2016 at 13:12):
Can you explain what you mean by "questions" as "tables", @Brian Postlethwaite ?
Brian Postlethwaite (Aug 22 2016 at 13:14):
Say you have a questionnaire that has 2 pages (groups) and on page 2 there is a table of data.
The table is therefore a repeating group within another group.
Pascal Pfiffner (Aug 22 2016 at 13:14):
I've mostly been using standardized questionnaires like WPAI and SF-36. The only times those have repeat
is for multiple choice questions.
Josh Mandel (Aug 22 2016 at 13:16):
Wait, why is the table a "repeating group"?
Brian Postlethwaite (Aug 22 2016 at 13:20):
A repeating group can be rendered as a table, or just a repeating section, like this example (sorry, DSTU2 format)
http://smartq.azurewebsites.net/Home/Survey?questionnaireId=https%3A%2F%2Fsqlonfhir-dstu2.azurewebsites.net%2Ffhir%2FQuestionnaire%2Fsample-nested-group&fhirServiceUrl=https%3A%2F%2Fsqlonfhir-dstu2.azurewebsites.net%2Ffhir%2F
Brian Postlethwaite (Aug 22 2016 at 13:21):
(Need to get my editor updated to STU3)
Lloyd McKenzie (Aug 22 2016 at 17:23):
@Josh Mandel Nesting questions inside an "answer" for a group that can't possibly have an answer would be very weird. It would also change the semantics of the "answer" element. @Pascal Pfiffner yes, you'd have to make up an id for the group. And you'd have to make up an id for all of your embedded instruction text too. That's what making linkId mandatory would mean. If we leave it that linkId is only required for those things that your system personally cares about, then it no longer works as an always present, generic referencing mechanism
Josh Mandel (Aug 22 2016 at 17:28):
@Lloyd McKenzie Can you explain why (as @Brian Postlethwaite suggested) we couldn't just get by with QuestionnaireResponse.item.item
, and eliminate QuestionnaireResponse.item.answer.item
? If this doesn't work, could you provide a specific example to help @Brian Postlethwaite and me understand the design choice? Currently we don't get it.
Pascal Pfiffner (Aug 22 2016 at 17:34):
@Lloyd McKenzie Alright, point taken.
Pascal Pfiffner (Aug 22 2016 at 17:34):
If we have a repeating question that works as a multiple choice question (e.g. asking for which meds a patient is taking), would I repeat that in item.item
or item.answer.item
?
Lloyd McKenzie (Aug 22 2016 at 21:47):
Question 1: Which of the following diseases do you have? (type = open-choice); nestedQuestion 1.1: "When was the onset of the disease?"
QuestionnaireResponse: { linkId=1, answer [ {answerValue=diabetes, item { linkId=1.1, answer= [ {answerValue=childhood} ] } }, {answerValue=heartDisease, item {linkId=1.1, answer=[ {answerValue=adult} ] } } ] }
Brian Postlethwaite (Aug 22 2016 at 23:10):
In that case the item.answer.item could easily fit into the item.item
Lloyd McKenzie (Aug 23 2016 at 00:43):
How? item.item wouldn't associate childhood with the diabetes answer as opposed to heartDisease. You'd end up with two answers, then two child questions
Brian Postlethwaite (Aug 23 2016 at 00:48):
if the question repeated, repeat at that point, not the answer point.
Josh Mandel (Aug 23 2016 at 02:10):
I'm with Brian -- I can't see what having a separate recursion point adds in this scenario (and it creates confusion). The top question just repeats, and a linkId would make the correspondence clear.
Brian Postlethwaite (Aug 23 2016 at 02:13):
+1 on that Josh.
Lloyd McKenzie (Aug 23 2016 at 03:19):
Why echo the question text for each repetition?
Brian Postlethwaite (Aug 23 2016 at 03:26):
then why have the item without the answer?
(I think we only need/want one of them) or you need to document more clearly which types should use which nesting)
Lloyd McKenzie (Aug 23 2016 at 03:44):
If you have a group that contains another group, there's no answer to do the containing
Lloyd McKenzie (Aug 23 2016 at 03:44):
We can add a constraint about which gets used when
Lloyd McKenzie (Aug 23 2016 at 03:45):
(Submit a change request :))
Josh Mandel (Aug 23 2016 at 16:13):
I still can't understand why we'd have two places.
Josh Mandel (Aug 23 2016 at 16:57):
I submitted GF#10481 to propose eliminating
QuestionnaireResponse.item.answer.item
(@Brian Postlethwaite please comment there if you agree)
Last updated: Apr 12 2022 at 19:14 UTC