Create a simple report with OpenMRS Reporting module

OpenMRS is a Medical Record System which is freely available and maintain by OpenMRS open source community. Software has written in targeted to run on resource constrained environments and have been proved success over the past 2 decades. Reports makes the data visualization more convenient and for data analytics far better. Therefore OpenMRS has a dedicated module to maintain the reports which is known as Reporting Module.

Reporting module is a very flexible module which its sole purpose is to facilitate the report creation, modification and customization. There are key points that you need to aware before you going to create a new report. In order to create a report in OpenMRS reporting module, you need to have following 2 things:

  1. Configured report (elements, output format, etc)
  2. Data set definition

Configured report

First click on the Custom Report(Advanced) button in Report Administration window. Then give a name and a small description about what the report is going to be.

If you are going to create a report, you should know what are the things that needs to be shown in the report. For example, if you want to show all the visits for a given date range, you need to decide that whether you ask the user start date and end date or you can hard-code it in that report. When you are going to ask anything from the user who runs the report, you get those inputs via parameters. Therefore, you need to define parameters accordingly.

At the same time, OpenMRS reports has given the flexibility to chose the output format of the reports. You can have report results as in Microsoft Excel format(.xls) or CSV or to show in the web browser(this is the default output format).

Data set definition

In order to run a report, it must have a data source. In openMRS report, the data source for reports are coming through Data-Set definitions. One report can have more than 1 definition.

Click on the Data Set Definitions tab in the Report Administration window.

For the moment, you can create a new SQL Dataset Definition. This will simply run the given query and fetch the result.

Save the SQL data definition. Then go back to the Report Editor window of your previously created. Click on the data-set definitions and add that newly created SQL data-set definition.

Now the link has been made between the report and the dataset definition. You can run the report and view the results.

If you chose the default web browser output of the report, you will see something like below.