Table of Contents

23.01. DHIS2 integration

DHIS2 is an open source data warehouse that can be used to store, aggregate and display health data. mSupply can push data periodically to a DHIS2 instance. Before this can happen, the data to be sent and any calculations that need to be made will need to be configured, as shown below.

DHIS2 data

DHIS2 stores data values that have 3 dimensions:

DHIS2 Dimension Description mSupply typical mapping
organisation unit Can be a facility, or a region The customer or store in mSupply
data element The type of data that is stored Usually a combination of an item code and the type-
for instance “SOH_368c74bf” for the stock on hand of Amoxycillin 250mg Capsules (using the universal code from https://codes.msupply.foundation/detail/368c74bf)
Period The historical time period associated with the data Same in mSupply

With these DHIS2 has the power to show different types of data for different places of interest on various graphs. It can also aggregate those values in hierarchical groups.

The types of data that you can send to DHIS2 from mSupply for an item:

  1. Current stock on hand
  2. Current months of stock on hand
  3. The amount of stock in adjustments
  4. The amount of stock received
  5. The amount of stock issued
  6. The amount of stock expiring within 90 days
  7. The amount of stock expired
  8. Average monthly consumption
  9. Days out of stock
  10. Stock at the beginning of the month
  11. Stock at the end of the month
  12. Whether the item is currently stocked out

Setup

Items

To send item details to DHIS2, mSupply has to know the identity of each of its items in DHIS2. There are two options for doing this:

  1. Use the item's universal code. See the 4.01.01 Items - General tab section for details on setting this.
  2. Use the DHIS2 UID or the DHIS2 code. Choose which one you want to use then enter those values in an item's custom field 1, 2, 3 or 6 (the 3 text custom fields).

The final step in setting up items is to tell mSupply which ones to send data to DHIS2 for. Do this by checking the Include in DHIS2 data push checkbox on an item's details window - see the 4.01.01 Items - General tab section for details on setting this.

Stores

Stores in mSupply correspond to org units in DHIS2. mSupply needs to know the Org unit reference for each of the stores that data needs to be sent to DHIS2 for.

To do this, add a “Dhis2Code” store custom field containing the Org unit reference to each store you want to send data to DHIS2 for. For all stores you don't want to send data to DHIS2 for, simply leave the “Dhis2Code” custom field empty.

For details on how to set store custom codes see the 26.07. Virtual stores section.

mSupply preferences

Before you can send mSupply data to a DHIS2 instance, you need to tell mSupply where the data has to go, what data to send and where the information comes from. To do that, go to File > Preferences and click on the DHIS2 tab to get to this window:

If this page already has settings entered and they have been used to successfully connect to the DHIS2 database then a “Last successful connection: date & time” message will show next to the Test connection button.

After entering the values you should click on the Test connection button to save the credentials and check that mSupply can now access the DHIS2 database. If the connection is successful you will see a green “Connection successful” message next to the button.

If the connection is not successful you will see a red “Authentication failed” message next to the button. Check your settings, edit them as necessary and try again. The connection problem may not be the credentials, it could be something else like the settings for firewalls between mSupply and the DHIS2 database.

Once configured, a scheduler will run and regularly send data from mSupply to DHIS2. If there are any errors these will be saved in the log (see the 25.19. The system log page for details).

Of course, once you have told mSupply where all the data is stored, you have to actually enter the DHIS2 item identifiers and Store identifiers into mSupply.

Connections to DHIS2 have been configured successfully for Laos and countries that are part of the Tupaia project including Kiribati, Tonga, Solomon Islands, Cook Islands and Vanuatu. And lots more!