Support DHIS2 2.43 - #1253
Open
xurxodev wants to merge 3 commits into
Open
Conversation
DHIS2 2.43 requires `program` in /tracker/events GET requests when filtering
by programStage; omitting it (previously only programStage was sent) fails
with a 400 Bad Request. Threads {program, programStage} pairs end-to-end via
the existing ProgramStageRef type instead of bare programStage strings.
…ogram lookup DHIS2 tightened /tracker/trackedEntities GET validation inconsistently across versions: <=2.40 requires the deprecated singular `trackedEntity` (the plural `trackedEntities` doesn't filter by id yet), 2.41 accepts either but rejects both together, and >=2.42 requires the plural `trackedEntities` (E1003 if only `trackedEntity` is sent). No single param works on all versions, so getTEIsById() now picks the param based on targetInstance.apiVersion.
BundleMonNo change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
….43 omits it per dataValue DHIS2 2.43 leaves out the per-item orgUnit in GET /api/dataValueSets responses when the query filters by a single orgUnit, setting it only once at the response root instead. This caused the sync's POST payload to carry an empty orgUnit on every dataValue in that case.
xurxodev
marked this pull request as ready for review
July 13, 2026 05:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 References
📝 Implementation
DHIS2 tightened validation on two
/tracker/*GET endpoints across recent server versions, in each case requiring a parameter that used to be optional/omittable. Both were found via real HAR captures againstplay.im.dhis2.org/stable-2-43-0-1and confirmed empirically against 2.40/2.41/2.42/2.43 play instances./tracker/events(2.43+): requiresprogramalongsideprogramStage; previously onlyprogramStagewas sent. Fix threads{program, programStage}pairs end-to-end (reusing the existingProgramStageReftype) instead of bareprogramStagestrings, touchingEventsRepository,ListEventsUseCase,EventsD2ApiRepository,EventsPayloadBuilder,EventsSelectionStep.tsx, andMSFHomePagePresenter.ts. SendingprogramalongsideprogramStageis a no-op on 2.40/2.41/2.42 and required on 2.43+, so no version check is needed here./tracker/trackedEntitiescross-program lookup by TEI ids (2.42+): the deprecated singulartrackedEntityparam alone now fails withE1003. Unlike the events fix, there's no single param choice that works on every version —<=2.40only supports the singulartrackedEntity(the plural doesn't filter by id yet),2.41accepts either but rejects both together, and>=2.42requires the pluraltrackedEntities. Fixed inTEID2ApiRepository.getTEIsById()by branching ontargetInstance.apiVersion./api/dataValueSets(2.43+): on GET, when the query filters by a singleorgUnit, DHIS2 2.43 stops repeatingorgUniton each returned dataValue and sets it only once at the response root instead.AggregatedD2ApiRepository.getAggregated()blindly destructuredorgUnitoff each item, so the subsequent sync POST carried an emptyorgUniton every dataValue in that case. Fixed with a fallback (orgUnit ?? data.orgUnit) — the per-item field is still used whenever DHIS2 does send it, so no version check is needed.📹 Screenshots/Screen capture
🔥 Is there anything the reviewer should know to test it?
/tracker/eventsmock insync-events.spec.tsthat fails ifprogramis missing from the request.play.im.dhis2.orginstances (2.40.12, 2.41.9, 2.42.5.1, 2.43.0.1) by hitting the endpoints directly with curl, not just via mocked tests. For theorgUnitfix specifically: verified via POST/GET round-trip with real test data on single- and multi-orgUnit queries on 2.43 to nail the boundary, then cleaned up the test data values afterward.tsc --noEmitclean.📑 Others