Generally these kind of pyramid change should be “thought upfront” and not applied “blindly”
- trying to preserve the id of the orgunit with data (health center) and
- update the “polygon/coordinate names” in place if it’s acceptable (if it reflects minor changes)
- move them around on the new provinces/district/aires/…
Sadly we had this kind of changes too and discovered the day they migrated the dhis2, but it was for an aggregate model.
IMO you’ll need to a matching of the orgunits “new - old” (note this mapping can be stored as a custom attribute if needed for a longer time)
then a migration script either
- via the api (unsure if you can just update the orgunit of the enrollments and events, or you copy the enrollments/events on the new orgunit, soft delete the one on the “old” orgunit)
- or via sql (might get tricky if you have duplicated enrollments)
then re run analytics
It looks possible through the UI : Tracker Capture - DHIS2 Documentation
So I would inspect the api calls and automate that transfert of ownership
(perhaps check first the a few records and the results in the dashboard)
Apparently there is an api for that : How to transfer all TEA and program stages from one org. unit to another org. unit in version 2.30 - #11 by Ulanbek
the related documentation Tracker - DHIS2 Documentation