Skip to content

Add DataHub-styled React visualizations with validated chart intents - #100

Open
shirshanka wants to merge 2 commits into
mainfrom
codex/react-charts
Open

shirshanka wants to merge 2 commits into
mainfrom
codex/react-charts

Conversation

@shirshanka

Copy link
Copy Markdown
Contributor

Summary

Introduce a React visualization catalog built with visx and a local adapter of DataHub Alchemy colors. The chart model selects a versioned intent and column roles; the backend validates it and binds the full query/tool result. Both automatic SQL charts and create_chart use this path.

Included

  • KPI tiles with history sparklines; horizontal and diverging bars; line and area charts with up to eight series.
  • Chart/data toggle, accessible labels, responsive layouts, app themes, PNG export, and print styles.
  • Preserve null gaps, signed values, SQL ordering, and truncation warnings. Reject ambiguous mappings and duplicate category/series pairs; retain data in a table when an intent cannot render.
  • Persist intent and rows in the existing CHART payload; no database migration.
  • Preserve legacy Vega-Lite conversations and use Vega for specialized charts, transforms, and custom colors. Lazy-load its renderer.
  • Development gallery at /charts.html, contract documentation, and CI coverage for the new frontend tests.

This uses local Alchemy color tokens, not a new published Alchemy dependency. Trend categories are equally spaced in SQL result order; the renderer does not infer continuous time intervals or aggregate data.

Verification

  • 371 backend unit tests, including 23 new visualization tests
  • 6 MCP transport integration tests
  • Ruff lint and format; mypy (62 source files)
  • Frontend production build and ESLint (existing warnings only)
  • 16 new visualization tests; 51 passing focused frontend tests including grouping/stress
  • Mocked model responses through both generation paths and SSE
  • SQLite persistence/reload and frontend message reconstruction
  • Browser checks: light/dark themes, 390px layout, table toggle, legacy Vega, PNG download and inspection

Known verification limits

  • The full frontend unit suite is 60 passed / 1 failed. The existing buildUiMessages.test.ts test attaches USAGE to the previous TOOL_CALL in result fails against unchanged implementation/test files. This PR adds an explicit CI step for the new visualization suite; it does not suppress or modify that existing test.
  • Live LLM/warehouse verification and full-transcript PDF generation have not been performed. Print styles were reviewed; GitHub's existing Playwright suite will run in CI.

Preview locally

pnpm --dir frontend install --frozen-lockfile
pnpm --dir frontend dev --host 127.0.0.1 --port 5187
# Open http://127.0.0.1:5187/charts.html

See docs/visualizations.md for the schema, supported forms, limits, and compatibility behavior.

This branch has not been deployed

No deployments
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