Issue with deleting programs

I tried to delete a program, but was not able to because of link to ProgramStageInstance.

I looked in Event Visualizer and deleted the only two events that existed – now when I check the api (http://52.15.117.219:8080/api/27/dataValueSets.json?dataElementGroup=DAs1xiHQyYb&period=2018&orgUnit=uU2f1QST4ZM) I can see that there are no events.

I still have the same error when I try to delete the program. Is there a way to delete ALL data associated with an event program at once? Or a way to locate all data associated with a program, so I can see if somehow I am missing something? Otherwise, is there a way to delete a program with all associated data and metadata (data elements and data values)?

2 Likes

Hi there @berhard!
There is no tool for doing bulk deletion of programs with all data currently. To do a deep program delete you would have to use database scripts. Because of soft-deletion it would not be enough to delete the data through the APIs.

I assume that deleting the program is an issue of tidying your database, and it is not sufficcent for you that the end users dont see the program anymore. If it is OK that the program is just hidden from view, not actually deleted, you could just reduce the sharing of the program. Only admins would be able to see it.

Here is a thread that talks about cleaning the db with SQL:

2 Likes