← Back to team overview

dhis2-devs team mailing list archive

Re: In DHIS 2.27 Issues with deleting organisation unit

 

Thanks for the quick reply Jason,

In DHIS documentation
<https://docs.dhis2.org/2.27/en/developer/html/webapi_maintenance.html>, we
came across a WEB API which can clear all the data of the organisation unit.

/api/26/maintenance/dataPruning/organisationUnits/<org-unit-id>

API Details: Data pruning will remove complete data set registrations, data
approvals, data value audits and data values, in this case of an
organisation unit.

We are expecting that this API will clear all the data of the given
organisation unit and any data/approvals of its parent organisation units
will be untouched. Is our expectation correct?

Do you see any problem with deleting data for the organisation unit using
this API.

Thanks,
Jhansi

On Thu, Dec 14, 2017 at 9:12 PM, Jason Pickering <
jason.p.pickering@xxxxxxxxx> wrote:

> Hi Jhansi,
> You will also need to get rid of the data in the data value audit table.
>
> Here is an SQL function which might work for you.
>
> https://github.com/dhis2/dhis2-utils/blob/master/
> resources/sql/delete_orgunit_with_data.sql
>
> Regards,
> Jason
>
>
> On Thu, Dec 14, 2017 at 2:49 PM, Jhansi Reddy Karee <
> jhansirk@xxxxxxxxxxxxxxxx> wrote:
>
>> Hello Team,
>>
>>
>> In DHIS 2.27, we are not able to delete an organisation unit after
>> deleting all the data associated to it.
>>
>>
>> Following are the steps we have followed to do this:
>>
>>    -
>>
>>    Delete all the data associated to the organisation unit
>>    -
>>
>>    In Data administration app, under maintenance, we have performed
>>    maintenance over “Permanently remove soft deleted data values”.
>>    -
>>
>>    Tried deleting the organisation unit. But, we are getting the
>>    following error: Could not delete due to association with another object:
>>    DataValueAudit
>>
>>
>> Please let us know if we have missed anything.
>>
>>
>> Thanks,
>>
>> Jhansi
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+46764147049
>

Follow ups

References