This guide walks through creating a data rule end to end: choosing what to evaluate, setting the effective period, writing an expression, validating it, and saving.Documentation Index
Fetch the complete documentation index at: https://docs.mangrovesystems.com/llms.txt
Use this file to discover all available pages before exploring further.
Before you start
You need:- Write access to the project’s Data Rules. Ask an admin if the Add Rule button is greyed out.
- A clear sense of the measurement or calculation you want to validate, and the threshold or pattern that defines a problem.
Step-by-step
Open Data Rules
Navigate to Project Settings → Data Rules. The Data Rules page lists every rule configured for the project, along with what it evaluates, its status, and the dates it applies to.Click Add Rule in the top right to start a new rule.
Choose what the rule evaluates
Pick a target for the rule:
| Target | When to use |
|---|---|
| Event Data | Validate raw measurements as events are created or updated. Best for catching ingestion-time errors (out-of-range readings, missing values). |
| Batch Calculations | Validate model outputs after a batch is generated. Best for catching downstream calculation issues (a CI score that drifts outside expected bounds). |
- For Event Data, optionally select an event type to scope the rule. Leaving this blank evaluates the rule against any event whose datapoints match the expression.
- For Batch Calculations, select the model whose calculation results should be evaluated. The available variables come from that model’s nodes.
Set the effective period
Pick the dates the rule should apply to:
- Effective from — the earliest date the rule applies to. Required.
- Effective to — the date the rule stops applying. Leave blank for Ongoing.
Write the rule expression
Use the rule editor to write the condition that should trigger an alert. Type When the expression evaluates to true on a record, that record is flagged. See Rule Expressions for the full language reference and more examples.
{{ to open autocomplete and pick a datapoint slug or model node.Name the rule and write an alert message
Two short fields describe the rule to anyone who later sees it on a record or in the rules list:
- Rule Name — a short identifier shown in the Data Rules list and in audit history (for example, “Carbon content cap”). Keep it brief and stable, even if you later edit the expression.
- Alert Message — the human-readable explanation shown on each alerted record (for example, “Carbon content out of range”). Defaults to a humanized version of the rule expression; edit it to read more naturally for the people triaging alerts.
Validate the rule
Click Validate Rule to check the expression. Mangrove will:
- Confirm the syntax parses correctly
- Confirm every variable resolves to a real datapoint or model node
- Run the rule against recent project data and show a Results Preview of records that would have been flagged
Save and run the rule
Click Save Rule. Mangrove confirms the effective range and evaluates every matching record within it — both historical and going forward. Records outside the range are left untouched.
Confirm the rule is active
After saving, you land on the rule detail page. The header shows the rule status, its effective period, and a list of any matching records found during evaluation.The rule is now live: every new event or batch generation within the effective period will run the expression and raise an alert if it matches.
Editing a rule
Open a rule from the Data Rules list and click Edit. Changing the expression saves a new version and archives the previous one — historical results stay tied to the version that produced them. When you save an edit, Mangrove re-evaluates matching records within the effective period. To stop a rule from applying to new data, shorten its Effective to date instead of editing the expression.Archiving vs deleting
| Action | Effect |
|---|---|
| Archive | Stops the rule, hides its alerts from records, and preserves history for audit. Use for rules that have produced results. |
| Delete | Permanently removes the rule and its evaluation results. Only available when the rule has never produced a result, or you accept that the results will be deleted with it. |