Skip to main content
Data Rules let you encode the data quality checks that matter to your project as expressions Mangrove evaluates automatically. When an event is created, a data point is updated, or a batch is calculated, the rule runs in the background and acts on any record matching a condition you’ve defined. Use Data Rules when you want to:
  • Catch out-of-range measurements before they propagate into reports
  • Flag missing or implausible values during data ingestion
  • Correct a recurring class of bad or missing data points without editing each one
  • Validate that calculated batch outputs stay within expected bounds
  • Encode methodology guardrails that your team would otherwise check by eye
Commonly used rules collects them grouped by the failure each one catches, ready to adapt to your project’s data points.

Key concepts

Rule

A rule is a single named expression evaluated against either incoming event data or model calculation results. Rules belong to a project and are managed in Project Settings → Data Rules. Every rule carries an ID beginning rule_, which is how the API identifies it. The rules list hides the ID until you add the Rule ID column from Columns, and the search box matches a rule’s name or its ID, so an ID you have been given finds its rule.

What a rule runs on

Each rule runs on one kind of data, shown in the rules list under Runs on: A rule never blocks event creation, data point updates, or batch generation. It acts after the fact.

What a rule does

Each rule takes one of two actions on the records its condition matches: A substitute rule carries an ordered list of methods, and works down it until one produces a usable value. Where none does, the rule raises an alert instead. With Hold for approval on, the rule proposes each correction and a person decides it; see Approve corrections. Substitutions are enabled per account. See Substituting a value for what a correction looks like on the data, and Correcting many values at once for writing one over the API.

Rule expression

The expression is the condition that triggers the rule. Expressions are written in a domain-specific language similar to SQL, for example:
When the expression evaluates to true on a record, that record is flagged. See Rule Expressions for the full reference.

Effective period

Every rule has an Effective from date and an optional Effective to date. The rule evaluates records whose date falls within this range. Anything outside it is left alone.
  • Set Effective to to a date when the rule should stop applying (for example, when a methodology version retires).
  • Leave Effective to blank to mean Ongoing: the rule keeps running on new data indefinitely.
When you save a new or edited rule, Mangrove evaluates every matching record within the effective range automatically. There is no separate backfill step.

Alert

When a rule’s expression matches a record within the effective period, Mangrove creates an alert. Alerts surface in three places:
  • Event drawer: alerts appear on the affected event with a link back to the rule
  • Batch detail: batches with rule alerts show them on the batch page
  • Reports: alerts on records included in a report are propagated to that report
Alerts can be dismissed with a reason, which preserves the result for audit while clearing it from the active list.

Lifecycle

To stop a rule from running on new data, set or shorten its Effective to date. The rule and its history stay in the project, and its alerts are re-evaluated against the new period, which resets any dismissals, so plan on re-triaging afterwards. To remove a rule entirely, delete it, which also removes all of its evaluations and alerts. Values it corrected stay corrected.

API access

Reading rules and their results over the Mangrove API requires your API token to have Data Rules read permission. Changing anything, including creating a rule, editing it, deleting it, dismissing its alerts, and approving or rejecting a correction it proposed, requires write permission. A token without them gets a 403 Forbidden back. To grant them, open Account Admin → API, edit the token, and tick Data Rules in the permissions list. The full set of endpoints is under Data Rules in the API reference.