Removing Patient and associated data from OpenMRS, OpenERP and OpenELIS

Hi my friends,

Can someone please provide detailed instructions as to how I can remove all the patient/customer data from all 3 systems. I have seen several “ideas” but there always seems to be issues. I am running Bahmni 0.87. I believe there may be sql scripts but not sure where and I am not sure how to run a SQL file from the command line.

Please help!

Thank you so much, in advance! Denise

Have you tried the steps described here? -Make sure to set the environment variables for the three databases correctly. Running the “” script will download corresponding sql scripts for deleting data in each database and the sql scripts will be executed for you.


Please BACKUP all your databases first before you run any SQL… to ensure that if things don’t go the way you hoped, you can always “reboot” your database : )

1 Like

Thank you so much @rubailly and @gsluthra! The process worked okay but I found a couple of things that could be improved/fixed.

In OpenMRS, it didn’t clear out the Bed table value to “AVAILABLE” for all Patients that were previously assigned a Bed.

I also am having an issue with OpenERP. Most of the patients were left as customers. It seems that first, there are no deleting cascades set up i.e. invoices/quotations. I would like to start fresh with OpenERP but am unable to clear out the accounting / Patients pieces. Additional thoughts would be appreciated? Can I only start fresh for that system?

Thank you!

Thanks for identifying. This is a miss in the script. We will update the script with the required changes. As a temporary solution please run the below queries.

update bed set status=“AVAILABLE”; delete from bed_patient_assignment_map;

Thanks @sravanthi17, that takes care of first question. I’m still having issues with OpenERP. Need to reinstall I think at this point. I removed a module and everything has gone badly. Please advise.

Which module did you remove ?

@dnelson: You can see the openerp instance in the online demo, and compare your modules to see what may be different / missing.

Online Demo

1 Like

i had added a few to try out like Social Network and Lunch. I cleaning up, I removed them and it “broke” the system. In googling the issue and “solution”, it seems there are a couple of bugs in the older versions of oodo. At this time, I just don’t have the time to troubleshoot longer because it really doesn’t have anything to do with Bahmni’s installation, EXCEPT to say, take caution in removing modules. :slight_smile: Thank you!