Background
This module provides a mechanism for filtering persistent data on a configurable and customisable basiscustomizable basis. In a nutshell it enforces metadata-based access to users and/or roles.
For instance, out of the box, the module supports location-based and privilege-based access control to patient records and their clinical data. The initial implementation for those two use cases is restricted to the patients and their visits, encounters and observations. For more examples of filtering observation-specific data, see this thread.
The Data Filter Module is highly generic, allowing any filtering strategy you can think of - users can define filtering strategies to make data available to some users. E.g. One large Implementer org is already using it for 2 use cases: Functional Level: Location-Based Access & Program-Based Access. E.g. “I’m a Physiotherapist at Site X → I can see Rehab data for Site X.”
Info | ||||
---|---|---|---|---|
| ||||
Story from an O3 Implementer in 2023 using the Data Filter Module: "Our need was to host data in one database and restrict access on a need to know basis based on roles/privileges and meet our data protection requirements. This led to investment in the Data Filter Module that allows the data to be segregated using roles/privileges. This feature will allow you to implement OpenMRS in the entire hospital/clinic without having to separate your instances - e.g. no more 1 instance for HIV/TB, another instance for maternity, etc. In case you are deploying the system in a hospital that has an HIV/TB clinic + Maternity, you can run one instance and limit the user’s access on a need to know basis." |
Architectural Overview
The data model has been kept simple deliberately such that only two concepts matter: 1) which entity is being restricted by the filtering and 2) on what basis does this filtering restriction operate?
...
This is all controlled and stored in a single table modelled by EntityBasisMap
and can be configured through DataFilterService
.
Code
Code available on GitHub here: https://github.com/openmrs/openmrs-module-datafilter
Examples
Let us go through a couple of filters that are baked into the module. This will help highlight how much of the design of filters follows systematic rules, and how much of it is implementation-specific.
...