← Back to the hackathon home
Topic 16 of 18

Downloading Data From DHIS2

Step by Step Guide: Raw Values, Chart Data, Images and When to Rebuild Analytics

Purpose of this guide

Getting data out of DHIS2 is easy once you know which of the three routes you need: the raw values, the numbers behind a chart, or a picture for a report. This guide covers all three, and the analytics tables that explain most empty downloads.

Step 1: Decide What You Actually Want
You wantUseFormat
The raw values, for analysis in R or ExcelImport/Export app, data exportCSV or JSON
What a chart showsData Visualizer, DownloadCSV, Excel or an image
A map for a reportMaps app, DownloadPNG
The setup rather than the dataImport/Export app, metadata exportJSON
A pivot table for a meetingData Visualizer, DownloadExcel
Step 2: Export Raw Data Values
Click: Apps menu → Import/Export → Data export
Figure 1. The data export screen. This picture was drawn for the guide. Your screen will show your own names and dates.
  1. 1Organisation unit. Pick the top of the branch you want.
  2. 2Include descendants. Tick it, or you get only that one unit.
  3. 3Data set. One or more. Everything in them is exported.
  4. 4Dates. Start and end of the period you need.
  5. 5Format. CSV for Excel or R, JSON for another system.
  6. 6Compression. Zip it for a year of facility data, or the file is enormous.
  7. 7EXPORT. The download starts in your browser.
What the CSV holds: one row per value, with the data element, the category option combination, the organisation unit, the period and the value. It is long, not wide, which is exactly what R and Python want.
Step 3: Download What a Chart Shows
In the Data Visualizer: Download
Figure 2. The download menu. This picture was drawn for the guide. Your screen will show your own names and dates.
  1. 1Image. For slides. It looks exactly like the chart on screen.
  2. 2PDF. For printing.
  3. 3CSV. The numbers behind the chart, ready for Excel or R.
  4. 4Excel. The same, already formatted.
  5. 5What to choose. If somebody will do arithmetic on it, never send the image.
Step 4: If the Download Is Empty or Stale

Charts, maps and dashboards read the analytics tables, not the values you typed. Those tables are built on a schedule, so fresh data is invisible until they run.

Figure 3. Analytics tables in the Data Administration app. This picture was drawn for the guide. Your screen will show your own names and dates.
  1. 1What they are. The tables every chart reads.
  2. 2START EXPORT. Rebuilds them. Minutes on a small database, hours on a national one.
  3. 3The message. When it finishes, your new data appears in every chart.
What you seeWhyWhat to do
Empty chart, data is in data entryAnalytics have not runRun the analytics tables
Empty export from Import/ExportWrong period, or descendants not includedWiden the dates, tick include descendants
Huge file that will not openA year of facility level dataExport district level, or zip it
Numbers differ from the screenThe export is raw, the chart may be an indicatorCompare like with like

Final Checklist