Skip to main content
William Boyden
Theme: Night, matching your device
Status
shipped
Period
2026-08
Dated
Role
Design and implementation

Gov Payroll Analytics Workbench

Analytics pipeline over a 23-table, ~279M-row ClickHouse database of government payroll and federal spending: 14 re-runnable probe datasets that embed their own SQL, plus a self-contained dashboard.

Python 3.13 stdlibClickHouse 24.3MCP JSON-RPC + SSEvanilla JS/CSS
database
23 tables, ~279M rows when built; the warehouse holds 48 tables and ~446M rows today
probe datasets
14, each under 0.3 s server-side
dashboard
1 self-contained HTML file

Highlights

  • The agent doing the analysis has no database port by design — the query layer drives the clickhouse-mcp server over JSON-RPC with SSE responses, session-id handshakes, retry and stale-session re-handshake
  • Every dataset is self-documenting — each data/*.json embeds the exact SQL, per-attempt elapsed time and row count, and the dashboard ships a provenance section exposing all of it
  • Three real ClickHouse quirks diagnosed and worked around — missing arbitrary() (error 46), alias-shadowing ILLEGAL_AGGREGATION (error 184), and non-uniform column names like fiscal_year stored as the string FY2026
  • Two coverage traps caught before they lied — QCEW carries 9 aggregation levels per county (~9x overstate unless filtered to agglvl_code 70) and federal awards store cumulative modifications (~12x overstate until deduped to final obligation per award)
  • KPIs are recomputed from the rows at build time, never hardcoded; the single index.html embeds data as a JSON island and opens over file:// with zero network requests

Related writing