Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

name: op-overlay-formula
kind: operator
category: OVERLAY
operator: OVERLAY_FORMULA
description: Expression-driven overlay evaluated per host coordinate against a per-host-shape variable namespace.
type: reference
applies_to: process, compose
examples_tags: [overlay, feature-engineering]

An expr-lang/expr expression evaluated per host coordinate. The variables, functions and refusal codes on each host: overlay-formula-namespace.

Use when

Computes a custom figure for every cell, group or total from an expression over the value and its margins, totals or prior point.

Questions it answers:

  • Can I show each cell as its gap from the row margin divided by the grand total?
  • Can I flag each month whose value is more than 10% above the prior month?

Use something else:

  • ATTR_FORMULA when you need a derived field on every row before aggregation.

Params

NameTypeDefaultDescription
fieldstring—SERIES host: the OUTPUT LABEL read as value (Compose: and ref_value, slot.<label>.value, per slot) or one element column "<label>[<element label>]"; absent, the first aggregation.
partition_bylist—Over two or more groupers (Compose: the first target’s), the leading group key columns each partition shares (default all but the last; [] = one walk).
formulastring(required)The expression; absent, empty or not a string → PULSE_OVERLAY_PARAM_MISSING, unparsable → PULSE_OVERLAY_FORMULA_PARSE_ERROR.
baseline_positionint—SERIES host: the 0-based row of each partition baseline reads.

scope — cell (MATRIX) / group (SERIES) / total (SCALAR).

Host shape

overlays on a crosstab (cell, margin_*, sd_*) or a grouped Process (value, total, prior, baseline; empty ref; per partition over N ≥ 2 groups); Compose on the first target against a reference of any shape (ref_cell / ref_value / ref, slot.<label>.*). Ungrouped → PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE.

Output

Shape matches the host; one number per evaluation (a bool reads 0 / 1). No summary.baseline.

Contract

  • Weight: not read; a weight in force is skipped.
  • Streaming: buffered only.

Gotchas

  • A NaN MATRIX host cell is MISSING: never evaluated, the cell stays absent, no warning.
  • A name outside the namespace is PULSE_OVERLAY_FORMULA_INVALID_IDENT (+ allowed set), predict and runtime; a non-numeric result is PULSE_OVERLAY_FORMULA_TYPE_MISMATCH.
  • No vector functions; total(expr) is PULSE_FORMULA_TOTAL_SITE here (use the total variable). Embedder ExprFunctions widen functions, never variables.
  • Margins, totals and SDs are post-fold, hence buffered.
  • A crosstab (overlays or a Compose slot) reads cell values: a code cell (AGG_MODE over categorical_* / packed_bool — the modal dictionary index / truth value) → PROCESSING_CONFIG, reason categorical_code (+ field, field_type; the cell path in slot / Compose host), predict and runtime. Use a count cell.

See