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

Add support for administrative levels search parameters on LocationHierarchy endpoint #66

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

Conversation

lincmba
Copy link
Contributor

@lincmba lincmba commented Jun 27, 2024

Resolves #64

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 Jun 27, 2024

Codecov Report

Attention: Patch coverage is 49.39759% with 42 lines in your changes missing coverage. Please review.

Project coverage is 44.89%. Comparing base (d7eeb69) to head (7d9ba8b).
Report is 14 commits behind head on main.

Files Patch % Lines
...teway/plugins/LocationHierarchyEndpointHelper.java 53.24% 29 Missing and 7 partials ⚠️
...ay/plugins/endpoint/LocationHierarchyEndpoint.java 0.00% 5 Missing ⚠️
...way/plugins/PractitionerDetailsEndpointHelper.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #66      +/-   ##
============================================
+ Coverage     43.81%   44.89%   +1.08%     
- Complexity      106      123      +17     
============================================
  Files            15       15              
  Lines          1075     1156      +81     
  Branches        120      143      +23     
============================================
+ Hits            471      519      +48     
- Misses          545      570      +25     
- Partials         59       67       +8     

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

public static final String AUTHORIZATION = "Authorization";
public static final String KEYCLOAK_UUID = "keycloak-uuid";
public static final String IDENTIFIER = "_id";
public static final String MIN_ADMIN_LEVEL = "administrativeLevelMin";
public static final String MAX_ADMIN_LEVEL = "administrativeLevelMax";
public static final int DEFAULT_MAX_ADMIN_LEVEL = 10;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is a reasonable default maximum admin level depth?

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we can have a max level because countries have different hierarchies. I know we can have the min which is 0 but I don't think we can restrict the max

In case the max is not defined we are supposed to fetch the whole hierarchy to the end of the node

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seeing this is how the type element is represented:

"type": {
    "coding": [
      {
        "system": "http://example.org/fhir/CodeSystem/location-type",
        "code": "1",
        "display": "Level 1"
      }
    ],

querying directly with conditions like code is greater than 5 on a string representation of a code is not possible. FHIR does not support such numeric comparisons on string fields directly within the query. So, to handle this, I have implement post-query filtering in the application logic.

This commit addresses that 7d9ba8b
This means, api requests with adminstrativeLevelMax set will be more optimized than those without.

Copy link
Member

Choose a reason for hiding this comment

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

This makes sense. Can we review the performance with what we have as we think of how to address this?

@lincmba lincmba force-pushed the add_admin_level_search_params_to_locationhierarchy branch from 68a1567 to b71884a Compare July 1, 2024 13:26
@lincmba lincmba force-pushed the add_admin_level_search_params_to_locationhierarchy branch from b71884a to 7067ddf Compare July 1, 2024 13:26
@lincmba lincmba force-pushed the add_admin_level_search_params_to_locationhierarchy branch from 9323f53 to 1c1d783 Compare July 8, 2024 23:48
@lincmba lincmba requested a review from ndegwamartin July 9, 2024 02:34
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.

Add extra search parameters on the LocationHierarchy Endpoint
4 participants