Skip to content

Conversation

parthfloyd
Copy link
Contributor

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

Fixes #2880

Description
Replaced deep equal check for answerOption in populateInitialValues to a more custom logic for Coding Type & keeping the behavior same for other types.

Alternative(s) considered
None | Looking forward to feedback

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).

Comment on lines 3184 to 3185
assertThat(selectedOption.initialSelected).isTrue()
assertThat(question.answerOption.count { it.initialSelected }).isEqualTo(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is just testing the createObservationChoiceQuestionnaire function no? i don't think this is necessary.

the important thing in the test case is below: the generated questionnaire response from the population process includes selected answers.

=====

actually, this reveals a problem in the populate function (thanks laz for pointing out) i dont' think it should change the questionnaire... can you fix that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @jingtang10 for the feedback. Yes absolutely.
To confirm, refactoring populate function to modify/update only the questionnaireResponse answers. (rather than current approach of modifying questionnaire's initial or answerOption.selectedAnswer)
cc: @LZRS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update I've modified functions based on feedback.
Please feel free to let me know if any changes are required.
CC: @LZRS , @jingtang10

@github-project-automation github-project-automation bot moved this from New to PR under Review in Android FHIR SDK Oct 1, 2025
@parthfloyd parthfloyd requested a review from jingtang10 October 15, 2025 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: PR under Review

Development

Successfully merging this pull request may close these issues.

InitialExpression with result of type Coding should ignore display

2 participants