Creating Reports in OpenMRS

Creating Reports in OpenMRS

This documentation teaches developers how to create custom reports for OpenMRS using three approaches: programmatic (Java-based) and configuration-based (YAML/SQL) and UI-Defined Reports.

Note on UI-Defined Reports

UI-Defined Reports are deprecated and no longer actively supported.
They may continue to work in some environments, but they are not recommended for new development and are used at your own risk.
Future enhancements, bug fixes, and documentation focus will be on the programmatic and configuration-based approaches.

This documentation intentionally focuses on the two supported approaches: programmatic and configuration-based reporting.

About This Documentation

OpenMRS reports can be created in multiple ways:

  1. UI-Defined Reports (deprecated): Created through the OpenMRS web interface

  2. Programmatic Reports: Defined in Java code within OpenMRS modules

  3. Configuration-Based Reports: Defined using YAML configuration files and SQL queries

This documentation focuses on programmatic and configuration-based approaches, which offer advantages such as:

  • Version control and reproducibility

  • Complex logic and calculations

  • Reusable components and patterns

  • Easy deployment across multiple sites

  • Automated testing capabilities

Choosing an Approach

Configuration-Based Reports (Recommended for most use cases)

  • ✅ No Java coding required

  • ✅ Define reports in YAML + SQL files

  • ✅ Deploy without module compilation

  • ✅ Perfect for site-specific customizations

  • ✅ Easy to maintain and version control

Start Here: Configuration-Based Reports

Programmatic Reports

  • ✅ Full Java programming capabilities

  • ✅ Complex business logic and calculations

  • ✅ Reusable across many implementations

  • ✅ Tight integration with module code

  • ✅ Custom data definitions and converters

Start Here: Programmatic Reports

Examples Reference

Configuration-Based Reports

Examples based on the PIH EMR configuration (39 production reports), generalized for any OpenMRS implementer. All patterns validated against OpenMRS Reporting Module source code.

Programmatic Reports

Examples based on the openmrs-module-drcreports module (54+ production reports), generalized for any OpenMRS module. All patterns validated against OpenMRS Reporting Module source code.