Repository navigation
[FIX] Bulk load accepts only one year/period at a time - #419
Merged
MiquelAdell merged 1 commit intoOct 22, 2026
Merged
Conversation
DHIS2 only accepts the first period of a dataValueSets request when the data set has data input periods (DHIS2-22277), so imports and deletes with several periods were partially rejected as "not open". Group the data values by period before chunking them by size.
BundleMonNo change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
xurxodev
approved these changes
Oct 16, 2026
xurxodev
left a comment
There was a problem hiding this comment.
Thanks @anagperal
Works fine!
@MiquelAdell some notes
- The bug seems fixed upstream from 2.43. It reproduces on 2.41.10. the workaround can be removed once the instances are on 2.43 or later.
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.
📌 References
📝 Implementation
When a data set has data input periods, DHIS2 only accepts the first period of each
dataValueSetsrequest. Values for the other periods are rejected with "Period: X is not open for this data set at this time", even when those periods are open. The org unit does not matter: several org units in the same period import fine.Bulk Load sent up to 1000 data values per request, mixing periods, so a template with several years imported only the first one. The same happens with "Delete and import".
chunkDataValuesByPeriod(src/data/Dhis2DataValueChunks.ts): groups the data values by period, in the order they appear, and then chunks each period by size.InstanceDhisRepository.importAggregatedDatauses it instead of_.chunk. The rest is unchanged: chunks are still posted one after another and merged into a single import summary, and data set completion still works per chunk.Tracker programs are not affected (tested with several org units, creating and updating), so they are not changed.
🔥 Notes for the reviewer
_.chunk(dataValues, bulkOperationChunkSize)inimportAggregatedDataand deletingDhis2DataValueChunks.tsand its spec.How to test
development, only the first period is imported.📹 Screenshots/Screen capture
test-BL.webm
📑 Others