DocsCore conceptsDiff predicates

Diff predicates

A predicate decides when a monitor actually fires. After Verid extracts your fields and compares them to the previous run, the predicate is evaluated against the diff - if it returns true, deliveries go out. If it returns false, the run is recorded but nothing is delivered.

This is the difference between "the page changed" and "the price dropped by more than 5%".

TypeFires when
any_field_changesAny tracked field changed
field_changesA specific field changed
field_increases_by_percentNumeric field went up by ≥ N%
field_decreases_by_percentNumeric field dropped by ≥ N%
field_increases_by_absoluteNumeric field went up by ≥ N
field_decreases_by_absoluteNumeric field dropped by ≥ N
field_matches_regexNew value matches a regex
field_equalsField equals a literal value
compositeAND / OR of other predicates

All predicates reference fields by the name you gave them in extract_config.fields. See Extraction methods for how fields are defined.

any_field_changes

json
{ "type": "any_field_changes" }

Fires if any tracked field differs from the previous run. The simplest predicate - pair it with method: "full_page" for a "tell me when anything changes" monitor.

field_changes

json
{ "type": "field_changes", "field": "tag_name" }

Fires only when tag_name differs. Other fields can shift without firing. Best for "new release", "status text changed", and similar exact-match-irrelevant cases.

field_increases_by_percent

json
{ "type": "field_increases_by_percent", "field": "price", "threshold": 5 }

Fires when price is at least 5% higher than the previous run. The field value must be numeric (or a numeric string Verid can parse). Threshold is a positive number - 5 means 5%, not 0.05.

field_decreases_by_percent

json
{ "type": "field_decreases_by_percent", "field": "price", "threshold": 10 }

Mirror of the above - fires on a ≥ 10% drop. Common pattern for price-drop alerts and stock-dip notifications.

field_increases_by_absolute

json
{ "type": "field_increases_by_absolute", "field": "url_count", "threshold": 1 }

Fires when the field increases by at least the absolute amount. With threshold: 1 you get a "one or more new entries" trigger - useful for sitemap, RSS, or comment-count monitors.

field_decreases_by_absolute

json
{ "type": "field_decreases_by_absolute", "field": "in_stock", "threshold": 5 }

Same idea, downward. Useful for inventory drops, follower-count loss, etc.

field_matches_regex

json
{ "type": "field_matches_regex", "field": "status", "pattern": "^(error|failed|degraded)" }

Fires when the new value of status matches the regex. JavaScript regex syntax. Escape backslashes in JSON (\\d+, not \d+).

field_equals

json
{ "type": "field_equals", "field": "availability", "value": "In Stock" }

Fires when the new value equals the literal value exactly. value can be a string, number, or boolean. Case-sensitive for strings.

composite (AND / OR)

json
{
  "type": "composite",
  "operator": "AND",
  "conditions": [
    { "type": "field_changes", "field": "tag_name" },
    { "type": "field_equals",  "field": "prerelease", "value": false }
  ]
}

Combine multiple predicates with AND or OR. Conditions can themselves be composite - nest as deep as you need. Common pattern: "tag_name changed AND prerelease is false" to skip beta releases, or "price dropped by 10% OR went out of stock" to capture both signals in one monitor.

Tips

  • Numeric parsing: For *_by_percent and *_by_absolute predicates, Verid attempts to parse strings like "$1,299.00" or "+5.4%" as numbers. Strip currency symbols in your extractor when possible - it's less surprising.
  • First-run behaviour: The first run of a monitor never fires (there's nothing to compare against). The baseline is established silently.
  • Boolean fields: With field_equals, JSON booleans (true / false) match exactly. If your extractor returns the string "true", that's not equal to the boolean true.