Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
90a862c
feat: uncomment fallback coordinate field
BRaimbault Feb 17, 2025
0d5d9ce
Merge branch 'master' into feat/DHIS2-8165
BRaimbault Feb 21, 2025
1caee70
Merge branch 'master' into feat/DHIS2-8165
BRaimbault Apr 4, 2025
6e19f35
Merge branch 'master' into feat/DHIS2-8165
BRaimbault Apr 24, 2025
84581ac
Merge branch 'master' into feat/DHIS2-8165
BRaimbault May 8, 2025
c07c37a
Merge branch 'master' into feat/DHIS2-8165
BRaimbault May 9, 2025
e4da9b8
feat: support OU and data item of type OU
BRaimbault Apr 3, 2025
b774552
feat: show OU name in Event and TE popups
BRaimbault Apr 4, 2025
220632f
chore: update docs
BRaimbault May 5, 2025
53621df
chore: add cypress tests
BRaimbault May 5, 2025
09bbb12
fix: introduce feature toggling
BRaimbault May 6, 2025
9ce00cf
chore: introduce version toggling in cypress test
BRaimbault May 6, 2025
5aac700
chore: fix lint error
BRaimbault May 6, 2025
d53513f
fix: update formatValueForDisplay helper
BRaimbault May 9, 2025
1d2a58f
chore: fix lint error
BRaimbault Jun 30, 2025
163c8a2
chore: fix cypress test
BRaimbault Jun 30, 2025
8d22dc4
Merge branch 'master' into feat/DHIS2-8165
BRaimbault Jul 2, 2025
8c1c216
Merge branch 'master' into feat/DHIS2-3354
BRaimbault Jul 7, 2025
469eb7c
Merge branch 'master' into feat/DHIS2-3354
BRaimbault Jul 14, 2025
d4b802d
feat: new showCentroids mapViews prop
BRaimbault Jul 15, 2025
40b46c4
chore: docs update
BRaimbault Jul 17, 2025
8617a1b
chore: rename showCentroids to geometryCentroid
BRaimbault Jul 17, 2025
33e0edb
Merge branch 'feat/DHIS2-3354' into feat/DHIS2-8165
BRaimbault Jul 17, 2025
7420541
fix: update coords fallback mechanism
BRaimbault Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/elements/event_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class EventLayer extends Layer {
}

selectCoordinate(coordinate) {
cy.get('[data-test="coordinatefield"]').click()
cy.get('[data-test="coordinatefield"]').first().click()
cy.contains(coordinate).click()

return this
Expand Down
128 changes: 103 additions & 25 deletions cypress/integration/layers/eventlayer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CURRENT_YEAR,
EXTENDED_TIMEOUT,
POPUP_WAIT,
getDhis2Version,
} from '../../support/util.js'

const programE2E = {
Expand All @@ -26,23 +27,55 @@ const programIP = {
const programGeowR = {
name: 'E2E - GeoProgram - Points (with reg)',
stage: 'E2E - Geo - Stage - Point',
coordinates: [
{ name: 'Event location', coords: '-11.499252, 8.178188' },
{ name: 'Enrollment location', coords: '-11.634007, 8.011976' },
{ name: 'Tracked entity location', coords: '-11.529636, 8.040193' },
startDate: `2025-01-01`,
endDate: `2025-03-31`,
ous: ['Bo'],
scenarios: [
{
name: 'E2E - Geo - DE - Coordinate',
coords: '-11.602850, 8.077288',
ous: ['Bo', 'Bargbe'],
filters: { item: 'E2E - Geo - DE - ID', value: '#C' },
coordinates: [
{ name: 'Event location', coords: '-11.499252, 8.178188' },
{ name: 'Enrollment location', coords: '-11.634007, 8.011976' },
{
name: 'Tracked entity location',
coords: '-11.529636, 8.040193',
},
{
name: 'E2E - Geo - DE - Coordinate',
coords: '-11.602850, 8.077288',
},
{
name: 'E2E - Geo - TEA - Coordinate',
coords: '-11.499982, 8.049881',
},
],
},
{
name: 'E2E - Geo - TEA - Coordinate',
coords: '-11.499982, 8.049881',
ous: ['Bo', 'Badjia', 'Ngelehun CHC'],
filters: { item: 'E2E - Geo - DE - ID', value: 'C' },
coordinates: [
{
name: 'Organisation unit location',
coords: '-11.419700, 8.103900', // Ngelehun CHC
},
],
},
{
ous: ['Bo', 'Badjia'],
filters: { item: 'E2E - Geo - DE - ID', value: 'C' },
coordinates: [
{
name: 'E2E - Geo - DE - Organisation Unit',
coords: '-11.686100, 7.390850', // Bathurst MCHP
},
{
name: 'E2E - Geo - TEA - Organisation Unit',
coords: '-11.686100, 7.390850', // Bathurst MCHP
},
],
},
],
startDate: `2025-01-01`,
endDate: `2025-03-31`,
ous: ['Bo', 'Bargbe'],
filters: { item: 'E2E - Geo - DE - ID', value: '#C' },
}

context('Event Layers', () => {
Expand Down Expand Up @@ -206,36 +239,81 @@ context('Event Layers', () => {
}

// Event layer config

Layer.openDialog('Events')
.selectProgram(programGeowR.name)
.selectStage(programGeowR.stage)

Layer.selectTab('Period')
.selectPeriodType({ periodType: 'Start/end dates' })
.typeStartDate(programGeowR.startDate)
.typeEndDate(programGeowR.endDate)
Layer.selectTab('Style').selectViewAllEvents()

// Test coordinates in scenario 0

Layer.selectTab('Org Units')
.unselectOu('Sierra Leone')
.openOu(programGeowR.ous[0])
.selectOu(programGeowR.ous[1])
.openOu(programGeowR.scenarios[0].ous[0])
.selectOu(programGeowR.scenarios[0].ous[1])
Layer.selectTab('Filter')
cy.contains('Add filter').click()
cy.getByDataTest('dhis2-uicore-select-input').last().click()
cy.contains(programGeowR.scenarios[0].filters.item).click()
cy.getByDataTest('dhis2-uiwidgets-inputfield-content')
.find('input')
.type(programGeowR.scenarios[0].filters.value)

testCoordinate(programGeowR.scenarios[0].coordinates[3], false) // Geo - DataElement - Coordinate
testCoordinate(programGeowR.scenarios[0].coordinates[4]) // Geo - TrackedEntityAttribute - Coordinate
testCoordinate(programGeowR.scenarios[0].coordinates[2]) // Tracked entity location
testCoordinate(programGeowR.scenarios[0].coordinates[1]) // Enrollment location
testCoordinate(programGeowR.scenarios[0].coordinates[0]) // Event location

cy.getByDataTest('layer-edit-button').click()
Layer.selectTab('Filter')
cy.getByDataTest('remove-filter-button').click()
Layer.updateMap()
cy.getByDataTest('layer-edit-button').click()
Layer.selectTab('Filter')
cy.contains('Add filter').click()
cy.getByDataTest('dhis2-uicore-select-input').last().click()
cy.contains(programGeowR.filters.item).click()
cy.contains(programGeowR.scenarios[1].filters.item).click()
cy.getByDataTest('dhis2-uiwidgets-inputfield-content')
.find('input')
.type(programGeowR.filters.value)
.type(programGeowR.scenarios[1].filters.value)
Layer.updateMap()

Layer.selectTab('Style').selectViewAllEvents()
// Test coordinates in scenario 1

// Test different coordinates
testCoordinate(programGeowR.coordinates[3], false) // Geo - DataElement - Coordinate
testCoordinate(programGeowR.coordinates[4]) // Geo - TrackedEntityAttribute - Coordinate
testCoordinate(programGeowR.coordinates[2]) // Tracked entity location
testCoordinate(programGeowR.coordinates[1]) // Enrollment location
testCoordinate(programGeowR.coordinates[0]) // Event location
cy.getByDataTest('layer-edit-button').click()
Layer.selectTab('Org Units')
.unselectOu(programGeowR.scenarios[0].ous[1])
.openOu(programGeowR.scenarios[1].ous[1])
.selectOu(programGeowR.scenarios[1].ous[2])
Layer.updateMap()

testCoordinate(programGeowR.scenarios[1].coordinates[0]) // Organisation Unit location

// VERSION-TOGGLE
// https://dhis2.atlassian.net/browse/DHIS2-19010 and:
// - [2.40.8] https://github.com/dhis2/dhis2-core/commit/f2286a5aa70b2957bd24925776e9394cd67d44c1
// - [2.41.4] https://github.com/dhis2/dhis2-core/commit/19f29f27385cfae1c7fac234439f49987ec2abe4
// - [2.42.0] https://github.com/dhis2/dhis2-core/commit/e5b29f4f1dbee791be9e6befb8a304151a1661c9
const serverVersion = getDhis2Version()
if (
(serverVersion.minor === 40 && serverVersion.patch >= 8) ||
(serverVersion.minor === 41 && serverVersion.patch >= 4) ||
serverVersion.minor >= 42
) {
// Test coordinates in scenario 2

cy.getByDataTest('layer-edit-button').click()
Layer.selectTab('Org Units')
.unselectOu(programGeowR.scenarios[1].ous[2])
.selectOu(programGeowR.scenarios[2].ous[1])
Layer.updateMap()

testCoordinate(programGeowR.scenarios[2].coordinates[0]) // Geo - DataElement - Organisation Unit
testCoordinate(programGeowR.scenarios[2].coordinates[1]) // Geo - TrackedEntityAttribute - Organisation Unit
}
})
})
2 changes: 1 addition & 1 deletion cypress/support/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const requests = {
},
getCachedDataProvider_SystemSettings: {
method: 'GET',
url: '**/systemSettings?key=keyAnalysisRelativePeriod,keyHideDailyPeriods,keyHideWeeklyPeriods,keyHideBiWeeklyPeriods,keyHideMonthlyPeriods,keyHideBiMonthlyPeriods,keyDefaultBaseMap,keyBingMapsApiKey,keyAzureMapsApiKey',
url: '**/systemSettings?key=keyAnalysisRelativePeriod,keyHideDailyPeriods,keyHideWeeklyPeriods,keyHideBiWeeklyPeriods,keyHideMonthlyPeriods,keyHideBiMonthlyPeriods,keyDefaultBaseMap,orgUnitCentroidsInEventsAnalytics,keyBingMapsApiKey,keyAzureMapsApiKey',
},
getCachedDataProvider_ExternalMapLayers: {
method: 'GET',
Expand Down
7 changes: 4 additions & 3 deletions docs/maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,10 @@ layer** selection. This opens the Events layer configuration dialog.
If there is only one stage available for the selected program,
the stage is automatically selected.

- Select a value from the **Coordinate field** for the positions
shown on the map. By default, "Event location" is selected.
Depending on the program, other options may include "Tracked entity location", "Enrollment location", and coordinate-type data elements or attributes such as "Household location".
- Select a value from the **Coordinate field** to determine which positions are displayed
on the map. By default, "Event location" is selected. You can also choose "Organisation unit location".
Depending on the selected program, additional options may include "Tracked entity location", "Enrollment location", and coordinate-type/organisation-unit-type data elements or attributes such as "Household location"/"Referral facility".
The number of events represented on the map may vary depending on the selected option and the availability of coordinates. Organisation units are represented by their centroids.

- By default all events with coordinates are shown on the map.
Use the **Event status** field to only show events having one
Expand Down
37 changes: 26 additions & 11 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2025-07-08T14:01:49.308Z\n"
"PO-Revision-Date: 2025-07-08T14:01:49.308Z\n"
"POT-Creation-Date: 2025-07-18T13:42:06.919Z\n"
"PO-Revision-Date: 2025-07-18T13:42:06.919Z\n"

msgid "2020"
msgstr "2020"
Expand Down Expand Up @@ -95,29 +95,29 @@ msgstr "None"
msgid "Cascading"
msgstr "Cascading"

msgid "Org Unit location"
msgstr "Org Unit location"

msgid "Event location"
msgstr "Event location"

msgid "Enrollment location"
msgstr "Enrollment location"

msgid "Tracked entity location"
msgstr "Tracked entity location"

msgid "Organisation unit location"
msgstr "Organisation unit location"
msgid "Tracked Entity location"
msgstr "Tracked Entity location"

msgid "Fallback coordinate field"
msgstr "Fallback coordinate field"

msgid "Coordinate field"
msgstr "Coordinate field"

msgid "Enrollment > event > tracked entity > org unit coordinate"
msgstr "Enrollment > event > tracked entity > org unit coordinate"
msgid "Event > Enrollment > Tracked Entity > Org Unit location"
msgstr "Event > Enrollment > Tracked Entity > Org Unit location"

msgid "Event > org unit coordinate"
msgstr "Event > org unit coordinate"
msgid "Event > Org Unit location"
msgstr "Event > Org Unit location"

msgid "Event data item"
msgstr "Event data item"
Expand Down Expand Up @@ -431,6 +431,9 @@ msgstr "Event status"
msgid "Boundary color"
msgstr "Boundary color"

msgid "Draws a buffer area around each location."
msgstr "Draws a buffer area around each location."

msgid "Buffer"
msgstr "Buffer"

Expand All @@ -452,6 +455,12 @@ msgstr "Line/stroke width"
msgid "Line/stroke width must be between 0-10."
msgstr "Line/stroke width must be between 0-10."

msgid "Convert polygons to their centroids."
msgstr "Convert polygons to their centroids."

msgid "Centroids"
msgstr "Centroids"

msgid "Labels"
msgstr "Labels"

Expand Down Expand Up @@ -751,6 +760,9 @@ msgstr "Not set"
msgid "Could not retrieve tracked entity data"
msgstr "Could not retrieve tracked entity data"

msgid "Tracked entity location"
msgstr "Tracked entity location"

msgid "Last updated"
msgstr "Last updated"

Expand Down Expand Up @@ -1400,6 +1412,9 @@ msgstr "Choropleth"
msgid "Bubble map"
msgstr "Bubble map"

msgid "Organisation unit location"
msgstr "Organisation unit location"

msgid "Automatic color legend"
msgstr "Automatic color legend"

Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
collectCoverageFrom: ['src/**/*.js'],
testPathIgnorePatterns: ['/node_modules/', '/cypress/'],
transformIgnorePatterns: [
'/node_modules/(?!d3-(array|axis|color|format|interpolate|scale|selection|time)|internmap)',
'/node_modules/(?!d3-(array|axis|color|format|geo|interpolate|scale|selection|time)|internmap)',
],
moduleNameMapper: {
'\\.(css)$': 'identity-obj-proxy',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"d3-axis": "^3.0.0",
"d3-color": "^3.1.0",
"d3-format": "^3.1.0",
"d3-geo": "^3.1.1",
"d3-scale": "^4.0.2",
"d3-selection": "^3.0.0",
"d3-time": "^3.1.0",
Expand Down
6 changes: 6 additions & 0 deletions src/actions/layerEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ export const setBufferRadius = (radius) => ({
radius,
})

// Set geometry to centroid (events)
export const setGeometryCentroid = (checked) => ({
type: types.LAYER_EDIT_GEOMETRY_CENTROIDS_SET,
payload: checked,
})

// Set point radius low (thematic, org unit)
export const setRadiusLow = (radius) => ({
type: types.LAYER_EDIT_RADIUS_LOW_SET,
Expand Down
Loading
Loading