Hello DHIS2 developers,
I work for TerraFrame, an organisation which is developing a DHIS2 integration which synchronizes entire hierarchies of Organisation Units over to DHIS2. I have run into a few problems which are due to the specifics of how the DHIS2 translation and metadata API works. These problems are slowing down our synchronization process to a max synchronization speed of about 400 organisation units per hour.
There are essentially three problems I have run into which prevent me from synchronizing data in a performant way.
-
I am unable to submit translation data for Organisation Units using the metadata API. Technically this is supported, however when I attempt to do so while updating an existing object, if a translation with the same Property and Locale pair already exists, instead of updating it, the DHIS2 instead creates a duplicate value, effectively corrupting the database. For an update such as this, I would expect the DHIS2 to simply update the existing value with the value which I am providing. The documentation explicitly mentions that the metadata import endpoint is not supposed to allow for updating of translations, “as it would be too easy to make mistakes and overwrite the other available locales.”. As a result, I must submit my data again to a separate endpoint, the entity translations endpoint, which causes me to perform another request, which significantly slows down my synchronization.
-
This separate endpoint requires that I have knowledge of existing data within your database: the translations array for a given Organisation Unit. Our system does not have this knowledge, and since this data must be resubmitted it requires us to fetch this information and then make the modifications we need to it, and then submit it to the entity translations endpoint. Ideally we would be able to simply submit the data which we have, and DHIS2 would perform the necessary merging into the existing data.
-
When submitting an update to an existing Organisation Unit via the metadata API, I am required to also submit: name, shortName, openingDate, when really only id should be required. Again, this suffers from the same problem mentioned in #2: our system may not know that information, which requires us to fetch the object or else risk accidentally changing it.
Thanks