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

Feature to review question/answers in list view in Questionnaire Fragment

Open nsabale7 opened this issue 2 years ago • 7 comments

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #227

Description Feature to review question/answers in list view from questionnaire and questionnaireResponse

Alternative(s) considered Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type Feature

Screenshots (if applicable)

Checklist

  • [x] I have read and acknowledged the Code of conduct.
  • [x] I have read the Contributing page.
  • [x] I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • [x] I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • [x] I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • [x] I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • [x] I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

nsabale7 avatar Apr 19 '22 12:04 nsabale7

This is fantastic work. Thanks both @nsabale7 and @joiskash!

One thought - shouldn't review mode simply add a new review page to the questionnaire, instead of changing the behavior of the entire questionnaire fragment?

So what I was imagining:

* if QuestionnaireFragment is launched with the flag turned off, everything is the same as before, i.e., showing either single page questionnaire, or paginated questionnaire

* if QuestionnaireFragment is launched with the flag turned on, there will be a new reivew page after the single-page or multi-page questionnaire, which allows the user to either submit the questionnaire or go back to the questionnaire to edit (intially could just go back to the first page in our v1)

is this better/worse than the current design? i feel it's probably closer to what developers want? I don't really want developers to have to create another questionnaire fragment when using review mode.

Thanks @jingtang10 !

The current implementation is as per our discussion with @dubdabasoduba :

  1. Review mode will always be enabled. If the flag is passed as false when the questionnaire fragment is launched, then on the last page, the next page button will turn into a review button. On pressing the review button all the view holders in the recyclerview are replaced by a simple question-answer view holder and enables the edit button. If the edit button is pressed, the view navigates back to the last page.
  2. If the flag is true, then the questionnaire fragment will launch directly into the review mode with the edit button enabled. The edit button behavior is the same as described above.

Based on the discussion with @dubdabasoduba and our team, it seems like review mode at the end of the questionnaire is a requirement i.e. accurate data capture cannot be done without review. Developers do not have to create a new fragment to get into review mode. The current fragment can switch between the two modes based on button press.

  1. Review button on the last page
  2. Edit button to get back to data capture mode.

@nsabale7 please add a video of this behavior so that it is clear.

joiskash avatar Apr 26 '22 12:04 joiskash

https://user-images.githubusercontent.com/82660329/165461874-cb134d62-b124-439d-b9ba-2021297e6e7f.mp4

This video shows normal flow where user can do data collection and then review.

nsabale7 avatar Apr 27 '22 07:04 nsabale7

https://user-images.githubusercontent.com/82660329/165462203-4f3caf51-95c4-4a9c-a19d-7a83f646a91b.mp4

This video shows directly the review feature and then go into edit feature.

@jingtang10

nsabale7 avatar Apr 27 '22 07:04 nsabale7

@jingtang10 we have two things that we need your help with

  1. Passing the context to QuestionnaireItemViewItem to fetch string resources for the NOT_ANSWERED string

yeah as we discussed this is fine.

  1. Fetching the current questionnaire state to pass to the QuestionnaireReviewPageItemAdapater

i don't really undrestand this. why does the adapter need to fetch the state? it shouldn't do that. the items should include all the info for the ui...

jingtang10 avatar Jul 01 '22 17:07 jingtang10

@jingtang10 I have added reviewMode flag in the questionnaireStateFlow which helps to decide the adapter for submitting state items. Please review new changes.

nsabale7 avatar Jul 06 '22 11:07 nsabale7

@nsabale7 can you sync please - we made some changes in the view model. thanks!

jingtang10 avatar Jul 22 '22 18:07 jingtang10

@nsabale7 can you sync please - we made some changes in the view model. thanks!

Sure @jingtang10, thanks.

nsabale7 avatar Jul 25 '22 11:07 nsabale7

https://user-images.githubusercontent.com/82660329/186142611-728a3c71-3215-456a-be43-b1f4f0a72419.mp4

nsabale7 avatar Aug 23 '22 11:08 nsabale7

Looks good @nsabale7

In your recording I noticed that the "subtitle/instructional" text field is showing up on the review screen. Example: "select one" or "check all that apply". Is this intentional?

shelaghm avatar Aug 23 '22 22:08 shelaghm