Skip to content

Mapping DHIS2 instances

Sergio Galan edited this page Jan 8, 2021 · 3 revisions

instance configuration / Mapping DHIS2 instances' metadata

Why mapping?

Mapping is one of the most powerful features in MDSync. There are many situations where our destination instance has different metadata than our source instance This may occur when:

  • you are sending data or metadata form a development instance to a production instance. In this cases DEV and PROD fall easily out of sync and there may end up being big difference that pose challenges to publish new developments.
  • you are collating data from a specific program or disease from different instances (e.g. different country instances). For instance you need to combine data that was gathered in the context of a specific program, but then researchers realize that the information might be useful for another program. Even though metadata is not the same, data could still be synchronized using this mapping feature.
  • you have different levels of detail in two instances. (For instance, if the source instance contains data aggregated in 5 age groups and the destination instance in only 2)
  • you need to sync programs that are implemented slightly different in different Organizational Units.

In these situations, sending data from one instance to another one is challenging process. MD Sync allows you to overcome this difficulty. It takes data from the source instance and applies the necessary transformation so that it can be received by the destination instance based on the metadata mapping you have previously generated.

How to map

Mapping is done between the source instance and each destination instance. Hence, MD Sync will save one mapping per destination instance. To access the mapping configuration, we do it from

→ MetaData Synchronization / Destination Instance Settings/ 3 Dots menu/ Metadata Mapping

instance%20configuration%20Mapping%20DHIS2%20instances/5_Screenshot_2020-07-09_at_12.53.43.png

  • There are three different sections according to the kind of data you want to send, you may need to map:
    • Aggregated metadata, including data elements, category options and indicators
    • Programs (events) Programs, Data elements, indicators
    • Organisation units
  • Global mapping complements the previous sections. It is used to create mappings for Metadata that appears frequently. Sometimes there are option sets or categories that apply to different data elements. Do you have to create a new mapping for one of these elements each time it appears? No, you just simply add that mapping as a global mapping between instances and it will always be applied. If needed, you can later overwrite this mapping for a specific data.

instance%20configuration%20Mapping%20DHIS2%20instances/eng.png


Mapping can be manual o auto-mapping. Continue reading this article to learn how to create mappings.


Inside each of the mapping sections, we have the list with all the metadata objects available for mapping.

instance%20configuration%20Mapping%20DHIS2%20instances/Untitled.png

For each item these are the options:

instance%20configuration%20Mapping%20DHIS2%20instances/Untitled%201.png


Remember that we are defining the mapping for a single destination instance.


Set Mapping (Manual mapping)

  1. Select source metadata object Select the metadata object on the source instance and click on "mapped ID" icon, (or the "set mapping" option in the three dots menu)

  2. Find the ID from the destination instance that maps against the metadata element in the source instance. After selecting the source element, MD Sync will retrieve the destination instance metadata and will let you choose the data elements in the destination instance that maps against it.

    instance%20configuration%20Mapping%20DHIS2%20instances/Untitled%202.png

    That modal window contains the metadata object list from destination instance. Choose the one you want to map. For objects without linked metadata this is the end of the process: the mapping is finished.

    instance%20configuration%20Mapping%20DHIS2%20instances/mapping_ok.gif

  3. Related metadata mapping

There are some data elements for which you need to do additional mapping. If there are related metadata objects to be mapped (e.g. options or category options) an alert sign would appear by the mapped object.

instance%20configuration%20Mapping%20DHIS2%20instances/Untitled%203.png

You just need to indicate an additional mapping because the related metadata needs to be translated to the destination system metadata too. To do that:

  1. Click on the icon to fix the problem.
  2. A new window appears with the list of related metadata. The alert icon indicates the objects that needs to be fixed.
  3. Clicking again on the alert icon for an object shows another list with the available objects at the destination instance.
  4. Select the destination object to finish this related metadata mapping.

instance%20configuration%20Mapping%20DHIS2%20instances/fix_mapping_optionset2.gif


If the option set or category option combo that you are mapping applies to more than one data element, it is recommended to map it from the Global window. All maps done in global will be applied to all metadata elements across the instances.


Mapping Organisational Units

A slightly special case of mapping is the Organizational Unit mapping (OU mapping). If there are differences between the Organisational Units in the instances, with OU mapping we can define a mapping between one source OU and one destination OU.

instance%20configuration%20Mapping%20DHIS2%20instances/Untitled%204.png

Follow these steps to create an OU mapping:

  1. Select the OU in the source instance.
  2. Click on the "set mapping icon"
  3. Select the OU from the destination instance

Auto-map element

MD Sync can auto map metadata objects for you. Instead of letting you manually select the object at the destination instance, it automatically searches for the corresponding object. It does so by:

  1. Searching for metadata objects in the destination instance the have the same UIDs as those in the source instance.
  2. If there is no match, it searches for metadata objects with the same code
  3. if non of the previous steps returns a good candidate, it uses a "best effort" algorithm to look for metadata objects with similar names

To perform this auto-mapping, select as many elements as you need to map, and then select the three dots menu (or right click) → Auto-map element

In the following clip, the auto-mapping easily manages to find a destination data element with a slightly different name because they share the same UID:

instance%20configuration%20Mapping%20DHIS2%20instances/automapping.gif

Exclude mapping

When configuring a synchronization operation you can choose which data elements are you going to sync and which ones you do not want to sync. But now imagine that there is a data element that you never want to sync with a destination instance, for example person's first name or IDs. In this case you don't need to exclude that element manually from every synchronization, you can exclude it from all synchronizations from the mapping page. When you exclude a data element for a particular destination instance, that element will always be ignored during the sync process.

Reset mapping to default values

It sets back the mapping to the default state: not mapped.


Take into consideration that If there is no mapping, the synchronization will assume that the same metadata exists at the destination instance. If that is not the case, the process will throw an error, with a detailed log explaining what the inconsistent metadata is


Related metadata mapping

instance%20configuration%20Mapping%20DHIS2%20instances/Untitled%205.png

This contextual option only appears for mapped objects with related metadata. It is intended for manual mapping of options sets and category options.

This is an example of related metadata mapping. By clicking on Mapped ID, you can edit the mapping if necessary.

instance%20configuration%20Mapping%20DHIS2%20instances/related_metadata_modal.png

A new window appears with the related metadata objects: Map them with the same three steps:

  1. Select source object
  2. Click on the set mapping icon
  3. Select destination object

After creating the mapping, it is possible to configure the same mapping as a global mapping by selecting the right-click-menu option "make this mapping global"


instance%20configuration%20Mapping%20DHIS2%20instances/Untitled%206.png

Validate mapping

This contextual option only appears for already mapped objects.

Clone this wiki locally