Metadata api and groups/groupsets

I’ve been grappling with a problem exporting and importing orgunit metadata which I’d like to share some thoughts on.

Two dhis2 instances (in Rwanda) have slightly different sets of orgunits. So we are trying to rationalize and combine them - in most cases a union of the two with some shuffling around in the hierarchy.

We have solved this pretty well but here is a challenge with group memberships. If I export all the orgunits from system A, together with their orgunitgroups, over to system B, one consequence is that the existing group memberships in A get replaced by those from B rather than appended. This is not the desired behaviour

It doesn’t look like we have an api method which will allow me to add an orgunit to an existing group. I could of course be missing something.

Can we brainstorm a simpler but potentially more important case: adding a new orgunit, say Bob’s Clinic, of type “Clinic” and Ownership “Faith Based”. I can add Bob’s Clinic easily enough by posting the metadata. Any suggestions for adding it to the “Clinic” and “Faith Based” groups. Currently I am resorting to downloading the entire groups metadata, adding to it where appropriate, then posting the whole list back.

Is there a better way?

Bob

Jason has just suggested posting the orgunit directly to the orgUnit resource endpoint (together with its groups). That should work. Perhaps there is a viewClass option I can use on the metaData option which achieves the same result. I’ll check …

···

On 24 September 2013 17:22, Bob Jolliffe bobjolliffe@gmail.com wrote:

I’ve been grappling with a problem exporting and importing orgunit metadata which I’d like to share some thoughts on.

Two dhis2 instances (in Rwanda) have slightly different sets of orgunits. So we are trying to rationalize and combine them - in most cases a union of the two with some shuffling around in the hierarchy.

We have solved this pretty well but here is a challenge with group memberships. If I export all the orgunits from system A, together with their orgunitgroups, over to system B, one consequence is that the existing group memberships in A get replaced by those from B rather than appended. This is not the desired behaviour

It doesn’t look like we have an api method which will allow me to add an orgunit to an existing group. I could of course be missing something.

Can we brainstorm a simpler but potentially more important case: adding a new orgunit, say Bob’s Clinic, of type “Clinic” and Ownership “Faith Based”. I can add Bob’s Clinic easily enough by posting the metadata. Any suggestions for adding it to the “Clinic” and “Faith Based” groups. Currently I am resorting to downloading the entire groups metadata, adding to it where appropriate, then posting the whole list back.

Is there a better way?

Bob

Hi Bob,

···

On Tue, Sep 24, 2013 at 6:22 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

I’ve been grappling with a problem exporting and importing orgunit metadata which I’d like to share some thoughts on.

Two dhis2 instances (in Rwanda) have slightly different sets of orgunits. So we are trying to rationalize and combine them - in most cases a union of the two with some shuffling around in the hierarchy.

We have solved this pretty well but here is a challenge with group memberships. If I export all the orgunits from system A, together with their orgunitgroups, over to system B, one consequence is that the existing group memberships in A get replaced by those from B rather than appended. This is not the desired behaviour

It doesn’t look like we have an api method which will allow me to add an orgunit to an existing group. I could of course be missing something.

I see the issue. The challenge here is to be able to support removal of members in (org unit) groups, at the same time as supporting incremental additions to a group. What I mean is, if you for instance want to remove all but one member for a group, then the best way is to simply include that single member in the message and none else. This conflicts with the desire for convenient additions of members to a group, where you must post all members. I think we need to add a new method for this. Feel free to suggest what would be most sensible.

Lars