31 Import/Export App

In a primary health system, the HMIS typically involves a distributed application, where the same application is running in different geographical locations (PHCs,CHCs, hospitals, districts, and state). Many of these physical locations do not have Internet connectivity, and hence they work off-line. At some point (normally at the district level), the data needs to be synchronised in order to have a consolidated database for the a particular geographical region. For this, it is important to be able to export data from one location (which is working offline, say at the health facility level) and import into another one (say at the district level). This feature of exporting and importing is thus a crucial function of a HMIS. This feature also helps us overcome the dependency on the Internet to some degree, as data updates can be transferred via USB key where there is no connectivity, or through email where there is limited Internet connectivity. DHIS2 provides robust export-import functionality to fulfil these needs.

To access the Import/Export app, search in the top header bar for Import/Export. Import/Export app offers a number of services details for which can be found below.

31.1 Metadata Import

Metadata Import can be accessed from the sidebar by clicking on Metadata Import.

  1. Choose a file to upload

  2. Select from the available formats e.g. JSON , XML or CSV

  3. Choose Dry Run . Yes will do a test import without importing any data into the database.

  4. Choose a import strategy from

  5. Click MORE OPTIONS if you want to adjust Reference Mode or Object Type before importing.

  6. Click Import which will bring up the Logger at the bottom of the page to show the progress.


It is highly recommend to use the Dry run option to test before importing data; to make sure you keep control over any changes to your Metadata, and to check for problems with out-of-sync data elements or organisation unit names


If an organisation unit e.g. Nduvuibu MCHP had a unknown reference to an object with ID aaaU6Kr7Gtpidn, it means that the object with ID aaaU6Kr7Gtpidn was not present in your imported file, and it was not found in the existing database.

You can control this using Reference Mode option available under MORE OPTIONS, to indicate if you want to allow objects with such invalid references to be imported or not. If you choose to import invalid references you will have to correct the reference manually in DHIS2 later.

31.1.1 Matching Identifiers in DXF2

The DXF2 format currently support matching for two identifiers, the internal DHIS2 identifier (known as a UID), and also using an external identifier called called a “code”. When the importer is trying to search for references (like the one above), it will first go to the UID field, and then to the code field. This allows you to import from legacy systems without having a UID for every meta-data object. I.e. if you are importing facility data from a legacy system, you can leave out the ID field completely (DHIS2 will fill this in for you) and put the legacy system’s own identifiers in the code field, this identifier is required to be unique. This not only works for organisation units, but for all kinds of meta-data, allowing for easy import from other systems.