Bahmni Mart Reports

[V0.93] Bahmni Mart provides a way of transferring data from Bahmni into a dedicated database for reporting/analytics purposes – to make it easy to perform reporting, and to avoid performance issues in a running EMR system, due to heavy SQLs. Bahmni Mart can then be connected with Metabase, an open source analytics tool, quite similar to PowerBI, Tabluea, etc. to create visualisations, dashboards and reports. 

At the core, Bahmni Mart is a flattened and simplified database intended for analytics wherein hierarchical structures have been flattened and pivoted and many other entities denormalized. You may plugin data visualization tools Metabase, Superset etc on top of this database. At the same time, you may want to integrate Bahmni Reports with Bahmni mart. The following sections detail how this can be done. 


For diagrams and high level feature details on Bahmni Mart, please refer to this document section in Implementor Guide: Bahmni Mart


Configure Datasource Definition for Bahmni Mart

Configure the datasource definition like in the example below. 

file: /opt/bahmni-reports/etc/bahmni-reports.properties

Datasource definition
bahmni.mart.url=jdbc:postgresql://localhost:5432/analytics
bahmni.mart.username=analytics
bahmni.mart.password='somepwd'

Configure in Reports Application Config

Once the datasource is defined, you will then need to define a report type in your application configuration. 

file: /var/www/bahmni_config/openmrs/apps/reports/reports.json

Mart Generic Report

You will need to define a "MartGeneric" type

"bahmniMartTestReport": {
    "name": "Mart Test Report",
    "type": "MartGeneric",
    "config": {
       "sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/testMartCode.sql"
    }
}

Mart Concatenated Reports

You may also want to run concatenated reports on the mart data source. For that you can define a 'MartConcatenated' type. For more information on Concatenated Reports, please see here

{
  "customReport21": {
    "name": "Indicators(Custom Excel)",
    "type": "MartConcatenated",
    "config": {
      "reports": [
        {
          "name": "Bahmni Mart Test",
          "type": "MartGeneric",
          "config": {
            "sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/NewPatientConsultations.sql"
          }
        }
      ]
    }
  }
}

On this Page