Skip to content

feat: load tracked entities from tracker analytics [DHIS2-16362] - #3783

Draft
BRaimbault wants to merge 7 commits into
feat/DHIS2-16362from
feat/DHIS2-16362-phase-1
Draft

BRaimbault wants to merge 7 commits into
feat/DHIS2-16362from
feat/DHIS2-16362-phase-1

Conversation

@BRaimbault

@BRaimbault BRaimbault commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Tests ~70% | Code ~30%

Implements DHIS2-16362

Description

Phase 1 of the tracked entities layer rewrite. This PR targets the feat/DHIS2-16362 integration branch, not master: phases are reviewed separately and released together.

  • On 2.41+, the layer loads from analytics/trackedEntities/query, limited to 50,000 rows with a truncation warning.
  • 2.40 (no analytics endpoint), layers with relationships and layers filtered by follow-up (analytics supports neither) still use tracker/trackedEntities. canLoadTrackedEntitiesFromAnalytics makes that choice.
  • Geometry comes back as WKT, parsed with betterknown, so polygon tracked entity types keep working. geometryOnly=true is used, because coordinatesOnly=true drops polygons.
  • Both APIs share one set of filters (getTrackedEntityFilters), so program status, follow-up and period follow the same rules.
  • Server version differences go through util/versionToggle.js and are tagged VERSION-TOGGLE.
  • Errors show on the layer card (loadError) instead of leaving the layer loading.
  • teiRelationshipsParser.js is renamed to trackedEntityRelationships.js and now also loads relationships.

Behavior changes:

  • 2.41+ layers without a saved org unit mode now include all org units below the selected ones, matching Line Listing. 2.40 keeps "Selected only".
  • Follow-up now filters on 2.41+ (it was silently ignored), and an unchecked box no longer hides tracked entities marked for follow-up.
  • On 2.41+, data is as fresh as the last analytics table run.

src/util/versionToggle.js is also added by #3707. Whichever merges second keeps both sets of functions.


Quality checklist

Add N/A to items that are not applicable.

  • Dashboard tested
  • Cypress and/or Jest tests added/updated
  • Docs added N/A
  • d2-ci dependencies replaced N/A
  • Tester approved (name)

ToDos

  • Test point (Malaria Entity) and polygon (Focus area) tracked entity types
  • Test on 2.40 and 2.41+
  • Test a layer with relationships, and one with follow-up checked
  • Test the error on a server without tracked entity analytics tables

Known issues

  • Tracker analytics has no follow-up filter, so follow-up layers use the tracker API (dhis2-core ticket to file)
  • Tracker analytics returns WKT geometry instead of GeoJSON like events and enrollments (dhis2-core ticket to file)
  • Relationship types that don't link two tracked entities show a load error (fixed in the Phase 2 relationships rewrite)

@dhis2-bot

Copy link
Copy Markdown
Contributor

🚀 Deployed on https://pr-3783.maps.netlify.dhis2.org

@dhis2-bot
dhis2-bot temporarily deployed to netlify October 5, 2026 14:14 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify October 5, 2026 14:33 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify October 5, 2026 14:41 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify October 5, 2026 16:43 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify October 5, 2026 16:55 Inactive
@dhis2-bot
dhis2-bot temporarily deployed to netlify October 5, 2026 19:22 Inactive
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@dhis2-bot
dhis2-bot temporarily deployed to netlify October 6, 2026 07:19 Inactive

This branch was previously deployed

1 inactive deployment
netlify — f56c0850 Deployed Oct 6, 2026 by dhis2-bot
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.

2 participants