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

Optimize location hierarchy #87

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

lincmba
Copy link
Contributor

@lincmba lincmba commented Sep 24, 2024

  • Instead of fetching entire practitionerdetails then getting locations, just get the locations.
  • replace for loops with streams
  • use sets instead of lists to avoid duplication
  • switch from using DFS to BFS in getting locations deep in the hierarchy

Resolves #82

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.

@codecov-commenter
Copy link

codecov-commenter commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 75.28090% with 22 lines in your changes missing coverage. Please review.

Project coverage is 60.89%. Comparing base (e5c3ada) to head (f8a344a).
Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
...way/plugins/PractitionerDetailsEndpointHelper.java 65.78% 13 Missing ⚠️
...teway/plugins/LocationHierarchyEndpointHelper.java 80.43% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main      #87       +/-   ##
=============================================
+ Coverage     44.25%   60.89%   +16.64%     
- Complexity      138      195       +57     
=============================================
  Files            16       16               
  Lines          1358     1404       +46     
  Branches        160      158        -2     
=============================================
+ Hits            601      855      +254     
+ Misses          689      468      -221     
- Partials         68       81       +13     

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

 Instead of fetching entire practitionerdetails, just get the locations.
@lincmba lincmba marked this pull request as draft September 24, 2024 10:59
 - replace for loops with streams
 - use sets instead of lists to avoid duplication
 - switch from using DFS to BFS in getting locations deep in the hierarchy
 - switch from for loop to streams in filterLocationsByAdminLevels
@lincmba lincmba marked this pull request as ready for review September 25, 2024 16:39
@@ -443,23 +453,25 @@ public List<String> generateAdminLevels(

public List<Location> filterLocationsByAdminLevels(
List<Location> locations, List<String> postFetchAdminLevels) {
if (postFetchAdminLevels == null) {

if (postFetchAdminLevels == null || postFetchAdminLevels.isEmpty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolves bug of filtering out all locations when adminlevels is not provided/is empty

@ndegwamartin
Copy link
Collaborator

PR looks good. Lets bump up the Release version as well cc @lincmba

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.

FHIR Gateway Performance Optimization
3 participants