Vibha's data and monitoring platform · vibha.org

Worked rule examples

Reading the operators reference tells you what each piece does in isolation. This page is the other half: three complete, real rules, each shown exactly as the rule editor renders it and explained one piece at a time — what it reads, what it computes, and why it is written that particular way rather than some other way that merely looks equivalent.

Example 1 — age from a date of birth

A programme intake form asks for a date of birth and needs an age in whole years, displayed back to the respondent but never hand-typed by them — the two must never disagree.

Example 2 — a follow-up that is only sometimes required

The same intake form collects household size. Above six people, the programme's rules require a second form of identification for the extra household members — but asking every applicant for it, most of whom have small households, would be pure friction.

Example 3 — rejecting a contradiction across two fields

A monitoring visit form records a visit's start and end time. Neither field alone can be wrong, but the combination can be — an end time before the start time is a data-entry slip that should never reach the database.

Starting templates

Every rule above is common enough that you rarely need to build it node by node. The rule editor offers these as ready-made starting points — like picking a form letter instead of writing one from a blank page — so the common shapes are one click rather than four nested pickers. Each produces a tree that compiles as-is; you then swap a field or a constant to match your form.

TemplateKindWhat it builds
Age from date of birthCalculateyearsBetween(date_field, today()). Swap the date field to match your question.
Add two answers togetherCalculateAdds two numeric questions. Replace the second operand with another field or a constant.
Show when an answer matchesShowReveals a question when another has a specific value. Fill in the target value.
Show once something is answeredShowReveals a follow-up the moment an earlier question is filled in.
Require a follow-upRequireMakes a question mandatory once another has any answer.
Reject a value outside a rangeValidatenot(between(field, 0, 100)) — blocks submission when a number falls outside the allowed band.