Skip to content

Conversation

oscarArismendi
Copy link

@oscarArismendi oscarArismendi commented Sep 19, 2025

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

Closes #1308

Description
Fix patient list not refreshing after editing patient details by updating the PatientItemDiffCallback.areContentsTheSame() method to include name and dob field comparisons.
Alternative(s) considered
Option 1: Compare entire object (oldItem == newItem)

Pros: Catches all field changes automatically

Cons: May trigger unnecessary updates for internal fields not visible to users

I've found this solution being dismiss on this MR review.

Option 2: Adapter workaround (submitList(null) then submitList(data))

Code Screenshot 2025-09-18 at 6 57 08 PM

Pros: Quick fix that bypasses DiffUtil entirely
Cons: Loses DiffUtil's efficient animations and selective updates; treats symptom rather than cause

Option 3: Compare user-visible fields (chosen solution)

Pros: Fixes root cause while maintaining DiffUtil efficiency; updates only when UI-relevant data changes
Cons: Requires maintenance when display fields change

Type
Choose one: Bug fix

Screenshots (if applicable)

Testing
NameChangeAfterAPatientDetailUpdate.mp4
**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

google-cla bot commented Sep 19, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@oscarArismendi
Copy link
Author

oscarArismendi commented Sep 19, 2025

Hi @jingtang10 , I’m running into the issue below and it’s blocking me. Any guidance you can share would be greatly appreciated.

  1. I had issues running ./gradlew connectedCheck. I suspect it might be due to not having the correct API level installed, but I’ve already tried with versions 33 through 35 and it still doesn’t work. I’ve attached a screenshot of the emulator error and the logs.
Emulator Error Screenshot 2025-09-18 at 10 13 31 PM
Logs

./gradlew connectedCheck

Configuration '_internal-unified-test-platform-android-test-plugin-result-listener-gradle' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-retention' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-apk-installer' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-logcat' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-emulator-control' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-device-info' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-coverage' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-launcher' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-driver-instrumentation' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-device-provider-gradle' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-device-provider-ddmlib' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-core' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration '_internal-unified-test-platform-android-test-plugin-host-additional-test-output' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration 'androidTestUtil' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration 'debugAndroidTestAnnotationProcessorClasspath' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration 'debugAndroidTestCompileClasspath' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration 'debugAndroidTestRuntimeClasspath' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

Configuration 'kotlinCompilerPluginClasspathDebugAndroidTest' was resolved during configuration time.
This is a build performance and scalability issue.
See gradle/gradle#2298

--- Test Execution ---

Task :datacapture:connectedDebugAndroidTest

Starting 105 tests on Pixel_7_API_33(AVD) - 16

com.google.android.fhir.datacapture.contrib.views.PhoneNumberViewHolderFactoryInstrumentedTest

shouldSetQuestionnaireResponseItemAnswer [Pixel_7_API_33(AVD) - 16] SKIPPED

Tests 18/105 completed. (1 skipped, 0 failed)
Tests 27/105 completed. (1 skipped, 0 failed)
Tests 38/105 completed. (1 skipped, 0 failed)
Tests 53/105 completed. (1 skipped, 0 failed)

com.google.android.fhir.datacapture.test.views.DropDownViewHolderFactoryEspressoTest

shouldSelectAndClearAnswerInAutoCompleteDropdown [Pixel_7_API_33(AVD) - 16] FAILED
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:903)

Tests 60/105 completed. (1 skipped, 1 failed)
Tests 73/105 completed. (1 skipped, 1 failed)

com.google.android.fhir.datacapture.test.views.QuestionnaireItemDialogMultiSelectViewHolderFactoryEspressoTest

selectOther_shouldScrollDownToShowAddAnotherAnswer [Pixel_7_API_33(AVD) - 16] SKIPPED

Tests 80/105 completed. (2 skipped, 1 failed)
Tests 85/105 completed. (2 skipped, 1 failed)
Tests 90/105 completed. (2 skipped, 1 failed)

com.google.android.fhir.datacapture.views.factories.AutoCompleteViewHolderFactoryEspressoTest

shouldAddDropDownValueSelectedForMultipleAnswersAutoCompleteTextView [Pixel_7_API_33(AVD) - 16] FAILED
expected to be empty but was: Coding 3

shouldReturnFilteredDropDownMenuItems [Pixel_7_API_33(AVD) - 16] FAILED
expected: 1 but was : 5

Tests 107/105 completed. (2 skipped, 3 failed)

--- Summary ---

Finished 107 tests on Pixel_7_API_33(AVD) - 16

Tests failed: 3

--- Build Report ---

Task :datacapture:connectedDebugAndroidTest FAILED
Tests on Pixel_7_API_33(AVD) - 16 failed: There were 3 failure(s).

Problems report: /build/reports/problems/problems-report.html
Test report: /datacapture/build/reports/androidTests/connected/debug/index.html

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':datacapture:connectedDebugAndroidTest'.

There were failing tests.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

BUILD FAILED in 2m 13s
227 actionable tasks: 3 executed, 224 up-to-date

  1. I didn’t mark that I’ve read the Contributing because the link doesn’t work.

@oscarArismendi oscarArismendi force-pushed the chore/search-list-not-displaying-changes-after-patient-details-update branch from 22f9b3d to d6e5a67 Compare September 19, 2025 03:03
@oscarArismendi
Copy link
Author

I was able to get ./gradlew connectedCheck passing by using API 33. There is one test that fails when running the full test suite but passes when run individually, which indicates test isolation issues where the test environment isn't being properly cleaned between tests.

I suggest addressing this in a separate issue to keep this MR focused on the patient list update fix.

Test Screenshots Screenshot 2025-09-19 at 11 26 31 AM Screenshot 2025-09-19 at 11 26 59 AM
cc @jingtang10

Copy link
Collaborator

@LZRS LZRS left a comment

Choose a reason for hiding this comment

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

Loved the detailed pros vs cons of the alternatives considered in the descriptions. Thanks for the thoroughness!

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 you @oscarArismendi for your fix! Appreciate it!

Thanks @LZRS for taking a look.

@github-project-automation github-project-automation bot moved this from New to PR under Review in Android FHIR SDK Sep 25, 2025
@jingtang10 jingtang10 enabled auto-merge (squash) September 25, 2025 10:23
@oscarArismendi
Copy link
Author

Hi @jingtang10, I see the workflows are pending and haven’t run automatically since this is my first contribution. Could you please help approve them so the checks can run? Thanks!

@jingtang10
Copy link
Collaborator

started the workflow - sorry i didn't realise it was stopped

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.

search list not updating on patient details update
3 participants