android-fhir
android-fhir copied to clipboard
Allow rendering of complex questions with repeated answers and nested items, repeated groups and nested items
Is your feature request related to a problem? Please describe. Currently the SDC library supports repeated answers, but not items nested in answers that can repeat. Also full support for repeated answers is not yet available in the SDC library
Describe the solution you'd like To support the spec completely we need to be able to handle all the questionnaireItem types that are shown in the diagram bellow.
linkId | item.repeats | item.type == group | hasNestedItem | isSupported |
---|---|---|---|---|
item_1 | true | false | true | false |
item_7 | true | false | false | true |
item_2 | false | false | false | true |
not in image | false | false | true | true |
item_group_3 | false | true | true | true |
item__group_4 | true | true | true | false |
One important thing to note in the above table is that if there are nested items within unsupported types, then they will automatically not be supported. Also the behavior of the library with a questionnaire which contains unsupported types is unknown.
Additional context This also requires some thinking from the UX/UI point of view. eg: How do we handle a checkbox type with nested items? do we keep extra buttons to clear the nested answers/ edit nested items? What will the view look like?
Would you like to work on the issue? I had started some initial work . Below are the following suggestions:
- Change the key of the linkIdToQuestionnaireResponseItemMap and maybe the linkIdToQuestionnaireItemMap to a data class that will contain information like how many repeated answers/ items are currently in the item.
- The data class questionnaireItemViewItem should probably have an optional questionnaireItemAnswerComponent
- New callback to handle change in a particular answer within an item to make sure the change is propagated through the tree.
cc: @jingtang10
@RaaziaTarique I had created this diagram to get a hold of the tree structure of the questionnaireResponse for various types of questionnaireItem. It maybe of use while you implement the refactoring in #1369
Any update on this @kevinmost? What's the ETA for this?
I think we should focus on rendering of nested questions under repeated answers in this ticket. Repeated groups are handled by kevin in a different issue #726