fix: show dataset and org unit names (not UIDs) in autocomplete-compute error alerts - #180
Open
Ramon-Jimenez wants to merge 2 commits into
Open
Ramon-Jimenez wants to merge 2 commits into
Ramon-Jimenez wants to merge 2 commits into
Conversation
… alerts DHIS2 import-conflict messages (e.g. E7642) reference metadata by UID. The existing replacement only targeted org units via a regex matching "organisation unit:", which never matched the actual "org unit:" wording, and it never resolved the data set name at all. Replace UIDs generically: swap every backtick-wrapped UID for its name using the org units already loaded plus the app's configured data sets, independent of the surrounding label wording. Wire dataSets through to AlertStatsErrors from both the auto-complete-compute (incl. subnational variant) and fix-totals reports. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
eperedo
requested changes
Jun 22, 2026
eperedo
left a comment
Contributor
There was a problem hiding this comment.
it works, just a minor observation to avoid duplicating a type.
| // DHIS2 import conflict messages reference metadata by UID (e.g. ``data set: `Tu81BTLUuCT` ... | ||
| // org unit: `e9IoKRAkYLO```). Replace every backtick-wrapped UID we know about with its name, | ||
| // regardless of the surrounding label wording (which varies between DHIS2 versions). | ||
| function replaceIdsByNames(message: string, items: Array<{ id: string; name: string }>): string { |
Contributor
There was a problem hiding this comment.
we can use NamedRef[] for items instead of array<{}>
Contributor
Author
There was a problem hiding this comment.
Good call — done in 96fff74. Switched replaceIdsByNames to take NamedRef[]; OrgUnit satisfies it so the [...orgUnits, ...dataSets] spread still typechecks.
Address review feedback: NamedRef[] is the existing shared type for
{ id, name } refs, clearer than an inline object array.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
eperedo
approved these changes
Jun 23, 2026
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.
ClickUp
Closes CU-869du4j73
Problem
In the NHWA Auto-complete compute report (standard + subnational variants), the error banner shown after a Fix all run displayed raw DHIS2 import-conflict messages with UIDs instead of names, e.g.:
Client reported these used to show readable names.
Root cause
These messages are produced verbatim by the DHIS2 backend (
conflict.value). The only client-side beautification,replaceOrgUnitIdByNameinAlertStatsErrors, had two long-standing gaps:organisation unit:, but the actual message wording isorg unit:→ never matched.(The trigger for the change was almost certainly a server-side conflict-message format change; this fix makes the app robust regardless.)
Fix
replaceIdsByNamesthat swaps every backtick-wrapped UID for its name, independent of the surrounding label wording.config.dataSets).dataSetsthrough toAlertStatsErrorsfrom the auto-complete-compute report (covers the subnational variant too — same shared component) and the fix-totals report.Scope
AlertStatsErrors.tsx— generic UID→name resolverNHWAAutoCompleteCompute.tsx— passesdataSets(used by both standard and subnational variants)NHWAFixTotals.tsx— passesdataSetsTesting
tsc --noEmitclean,eslintclean, prettier-formatted.🤖 Generated with Claude Code