← Back to team overview

dhis2-devs team mailing list archive

Re: Organisational Unit merge

 

Hi Prosper,

Yes, this functionality was dropped due to multiple complications with the
code. In older versions it is still there, but I would strongly encourage
you not ot use it. It was either non-functional in certain cases (but
appear to work through the UI) , or would possibly corrupt data in others
due to outdated logic in the code.

In the meantime, I have added two  SQL for PostgreSQL functions here
<https://github.com/dhis2/dhis2-utils/tree/master/resources/sql>.

1) SELECT * FROM delete_site_with_data(UID)  where UID is the uid of the
"site" is required. This will drop all references to an organisation unit
with no children. It will not work if the site has children. This is needed
by the second script. You do not need to execute this, but rather it needs
to be present in the database.

2) SELECT * FROM merge_orgunits(source_uid,destination_uid);

will merge two organisation units. There are a number of caveats

a) Overlapping data which is not of type "INT", will be dropped from the
source organisation unit, in favor of the destination organisation unit.

b) Events/tracker data is currently not supported. More code would need to
be added to handle this.

You can probably modify these to suit your needs. We are still
contemplating putting the functionality back in, but it will be quite a bit
of work to get it right, and due to the possible differences in how
overlapping data should be handled between different instances of DHIS2, it
may require even more work to get it right. In the end, this is a quite
tricky operation, and may depend on specific logic of how to handle
overlapping data. If you have no overlapping data, then it should be pretty
simple to switch the organisation unit ID references, and then delete the
source organisation unit as usual.

Hope this helps.

Regards,
Jason


On Tue, Oct 13, 2015 at 6:44 AM, Prosper BT <ptb3000@xxxxxxxxx> wrote:

> Dear Developers,
>
> For a long time with the different versions and builds the organisational
> unit merge has not been working, I have submitted bugs but not solutions.
>
> Was this dropped or?
>
> Regards
>
> --
> Prosper Behumbiize, MPH
> Global HISP| University Of Oslo/HISP Uganda
> +256 752 751 776 | +256 776 139 139
> ptb3000@xxxxxxxxx | prosper@xxxxxxxxx | Skype: prospertb
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049

Follow ups

References