name: compose-banner
description: Compose `banner` — a survey banner table (stub sections × column groups + a Total block) as ONE Compose request, expanded into ordinary crosstab slots and stitched back into the response `banner` with per-block significance letters.
type: guide
kind: design
applies_to: compose, predict
covers: [ComposedRequest, BannerSpec, BannerResult, pulse_compose]
requires: [capability:compose_banner, capability:crosstab]
Compose banners
A banner is the survey table “Total | Gender | Age | Region” across several KPI stubs, written once. Before any slot runs, Pulse expands it into ordinary crosstab slots — per section, the Total slot, then one slot per column group — appended after requests (and any sweep slots). Each slot runs exactly like a hand-written one (compose-requests), then banner on the response stitches each section’s slots side by side.
{
"banner": {
"request": {
"cohort": {"filename": "survey.pulse"},
"crosstab": {
"rows": [{"type": "<category grouper>", "field": "brand"}],
"cell": {"type": "<count>", "field": "brand"},
"normalize": "column",
"margins": {"rows": true, "columns": true, "grand": true}
}
},
"sections": [
{"label": "all"},
{"label": "aware", "filterers": [{"type": "<value filter>", "field": "aware", "values": ["yes"]}]}
],
"groups": [
{"label": "Gender", "columns": [{"type": "<category grouper>", "field": "gender"}]},
{"label": "Age", "columns": [{"type": "<category grouper>", "field": "age"}]}
],
"total": true,
"overlays": [{"name": "sig", "kind": "<pairwise kind>", "scope": "column", "params": {"letters": {}}}]
}
}
Shape
requestis the base every slot starts from: cohort, weight, filterers,returnand the shared crosstab (rows, cell, margins, normalize). It may not setlabel, crosstabcolumns(the groups own them) or crosstabshape: long. Itslabelsride only the slots whose rows or columns group by the bound field, so banner columns get display labels withoutPULSE_LABEL_NOT_APPLIED; a binding grouped by no slot stays on every slot and warns.sections(at least one): each a uniquelabel, plus optionalfilterersAPPENDED to the base’s — a section has its own base (all adults vs aided-aware) — and optionalrows/cell/cellsREPLACING the base crosstab’s (severalcells= several measures as stub rows,crosstab-measures).groups: each a uniquelabeland a non-emptycolumnsgrouper list. Empty only withtotal: true.total: trueadds the Total block: a crosstab with no column grouper (the implicit Total column), stitched first. No group may then be labelledTotal.overlaysare appended to every GROUP slot after the base’s own — never to the Total slot. A section’s ownoverlaysREPLACE them on its group slots (a means test on a mean stub); itsletters[]then carrysection: true.
Slot labels are <section>:<group> (all:Total), unique across the batch (PULSE_COMPOSE_LABEL_COLLISION). Structural faults are PULSE_BANNER_INVALID with details.reason (request_missing, request_label_set, columns_set, shape_long, sections_empty, groups_empty, label_empty, label_duplicate, label_reserved, columns_empty) and details.field; everything else is judged on the expanded slot exactly as on its hand-written twin.
The stitched table
banner.sections[i] per section: row_header / row_keys (the union of the blocks’ rows, first seen first), column_keys (every block’s keys concatenated), cells[row][column], column_margins, cell_label / cell_labels, normalize_applied, and blocks[] — {label, slot, total, start, count, column_header, row_margins, grand_total, measures}. Every figure is COPIED from its slot. A record reaches a block’s margin only if it reached a CELL of that block, so row margins and grand totals are per block. A row a block lacks is absent there.
Letters
A banner overlay carrying params.letters adds letters[] per section — {overlay, name, kind, scope, cells} on the stitched coordinates, each present cell {letter, group, higher, above}. Under column scope the letters run on across the banner (Gender A, B; Age C, D, E; …): each block keeps its own comparison groups, so a column is compared only with columns of its own group, never across groups. The Total block is compared to nothing: it never receives the banner overlays, so its columns carry no letter cell. Under row scope cells are copied unchanged.
A batch multiplicity block with family compose pools every banner slot’s tests; letters are recomputed after the batch fold, so above reads the corrected significance.
Limits, predict, return, stream
MaxComposeSlotscounts explicit + sweep + banner slots (sections × (groups + Total)) before any runs:PULSE_LIMIT_EXCEEDED, serial and parallel alike.PredictCompose/pulse_predictexpands the same way and reportsbanner {sections, groups, total, expanded_count, labels}.- A banner slot always computes its whole response (the stitch reads it unshaped); its
returnstill trims it on the wire.bannersits outside the composereturn: always emitted, never rounded. MCP fills a missing base-requestreturnwith thestandarddefault. --echo-requestechoes the expanded slots;--streamends with one{"banner":{...}}line.- Cost: one cohort scan per slot;
ComposeParalleloverlaps them.
See
compose-requests (slots, labels, parallel) · crosstab-guide (the slot crosstab) · crosstab-measures (several measures as stub rows) · pairwise-n-sources (the pairwise kinds and letters) · compose-sweeps (the other expansion).