android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Allow rendering of complex questions with repeated answers and nested items, repeated groups and nested items

Open joiskash opened this issue 3 years ago • 1 comments

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.

Questionnaire ResponseTree_V2

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:

  1. 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.
  2. The data class questionnaireItemViewItem should probably have an optional questionnaireItemAnswerComponent
  3. New callback to handle change in a particular answer within an item to make sure the change is propagated through the tree.

cc: @jingtang10

joiskash avatar Nov 03 '21 10:11 joiskash

@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

joiskash avatar May 19 '22 08:05 joiskash

Any update on this @kevinmost? What's the ETA for this?

f-odhiambo avatar Aug 17 '22 11:08 f-odhiambo

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

jingtang10 avatar Feb 28 '23 14:02 jingtang10