Re: [Dhis2-devs] merging facilities (org-units) without losing data

2018-01-07 Thread moses mwale
Thanks very much, allow me to go through and implement the given knowledge

On Sun, Jan 7, 2018 at 11:29 PM, Jason Pickering <
jason.p.picker...@gmail.com> wrote:

> Hi Moses
> We have some SQL scripts for this here.
>
> https://github.com/dhis2/dhis2-utils/blob/master/
> resources/sql/merge_orgunits.sql
>
> This script will not handle tracker data but could probably be adapted
> fairly easily to do so.
>
> Regards,
> Jason
>
>
>
> On Jan 7, 2018 7:28 AM, "Knut Staring"  wrote:
>
>> Hi Moses,
>> I would take a backup of the database and then do this with an sql
>> script, just changing the sourceid (the database internal referent to the
>> organisationunitid) in the datavalues table. But you may get blocked if the
>> same period has been filled for both, in which case you may want to do a
>> "NOT IN" or left join.
>>
>> Knut
>>
>> On Jan 7, 2018 10:29, "moses mwale"  wrote:
>>
>>> Hey devs is it possible to merge facilities without losing data, some
>>> admin accidentally created other duplicates units into the system. anyone
>>> knows how its done?
>>>
>>> developer_lusaka_systems
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>


-- 
developer_lusaka_systems
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Inconsistency between schema and api ?

2018-01-07 Thread Martin Van Aken
BTW, I did the test with the collectionName & it works, thanks!

On Sun, Jan 7, 2018 at 2:06 PM, Martin Van Aken 
wrote:

> Hello,
> Thanks for the clarification. So, I can rely on the fact that the schema
> property "collectionName" will be consistent with the actual object field,
> correct?
>
> Just for my curiosity/understanding - while I'm all for API stability (and
> not breaking stuff or let say break it carefully), I fail to see how
> updating the schema to be consistent would actually break anything ?
>
> Matin
>
> On Sat, Jan 6, 2018 at 2:55 PM, Lars Helge Øverland 
> wrote:
>
>> Hi Martin,
>>
>> this is correct and a good observation.
>>
>> If you look in the source code you can see that we have specified a JSON
>> field name directly on the get method:
>>
>> @JsonProperty( "organisationUnits" )
>>
>> https://github.com/dhis2/dhis2-core/blob/master/dhis-2/dhis-
>> api/src/main/java/org/hisp/dhis/organisationunit/Organisa
>> tionUnitGroup.java
>>
>> This was done to improve on a bad naming choice ("members") in the past
>> and to expose a more sensible name in the API. This is then reflected in
>> the schemas API as you observed. We hope to change the Java property name
>> in the future but it requires a bit of refactoring.
>>
>> You can get the name of collections as they are actually rendered in the
>> API through the "collectionName" schema property in the mean time. You
>> could say that we should have a dedicated consistent schema property for
>> the "API field", we could perhaps work on that.
>>
>> best,
>>
>> Lars
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 6 January 2018 at 14:26, Martin Van Aken 
>> wrote:
>>
>>> Hello!
>>>
>>> I'm making a new DHIS2 App and so make use of the API through d2. I
>>> think I found an inconsistency between the schema as exposed under
>>> api/schemas and the real field returned.
>>>
>>> Having access to the schema is very handy to directly know for example
>>> which field to show & how (as we have access to their property types).
>>>
>>> - When using organisationUnitGroups, for example
>>> https://play.dhis2.org/demo/api/organisationUnitGroups/RXL3lPSK8oG.json
>>> we get a field named "organisationUnits" with a list of ids of the linked
>>> unit.
>>> - But on the schema (https://play.dhis2.org/demo/a
>>> pi/schemas/organisationUnitGroup) the link to organisationUnit is
>>> actually referenced under the field name "members"
>>>
>>> There are similar situation for OU (organisationUnitGroups vs just
>>> "groups") and probably other.
>>>
>>> Is it something I'm missing or is that a mistake? If this is a bug, let
>>> me know if I can fill a PR (with some direction from the team).
>>>
>>> Thanks,
>>>
>>> Martin
>>>
>>>
>>> --
>>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>>
>>> Mobile : +32 486 899 652
>>>
>>> Follow me on Twitter : @martinvanaken 
>>> Call me on Skype : vanakenm
>>> Hang out with me : mar...@joyouscoding.com
>>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>>> Company website : www.joyouscoding.com
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Lars Helge Øverland
>> Lead developer, DHIS 2
>> University of Oslo
>> Skype: larshelgeoverland
>> l...@dhis2.org
>> http://www.dhis2.org 
>>
>>
>
>
> --
> *Martin Van Aken - **Freelance Enthusiast Developer*
>
> Mobile : +32 486 899 652
>
> Follow me on Twitter : @martinvanaken 
> Call me on Skype : vanakenm
> Hang out with me : mar...@joyouscoding.com
> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
> Company website : www.joyouscoding.com
>



-- 
*Martin Van Aken - **Freelance Enthusiast Developer*

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken 
Call me on Skype : vanakenm
Hang out with me : mar...@joyouscoding.com
Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
Company website : www.joyouscoding.com
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Inconsistency between schema and api ?

2018-01-07 Thread Martin Van Aken
Hello,
Thanks for the clarification. So, I can rely on the fact that the schema
property "collectionName" will be consistent with the actual object field,
correct?

Just for my curiosity/understanding - while I'm all for API stability (and
not breaking stuff or let say break it carefully), I fail to see how
updating the schema to be consistent would actually break anything ?

Matin

On Sat, Jan 6, 2018 at 2:55 PM, Lars Helge Øverland  wrote:

> Hi Martin,
>
> this is correct and a good observation.
>
> If you look in the source code you can see that we have specified a JSON
> field name directly on the get method:
>
> @JsonProperty( "organisationUnits" )
>
> https://github.com/dhis2/dhis2-core/blob/master/dhis-2/
> dhis-api/src/main/java/org/hisp/dhis/organisationunit/
> OrganisationUnitGroup.java
>
> This was done to improve on a bad naming choice ("members") in the past
> and to expose a more sensible name in the API. This is then reflected in
> the schemas API as you observed. We hope to change the Java property name
> in the future but it requires a bit of refactoring.
>
> You can get the name of collections as they are actually rendered in the
> API through the "collectionName" schema property in the mean time. You
> could say that we should have a dedicated consistent schema property for
> the "API field", we could perhaps work on that.
>
> best,
>
> Lars
>
>
>
>
>
>
>
>
>
> On 6 January 2018 at 14:26, Martin Van Aken 
> wrote:
>
>> Hello!
>>
>> I'm making a new DHIS2 App and so make use of the API through d2. I think
>> I found an inconsistency between the schema as exposed under api/schemas
>> and the real field returned.
>>
>> Having access to the schema is very handy to directly know for example
>> which field to show & how (as we have access to their property types).
>>
>> - When using organisationUnitGroups, for example
>> https://play.dhis2.org/demo/api/organisationUnitGroups/RXL3lPSK8oG.json
>> we get a field named "organisationUnits" with a list of ids of the linked
>> unit.
>> - But on the schema (https://play.dhis2.org/demo/a
>> pi/schemas/organisationUnitGroup) the link to organisationUnit is
>> actually referenced under the field name "members"
>>
>> There are similar situation for OU (organisationUnitGroups vs just
>> "groups") and probably other.
>>
>> Is it something I'm missing or is that a mistake? If this is a bug, let
>> me know if I can fill a PR (with some direction from the team).
>>
>> Thanks,
>>
>> Martin
>>
>>
>> --
>> *Martin Van Aken - **Freelance Enthusiast Developer*
>>
>> Mobile : +32 486 899 652
>>
>> Follow me on Twitter : @martinvanaken 
>> Call me on Skype : vanakenm
>> Hang out with me : mar...@joyouscoding.com
>> Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
>> Company website : www.joyouscoding.com
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Lars Helge Øverland
> Lead developer, DHIS 2
> University of Oslo
> Skype: larshelgeoverland
> l...@dhis2.org
> http://www.dhis2.org 
>
>


-- 
*Martin Van Aken - **Freelance Enthusiast Developer*

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken 
Call me on Skype : vanakenm
Hang out with me : mar...@joyouscoding.com
Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken
Company website : www.joyouscoding.com
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] merging facilities (org-units) without losing data

2018-01-07 Thread Jason Pickering
Hi Moses
We have some SQL scripts for this here.

https://github.com/dhis2/dhis2-utils/blob/master/resources/sql/merge_orgunits.sql

This script will not handle tracker data but could probably be adapted
fairly easily to do so.

Regards,
Jason



On Jan 7, 2018 7:28 AM, "Knut Staring"  wrote:

> Hi Moses,
> I would take a backup of the database and then do this with an sql script,
> just changing the sourceid (the database internal referent to the
> organisationunitid) in the datavalues table. But you may get blocked if the
> same period has been filled for both, in which case you may want to do a
> "NOT IN" or left join.
>
> Knut
>
> On Jan 7, 2018 10:29, "moses mwale"  wrote:
>
>> Hey devs is it possible to merge facilities without losing data, some
>> admin accidentally created other duplicates units into the system. anyone
>> knows how its done?
>>
>> developer_lusaka_systems
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp