← Back to team overview

dhis2-users team mailing list archive

Re: API: Mass-deleting data values

 

Hi Uwe,

you are right in that we do not support bulk deletion through the Web API.
The main reason is that we want to avert disaster by someone doing it by
mistake or through malicious activity. However we are getting an increasing
number of requests for this so we will consider it.

An effective alternative is to simply use a SQL statement to accomplish it.
Is that an option for you?

regards,

Lars




On Wed, Dec 2, 2015 at 5:44 PM, Uwe Wahser <uwe@xxxxxxxxx> wrote:

> Dear all,
>
>
> currently I am looking at ways of deleting larger amounts of DataValues
> based on their dimensions OrgUnit, Period, DataElement AND
> AttributeOptionCombination. the main purpose is to invalidate old values on
> AttributeOptionCombinations, which no there are no more values in an
> updated source-system. So far I tried the following options:
>
>
> 1 - DELETE api dataValues?pe=xxx&ou=xxx&de=xxx&cc=xxx&cp=xxxx: works, but
> take s a loong time since every delete-record has open the api-connection
> once.
>
>
> 2 - POST api dataValueSets?importStrategy=DELETE: should be the most
> applilcable, if it works - does it? I only get ignored records in the
> result set. Does it make sense to investigate further into this option, or
> is this api not forseen for deleting?
>
>
> 3 - POST api dataValueSets?importStrategy=UPDATE with all values set to 0:
> have not yet tried this option, but would fall back on this, if I can't get
> (2) to work. I assume that the 0-value-records will be eliminated by DHIS2
> lateron (when? during analytical table-update?)
>
>
> Could someone please comment, if any of these options make sense, or if
> there is another, more elegant version?
>
>
> Thanks a lot in advance!
>
>
> Regards,
>
>
> Uwe
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org>

Follow ups

References