← Back to team overview

dhis2-devs team mailing list archive

Re: XML Import of Org Unit Attribute

 

Hi Laura

The simplest way to get to know what is required for a import is to go to
/api/schemas, in your case you should have a look at
/api/schemas/organisationUnit.

We do not support any kind of patching when it comes to multiple imports,
so you have to include the full object. If you are only updating one single
OU, we do support single/multiple value PATCHING, please see [1]

[1] https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s09.html#d5e789

--
Morten

On Thu, Oct 15, 2015 at 9:45 AM, Laura E. Lincks <
laura.lincks@xxxxxxxxxxxxxxxxx> wrote:

> Version: 2.20
> Build: 19958
>
> I need to update existing Org Units with a new, non-existing Org Unit
> attribute *values* using XML meta-data import.
>
> I'm trying to create the simplest XML to do this, excluding tags which
> have no bearing on the update. I just need to add an attribute value to
> each Org Unit.
>
> *I've noticed the following:*
> I must include *openingDate*, *name* and *shortName* even though I am not
> affecting any of those properties (these did not appear to be mandatory in
> 2.18)
> If I do not include *created* a new *created* date is generated
> If I do not include *(u)id* a new (u)*id* is generated (tag is "id",
> column name is "uid")
>
> I would think that generating new *uid *and *created* values could cause
> problems with data integrity. Is this intentional? Are Org Unit records
> being deleted and recreated when running an XML import as it appears to? I
> would assume that if I don't include those tags it would retain whatever
> values already exist for each record.
>
> It seems that in order to ONLY add a non-existing attribute to each Org
> Unit (and not alter the *uid* or *created*  values) I must include the
> following tags in my XML file:
>
> *For organisationUnit:*
> id
> created
> name
> shortName
> openingDate
>
> *For Org Unit Attribute:*
> code
> name
> id
> value
> externalAccess (maybe??)
>
> Can someone confirm or comment on my findings and questions?
> Thanks.
>
> *Laura E. Lincks*
> Database Manager/Developer
> ICAP - Columbia University
> Mailman School of Public Health
> 60 Haven Ave, Floor B1
> New York, NY 10032
> Tel: 212 304 7132
>
> _______________________________________________
> 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
>
>

References