Skip to content

feat: check data items against periods and org units from metadata - #1865

Draft
BRaimbault wants to merge 4 commits into
masterfrom
feat/data-item-period-types
Draft

BRaimbault wants to merge 4 commits into
masterfrom
feat/data-item-period-types

Conversation

@BRaimbault

@BRaimbault BRaimbault commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixtures 50% / Tests 25 % / Library code 20% / Stories 5%

Key features

Check, before Update, whether a data item can give values for the selected periods and org units: full, partial, none or unknown, with reasons


Description

Metadata only, no analytics requests. An item's profile lists its data sets and programs, with their period type, aggregation and org unit assignment.

  • Periods: whether the data's period type adds up into the period asked for, with analytics' rules for AVERAGE, FIRST and LAST. Relative periods are resolved locally, on relativePeriodDate.
  • Org units: from assignment counts per level (pageSize=1; lists for large selections).
  • Expressions follow dhis2-core's missing value strategies: a missing item counts as 0 in an indicator's side, and both sides are needed.
  • Over several periods and org units, results add up, as for a relative period.
  • Entry point: useDataItemProfiles(items, { orgUnits }) → getDataItemCompatibility(itemId, { periods, orgUnits }).

TODO

  • Tests added, checked against analytics results recorded on 2.40–2.44 (periods and org units)
  • Storybook added (DataItemProfile)

Known issues

  • The test fixtures don't record yet: missingValueStrategy, /api/periodTypes, an indicator sum case

Screenshots

supporting text

Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/modules/dataItemProfile/periodTypes.js Outdated
Comment thread src/__demo__/DataItemProfile.stories.js Outdated
Comment thread src/__demo__/DataItemProfile.stories.js Outdated
Comment thread src/modules/dataItemProfile/__tests__/periodFixtures.spec.js
Comment thread src/modules/dataItemProfile/__tests__/periodFixtures.spec.js Outdated
Comment thread src/modules/dataItemProfile/__tests__/periodFixtures.spec.js
@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant