Skip to content

feat: REGISTRATION_OU for events and enrollments (DHIS2-21980) - #24971

Open
luciano-fiandesio wants to merge 13 commits into
masterfrom
DHIS2-21980-REGISTRATION-OU-EVENTS-ENROLLMENTS
Open

feat: REGISTRATION_OU for events and enrollments (DHIS2-21980)#24971
luciano-fiandesio wants to merge 13 commits into
masterfrom
DHIS2-21980-REGISTRATION-OU-EVENTS-ENROLLMENTS

Conversation

@luciano-fiandesio

@luciano-fiandesio luciano-fiandesio commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

REGISTRATION_OU becomes a new org-unit dimension and filter on all four
tracker-analytics endpoints (/analytics/events/query, /analytics/events/aggregate,
/analytics/enrollments/query, /analytics/enrollments/aggregate), so clients can select or group by the org unit where the tracked entity was registered.

The implementation resolves request items through the existing ou dimension pipeline
(USER_ORGUNIT*, LEVEL-n, OU_GROUP-uid all work), stores them in dedicated EventQueryParams fields, and produce SQL against a second, independently aliased join of analytics_rs_orgunitstructure (regous, next to ous and enrl). Matching is always at or below, aggregate always return one row per requested org unit.

Files to review

  • RegistrationOuSqlFragments.java contains SQL builders: join, uidlevelN predicate, uid/name projections.
  • RegistrationOuSqlCoordinator.java orchestrates join/where/select for both analytics types;
  • RegistrationOuSqlConstants.java contains alias regous, struct table, DIMENSION_NAME.
  • EventQueryParams.java New fields + hasRegistrationOuDimension() ,hasRegistrationOuRestriction(),hasRegistrationOuAggregateColumn().
  • DefaultEventDataQueryService.java main logic for resolving the Registration ou resolveRegistrationOu
  • ColumnHeader, HeaderHelper, MetadataItemsHandler.java Grid response management

@luciano-fiandesio
luciano-fiandesio force-pushed the DHIS2-21980-REGISTRATION-OU-EVENTS-ENROLLMENTS branch 3 times, most recently from 0a1eab2 to 5b8b3a3 Compare August 31, 2026 08:39
@janhenrikoverland janhenrikoverland added the deploy Deploy DHIS2 instance with IM. label Sep 1, 2026
@luciano-fiandesio
luciano-fiandesio marked this pull request as ready for review September 1, 2026 07:55
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.89671% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.19%. Comparing base (4e91191) to head (be339fb).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ytics/event/data/DefaultEventDataQueryService.java 80.95% 4 Missing and 4 partials ⚠️
...a/registrationou/RegistrationOuSqlCoordinator.java 93.47% 1 Missing and 2 partials ⚠️
.../org/hisp/dhis/analytics/tracker/HeaderHelper.java 95.45% 1 Missing ⚠️
...p/dhis/analytics/tracker/MetadataItemsHandler.java 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #24971       +/-   ##
=============================================
+ Coverage     28.05%   65.19%   +37.13%     
- Complexity      149      688      +539     
=============================================
  Files          3742     3744        +2     
  Lines        145824   146027      +203     
  Branches      16979    17001       +22     
=============================================
+ Hits          40917    95196    +54279     
+ Misses       100787    43079    -57708     
- Partials       4120     7752     +3632     
Flag Coverage Δ
integration 42.19% <24.88%> (?)
integration-h2 28.05% <22.53%> (-0.01%) ⬇️
unit 36.48% <93.42%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../hisp/dhis/eventvisualization/SimpleDimension.java 100.00% <100.00%> (+5.12%) ⬆️
...rc/main/java/org/hisp/dhis/feedback/ErrorCode.java 99.29% <100.00%> (+0.18%) ⬆️
...rg/hisp/dhis/analytics/event/EventQueryParams.java 73.67% <100.00%> (+42.06%) ⬆️
.../event/data/AbstractJdbcEventAnalyticsManager.java 69.99% <100.00%> (+60.61%) ⬆️
...his/analytics/event/data/AggregatedRowBuilder.java 82.92% <100.00%> (+82.92%) ⬆️
...alytics/event/data/DefaultEventQueryValidator.java 62.35% <100.00%> (+53.96%) ⬆️
...is/analytics/event/data/EventAggregateService.java 66.40% <100.00%> (+64.81%) ⬆️
...ics/event/data/JdbcEnrollmentAnalyticsManager.java 74.89% <100.00%> (+61.67%) ⬆️
...nalytics/event/data/JdbcEventAnalyticsManager.java 67.82% <100.00%> (+66.20%) ⬆️
...ata/registrationou/RegistrationOuSqlFragments.java 100.00% <100.00%> (ø)
... and 6 more

... and 2119 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1582037...be339fb. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Instance deployed to https://dev.im.dhis2.org/pr-24971

@luciano-fiandesio
luciano-fiandesio force-pushed the DHIS2-21980-REGISTRATION-OU-EVENTS-ENROLLMENTS branch from c6ba0df to 8a5a50a Compare September 3, 2026 09:23
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy Deploy DHIS2 instance with IM. run-api-analytics-tests Enables analytics e2e tests run-api-analytics-tests-clickhouse run-api-analytics-tests-doris Enables analytics e2e tests on Doris

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants