Skip to content

feat(data-analytics-demo): T-09 dashboard — self-built Python+Jinja2+Plotly (Evidence pivot)#89

Merged
leagames0221-sys merged 1 commit into
mainfrom
feat/data-analytics-demo-t09-dashboard
May 17, 2026
Merged

feat(data-analytics-demo): T-09 dashboard — self-built Python+Jinja2+Plotly (Evidence pivot)#89
leagames0221-sys merged 1 commit into
mainfrom
feat/data-analytics-demo-t09-dashboard

Conversation

@leagames0221-sys

Copy link
Copy Markdown
Owner

Summary

Phase 5 of the data-analytics-demo bolt-on. Ships a self-built static-HTML dashboard generator written in pure Python (Jinja2 + Plotly) that replaces the originally planned Evidence integration.

What lands

Path Role
src/data_analytics_demo/dashboard/render.py Orchestration — reads marts, builds figures, renders templates, writes dashboard/build/{index,rfm,churn,kpi}.html
src/data_analytics_demo/dashboard/queries.py Centralised DuckDB queries against the dbt marts
src/data_analytics_demo/dashboard/charts.py Plotly figure builders (bar / scatter / line / area / heatmap), CDN plotly.js for small per-page size
src/data_analytics_demo/dashboard/templates/*.html.j2 Jinja2 templates — base layout + 4 page templates
tests/test_dashboard.py 4 AC-coverage cases (T-09 / AC-5.1〜5.4)
pyproject.toml Adds jinja2 (BSD, Pallets) + plotly (MIT, Plotly Inc.)
Makefile + cli.py make dashboard / data-analytics-demo dashboard invoke the Python generator
docs/adr/0070-...md Amendment block documenting the Evidence → self-built pivot with revised Tradeoff 4

Why the Evidence pivot

Local installation of Evidence hit four+ chained peer-dep resolution failures under pnpm 10's isolated layout and npm strict resolution (@sveltejs/kit, vite, @evidence-dev/tailwind, ...). The fix path was unbounded and would have introduced a second package manager into an otherwise-Python sub-tree for a build-time-only artifact. The amended ADR-0070 captures the rationale.

A pure-Python generator gives:

  • Smaller blast radius (2 PyPI deps vs ~629 npm deps)
  • Single toolchain (same ruff / mypy / pytest gates as the rest of the package)
  • Stronger portfolio signal — "self-built static dashboard generator" reads as analytics-engineering breadth
  • Full layout control (Plotly figures + Jinja2 templates produce the same chart types Evidence was going to)

AC coverage

AC Behaviour Verified by
5.1 make dashboard produces static HTML test_ac_5_1_renders_all_pages
5.2 Output includes ≥ 3 sections (RFM / churn / KPI) test_ac_5_2_index_includes_required_sections
5.3 Reads from the same analytics.duckdb test_ac_5_3_uses_provided_duckdb
5.4 Missing DuckDB → clear error test_ac_5_4_missing_warehouse_raises

Local verify

  • make data + make dbt + make dashboard end-to-end OK on Python 3.12 venv
  • 4 pages produced: index (28KB), rfm (39KB), churn (12KB), kpi (38KB); Plotly via CDN keeps per-page small
  • ruff + mypy --strict clean (19 source files)
  • pytest 26 passed; coverage 88.31%
  • check-doc-drift.mjs 0 failure; check-adr-claims.mjs 77/77

Test plan

  • Required CI checks green (existing 11 + python-test + python-audit)
  • No HIVE-token leaks (D-HIVE-OPACITY)

…Plotly (Evidence pivot)

Phase 5 of the data-analytics-demo bolt-on. Ships a static-HTML dashboard
generator that reads the dbt marts and emits 4 pages of charts + tables to
`dashboard/build/`.

Pivot from Evidence: the original Tradeoff 4 (ADR-0070) chose Evidence as
the BI tool. Local installation hit four+ chained peer-dependency failures
under pnpm 10 isolated layout and npm strict resolution (@sveltejs/kit,
vite, @evidence-dev/tailwind, ...). The fix path was unbounded and would
have introduced a second package manager into an otherwise-Python sub-tree
for a build-time-only artifact. ADR-0070 is amended in this PR with the
revised Tradeoff 4 and the rationale.

What lands:
- src/data_analytics_demo/dashboard/{__init__,render,queries,charts}.py
  Pure Python generator — reads from analytics.duckdb via duckdb-py,
  builds Plotly figures, renders Jinja2 templates.
- src/data_analytics_demo/dashboard/templates/{base,index,rfm,churn,kpi}.html.j2
  Layout (header / nav / metric strip / cards / footer) + 4 page templates.
- tests/test_dashboard.py — 4 cases covering AC-5.1〜5.4 (renders all
  pages; index contains all 3 required sections; uses the supplied
  DuckDB; missing-warehouse raises a clear error).
- Makefile + cli.py — `make dashboard` / `data-analytics-demo dashboard`
  now invoke the Python generator.
- pyproject.toml — adds jinja2 (BSD, Pallets) + plotly (MIT, Plotly Inc.)
  to dependencies; both already in the audited stack space.
- ADR-0070 amendment with the revised Tradeoff 4 and a "Why this is the
  better fit" narrative.

Local verify (Python 3.12 venv, seed=42):
- `make data` + `make dbt` + `make dashboard` end-to-end OK
- 4 pages produced: index.html (28KB), rfm.html (39KB), churn.html (12KB),
  kpi.html (38KB) — Plotly via CDN keeps per-page size small.
- ruff OK / mypy OK (19 source files) / pytest 26 PASS / coverage 88.31%
- doc-drift 0 fail / adr-claims 77/77 PASS
@vercel

vercel Bot commented May 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
craftstack-collab Ready Ready Preview, Comment May 17, 2026 3:30pm
craftstack-knowledge Ready Ready Preview, Comment May 17, 2026 3:30pm

@leagames0221-sys leagames0221-sys merged commit c9f6197 into main May 17, 2026
13 checks passed
@leagames0221-sys leagames0221-sys deleted the feat/data-analytics-demo-t09-dashboard branch May 17, 2026 15:36
leagames0221-sys added a commit that referenced this pull request May 21, 2026
…Plotly (Evidence pivot) (#89)

Phase 5 of the data-analytics-demo bolt-on. Ships a static-HTML dashboard
generator that reads the dbt marts and emits 4 pages of charts + tables to
`dashboard/build/`.

Pivot from Evidence: the original Tradeoff 4 (ADR-0070) chose Evidence as
the BI tool. Local installation hit four+ chained peer-dependency failures
under pnpm 10 isolated layout and npm strict resolution (@sveltejs/kit,
vite, @evidence-dev/tailwind, ...). The fix path was unbounded and would
have introduced a second package manager into an otherwise-Python sub-tree
for a build-time-only artifact. ADR-0070 is amended in this PR with the
revised Tradeoff 4 and the rationale.

What lands:
- src/data_analytics_demo/dashboard/{__init__,render,queries,charts}.py
  Pure Python generator — reads from analytics.duckdb via duckdb-py,
  builds Plotly figures, renders Jinja2 templates.
- src/data_analytics_demo/dashboard/templates/{base,index,rfm,churn,kpi}.html.j2
  Layout (header / nav / metric strip / cards / footer) + 4 page templates.
- tests/test_dashboard.py — 4 cases covering AC-5.1〜5.4 (renders all
  pages; index contains all 3 required sections; uses the supplied
  DuckDB; missing-warehouse raises a clear error).
- Makefile + cli.py — `make dashboard` / `data-analytics-demo dashboard`
  now invoke the Python generator.
- pyproject.toml — adds jinja2 (BSD, Pallets) + plotly (MIT, Plotly Inc.)
  to dependencies; both already in the audited stack space.
- ADR-0070 amendment with the revised Tradeoff 4 and a "Why this is the
  better fit" narrative.

Local verify (Python 3.12 venv, seed=42):
- `make data` + `make dbt` + `make dashboard` end-to-end OK
- 4 pages produced: index.html (28KB), rfm.html (39KB), churn.html (12KB),
  kpi.html (38KB) — Plotly via CDN keeps per-page size small.
- ruff OK / mypy OK (19 source files) / pytest 26 PASS / coverage 88.31%
- doc-drift 0 fail / adr-claims 77/77 PASS

Co-authored-by: leagames0221-sys <leagames0221@users.noreply.github.com>
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