Bahmni-Metabase Integration

You can see a demo of Bahmni Metabase/Mart analytics tool in the following demo environments: . The aim of Metabase+Mart is to allow Bahmni users to be able to perform reporting/analytics on data collected across Bahmni systems. Bahmni MART will collect data across OpenMRS, Odoo, ELIS, Crater, etc and bring it in an easy-to-query fashion into one MartDB. Then you can use any BI/Analytics tool to connect to MartDB (postgres-db) and build visualizations/dashboards/reports. This also ensures main systems/databases do not get stressed due to analytics jobs. Out of the box, Bahmni ships with opensource metabase as a query/visualisation tool.

What is Metabase

Metabase is an open-source business intelligence tool. Metabase lets you ask questions about your data and displays answers in formats that make sense, whether that’s a bar chart or a detailed table.

You can save your questions and group questions into handsome dashboards. Metabase also makes it easy to share questions and dashboards with the rest of your team.

Sample Dashboard created in Metabase (using MART database)

 

Benefits of  Metabase

With the help of Metabase the users can generate reports by applying necessary conditions and required filters and can view them either in regular tabular structure or any other form of representation like bar graph , line chart etc that might deem fit to express the findings better, and all this can be done very easily without having to bother about writing the SQL queries for the same as the Metabase UI provides option to directly choose and query the required fields  from the database and applying required conditions without any hassle.

What is Bahmni Mart and its advantages

It is a Spring batch application responsible for transferring data from OpenMRS DB (and in future, from other databases) to an Analytics DB based on a scheduled cron job. You can see the current jobs in this configuration file: https://github.com/Bahmni/bahmni-mart/blob/master/conf/bahmni-mart.json

As OpenMRS database is a transaction database. Querying the same DB by a lot of systems eventually increases the load on it, and as it is not an analytics database for creating a single report  you would need to query multiple tables. Bahmni-Mart comes to the rescue as it transfers the data from OpenMRS to an Analytics DB which is a simplified database wherein hierarchical structures have been flattened and pivoted and many other entities de-normalised hence for generating reports the querying of database would be easier.

For instance, for every form created in Bahmni, a single Form table is created in MartDB, and each row of this table represents the data entered in one form. This makes querying reports on forms much easier, than the original obs data model followed by OpenMRS. As an example, in the Demo Lite environments, you can see the Malaria form (of EMR) represented as a Malaria table in the Mart DB.

The proposed solution

As we are aware of the benefits of having Bahmni-mart and Metabase configured with Bahmni docker, we decided on the stories required to be worked on to deliver our MVP.

 

 

Workflows for accessing  Bahmni Mart with Metabase on Bahmni Dev Lite Environment

 

1. Logging in to Metabase

When the user opens Metabase on Bahmni Dev lite environment for the first user creation an Admin user profile is preconfigured with Metabase and they don’t have to register again but can log-in directly using the Admin user credentials.

 

 

2. Connecting Databases

After logging in with the Admin user credentials the user can find OpenMRS DB and Mart DB added directly for the user’s convenience and can be accessed from the Metabase UI by going to data - > browse data post which the user can add/ remove databases as per their discretion.

After the Mart DB starts with the initial tables and values, if we create any new table for reflecting the same changes in the Metabase the user need to go to Admin Settings → Databases → mart → Sync Database schema now → Refresh the DB.

 

 

 

3. Visualising Pre-defined reports

To give the user a look and feel of the functionalities of Metabase right away we have added two predefined reports for the user to access the first thing they start the application and login as an Admin user.

To view and access the predefined reports after logging in the user has to open Collections -> Bahmni Analytics and then  they will find reports Clinic Visits and Registered Patients.

 

For more details on Bahmni MART and its architecure, please read:

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)