Skip to content

Feat/dhis2 query pushdown#16

Draft
abyot wants to merge 3 commits intomainfrom
feat/dhis2-query-pushdown
Draft

Feat/dhis2 query pushdown#16
abyot wants to merge 3 commits intomainfrom
feat/dhis2-query-pushdown

Conversation

@abyot
Copy link
Member

@abyot abyot commented Feb 26, 2026

Summary

This PR strengthens the DHIS2 org-unit collection integration by pushing query work down to DHIS2 while keeping an OGC-facing API shape. It also hardens field projection behavior, adds mapping docs/examples, and reduces local dev noise from Prefect during reload.

What changed

  • Centralized DHIS2 org-unit querying through the adapter:
    • Added pass-through query support (query_organisation_units) with configurable params.
  • Improved dhis2-org-units provider behavior:
    • OGC CQL filter subset translation to DHIS2 filters (eq, in, like/ilike, and).
    • Pushdown of paging (page, pageSize) when possible.
    • all=true extension mapped to paging=false.
    • Local fallback filtering when CQL cannot be translated.
  • Field projection cleanup:
    • OGC properties drives standard projection.
    • dhis2_fields enables dynamic DHIS2-native projection.
    • Enforced required id in projected fields to keep valid GeoJSON features.
    • Added robust parsing for nested DHIS2 fields (e.g. parent[id,name]).
  • Enabled forwarding extra query params from pygeoapi to providers:
    • include_extra_query_parameters: true for DHIS2 providers.
  • Prefect/dev ergonomics:
    • Added EO_API_ENABLE_PREFECT toggle to disable Prefect app/lifespan in local reload workflows.
    • Improved shutdown handling to reduce cancellation noise.
  • Added docs and utilities:
    • docs/dhis2-ogc-mapping-spec.md
    • sample_data/ADM1.geojson
    • scripts/run_chirps3_pipeline_with_geojson.py
  • Tests:
    • Expanded tests/test_dhis2_common.py for query options, all=true, ID enforcement, nested field parsing, projection behavior, and CQL translation.

Why

  • Avoid fetching everything and filtering locally where DHIS2 can do it server-side.
  • Keep the external API OGC-friendly while retaining DHIS2-native power where needed.
  • Support richer DHIS2 field use cases (hierarchy fields like path, nested parent[...]).
  • Improve local developer experience by avoiding noisy Prefect shutdown traces during --reload.

Example requests

  • OGC-style filtering + standard projection:
    • /ogcapi/collections/dhis2-org-units/items?filter=level=2&properties=name,code,level
  • OGC filtering + DHIS2-native projection:
    • /ogcapi/collections/dhis2-org-units/items?filter=level=2&dhis2_fields=name,code,level,path,parent[id,name]
  • Fetch all matches:
    • /ogcapi/collections/dhis2-org-units/items?filter=level=2&all=true&dhis2_fields=id,name,path,geometry

Notes

  • properties remains validated by pygeoapi (strict/OGC-safe).
  • dhis2_fields is the intended dynamic projection path for DHIS2-specific fields.

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.

1 participant