D4H-VA / smartva-dhis2

Verbal Autopsy data integration into DHIS2
https://smartva-dhis2.readthedocs.io
MIT License
1 stars 3 forks source link

How do we remove Org Units not longer required #17

Open rwardD4H opened 6 years ago

rwardD4H commented 6 years ago

We need to remove Bangladesh org units under VA global. This can't be done in DHIS2. We get a dependancy error (associations).

We have successfully uploaded Sri Lankan Org unit under VA global. But now want to remove or hide Bangladesh units as no longer relevant (for Sri Lanka).

rwardD4H commented 6 years ago

checking with David

davidhuser commented 6 years ago

There are a few ways to go about this:

a) Give users only access to Sri Lanka Org Units whenever you are creating a new user so they will not see those Org Units anywhere (except they are SuperUser)

b) Delete all events related to those orgunits, then deleting them "from bottom up". The dependency error means you attempted to delete an orgunit that still has children (e.g. deleting a District isn't possible because there are still Upazilas below)

c) Run the orgunit deletion database SQL script.

wget https://raw.githubusercontent.com/dhis2/dhis2-utils/master/resources/sql/delete_orgunittree_with_data.sql

psql -U dhis -d dhis2 -f /path/to/delete_orgunittree_with_data.sql

select delete_orgunittree_with_data('gQx5Qrsrg8q');