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_TOTALwhen you want each cell’s share of the whole.OVERLAY_ZSCORE_VS_MARGINwhen you want how far each cell sits from its row or column.
Params
| Name | Type | Default | Description |
|---|---|---|---|
population | enum | matrix | row (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.rankdatadefault). - 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_MODEovercategorical_*/packed_bool) on either slot →PROCESSING_CONFIG, reasoncategorical_code; use a count cell.