feat: format numeric values with digit group separator [PR3] [DHIS2-18242]#3647
Open
BRaimbault wants to merge 9 commits into
Open
feat: format numeric values with digit group separator [PR3] [DHIS2-18242]#3647BRaimbault wants to merge 9 commits into
BRaimbault wants to merge 9 commits into
Conversation
Contributor
|
🚀 Deployed on https://pr-3647.maps.netlify.dhis2.org |
4618336 to
78342d0
Compare
BRaimbault
commented
Apr 26, 2026
Collaborator
Author
BRaimbault
left a comment
There was a problem hiding this comment.
Ready for review.
78342d0 to
070dd74
Compare
9b7bc5b to
60caa87
Compare
edoardo
reviewed
May 8, 2026
edoardo
approved these changes
May 8, 2026
Member
edoardo
left a comment
There was a problem hiding this comment.
Some test examples don't have data, but I could verify on the netlify instance that changes in the DGS setting are reflected in the app.
|
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.



Parent
Implements
Overview
Third PR in the series extracted from the parent epic. Threads the system-configured digit group separator (
keyAnalysisDigitGroupSeparator:NONE/SPACE/COMMA) through the maps app so all numeric output is formatted consistently with the rest of DHIS2.No new behavior except formatting — every place a number renders to the user now respects the system setting.
Changes
Utility and plumbing
formatWithSeparatorandparseWithSeparatorhelpers insrc/util/numbers.js, plusDIGIT_GROUP_SEPARATOR_{SPACE,COMMA,NONE}constants insrc/constants/settings.js.keyAnalysisDigitGroupSeparatoradded toSYSTEM_SETTINGSso it's fetched by both the main app (useLayersLoader) and the plugin (LayerLoader). Both orchestrators thread it as a named parameter to every loader.The separator is exposed as a Redux-free dependency via the existing
useCachedData()provider, so the plugin (which doesn't have Redux) can read it the same way as the main app.formatWithSeparatoraccepts an optionalprecisionparameter for forward compatibility with DHIS2-3156, but no consumer wires it through yet.Files:
src/util/numbers.js,src/constants/settings.js,src/hooks/useLayersLoader.js,src/components/plugin/LayerLoader.jsxLoaders
Each loader accepts
keyAnalysisDigitGroupSeparatorand attaches it to the loaded layer config. Two loaders also bake formatted strings into feature properties at load time:thematicLoader:properties.valueis set to the formatted display string (consumed by tooltip, label, popup);properties.rawValuepreserves the numeric value for sort and computation.properties.rangeis formatted with the separator.earthEngineLoader:createLegendconstructs item names ("< min", "from - to", "> max") with the separator applied.eventLoader,trackedEntityLoader,geoJsonUrlLoader: thread the separator on config; raw per-feature values are preserved unchanged. These layer types use dynamic column names for data items, making parallel "raw" fields impractical, so formatting happens at the consumption site.The
properties.valueflip inthematicLoaderis a breaking change for anyone readingfeature.properties.valueexpecting aNumber. All internal consumers are updated.A side refactor extracts
parseJsonConfig,fetchRelationshipData, andbuildQueryVariablesfromtrackedEntityLoaderto keep the main loader function under SonarQube's complexity threshold. No behavior change.Files:
src/loaders/thematicLoader.js,src/loaders/earthEngineLoader.js,src/loaders/eventLoader.js,src/loaders/trackedEntityLoader.js,src/loaders/geoJsonUrlLoader.jsDisplay components
Components format at the render site, reading the separator either from layer config (popups, GeoJSON profile) or from cached system settings directly (legend, data table, org unit info, EE preview):
formatValueForDisplayinhelpers.jslearns to format numeric value types usingformatWithSeparatorwithforce: true. Popup data values arrive as strings from the API.rawValueas the value column'sdataKeyso sort and display both come from a single source. Cell rendering formats non-color cells with the separator.startValue/endValue/count. Refactored intonameLabel/rangeLabel/countLabelfor readability and to fix a leading-space artifact when name is empty.Bubbles.jsxformats bubble text values with the separator before passing them tocomputeLayout, so the layout offset correctly accounts for separator characters in text width.Bubble.jsxnow renders the pre-formattedtextprop directly.EarthEngineLayerrather thanuseCachedData(), since its parent is a class component.Files:
src/components/legend/LegendItemRange.jsx,src/components/legend/Bubbles.jsx,src/components/map/layers/EventLayer.jsx,src/components/map/layers/EventPopup.jsx,src/components/map/layers/TrackedEntityLayer.jsx,src/components/map/layers/TrackedEntityPopup.jsx,src/components/map/layers/GeoJsonLayer.js,src/components/datatable/DataTable.jsx,src/components/datatable/useTableData.js,src/components/orgunits/OrgUnitInfo.jsx,src/components/orgunits/OrgUnitData.jsx,src/components/edit/earthEngine/LegendPreview.jsx,src/components/map/layers/earthEngine/EarthEnginePopup.jsx,src/components/map/layers/earthEngine/EarthEngineLayer.jsx,src/util/helpers.jsTests update
src/util/__tests__/numbers.spec.jssrc/util/__tests__/helpers.spec.jssrc/util/__tests__/bubbles.spec.jssrc/loaders/__tests__/earthEngineLoader.spec.jsManual testing
Netlify: https://pr-3647.maps.netlify.dhis2.org/ + Instance: https://dev.im.dhis2.org/maps-app-42-3 (keyAnalysisDigitGroupSeparator === SPACE)
DHIS2-18963: Digit groups separator functionality in maps
Test maps
Quality checklist
Add N/A to items that are not applicable.