Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Org Unit Level and Paging issue #29

Closed
cvanhasselt opened this issue Nov 29, 2021 · 1 comment
Closed

Org Unit Level and Paging issue #29

cvanhasselt opened this issue Nov 29, 2021 · 1 comment

Comments

@cvanhasselt
Copy link

When querying a dhis2 instance with ~4200 organisation units, I wanted to find the root org unit, namely the single one with level = 1. Using the get_paged function (even though not necessary), the get_paged function returns the single root orgunit info multiple times, base on the number of pages needed for the full org unit tree - in other words, if I set the page_size to 50, I get 85 copies of the root (~4200/50) and if I set it 500, I get 9 copies, (~4200/500)

@davidhuser
Copy link
Owner

hello! historically there have been bugs with paging in the metadata API, and the dhis2.py library does not attempt to fix API bugs on the server level, so I'm wondering what DHIS2 version you were using? And can you add a code snipped of the get_paged function you used?

If you're just interested in the root OU you can also filter it without fetching all the records e.g. https://play.dhis2.org/2.37.0/api/organisationUnits?filter=level:eq:1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants