Push cache - #16
Merged
Merged
Push cache#16
Conversation
Collaborator
Author
|
pin ruff to use v0.15.22, if this version changes, any new rules cause annoying ruff errors. |
lgarridobsq
approved these changes
Aug 25, 2026
lgarridobsq
left a comment
Collaborator
There was a problem hiding this comment.
Hola! Just a couple of things -- very cool feature! make sure to advertise it to the team when you realease it ;) (i think you need to up the version?)
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.
Hola, I added an optional push caching to DHIS2Pusher.
The class DHIS2PushCache (push_cache.py), tracks datapoints already pushed to DHIS2 (per period, on disk as parquet) so that the next run skip datapoints unchanged since the last successful push.
Changes:
New DHIS2PushCache class: filter_new() to skip unchanged rows before pushing, mark_pushed() to record what was actually pushed. A datapoint is identified by dx/period/org_unit/category_option_combo/attribute_option_combo; any value difference (including to/from None) counts as changed.
Optional cache_path param in DHIS2Pusher (default None, fully backward compatible). When set, push_data() filters via the cache before classification, and marks datapoints as pushed afterward — excluding any DHIS2 rejected (_remove_rejected_points()), so failed pushes get retried next run instead of being wrongly treated as done.
Simplified summary["rejected_datapoints"] from a nested {"index", "datapoint"} structure to a flat list of the rejected payloads (the old "index" was chunk-local and not usable for matching).
Extensive test coverage for DHIS2PushCache (load/update/dedup/null-handling edge cases) and for the DHIS2Pusher integration (cache skip on repeat push, cache persisted to disk, rejected datapoints excluded from cache).
README updated with the new cache_path option.