# Admin tool of the week: Program Rule Validator Tool

**URL:** <https://community.dhis2.org/t/admin-tool-of-the-week-program-rule-validator-tool/78550>\
**Category:** Development - Développement\
**Tags:** tracker, android, admin-tool-weekly\
**Created:** [24 November 2026 16:55 UTC](https://community.dhis2.org/t/admin-tool-of-the-week-program-rule-validator-tool/78550 "2026-11-24T16:55:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olav](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/o/0ea827/32.png) [@Olav](https://community.dhis2.org/u/Olav)\
**Post date:** [24 November 2026 16:55 UTC](https://community.dhis2.org/t/admin-tool-of-the-week-program-rule-validator-tool/78550/1 "2026-11-24T16:55:18Z")

</div>

> ℹ **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](https://community.dhis2.org/t/introducing-admin-tool-of-the-week-tools-for-dhis2-system-administrators).

 ![Program Rule Validator Tool: the Invalid conditions tab lists four rules in the Sierra Leone demo, with the parser message for each](https://dhis2.b-cdn.net/uploads/default/original/3X/c/6/c6d4a80722163a275a4e7c614dd8ebfdb760bfb1.png)

### The problem

Tracker and event programs collect program rules over the years. Rules are added and removed, data elements are changed, and a program can be configured by several people over time. Two kinds of problems build up:

- **Rules that DHIS2 cannot evaluate.** A typo in a condition, such as `!==` instead of `!=`, or a reference to a variable that no longer exists. The rule then does nothing, and nobody notices until a field that should be hidden is shown, or a value that should be assigned is empty.
- **Program rule variables that no rule uses.** They are left behind when rules are deleted or rewritten. They make the program harder to maintain, and every Android device still downloads them.

The Maintenance and Metadata Management apps check one expression at a time, when you edit it. There is no list of all the broken rules on an instance.

### What the tool does

**Program Rule Validator Tool** checks all program rules of the programs you choose, and shows the results in three tabs:

- **Invalid conditions.** Rules whose condition DHIS2 cannot evaluate, with the message from the DHIS2 expression parser, for example _expected name at line:1 character:15_.
- **Invalid actions.** Rules with an action expression, such as the value in an _Assign value_ action, that DHIS2 cannot evaluate.
- **Unused program rule variables.** Variables that no rule in their program refers to. You can filter by program, tick the ones you want to remove, and delete them in one go. Before deleting, you can download the variables as a metadata file.

Each row has an **Edit** link that opens the rule or variable in the Metadata Management or Maintenance app.

![Validate all programs, look at the invalid conditions and actions, then filter the unused variables to one program and delete three of them](https://dhis2.b-cdn.net/uploads/default/original/3X/8/f/8fc2a61a183e82d3c64bf49ebd0a8498821010a1.gif)

### Try it on the demo instance

You can try the tool without installing anything: open [implement.im.dhis2.org/tools/apps/tool-program-rule-validator](https://implement.im.dhis2.org/tools/apps/tool-program-rule-validator) and log in as **tools** / **District1#**. The demo is a copy of the Sierra Leone database, and the problems it finds are real ones from that database. Click **Validate all** to see them.

The demo user can delete unused variables. Please try the delete on one or two at most, so other visitors still have something to find.

### Use with care

 ![The delete confirmation lists the three variables, with a Download backup button next to Delete](https://dhis2.b-cdn.net/uploads/default/original/3X/a/a/aacb9360faab8267f6224d03713d908614f7e8e8.png)

- **A delete cannot be undone in the tool.** Click **Download backup** in the confirmation first. To restore the variables, import that file in the Import/Export app.
- **A rule that builds a variable name while it runs, for example with `d2:concatenate`** , is not detected, so its variable is listed as unused. Check the list before you delete.
- **The validation messages come from DHIS2** and are sometimes short, for example _1 error(s), 0 warning(s)_.
- **Metadata Management can show an invalid action as valid.** Its expression builder shows _Valid expression_ for every _action_ expression, including ones that this tool lists under _Invalid actions_. This is a bug in Metadata Management ([DHIS2-22589](https://dhis2.atlassian.net/browse/DHIS2-22589)). Condition expressions are checked correctly in both.
- **The tool sends one request to DHIS2 for each expression.** On an instance with thousands of rules, run it at a quiet time.
- Try it on a copy of your database before you use it on a production server.

### Get it

- **Supported DHIS2 versions:** 2.41 and later (tested on 2.41, 2.42 and 2.43).
- **Download:** the latest `.zip` from the [releases page on GitHub](https://github.com/dhis2-utils/tool-program-rule-validator/releases/latest), then install it in the App Management app (_Upload app_). You can also install it from the DHIS2 Admin Toolbox app.
- **Documentation and source:** [github.com/dhis2-utils/tool-program-rule-validator](https://github.com/dhis2-utils/tool-program-rule-validator) (see the [user guide](https://github.com/dhis2-utils/tool-program-rule-validator/blob/main/docs/user/tool-program-rule-validator.md))
- **Authorities:** access to the app (“toolprogramrulevalidator app”) to check the rules. The tool checks only the programs the user can see. Deleting variables also needs _Manage program rule_ (`F_PROGRAM_RULE_MANAGEMENT`).
- **Already using an earlier version?** Upgrade to 1.1.0: earlier versions could list some variables as unused when a rule used them inside a function such as `d2:count`. Version 1.1.0 is installed as separate app if you have used a previous version, so uninstall the old “Program Rule Validator Tool” app after installing 1.1.0 if upgrading.

Questions, bugs or ideas? Reply below.

[**Click here to receive notifications for #admin-tool-weekly topics: ![](https://dhis2.b-cdn.net/uploads/default/original/3X/6/5/65d3ec3e7695e2bc3f687f58d8e6f4e2ca34946f.png)**](http://community.dhis2.org/subscribe-admin-tool-weekly)
