Background
Most OpenMRS tables include auditing attributes:
changed_by
date_changed
voided_by
date_voided
void_reason
These have limitations and require that tables contain audit history. We also end up supporting similar audit capabilities in several places within the API. We would like to centralize these auditing functions within a central audit service.
The "creator" and "date_created" columns can be left on the original tables. Moving them to a centralized table can be discussed at a later point.
The audit information is currently placed on objects as they are saved automatically by the RequiredDataAdvice/SaveHandlers and/or the AuditableInterceptor hibernate class.
Design
A single 'audit' table will hold the values above along with a "blob" type of column and a "type" column. The blob is serialized xml. The type is the class that is being modified.
We should start with one object to try this on before implementing system wide. It has been suggested that something like person_address would be suitable.
Design Goals
- Remove the redundant columns in almost every table for creator/dateCreated etc.
- Keep a record of what actually changed from one version to the next (e.g., an xml blob).
- Keep all the history for an object instead of just the most recent change.
- Avoid tight binding to specific domain objects; more specifically, have a strategy for easily handling additional types in the future.
Assigned Developer
(TBD)