Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Questionnaire with item repeats to handle questions which can have more than one answer #216

Closed
1 task done
Tracked by #523
joiskash opened this issue Feb 4, 2021 · 15 comments · Fixed by #490
Closed
1 task done
Tracked by #523
Labels
help wanted Extra attention is needed P1 High priority issue type:enhancement New feature or request

Comments

@joiskash
Copy link
Collaborator

joiskash commented Feb 4, 2021

Questionnaire.item.repeats is used to indicate that a particular question / group of questions can have multiple answers.

When rendering the questionnaire, it is up to the rendering software whether to render the question text for each answer repetition (i.e. "repeat the question") or to simply allow entry/selection of multiple answers for the question (repeat the answers).
This issue is linked to the following:

@joiskash joiskash added the type:enhancement New feature or request label Feb 4, 2021
@jingtang10 jingtang10 added good first issue Good for newcomers help wanted Extra attention is needed labels Feb 4, 2021
@epicadk
Copy link
Contributor

epicadk commented Mar 11, 2021

can I work on this?

@jingtang10
Copy link
Collaborator

I believe @joiskash was gonna take this.

@joiskash
Copy link
Collaborator Author

Yup that's right :)

@joiskash joiskash mentioned this issue Apr 5, 2021
8 tasks
@joiskash joiskash removed the good first issue Good for newcomers label May 7, 2021
@joiskash joiskash self-assigned this May 7, 2021
@joiskash joiskash removed the help wanted Extra attention is needed label May 7, 2021
@fredhersch fredhersch added the P1 High priority issue label May 11, 2021
@joiskash
Copy link
Collaborator Author

There are two main requirements as defined in the FHIR spec

  1. Multiple answers for questions
  2. Multiple sets of answers for groups.

If repeats is missing : Items are generally assumed not to repeat unless explicitly specified. Systems SHOULD always populate this value

If a question is marked as repeats=true, then multiple answers can be provided for the question in the corresponding QuestionnaireResponse. When rendering the questionnaire, it is up to the rendering software whether to render the question text for each answer repetition (i.e. "repeat the question") or to simply allow entry/selection of multiple answers for the question (repeat the answers). Which is most appropriate visually may depend on the type of answer as well as whether there are nested items.

@jingtang10 @fredhersch just wanted your views on the comment above.

que-6 | Rule | Required and repeat aren't permitted for display items | type!='display' or (required.empty() and repeats.empty())

@jingtang10
Copy link
Collaborator

I didn't know that a group can be repeated too. Interesting. It makes sense. I guess that could be handled in a separate PR or even in a separate issue if you prefer.

About the text you quoted, I think it depends on type of answer and whether nested items exist. For example, multiple choices questions with checkboxes probably don't need to repeat the question. But questions with nested items might need to have the question repeated to make it clear. We can probably depriorise this case (repeating the question) for now and focus on repeated questions without nested items.

Would this be enough as a starting point?

@fredhersch we might benefit from some mocks / UX support for this one.

@joiskash
Copy link
Collaborator Author

ok got it. Yea that makes sense and is a good starting point for this PR. Thanks @jingtang10

@joiskash
Copy link
Collaborator Author

Points to keep in mind for questionnaire items that can have more than one answer,:

  1. The ViewHolder has to initialize correctly i.e. if answers already exist , they should be displayed.
  2. The ViewHolder must be able to add new answers . Each ViewHolder must have its own mechanism to add new answers from UI. In the case of checkbox it is simple but in the case of an integer question with a slider widget it seems more complex. What will this look like? a "plus" icon?
  3. The ViewHolder must be able to remove answers. What will this look like for complex cases? a "dustbin" icon ?

@jingtang10
Copy link
Collaborator

@fredhersch on 2) and 3).

A plus icon sounds reasonable to me. Rather than a dustbin icon, can we do a minus icon? Simpler. Also can we try to use material icons?

@joiskash
Copy link
Collaborator Author

Sure I will use material design.

As discussed with Jing, I will be going ahead with the following design:
I will extract an interface on top of QuestionnaireItemViewHolder. This interface will have functions such as addAnswer, removeAnswer, updateAnswer(?) which will be implemented by each ViewHolderFactory. eg: In the case of check boxes, addAnswer removeAnswer simply means allowing multiple answers to be checked and unchecked. For more complex examples like edit text we will have to follow some UI pattern as described above.
The implications of this will be each type of view holder factory will have to handle its own case of rendering UI to allow multiple answers. The questionnaireItem.repeats will be used to check if multiple answers are allowed.

@fredhersch
Copy link
Collaborator

Could we split this into different issues:

  • Set of checkboxes
  • Multi-select dropdown with checkboxes
  • Edit text
  • Groups (of questions)
  • Nested items
  • Multiple items selected

@jingtang10
Copy link
Collaborator

@fredhersch how is "nested items" and "multiple items selected" different from the other items?

@jingtang10
Copy link
Collaborator

jingtang10 commented May 27, 2021

  • Set of checkboxes
  • Multi-select dropdown with checkboxes
  • Edit text
  • Groups (of questions)

@jingtang10
Copy link
Collaborator

I think the most important of these is the set of checkboxes. The rest will be good to have but probably not critical (yet). But this issue should be kept open for record keeping.

@fredhersch
Copy link
Collaborator

I think adding multi-select dropdown with checkboxes is a priority given the mobile surface we are supporting. The rest can be nice to haves for now.
cc: @joiskash @jingtang10

@jingtang10
Copy link
Collaborator

jingtang10 commented Aug 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed P1 High priority issue type:enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants