This module can be used to permanently remove the data from the database which is older than desired length of time. By default, OpenMRS will mark data as "voided" to effectively delete it from the user's view. However, that data is always there. This module is for those brave souls that need some more disk space and want to trim down their tables.
When the module is installed into the OpenMRS, you can click module link in the admin page to remove the voided data. You can then select the object type from the drop down list that you would like to purge. You also choose how old the data must be in order for it to be deleted.
As confirmation, the module will show how many voided objects will be removed from the database. By clicking submit, the module will delete all the desired voided data.
Module download: https://addons.openmrs.org/#/show/org.openmrs.module.cleaningvoided
View the source code: http://source.openmrs.org/browse/Modules/cleaningvoided/trunk