# New app for analysis of DHIS2 aggregate data

**URL:** <https://community.dhis2.org/t/new-app-for-analysis-of-dhis2-aggregate-data/74337>\
**Category:** App Development\
**Tags:** maps, malaria, climate, chap\
**Created:** [15 June 2026 01:18 UTC](https://community.dhis2.org/t/new-app-for-analysis-of-dhis2-aggregate-data/74337 "2026-06-15T01:18:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Painter](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/john_painter/32/52_2.png) [@John\_Painter](https://community.dhis2.org/u/John_Painter)\
**Post date:** [15 June 2026 01:18 UTC](https://community.dhis2.org/t/new-app-for-analysis-of-dhis2-aggregate-data/74337/1 "2026-06-15T01:18:02Z")

</div>

# Magic Glasses 2 (MG2) — Epidemiological Analysis of DHIS2 Routine Health Data

_See what the data is really saying_

 ![MG2 Logo](https://dhis2.b-cdn.net/uploads/default/original/3X/8/2/823a08da20f3a3615d5fb68b9d7d43da2cd74d0f.png)

* * *

## What is MG2?

Every dataset has noise — inconsistent reporting, outliers, gaps. The epidemiological  
signal is there. Getting to it is the hard part.

**Magic Glasses 2 (MG2)** is a free, open-source R/Shiny application that guides  
epidemiologists and health data analysts through a complete routine data analysis  
workflow — directly from a DHIS2 connection, without ever leaving the app.

MG2 is a standalone R/Shiny application that connects to DHIS2 via the API — not a native DHIS2 app, but built specifically around the DHIS2 data model and workflow.

It is not a dashboard. It is step-by-step workflow: from raw DHIS2  
data to a cleaned, adjusted, modelled impact estimate. The sequence matters, and MG2  
makes it explicit.

* * *

## Who is it for?

MG2 is designed for **epidemiologists and surveillance analysts** working with routine  
health data in DHIS2 — particularly in national malaria programs, HMIS units, and  
similar public health contexts. It assumes some familiarity with data analysis but  
does not require programming skills to use.

* * *

## What does it do?

MG2 walks users through eight analytical steps:

**1. Setup & Authentication**  
Connect to any live DHIS2 instance via the API, or load local data files. A demo  
mode is available with synthetic Sierra Leone malaria data and real PDR Lao malaria  
data — no login required.

**2. Metadata Explorer**  
Browse data elements, indicators, category option combinations, organisation units,  
and validation rules. Inspect the actual DHIS2 dataset forms as they appear to health  
workers. Useful on its own for understanding what data your instance is collecting.

**3. Data**  
Select data elements of interest and download via the DHIS2 API with one click.

**4. Data Quality Assessment (DQA)**

- Percent of facilities submitting the selected data elements each and every month
- Percent of values with no indication of being an outlier
- Perecent of values passing all DHIS2 validation rules
- Maps showing which districts are missing data

**5. Reporting Adjustment**  
Adjust for incomplete reporting using the champion-facility method, by identifying facilities that consistently report data values and removing bias of facilities that do not.

**6. Outlier Censoring**  
A series of six sequential algorithms to identify potential outliers that may skew analysis results.

**7. Evaluation & Forecasting**  
Time-series models (ARIMA, ETS, NNETAR, Prophet, and ensemble combinations) to assess the likelihood there was a real change. This is the same workflow that was used to assess the impact of the new malaria vaccine in Kenya using routine data.

* * *

## Try it out

**Live demo (no install required):**  
[https://connect.posit.cloud/magicglasses](https://connect.posit.cloud/magicglasses)

No DHIS2 account needed. On the Login tab, click **“Load Sierra Leone Demo”** or **“Load PDR Lao Demo”** to get started immediately with real-looking data.

To explore real data and have full functionality, you need to install MG2 locally (below).

**Install locally (R required):**

```r
# Install from GitHub
devtools::install_github("https://github.com/jpainter/MG2")

# Launch the app
MG2::run_mg2()

```

**Source code:** [github.com/jpainter/MG2](https://github.com/jpainter/MG2)

* * *

## Background

MG2 grew out of field work supporting national malaria programs in sub-Saharan Africa.  
The challenge was always the same: facilities report inconsistently, outliers contaminate  
trends, and turning DHIS2 data into defensible analytical outputs required a patchwork  
of disconnected tools and a lot of re-work every time something changed upstream.

The goal was to make that full pipeline reproducible, auditable, and accessible — so  
that this kind of epidemiological work doesn’t require a specialist every time.

_Routine data, extraordinary insight_

* * *

We’d love to hear from you — questions, feedback, or ideas for how MG2 could be  
more useful in your context.

_Thanks — John Painter_

---

<div class="post-metadata">

**Author:** ![Gassim](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/gassim/32/35347_2.png) [@Gassim](https://community.dhis2.org/u/Gassim)\
**Post date:** [17 June 2026 10:53 UTC](https://community.dhis2.org/t/new-app-for-analysis-of-dhis2-aggregate-data/74337/2 "2026-06-17T10:53:15Z")

</div>

Hi @John_Painter

There have been several times when someone from the community posts that they are going through a lengthy process in order to use R to analyze the data, so for those users, I’m pretty sure that they would appreciate this. Personally, I haven’t had to try that but maybe I’ll get a better understanding of all this with your app.

I’m looking at the demo link you shared and it looks like a big app:

 ![](https://dhis2.b-cdn.net/uploads/default/original/3X/7/9/79af9af9dbe3d9eff6c12dd945a6730ab9a40703.png)  
How much expertise does one need to use this? I know you said, ‘it assumes some familiarity with data analysis’, so not a lot of technical stuff?

---

<div class="post-metadata">

**Author:** ![John\_Painter](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/john_painter/32/52_2.png) [@John\_Painter](https://community.dhis2.org/u/John_Painter)\
**Post date:** [13 July 2026 13:49 UTC](https://community.dhis2.org/t/new-app-for-analysis-of-dhis2-aggregate-data/74337/3 "2026-07-13T13:49:27Z")

</div>

For the end user, it doesn’t require any coding knowledge, just some time to learn all the options. Much of it is self explanatory, but hands on training is helpful (1-2 hrs).

If running on a server, then no R experience needed at all. For most, however, they are currently installing on their laptop, which requires a little bit of R experience. They need to have R and GIT installed. A UI like Positron or Rstudio is helpful. Once the repository is downloaded the user runs one command - run\_mg2() and the app launches.
