Skip to content

feat(components): order chart series by value in the intent grammar - #53

Merged
jm-rivera merged 2 commits into
devfrom
feat/chart-intent-order
Nov 14, 2026
Merged

jm-rivera merged 2 commits into
devfrom
feat/chart-intent-order

Conversation

@jm-rivera

@jm-rivera jm-rivera commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

A chart intent can carry order: {by: "value", direction: "descending" | "ascending", period?} on line_chart, bar_chart and table. dfo-apis sorts every select list by member id (canonical_select), so today a "24 largest" bar chart draws its bars in id order; this member lets a writer ask for value order while the select stays a set for identity.

Changes

  • schemas/intent.v0.json: order on line_chart and table with an optional period label (up to 21 characters, the window label bound); bar_chart takes the same object without period. stat_card, note_narration and source_card still refuse it. The description says the order moves whole series, so a table's rows keep their period order within a series; that without period the series rank at the period where the most drawn series hold a value, the later on a tie; and that a refresh that can no longer rank as asked still draws and reports what it did in the fact summary.
  • manifest.json: catalog_version 2026.11.1, the intent schema digest, and the payload fixtures' digests, since each fixture carries the version.
  • tests/test_intent_grammar.py: which components admit order, the period bound, and the refused by and direction values.

Notes for reviewers

dfo-apis applies the member in DevelopmentFinanceObservatory/apis#300, pinned to this branch's head (9efaed0); repin to the merge commit after this merges. A deployment on 2026.11.0 refuses an intent that carries order with schema_invalid, so dfo-ai sends it only after dfo-apis prod serves 2026.11.1.

Testing: uv run pytest tests in python/dfo-spec-kit-components (367 passed), ruff, tools/validate_registry.py.

A chart intent can now carry `order: {by: "value", direction, period?}` on
line_chart, bar_chart and table, so a platform draws the series in value order
instead of the member-id order its canonical select produces. bar_chart takes
no `period`. catalog_version moves to 2026.11.1.
…h reports a fallback

The `order` description on line_chart and table now says each series moves whole, so a table's rows keep their period order; states the ranking rule as the period where the most drawn series hold a value, the later on a tie; and says a refresh that can no longer rank as asked still draws and reports what it did in the fact summary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant