<aside> 💡 This guide is intended for software developers for who are working on electronic data retrieval from DHIS2 based HMIS and integrate the information in other information systems such as information portals and dashboards. This guide is based on the DHIS2 version 2.30 (currently adopted for HMIS). This document is work-in-progress and being continuously updated for improved usefulness, conciseness and completeness.

</aside>

Basic concept

Before you start getting data from any DHIS2 instance, define the following basic elements clearly:

  1. What - what information to extract (Data variables or Indicators)
  2. When - Time period (Fixed - particular month, year, fiscal year etc, or Relative - Last month, last year, last fiscal year etc.)
  3. Where - Organization Unit/Administrative hierarchy (National, Province, District, Municipality, Health Facility etc.)

Each basic elements described above will have associated unique identifier in DHIS2 system. For example each data variables, indicators and organization units will have 11 digit alphanumeric unique identifier. Browse the metadata library for these identifiers.

DHIS2 Analytics Resource

To access analytical, aggregated data in DHIS2 you can work with the analytics resource. The analytics resource is powerful as it lets you query and retrieve data aggregated along all available data dimensions. It allows retrieve the aggregated data for a combination of any number of dimensions based on data elements, periods and organisation units.

URL structure for data access: http://hmis.gov.np/hmisdemo/api/analytics.<json|csv|xml>?<query-parameters>

The analytics resource lets you specify a range of query parameters (most useful mentioned below):

dimension: Dimensions and dimension items to be retrieved, repeated for each delimited by semicolon (includes variables, indicators, periods, organization units etc.). It is a required parameter.

filter: Filters and filter items to apply to the query, repeated for each delimited by semicolon. It is optional parameter.

URL Formation:

Variables and Indicators as dimension:

?dimension=dx:[identifier-1];[identifier-2];………..[identifier-n]

Periods as dimension: