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-rank
kind: operator
category: OVERLAY
operator: OVERLAY_RANK
description: Compose-host per-cell rank of each target cell within a configurable population (row / column / matrix).
type: reference
applies_to: compose
examples_tags: [overlay, compose, top-n]

Compose-only. Overlays decorate the host; no Response.Components.

Use when

Ranks each cell of a target Compose request’s crosstab (1 = largest) within its row, its column or the whole table.

Questions it answers:

  • Which product is the top seller in each region?
  • Where does each answer rank within its segment?

Use something else:

  • OVERLAY_SHARE_OF_TOTAL when you want each cell’s share of the whole.
  • OVERLAY_ZSCORE_VS_MARGIN when you want how far each cell sits from its row or column.

Params

NameTypeDefaultDescription
populationenummatrixrow (within the cell’s row), column (within its column) or matrix (across every present cell).

scope must be cell. reference required — anchors the slot match only. targets required slot labels.

Host shape

COMPOSE — MATRIX crosstab. Slots must match on schema and keys, but the reference’s VALUES are never read: ranks come from the target cells only.

Output

MATRIX — payload.matrix.cells[r][c].value = 1-based rank (1 = largest) within the population, on the target’s keys. summary.baseline unset. One layer per target, in targets order: one target keeps name; two or more are <name>__<target>, each the one-target layer. Over options.max_panel_targets (16) → PULSE_OVERLAY_PANEL_TARGETS_OVER_CAP.

Contract

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

Gotchas

  • Tie-breaking: average rank (matches scipy.stats.rankdata default).
  • An absent target cell stays absent and is NOT in the population’s denominator — ranks cover PRESENT cells only.
  • Buffered (the Compose fold always buffers).
  • A code cell (AGG_MODE over categorical_* / packed_bool) on either slot → PROCESSING_CONFIG, reason categorical_code; use a count cell.

See