Skip to content

Fix location hierarchy fetch with _syncLocations#129

Merged
dubdabasoduba merged 10 commits into
mainfrom
fix_location_fetching
Nov 12, 2025
Merged

Fix location hierarchy fetch with _syncLocations#129
dubdabasoduba merged 10 commits into
mainfrom
fix_location_fetching

Conversation

@dubdabasoduba
Copy link
Copy Markdown
Collaborator

IMPORTANT: Where possible all PRs must be linked to a Github issue

Resolves [link to issue]

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for
    bug fixes
  • I have added documentation for any new feature(s) and configuration
    option(s) on the README.md
  • I have run mvn spotless:check to check my code follows the project's
    style guide
  • I have run mvn clean test jacoco:report to confirm the coverage report
    was generated at plugins/target/site/jacoco/index.html
  • I ran mvn clean package right before creating this pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue with location hierarchy fetching when using the _syncLocations parameter by ensuring proper pagination handling and correct admin level filtering. The key change introduces a new method to collect all locations from paginated FHIR bundle responses.

Key changes:

  • Added collectAllLocations() method to properly handle paginated bundle results by following next links
  • Fixed generateAdminLevels() to handle blank strings (not just null) as default values
  • Updated calls to use actual admin level parameters instead of hardcoded defaults for pre-fetch operations

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

File Description
LocationHierarchyEndpointHelper.java Added pagination handling method and fixed admin level parameter usage in pre-fetch operations
BaseFhirEndpointHelper.java Enhanced generateAdminLevels() to treat blank strings as null using StringUtils.isNotBlank()
LocationHierarchyEndpointHelperTest.java Added tests for blank string handling and pagination, updated mock verifications to handle multiple calls
SyncAccessDecision.java Added debug logging and reformatted javadoc comment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +443 to +450
if (logger.isInfoEnabled()) {
String proxyBase = System.getenv(Constants.PROXY_TO_ENV);
logger.info(
"Proxying {} request to PROXY_TO base '{}' with path '{}'",
method,
proxyBase,
requestPath);
}
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The environment variable is retrieved on every invocation of this static method. Consider caching System.getenv(Constants.PROXY_TO_ENV) to avoid repeated lookups, or move the retrieval outside the info-enabled check if this method is frequently called.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 12, 2025

@dubdabasoduba I've opened a new pull request, #130, to work on those changes. Once the pull request is ready, I'll request review from you.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 53.33333% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.04%. Comparing base (ec034ff) to head (e84f814).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...lugins/helper/LocationHierarchyEndpointHelper.java 44.44% 15 Missing and 5 partials ⚠️
...ister/fhir/gateway/plugins/SyncAccessDecision.java 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #129      +/-   ##
============================================
+ Coverage     64.35%   67.04%   +2.69%     
- Complexity      296      310      +14     
============================================
  Files            19       19              
  Lines          2087     2109      +22     
  Branches        272      280       +8     
============================================
+ Hits           1343     1414      +71     
+ Misses          612      561      -51     
- Partials        132      134       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI and others added 4 commits November 12, 2025 08:43
…t calls

Co-authored-by: dubdabasoduba <4817531+dubdabasoduba@users.noreply.github.com>
Eliminate redundant getFhirClientForR4() calls in location pagination
@dubdabasoduba dubdabasoduba merged commit 473e10e into main Nov 12, 2025
2 of 3 checks passed
@dubdabasoduba dubdabasoduba deleted the fix_location_fetching branch November 12, 2025 09:37
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.

3 participants