Hi everyone, I’ve recently been exploring the Data Filter module while looking through the Integrating Data Filter for Data Segregation / Multi-tenancy project idea. Since most of my recent contributions have been around backend/service-layer logic in OpenMRS, this project seemed like a natural area for me to dive deeper into.
From my understanding so far, the Data Filter module uses Hibernate’s filtering mechanisms to inject additional conditions into queries so that data visibility can be restricted based on context — for example limiting patient data to locations a user has access to.
This seems like a powerful mechanism for implementing system-wide data segregation policies.
While reading through the project idea and some related code, I started thinking about a few areas that might be interesting to explore for extending the module.
Possible Areas of Exploration
1. Extensible Rule Definitions
Currently, filtering appears to be tied to predefined logic (such as location-based access). One possible direction could be making the filtering system more extensible, allowing administrators or modules to define additional rule templates such as:
-
restricting observations by concept codes
-
restricting data access based on user privileges
-
applying location or program-based filters dynamically
This might allow implementations to define more granular policies without modifying core filtering logic.
2. Administrative Configuration Layer
Another area that seems interesting is introducing a configuration or administrative layer where associations between users, locations, or other contextual entities can be managed.
For example:
-
mapping users or roles to specific location scopes
-
configuring rule sets that apply across multiple modules
-
defining which filters should be active in a given implementation
This could make the filtering system more flexible across different deployments.
3. Consistency Across O3 Modules
Since the O3 RefApp includes multiple frontend applications that interact with the backend services, it may also be worth considering how filtering behavior remains consistent across modules.
Ensuring that the same filtering rules apply uniformly at the service or DAO layer could help maintain predictable behavior regardless of which frontend component triggers the query.
Questions for the Community for better Understanding
As I’m still exploring the module and the broader design space, I’d really appreciate input from those who have worked with the Data Filter module or related access control mechanisms.
Some questions I’m particularly wanted to know about:
-
What are the current limitations of the Data Filter module in real-world implementations?
-
Are there known extension points or architectural constraints that should be considered when expanding its capabilities?
-
Would it make sense to think about rule templates and configuration-driven filtering, or is the expectation that filtering logic remains more static?
I’m hoping to better understand how the community envisions this evolving so that any implementation directions I explore align well with real-world needs.
Looking forward to hearing thoughts from others who have worked in this area.
cc: @wyclif, @jnsereko, @ibacher, @dkayiwa, @mseaton, @mogoodrich, @wikumc