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

Repeated Group: Fix Definition based extraction for multiple answers #1911

Merged
merged 11 commits into from
Dec 8, 2023

Conversation

nsabale7
Copy link
Collaborator

@nsabale7 nsabale7 commented Mar 14, 2023

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

Fixes #1794

Description
Iterating only questionnaire response items and finding the corresponding questionnaire item, as repeated groups answers create multiple response items with same linkId.

Alternative(s) considered
Another alternative can be to create a mapOf<linkId, QuestionnaireItemComponent> so that it can be used to find by linkId.
val currentQuestionnaireItem = questionnaireItemList.find { it.linkId == currentQuestionnaireResponseItem.linkId } can be replaced by map.

Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)
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).

Copy link
Collaborator

@joiskash joiskash left a comment

Choose a reason for hiding this comment

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

We discussed this solution offline, it makes sense to iterate over the response and then fetch the corresponding questionnaire item since initially this was written assuming that there will be no repeated items. I was just wondering if it may help in performance if we have a map linkId to questionnaireItem instead of doing a find to get the item.
cc: @omarismail94 @santosh-pingle

@santosh-pingle
Copy link
Collaborator

Thanks @nsabale7.
It looks good to me.

@nsabale7 nsabale7 requested a review from santosh-pingle May 3, 2023 11:25
Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

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

thanks so much for this PR 👍🙏

please see my comment below.

…ns/fix_repeated_group_extraction

# Conflicts:
#	datacapture/src/main/java/com/google/android/fhir/datacapture/mapping/ResourceMapper.kt
@nsabale7 nsabale7 requested a review from a team as a code owner September 25, 2023 11:45
@nsabale7
Copy link
Collaborator Author

@jingtang10 @santosh-pingle Sorry for the delay.

I have done the changes according to the comments given by Jing. I have modified the zipByLinkId and reused as per the point 2. Please review and let me know if any changes.

@nsabale7 nsabale7 requested a review from jingtang10 October 9, 2023 11:16
@omarismail94
Copy link
Contributor

@nsabale7 do you have any update regarding this PR? If it's stale, can we close it?

@nsabale7
Copy link
Collaborator Author

@omarismail94 No, it needs final review.

@omarismail94
Copy link
Contributor

@nsabale7 could you first resolve the conflict in ResourceMapper and merge the master branch into your PR?

…ns/fix_repeated_group_extraction

# Conflicts:
#	datacapture/src/main/java/com/google/android/fhir/datacapture/mapping/ResourceMapper.kt
@nsabale7
Copy link
Collaborator Author

nsabale7 commented Dec 7, 2023

@omarismail94 I have resolved the conflicts. Please review.

@omarismail94 omarismail94 dismissed jingtang10’s stale review December 8, 2023 15:45

All comments addressed

@omarismail94 omarismail94 enabled auto-merge (squash) December 8, 2023 15:46
@omarismail94 omarismail94 merged commit 088d381 into google:master Dec 8, 2023
2 checks passed
@omarismail94
Copy link
Contributor

nice change @nsabale7 to clean up the code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Definition based extraction for repeated groups extracts only one set of resources
5 participants