← Back to team overview

dhis2-devs team mailing list archive

Re: The "Organisation unit merge" function

 

Hi Hannan,
I realized that I had committed an earlier version of this script. Please
update again from the repo and try again.

If you have issues with the functions let me know, as we would like them to
be generally useful, so if something is missing let me know. Hopefully,
they can serve as the blueprint for the permanent fix in DHIS2.

Regards,
Jason


On Wed, Feb 24, 2016 at 3:02 PM, Hannan Khan <hannank@xxxxxxxxx> wrote:

> Dear Jason
>
> Than you for quick feedback.
>
> I already have a try with your functions and faced some issues earlier. I
> identified the issues and will tray again.
>
> Regards
>
> Hannan
>
> On Wed, Feb 24, 2016 at 7:56 PM, Jason Pickering <
> jason.p.pickering@xxxxxxxxx> wrote:
>
>> Hi Hannan,
>>
>> There were  issues with the implementation in DHIS2, and it could have
>> caused major havoc with the data, depending on the situation, thus there
>> was a decision to remove this for now. I think the devs are working on a
>> more permanent fix, but in the time being, I created two Postgresql
>> functions (if you are using MySQL..these will not work).
>>
>> The first, is to delete sites with data.
>>
>>
>> https://github.com/dhis2/dhis2-utils/blob/master/resources/sql/delete_site_with_data.sql
>>
>> and then to merge them (which depends on the first function)
>>
>>
>> https://github.com/dhis2/dhis2-utils/blob/master/resources/sql/merge_orgunits.sql
>>
>> Absolutely no warranty on this, so be sure to test very thoroughly your
>> self!  The merge function accepts different strategies (MIN, MAX, SUM, AVG,
>> LATEST, FIRST) for numeric data. Non-aggregatable data (option sets, text,
>> etc) will use the "latest" data in case of conflicts. You can of course
>> tweak this to your needs.
>>
>>
>> Good luck!
>>
>> Regards,
>> Jason
>>
>>
>> On Wed, Feb 24, 2016 at 11:43 AM, Hannan Khan <hannank@xxxxxxxxx> wrote:
>>
>>> Dear Experts
>>>
>>> From version 2.21 the "Organisation unit merge" function are
>>> discontinued. In some context this was very useful. Can it be added back
>>> again?
>>>
>>> Or I have to write SQL query to manually merge that.
>>>
>>> Regards
>>>
>>> Hannan Khan
>>> HISP Bangladesh
>>>
>>
>>
>>
>> --
>> Jason P. Pickering
>> email: jason.p.pickering@xxxxxxxxx
>> tel:+46764147049
>>
>
>


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

References