hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
1.94k stars 1.3k forks source link

Fix search document Bundle with local reference through composition #5978

Closed codeforgreen closed 3 weeks ago

codeforgreen commented 1 month ago

Fixes #5988

  1. Previously, when using placeholder references within a document bundle, the matching was done using the request url, which is not populated for standalone document bundles. That field would be populated for transaction bundles. The fix was simply to use the fullUrl of the bundle entry to match internal resources when resolving FHIRPath expression within a Bundle. See issue details for an example.
  2. I added some new test cases and merged existing test cases in a new test class FhirResourceDaoR4SearchBundleNoFTTest.
  3. While working on the fix, I found that using a parameter name that contains dot character would result in an ArrayIndexOutOfBounds when the resource is created/updated, which would happen in the ResourceLinkPredicateBuilder method createResourceLinkPaths. I noticed that the spec does not mention any restriction with respect to parameter name (code), therefore I applied two fixes here. One was try to first lookup a parameter using the full name including dot, and in case if not found, then try to build the chain. Second of all, the qualifier list provided can be empty and in such cases it should not produce an ArrayIndexOutOfBounds.
  4. I added some more tests to ResourceLinkPredicateBuilderTest to ensure mentioned issues are fixed.
github-actions[bot] commented 1 month ago

Formatting check succeeded!

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.42%. Comparing base (497b9f2) to head (d57019d). Report is 81 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5978 +/- ## ============================================ + Coverage 83.39% 83.42% +0.03% - Complexity 26927 27123 +196 ============================================ Files 1681 1694 +13 Lines 103965 104730 +765 Branches 13189 13277 +88 ============================================ + Hits 86702 87373 +671 - Misses 11613 11660 +47 - Partials 5650 5697 +47 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.