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

2018-01-06 Thread Knut Staring
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


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

2018-01-06 Thread moses mwale
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


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

2018-01-06 Thread Lars Helge Ă˜verland
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/api/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 
___
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


[Dhis2-devs] Inconsistency between schema and api ?

2018-01-06 Thread Martin Van Aken
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/api/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