Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Upsert tracked entity instances

Compare
Choose a tag to compare
@taylordowns2000 taylordowns2000 released this 08 Dec 13:54

Currently, DHIS2 doesn't support upserts on tracked entity instances but many organizations need to either add or update TEIs based on an external ID. With this new upserTEI function, @chaiwa-berian wrapped up several different DHIS2 apis to build an upsert: first checking if the entity exists with a unique attribute and a get request, and then either creating or updating the TEI.

N.B., DHIS2 also doesn't support patch for updates on tracked entity instances, but we don't want to destroy existing attributes if information from an external system is incomplete, so we've defaulted the behaviour to merge the new data with existing data, unless { replace: true } is set in the optional options argument in upsertTEI(uuid, data, options);