Importation of Category combo options with DXF2

Hi Devs,

I have been working my way through the bootstrapping of one instance from another instance of DHIS2, specifically on the whole category part of the model.The basic use case is synchronization of data from one system (a slave) to another instance (a master).

A bit of an adventure. Anyway, one of the things which puzzled be a bit was the importation of categoryOptionCombos. As an example, lets look at

http://apps.dhis2.org/demo/api/categoryOptionCombos/PP09MbybbwK.xml

which provides some details on a single category option combo. Get all of them from here and we should be able to reconstruct everything we need. (I think).

The process which I came up with started with importing all of the category options , followed by the categories, followed by the category combos. This was relatively straightforward. I thought this was enough, but realized of course, that the part which is important in all of this (the category option combos ) were not present. This was verified by examining the categoryoptioncombo table, which had nothing present except for the default. This was a bit puzzling to me, since all of the category options, categories and category combos were successfully imported.Without these, synchronization of data values between the two systems would of course been impossible, but obviously they need to be imported in order to get the UIDs in sync between the two systems.So, I went ahead and imported them.

However, coming back to the URL above, there is the endpoint in the API for the categoryOptionCombos, which provides the necessary metadata to reconstruct all of them. What I do not get really is this snippet of XML

…categoryOptionCombo xmlns=“http://dhis2.org/schema/dxf/2.0” name="(0-28d, At PHU)"…

Notice the “name” attribute, which I cannot find anywhere in the database. For background, consult this email from on the issue of ordering of category option combo names (https://lists.launchpad.net/dhis2-devs/msg20988.html) which describes an “issue” related to the ordering of the names. Sometimes we got (0-28d, At PHU), while other times like (At PHU, 0-28d) in the _categoryoptioncomboname resource table, which seems to be the only place where these are actually stored. I think this has been fixed, but I still do not understand why this cannot be persisted,. It would seem that categoryoptioncombo would be a better place for persistence (along with the UID and code) Is this attribute even stored someplace when the object is imported?

Not sure exactly when this got fixed, but the names in the resource table (_categoryoptioncomboname) do not seem to match the names (all the time) on the API end point. The reversal/switching of the category options seems to still be there.

Any clarity to a rather fuzzy area of DHIS2 would be appreciated.

Best regards,

Jason