Deleting Data in OpenMRS: Void vs. Retire vs. Purge
Throughout the OpenMRS API and data model, you will notice references to the terms void, retire, and purge. Here are some definitions that may help you understand why and where these terms are used.
| void | Functionally deletes data (from a user's perspective) without actually deleting data at the database level. Voided data should no longer be seen by users except where the user wants to explicitly view "deleted" data. Voiding allows "deleted" data to still be used for audit and undo purposes. We use void instead of delete to avoid confusion with a database delete (which permanently removed data from the system). Example: when a user deletes a patient address, we void the data within the database. |
| retire | Prevents future use of metadata. Data that references retired metadata remains valid. Retire applies to metadata, not clinical data. Example: when HEPATITIS C (2ND GENERATION) is replaced with a new test called HEPATITIS C (3RD GENERATION), then the first term, HEPATITIS C (2ND GENERATION), is retired. Existing results using the 2nd generation test are still valid and still viewable within the system; however for new/future results, the 2nd generation test is no longer available. |
| purge | Permanently (irreversibly) removes data from the system (a database level delete). In general, clinical data should never be purged. The purge feature is made available for removing metadata that has never been referenced within data and for super users that need to expunge data in special situations. Example: an administrator is loading new locations into the system and realizes that one of the locations was invalid. She purges the data before any clinical data references the invalid location. |
