feat: count features without coordinates across all layer types [PR7] [DHIS2-18242]#3651
Open
BRaimbault wants to merge 9 commits into
Open
feat: count features without coordinates across all layer types [PR7] [DHIS2-18242]#3651BRaimbault wants to merge 9 commits into
BRaimbault wants to merge 9 commits into
Conversation
…2-237, DHIS2-19850]
Contributor
|
🚀 Deployed on https://pr-3651.maps.netlify.dhis2.org |
BRaimbault
commented
May 4, 2026
Collaborator
Author
BRaimbault
left a comment
There was a problem hiding this comment.
Ready for review
9410582 to
9d9607a
Compare
HendrikThePendric
approved these changes
May 18, 2026
Contributor
HendrikThePendric
left a comment
There was a problem hiding this comment.
Changes look good to me. I left a few comments, but nothing critical.
Co-authored-by: Hendrik de Graaf <HendrikThePendric@users.noreply.github.com>
|
HendrikThePendric
approved these changes
May 18, 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.



Parent
Implements
Overview
Seventh PR in the series. Adds a "Count … without coordinates" checkbox to all five layer types. When enabled, the legend shows a Data quality section with the count of features that could not be mapped due to missing coordinates, and those features appear in the data table so they can still be inspected.
Changes
Event layer — count events without coordinates DHIS2-237
A "Count events without coordinates" checkbox is added to the Style tab of the event dialog. When checked,
withCoordinatesOnly(false)is passed to the analytics request so all events are returned regardless of coordinate presence.createEventFeatures(geojson.js) now guards against null geometry inbuildEventGeometryGetterand splits the result intodata(events with coordinates) anddataWithoutCoords(events without).loadData(event.js) returns the split.eventLoaderstoresdataWithoutCoordson the layer config and setslegend.eventsWithoutCoordinatesCount. Server clustering is disabled when counting is active (encoded inshouldUseServerCluster). The flag is serialised intoconfig.configJSON byfavorites.js.Files:
src/util/geojson.js,src/util/event.js,src/loaders/eventLoader.js,src/components/edit/event/EventDialog.jsx,src/util/favorites.jsOrg unit / facility / thematic / earth engine layers — count org units without coordinates DHIS2-19850
A "Count org units without coordinates" checkbox is added to the style tabs of the org unit, facility, thematic and earth engine dialogs. When checked,
getOrgUnitsWithoutCoordsCount(orgUnits.js) queries the analytics API (using a first available data element as a proxy dimension) to discover which of the requested org unit IDs in the selection have no geometry. The count is stored onlegend.orgUnitsWithoutCoordinatesCount; the missing org unit features are stored onconfig.dataWithoutCoords. For the org unit and thematic layers,fetchOrgUnitDetailsenriches each missing feature with its level and parent name before it reaches the data table. For earth engine,countFeaturesWithoutCoordinatesis kept as a top-level layer property (consistent with other EE props) rather than embedded in the config JSON.Files:
src/util/orgUnits.js,src/util/requests.js,src/loaders/facilityLoader.js,src/loaders/orgUnitLoader.js,src/loaders/thematicLoader.js,src/loaders/earthEngineLoader.js,src/components/edit/FacilityDialog.jsx,src/components/edit/orgUnit/OrgUnitDialog.jsx,src/components/edit/thematic/ThematicDialog.jsx,src/components/edit/earthEngine/StyleTab.jsx,src/util/favorites.jsShared plumbing
addGroupCountsToLegend,addLevelCountsToLegend,loadGroupSetData,fetchAndParseGroupSet,fetchAssociatedGeometriesare extracted intoorgUnits.jsand shared by both loaders, reducing cognitive complexity infacilityLoaderandorgUnitLoaderfrom ~21 to ~12.useTableDatamergesdataWithoutCoordsinto the displayed rows.Legend.jsxshows a Data quality section when either count is set.Files:
src/util/orgUnits.js,src/components/datatable/useTableData.js,src/components/legend/Legend.jsx,src/components/legend/styles/Legend.module.cssBug fix — null layerEdit in connected component selectors
When a layer dialog closes,
LAYER_CANCELsetslayerEdittonullbefore child components unmount.connect'smapStateToPropsruns synchronously in Redux subscription callbacks, causing a crash on any directlayerEdit.xproperty access. Optional chaining added to all affectedconnectselectors (StyleByGroupSet,Labels,IsolatedClass,BufferRadius,GeometryCentroid,Classification,SingleColor,NumericLegendStyle,CompletedOnlyCheckbox,RadiusSelect,AggregationTypeSelect,AggregationSelect,BandSelect). Pre-existing bug, surfaced by Cypress testing the org unit dialog close flow.Files: 13 component files under
src/components/Tests update
src/util/__tests__/orgUnits.spec.js—getStyledOrgUnits(facility item, org unit layer);addGroupCountsToLegend(reset, increment, no-match, missing dimensions);addLevelCountsToLegend(reset, increment, no-match);getOrgUnitsWithoutCoordsCount(empty ids, no data element, count missing, query error);fetchAndParseGroupSet(success, failure);loadGroupSetData(skip when not needed, skip when already loaded, mutates groupSet, error string on failure)src/util/__tests__/geojson.spec.js—buildEventGeometryGetterwith null / empty-string geometry;createEventFeaturessplits intodata+dataWithoutCoordssrc/util/__tests__/favorites.spec.js—countFeaturesWithoutCoordinatesserialised to config JSON for thematic and event layers; preserved as top-level property for earth engine layerManual testing
Netlify: https://pr-3651.maps.netlify.dhis2.org/ + Instance: https://dev.im.dhis2.org/maps-app-42-3
DHIS2-237: Event layer — count events without coordinates
Test map: ADGFWyG8S6R - main + ADGFWyG8S6R?interpretationId=rGHvPq2TYPn - plugin
DHIS2-19850: Org unit / facility / thematic / EE layers — count org units without coordinates
Test maps
Quality checklist