DELETING FACILITIES WITH DATA FROM THE DHIS

Hi all,

We are currently trying to delete old facilities from our main server
but nothing seems to be happening since these facilities already have
data.Is there a way one can do this or disable the facilities as this
is currently affecting the completeness of our data.

I need your help please.

Dear Mohamed,

Untag them from datasets. They will not affect your reporting rates and completeness.

If you delete them, you will be deleting historical data (which I think you want).

How I have solved this problem in Uganda, I always tag them as closed or Non functional using an organisation Unit Group Set.

Alex

···

On Wed, Apr 13, 2016 at 2:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "

1 Like

Mohamed,

I find that the far easiest way of doing this is to

  1. Identify all the facilities you want to delete

  2. Use a script (simple) to delete any datavalue records linked to those facilities

  3. Delete the facilities in the normal user interface, to ensure all related meta-data is removed.

Regards

Calle

···

On 13 April 2016 at 13:24, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi,

Alex and my posts crossed: if you want to keep that historic data, follow Alex’ suggestion. But if you want to get rid of it - the data might be irrelevant or duplicates - then using a script is easiest.

As far as I know, there is no “Prune Organisational Units” functionality (which would completely remove Orgunits with all their data) in DHIS2 similar to the functionality in DHIS 1.4

Regards

Calle

···

On 13 April 2016 at 13:32, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Mohamed,

Untag them from datasets. They will not affect your reporting rates and completeness.

If you delete them, you will be deleting historical data (which I think you want).

How I have solved this problem in Uganda, I always tag them as closed or Non functional using an organisation Unit Group Set.

Alex


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Wed, Apr 13, 2016 at 2:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi there.
I have added a Postgresql function to delete a site with data here.

Use at your own risk, but we have used this successfully in production systems.

Regards,

Jason

···

On Wed, Apr 13, 2016 at 8:37 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi,

Alex and my posts crossed: if you want to keep that historic data, follow Alex’ suggestion. But if you want to get rid of it - the data might be irrelevant or duplicates - then using a script is easiest.

As far as I know, there is no “Prune Organisational Units” functionality (which would completely remove Orgunits with all their data) in DHIS2 similar to the functionality in DHIS 1.4

Regards

Calle


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 13 April 2016 at 13:32, Alex Tumwesigye atumwesigye@gmail.com wrote:

Dear Mohamed,

Untag them from datasets. They will not affect your reporting rates and completeness.

If you delete them, you will be deleting historical data (which I think you want).

How I have solved this problem in Uganda, I always tag them as closed or Non functional using an organisation Unit Group Set.

Alex


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


On Wed, Apr 13, 2016 at 2:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET

Kampala

Uganda
+256 774149 775, + 256 759 800161

Skype ID: talexie

IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant

"I don’t want to be anything other than what I have been - one tree hill "

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

Hi devs,

In line with this, are there any plans to restore the 'organizational units merge' functionality that was removed in a previous version?

Thanks,

Ime
···

On 4/13/2016 12:39 PM, Jason Pickering wrote:

Hi there.�
I have added a Postgresql function to delete a site with data here.�

      Use at your own risk, but we have used this successfully in production systems.�

Regards,

Jason

      On Wed, Apr 13, 2016 at 8:37 PM, Calle Hedberg <calle.hedberg@gmail.com>
      wrote:

Hi,

            Alex and my posts crossed: if you want to keep that historic data, follow Alex' suggestion. But if you want to get rid of it - the data might be irrelevant or duplicates - then using a script is easiest.
            As far as I know, there is no "Prune Organisational Units" functionality (which would completely remove Orgunits with all their data) in DHIS2 similar to the functionality in DHIS 1.4

Regards

Calle

                On 13 April 2016 at 13:32, Alex Tumwesigye <>
                wrote:

Dear Mohamed,

                      Untag them from datasets. They will not affect your reporting rates and completeness.
                      If you delete them, you will be deleting historical data (which I think you want).
                      How I have solved this problem in Uganda, I always tag them as closed or Non functional using an organisation Unit Group Set.

Alex

                          On Wed, Apr 13, 2016 at 2:24 PM, Mohamed Bangura <mbangs87@gmail.com>
                          wrote:

Hi all,

                            We are currently trying to delete old facilities from our main server

                            but nothing seems to be happening since these facilities already have

                            data.Is there a way one can do this or disable the facilities as this

                            is currently affecting the completeness of our data.



                            I need your help please.

                            Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)

                            Post to� � �: dhis2-devs@lists.launchpad.net

                            Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)

                            More help� �: [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)


Alex Tumwesigye

                                  Technical Advisor - DHIS2 (Consultant),

                                  Ministry of Health/AFENET

Kampala

Uganda

                                                                          +256 774149 775,�                                        + 256 759 800161
                                    Skype ID: talexie
                                  IT Consultant (Servers, Networks and Security, Health Information Systems - DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant
                                "I don't want to be anything other than what I have been - one tree hill "
                  _______________________________________________

                  Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)

                  Post to� � �: dhis2-devs@lists.launchpad.net

                  Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)

                  More help� �: [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)


Calle Hedberg

                          46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


        _______________________________________________

        Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)

        Post to� � �: dhis2-devs@lists.launchpad.net

        Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)

        More help� �: [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)


Jason P. Pickering

        email: jason.p.pickering@gmail.com
_______________________________________________ Mailing list: Post to : Unsubscribe : More help :

atumwesigye@gmail.comtel:+46764147049https://launchpad.net/~dhis2-devsdhis2-devs@lists.launchpad.nethttps://launchpad.net/~dhis2-devshttps://help.launchpad.net/ListHelp

Hi Mohamed,

in 2.22 we introduced a Web API feature for forcing delete of organisation units:

http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s38.html

So if you are able to send a POST request to the following URL if will remove related data/completeness/approval records.

regards,

Lars

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

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

On Wed, Apr 13, 2016 at 1:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

1 Like

Hi Lars,

good to know! Will also delete trackedentitydatavalues?

other questions… what do you think…

  1. about adding startDate and endDate (or periods) as parameters?

  2. about adding a inlcudeDescendants=true as parameter? so we can remove data from the descendants org. units as well… (hope never had a mistake with this)

  3. Also deleting trackedentitydatavalues from a particular program …

Well there are multiple combinations, just wanted to know if you have some plans to add some calls like those… In PSI, we have to go many times to the database just to remove datavalues or trackedentitydatavalues…

Thanks

Jose

···

On Wed, Apr 13, 2016 at 4:53 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Mohamed,

in 2.22 we introduced a Web API feature for forcing delete of organisation units:

http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s38.html

So if you are able to send a POST request to the following URL if will remove related data/completeness/approval records.

regards,

Lars

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

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

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Wed, Apr 13, 2016 at 1:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

1 Like

Lars,

Bugger! - I had overlooked that (and maybe Jason too?). But just to confirm - that dataPruning api call in reality works exactly like the pg function shared by Jason?

Otherwise - very nice to see that has been included. I’ve had some sessions deleting duplicated OrgUnits that have been embedded all over the place, and it can be a pain in the b… to track down all the bits and pieces

Regards

Calle

···

On 13 April 2016 at 16:53, Lars Helge Øverland lars@dhis2.org wrote:

Hi Mohamed,

in 2.22 we introduced a Web API feature for forcing delete of organisation units:

http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s38.html

So if you are able to send a POST request to the following URL if will remove related data/completeness/approval records.

regards,

Lars

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

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

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Wed, Apr 13, 2016 at 1:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


1 Like

Yes, i did indeed overlook the native DHIS2 function, which Lars mentioned. Its good its there and supported by the core code. It was not there when I needed this function though.

It may be useful however to perform this operation via SQL in certain cases however. This function , and hopefully the one from the Java side, was developed specifically to be generic, only accepting a single paramater, the UID of the orgunit to delete. So, if you have other criteria (start date/end date, includeDescendants=true), you would need to feed both functions the UIDs of these sites in the proper manner. If there are children, the function will abort, as one could imagine a situation where you provide the function the UID of the root orgunit, and it would proceed to delete everything. So, its been made more with an atttempt to allow you to delete a site, but not entire branches at the same time, which could be easily achieved by simply calling the function multiple times in the correct order of sites to delete.

The other reason for having it, is it is used by the “merge_orgunits.sql”, which will perform the operation of merging orgunits (which was removed from the core for the time bering). Once the data has been merged (according to some strategies like MIN, MAX, LATEST, etc) the site to be removed will be deleted with this “delete_site_with_data.sql”.

Regards,

Jason

···

On Thu, Apr 14, 2016 at 2:09 AM, Calle Hedberg calle.hedberg@gmail.com wrote:

Lars,

Bugger! - I had overlooked that (and maybe Jason too?). But just to confirm - that dataPruning api call in reality works exactly like the pg function shared by Jason?

Otherwise - very nice to see that has been included. I’ve had some sessions deleting duplicated OrgUnits that have been embedded all over the place, and it can be a pain in the b… to track down all the bits and pieces

Regards

Calle


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 13 April 2016 at 16:53, Lars Helge Øverland lars@dhis2.org wrote:

Hi Mohamed,

in 2.22 we introduced a Web API feature for forcing delete of organisation units:

http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s38.html

So if you are able to send a POST request to the following URL if will remove related data/completeness/approval records.

regards,

Lars

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

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

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


On Wed, Apr 13, 2016 at 1:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

1 Like

Yes that function was introduced sort of under the radar. It works only for aggregate part of the data model.

Will be extended to tracker model at some point.

regards,

Lars

···

On Thu, Apr 14, 2016 at 1:27 AM, Jason Pickering jason.p.pickering@gmail.com wrote:

Yes, i did indeed overlook the native DHIS2 function, which Lars mentioned. Its good its there and supported by the core code. It was not there when I needed this function though.

It may be useful however to perform this operation via SQL in certain cases however. This function , and hopefully the one from the Java side, was developed specifically to be generic, only accepting a single paramater, the UID of the orgunit to delete. So, if you have other criteria (start date/end date, includeDescendants=true), you would need to feed both functions the UIDs of these sites in the proper manner. If there are children, the function will abort, as one could imagine a situation where you provide the function the UID of the root orgunit, and it would proceed to delete everything. So, its been made more with an atttempt to allow you to delete a site, but not entire branches at the same time, which could be easily achieved by simply calling the function multiple times in the correct order of sites to delete.

The other reason for having it, is it is used by the “merge_orgunits.sql”, which will perform the operation of merging orgunits (which was removed from the core for the time bering). Once the data has been merged (according to some strategies like MIN, MAX, LATEST, etc) the site to be removed will be deleted with this “delete_site_with_data.sql”.

Regards,

Jason

On Thu, Apr 14, 2016 at 2:09 AM, Calle Hedberg calle.hedberg@gmail.com wrote:

Lars,

Bugger! - I had overlooked that (and maybe Jason too?). But just to confirm - that dataPruning api call in reality works exactly like the pg function shared by Jason?

Otherwise - very nice to see that has been included. I’ve had some sessions deleting duplicated OrgUnits that have been embedded all over the place, and it can be a pain in the b… to track down all the bits and pieces

Regards

Calle


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On 13 April 2016 at 16:53, Lars Helge Øverland lars@dhis2.org wrote:

Hi Mohamed,

in 2.22 we introduced a Web API feature for forcing delete of organisation units:

http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s38.html

So if you are able to send a POST request to the following URL if will remove related data/completeness/approval records.

regards,

Lars

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

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

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


On Wed, Apr 13, 2016 at 1:24 PM, Mohamed Bangura mbangs87@gmail.com wrote:

Hi all,

We are currently trying to delete old facilities from our main server

but nothing seems to be happening since these facilities already have

data.Is there a way one can do this or disable the facilities as this

is currently affecting the completeness of our data.

I need your help please.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

1 Like

@Lars

Has the dataPruning api call for orgunits been extended to the tracker/event model now?

Regards
calle

1 Like