Stream: questionnaire
Topic: Nesting & repeats
Ivan Dubrov (Nov 30 2020 at 17:45):
Just to be clear I understanding relationship between items, answers and linkIds correctly.
Would it be valid to say that each questionnaire item would map to exactly one questionnaire response (inside a current parent) _except_ the case where questionnaire item is a repeatable group (in which case multiple questionnaire response items could be present in the same parent)?
Pseudocode:
for (let item in parentQuestionnaireItem.item) {
const responseItems = parentQuestionnaireResponse.item.filter(qr => qr.linkId === item.linkId);
// responseItems will have length 0 or 1 for all non-groups.
}
?
Lloyd McKenzie (Nov 30 2020 at 18:35):
Or anything that appears inside a repeatable group
Ivan Dubrov (Nov 30 2020 at 18:43):
But those will be stored inside QuestionnaireResponse items of each group repetition? In other words, in the pseudocode above, those will be in different "parentQuestionnaireItem"s (one parent for each group repetition)?
Lloyd McKenzie (Nov 30 2020 at 19:03):
Every QuestionnaireResponse.item will have a linkId that corresponds to an item in the Questionnaire. linkIds might be duplicated in the QuestionnaireResponse for any item that corresponds to a repeating group or appears nested within a repeating group.
Last updated: Apr 12 2022 at 19:14 UTC