can someone give me a suggestion on how to retrieve all orgunits through the WebAPI, including parent-child relationships of orgunits, so that an orgunit view can be created similarly to the view in Data Entry and Individual Records in DHIS 2? Perhaps it’s possible to pass a parameter to api/organisationUnits so to include children or something, or in analytics get orgunits to include parent when passing the LEVEL- parameter.
The query wouldn’t happen very often in the use case, but a low number of requests to the WebAPI would be preferable as ping rather than bandwidth is an issue.
can someone give me a suggestion on how to retrieve all orgunits through the WebAPI, including parent-child relationships of orgunits, so that an orgunit view can be created similarly to the view in Data Entry and Individual Records in DHIS 2? Perhaps it’s possible to pass a parameter to api/organisationUnits so to include children or something, or in analytics get orgunits to include parent when passing the LEVEL- parameter.
The query wouldn’t happen very often in the use case, but a low number of requests to the WebAPI would be preferable as ping rather than bandwidth is an issue.
We had a similar discussion in South Africa a few hours ago. If you have your top level orgunit UID (e.g. ‘JLA7wl59oN3’) you can drill using API calls such as:
can someone give me a suggestion on how to retrieve all orgunits through the WebAPI, including parent-child relationships of orgunits, so that an orgunit view can be created similarly to the view in Data Entry and Individual Records in DHIS 2? Perhaps it’s possible to pass a parameter to api/organisationUnits so to include children or something, or in analytics get orgunits to include parent when passing the LEVEL- parameter.
The query wouldn’t happen very often in the use case, but a low number of requests to the WebAPI would be preferable as ping rather than bandwidth is an issue.
That will get you all the org units and you could re-create the which are children of what org unit by level and parent id.
This is normally very slow however so depending on the amount of org units you might want to concider loading the other levels separately eventhough the ping is high.
Or you could concider loading the first level first and loading the other levels in the background (no matter whether they are used or not.
can someone give me a suggestion on how to retrieve all orgunits through the WebAPI, including parent-child relationships of orgunits, so that an orgunit view can be created similarly to the view in Data Entry and Individual Records in DHIS 2? Perhaps it’s possible to pass a parameter to api/organisationUnits so to include children or something, or in analytics get orgunits to include parent when passing the LEVEL- parameter.
The query wouldn’t happen very often in the use case, but a low number of requests to the WebAPI would be preferable as ping rather than bandwidth is an issue.
I think what you suggest Mark is probably the best solution in this case. Having to do only 3-4 requests is ok for dividing into levels. I was more worried I'd have to do something like one request per org unit with children.