Admin tool of the week: this post is part of a weekly series featuring small, open-source maintenance tools from the HISP Centre for DHIS2 system administrators. Read about the series.
The problem
Group sets such as Facility Ownership or Facility Type are commonly configured and used as data dimensions in DHIS2 analytics. They only give the right numbers if every object is in exactly one group of the set. In practice, that rule can easily break: a facility is upgraded from MCHP to CHP but never removed from the old group, a private clinic is also left in “Public facilities”, or a new facility is added to no group at all.
DHIS2 does not stop you from saving such mistakes, and nothing in the analytics apps shows them:
- An object in no group is left out when you break the data down by the set, so the groups add up to less than the total.
- An object in more than one group is counted under only one of them, and which one can change from one analytics run to the next.
DHIS2’s data integrity checks count these problems, but getting an overview of the problems and finding and fixing the objects one by one in the Metadata Management app can be cumbersome.
Compulsory, data dimension and catch-all groups
Two properties of a group set decide what counts as an error in group membership assignment, and what the implications are:
- Compulsory means every object must be in exactly one group of the set. An object in no group is an error.
- Data dimension means the set is included in analytics, as a dimension users can pick in Data Visualizer and Maps. This is where wrong group assignment give wrong numbers, either because an object is in two groups, because an object that should not be in a group has been added to it, or because and object that should be in a group is not.
We generally recommend adding a catch-all group to group sets, such as “Other” or “Unknown”, which gives a home to objects that don’t fit another group, or that you can’t place yet. This is particularly important for groups used as data dimensions: the groups then add up to the total, and what is unknown shows as unknown in the analytics tools instead of being dropped.
The user guide has a section on what these settings mean and how they affect analytics. It’s worth reading before you fix anything, and it is a good reference even if you never use the tool.
What the tool does
Group Set Integrity Tool checks every organisation unit, data element, indicator and category option group set, and helps you fix what it finds:
- Dashboard. One card per group set, with the number of conflicts (objects in more than one group), objects in no group, and objects that are OK. No group is red when the set is compulsory, orange when it is a data dimension, and grey when the set allows it. Choose an organisation unit to see the counts for one district or region.
- Find the problems. For each set, a matrix shows the counts by organisation unit level. Click a number to see the objects behind it, and drill down level by level.
- Fix one object by choosing the group it belongs in. The tool removes it from the other groups of the set. In a set that is not compulsory, you can also take an object out of its group.
- Fix many at once with Bulk fix: move everything that matches a filter to one group, or move every object that is in no group or in conflict to a catch-all group such as “Other/unknown”. You see a preview and can download the full list before anything is changed.
- Undo. Every change is recorded in History, and can be reverted for 24 hours.
- Check usage. The Usage tab shows how many favourites use the set, which helps you find data dimensions nobody uses. (Requires configuring SQL views in the app Settings tab).
- Change the settings. Turn Compulsory and Data dimension on or off from the tool. These changes are recorded in History too.

On instances with tens of thousands of organisation units, the tool can load the data through a few SQL views that it creates for you. In a test setup with over 200 000 organisation units, this cut the first load from more than 10 minutes to less than a minute.
Try it on the demo instance
You can try the tool without installing anything: open implement.im.dhis2.org/tools/apps/tool-group-set-manager and log in as tools / District1#. The demo is a copy of the Sierra Leone database, with a few facilities and data elements placed in two groups on purpose. Other visitors can fix things too, so the counts you see may differ from the pictures above.
Use with care
- This tool is experimental: it has had less testing than the other tools in this series so far. Try it on a copy of your database first.
- A bulk fix can move tens of thousands of objects in one go. Assign all to one group also moves objects that were already in the right group. Check the filter and the preview before you apply.
- History can only do a best-effort attempt to revert group assignments made with the tool, and only for 24 hours. Have a backup before using it in production.
- Fixing an object needs write access to the groups it changes, and a bulk fix needs write access to every group of the set, so that a set is never left half fixed.
- The SQL views are readable by every logged-in user by default, which lets them read the organisation unit hierarchy and group memberships through the API. In Settings, you can limit them to one user group.
Get it
- Supported DHIS2 versions: 2.40 and later (tested on 2.40, 2.41, 2.42 and 2.43)
- Download: the latest
.zipfrom the releases page on GitHub, then install it in the App Management app (Upload app) - Documentation and source: github.com/dhis2-utils/tool-group-set-manager (see the user guide)
- Authorities: metadata write sharing on the groups you fix, and the authority to add groups of that type (for example Add/Update Public Organisation Unit Group);
ALLor Add/Update Public SQL View to create the SQL views;ALLor Perform maintenance tasks for the DHIS2 integrity tab - Already using version 1.0.0? Later versions are installed as a separate app. Uninstall the old one after installing it, and add the new app to the user roles that had the old one. History and settings are kept.
Questions, bugs or ideas? Reply below.
Click here to receive notifications for #admin-tool-weekly topics: 
