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

Pack repeated groups into answers #1936

Merged
merged 12 commits into from
Mar 29, 2023

Conversation

jingtang10
Copy link
Collaborator

@jingtang10 jingtang10 commented Mar 24, 2023

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

Fixes #1900

Description
In our in-memory representation of QuestionnaireResponse, we nest repeated groups under the parent questionnaire response item as individual answers. However user-provided qustionnaire response JSON has repeated groups flattened as repeated items. To make the QuestionnaireViewModel accept such JSON, we need to pack the repeated groups under the same questionnaire response item. Additionally, when questionnaire response is returned to the application, repeated groups need to be unpacked again.

We created two extension functions QuestionnaireResponse.packRepeatedGroups and QuestionnaireResponse.unpackRepeatedGroups for this.

Create packRepeatedGroup and unpackRepeatedGroup functions

Alternative(s) considered
NA

Type
Bug fix

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • 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).

@jingtang10
Copy link
Collaborator Author

@kevinmost @omarismail94 @nsabale7 can you please review? thanks!

Copy link
Contributor

@kevinmost kevinmost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks really good to me

@jingtang10
Copy link
Collaborator Author

updated description.

Copy link
Contributor

@omarismail94 omarismail94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add an Espresso test to verify that a user provided QR that gets answered is saved? i.e. mimicing the issue that Nitin had

@jingtang10
Copy link
Collaborator Author

jingtang10 commented Mar 29, 2023

Do we need to add an Espresso test to verify that a user provided QR that gets answered is saved? i.e. mimicing the issue that Nitin had

i think the QVM test covers this sufficiently.

i believe espresso tests (and any other integration tests) should cover broad cases. corner cases should be covered by unit tests.

EDIT: spelling

@jingtang10
Copy link
Collaborator Author

thanks both @kevinmost @omarismail94.

omar - replied to your comments. ptal.

Copy link
Contributor

@omarismail94 omarismail94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jing, great change!!

@jingtang10 jingtang10 merged commit 256ab75 into google:master Mar 29, 2023
@jingtang10 jingtang10 deleted the qr-repeated-group branch March 29, 2023 14:52
LZRS added a commit to opensrp/fhircore that referenced this pull request May 15, 2024
pld added a commit to opensrp/fhircore that referenced this pull request Jun 21, 2024
before validation
borrows from sdk: google/android-fhir#1936

Co-authored-by: Sebastian <36365043+SebaMutuku@users.noreply.github.com>
Co-authored-by: Peter Lubell-Doughtie <peter@ona.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repeated Group: Mapping fails when questionaire response is passed as argument.
3 participants