You’re right; What I said pertains to the old import code.
I’ve compared your XML with an export from /23/metadata. It looks to me like all the same fields in the same syntax. The subfields aren’t in the same order, but I don’t see how that would matter.
···
On Mon, Aug 29, 2016 at 2:58 PM, Timothy Harding tharding@baosystems.com wrote:
Haven’t tried putting on ?sharing=true for the /xx/metadata uploader yet because it looks like those options all have new names and new defaults, but I have used it for the /metaData uploader. Just ran it again on the old one and I am getting similar problems with my sharing tags:
- INFO 2016-08-29 18:54:06,004 Unknown reference to {“class”:“class org.hisp.dhis.user.UserGroup”, “id”:“0”, “uid”:“null”, “code”:“null”, “name”:“null”, “created”:“null”, “lastUpdated”:“null” } on object UserGroupAccess{id=0, access=r-------} (DefaultIdentifiableObjectImporter.java [http-nio-18080-exec-34])
The xml is the same as in the previous emails, and the command this time was punctuated with: metaData?preheatCache=true&dryRun=false&sharing=true&async=false
–
Timothy Harding
Sr. Systems Analyst, BAO Systems
+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007
On Mon, Aug 29, 2016 at 2:25 PM, Jim Grace jim@dhis2.org wrote:
Try putting in the URL ?sharing=true (as documented in Developer Manual section 1.7.2.) It took me years to figure this out.
On Mon, Aug 29, 2016 at 2:21 PM, Timothy Harding tharding@baosystems.com wrote:
Also, it looks like if I turn on skipSharing, the uploader will still complain about all the userGroupAccesses. I’m guessing I have a syntax problem, any thoughts?
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
Jim Grace
Core developer, DHIS 2
HISP US Inc.
http://www.dhis2.org
–
Timothy Harding
Sr. Systems Analyst, BAO Systems
+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007
On Mon, Aug 29, 2016 at 1:45 PM, Timothy Harding tharding@baosystems.com wrote:
I’m trying to upload our xml doc to 2.23.23072 using /api/23/metadata and I’m getting quite a few errors back, most of them have to do with the sharing it looks like:
<errorReport>
<message>Invalid reference [null] (UserGroup) on object OVC_BCERT (D, DSD, Age/Sex): Active Beneficiaries [uRwxQ0Kh0In] (DataElement) for association "userGroupAccesses".</message>
<mainKlass>org.hisp.dhis.dataelement.DataElement</mainKlass>
<errorCode>E5002</errorCode>
</errorReport>
The xml I’m uploading looks like the following:
<dataElement name="OVC_BCERT (D, DSD, Age/Sex): Active Beneficiaries" shortName="OVC_BCERT (D, DSD, Age/Sex)" code="OVC_BCERT_D_DSD_Age_Sex" id="uRwxQ0Kh0In">
<description>Number of active beneficiaries surveyed</description>
<domainType>AGGREGATE</domainType>
<zeroIsSignificant>true</zeroIsSignificant>
<categoryCombo name="Age (0-17, 5) and Sex" id="rJkYyZJ5U4O"/>
<valueType>INTEGER</valueType>
<userGroupAccesses>
<userGroupAccess>
<access>r-------</access>
<userGroupUid>c6hGi8GEZot</userGroupUid>
<displayName>Data SI access</displayName>
<id>c6hGi8GEZot</id>
</userGroupAccess>
</userGroupAccesses>
<publicAccess>r-------</publicAccess>
<aggregationType>SUM</aggregationType>
</dataElement>
This user group definitely exists (just checked).
Has the xml format for uploading sharing changed for 2.22+?
Timothy Harding
Sr. Systems Analyst, BAO Systems
+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007
On Fri, Aug 26, 2016 at 12:03 AM, Morten Olav Hansen morten@dhis2.org wrote:
Hi Tim
Yes, could you try and send the same payload to /api/23/metadata? (you might need to change root element from metaData to metadata)
Parameters for new importer can be found here:
http://dhis2.github.io/dhis2-docs/master/en/developer/html/webapi_metadata_import.html
But in your case, you probably don’t need any parameters at all (sharing is on by default, and preheat is set to REFERENCE, which is far superior to the old preheater)
–
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Fri, Aug 26, 2016 at 2:14 AM, Timothy Harding tharding@baosystems.com wrote:
Hello Morten, thanks for your help and patience so far with my importer questions, have another for you:
Uploading around 70 data elements, each of which are shared with the same group and all public READ
Those are that “imported”, so those that didn’t currently exist, upload, and the log file will look like the following:
- INFO 2016-08-25 18:28:17,675 ‘system_dev-mer2.datim.org’ create org.hisp.dhis.dataelement.DataElement, name: PMTCT_STAT_SUBNAT (N, SUBNAT) TARGET: Known Results, uid: bWlpuel5QnH (AuditLogUtil.java [http-nio-18080-exec-8])
- INFO 2016-08-25 18:28:17,677 ‘system_dev-mer2.datim.org’ update org.hisp.dhis.dataelement.DataElement, name: PMTCT_STAT_SUBNAT (N, SUBNAT) TARGET: Known Results, uid: bWlpuel5QnH (AuditLogUtil.java [http-nio-18080-exec-8])
But, when an object already exists in the instance and I am trying to “update” it, I get the following message, note the warning:
- INFO 2016-08-25 18:28:25,910 ‘system_dev-mer2.datim.org’ update org.hisp.dhis.dataelement.DataElement, name: PMTCT_STAT_SUBNAT (N, SUBNAT): Known Results, uid: WJukn7T6Xbr (AuditLogUtil.java [http-nio-18080-exec-8])
- INFO 2016-08-25 18:28:25,911 Unknown reference to {“class”:“class org.hisp.dhis.user.UserGroup”, “id”:“0”, “uid”:“null”, “code”:“null”, “name”:“null”, “created”:“null”, “lastUpdated”:“null” } on object UserGroupAccess{id=0, access=r-------} (DefaultIdentifiableObjectImporter.java [http-nio-18080-exec-8])
The xml file uses the same as all the new elements:
<description>Number of pregnant women who were tested for HIV and know their results plus number of pregnant women with known HIV status at entry to services.</description>
<domainType>AGGREGATE</domainType>
<zeroIsSignificant>true</zeroIsSignificant>
<categoryCombo name="default" id="bjDvmb4bfuf"/>
<valueType>INTEGER</valueType>
<userGroupAccesses>
<userGroupAccess>
<access>r-------</access>
<userGroupUid>c6hGi8GEZot</userGroupUid>
<displayName>Data SI access</displayName>
<id>c6hGi8GEZot</id>
</userGroupAccess>
</userGroupAccesses>
<publicAccess>r-------</publicAccess>
<aggregationType>SUM</aggregationType>
</dataElement>
<dataElement name="PMTCT_STAT_SUBNAT (N, SUBNAT): Known Results" shortName="PMTCT_STAT_SUBNAT (N, SUBNAT)" code="PMTCT_STAT_SUBNAT_N_SUBNAT" id="WJukn7T6Xbr">
<description>Number of pregnant women who were tested for HIV and know their results plus number of pregnant women with known HIV status at entry to services.</description>
<domainType>AGGREGATE</domainType>
<zeroIsSignificant>true</zeroIsSignificant>
<categoryCombo name="default" id="bjDvmb4bfuf"/>
<valueType>INTEGER</valueType>
<userGroupAccesses>
<userGroupAccess>
<access>r-------</access>
<userGroupUid>c6hGi8GEZot</userGroupUid>
<displayName>Data SI access</displayName>
<id>c6hGi8GEZot</id>
</userGroupAccess>
</userGroupAccesses>
<publicAccess>r-------</publicAccess>
<aggregationType>SUM</aggregationType>
</dataElement>
In both cases though, the ** elements are missing their sharing group and are public read/write:**
These both were upload with: metaData?preheatCache=true&dryRun=false&sharing=true&async=false
and the user is a super user.
you had mentioned downloading metatdata from a /23/ am I also able to uploadload meta data to a /23/?
Timothy Harding
Sr. Systems Analyst, BAO Systems
+1 202-536-1541 | tharding@baosystems.com | http://www.baosystems.com | Skype: hardingt@gmail.com | 2900 K Street, Suite 404, Washington D.C. 20007
Jim Grace
Core developer, DHIS 2
HISP US Inc.
http://www.dhis2.org