Skip to main content
  • Date: 2026-11-24
  • Status: Agreed 2026-11-25 (proposed by Mahad); extended by 0013 (see Later changes)
  • Agreed by: Mahad (2026-11-25), for the team

Context

The streaming job’s results lived in Parquet folders and console prints. The demo video needs something a viewer can follow while the replay runs, and the ProjectSummary has a “UI” category for frontends to the results.

Decision

  • src/dashboard/app.py, a Streamlit app (streamlit run src/dashboard/app.py), reads data/stream/ every few seconds. Its refresh uses st.fragment(run_every=...), so the page redraws in place. It shows:
    • how far the replay has got;
    • today’s abnormal returns and attention spikes;
    • tomorrow’s watchlist from the big-move model (decision 0007);
    • event CARs as each window closes, with the significance call;
    • alerts per day, and one retailer’s cumulative abnormal return and attention.
  • It reads only finished micro-batches, the batch_id=N folders where Spark has written _SUCCESS, so a half-written batch never appears. Each finished folder is read once and cached.
  • It only reads. It writes nothing and needs no contract of its own. Its settings come from common.settings and common.study.

Alternatives considered

  • A notebook: it doesn’t refresh itself, and is awkward to show live.
  • Grafana or Superset: they need a database in between, which is more setup than the demo is worth.
  • Writing alerts to Kafka and reading them in a web app: closer to production, but two more moving parts for the same view.

Consequences

  • streamlit is added to requirements.txt.
  • Demo: start the replay and the job (files mode without --once, so it paces one file every 5 seconds, or Kafka with --seconds-per-day), then the dashboard in a second terminal.
  • tests/test_dashboard.py checks that only finished batches are read, in batch order.

Later changes

  • 2026-11-25, decision 0013: the same app is also hosted (Streamlit Community Cloud), with Replay and Event history views and a live feed, so a run can be watched without a laptop next to the job.
  • 2026-11-26, decision 0015: the demo is one command, scripts/demo_live.sh (or the cloud streamer). Starting the replay and the job by hand, as in Consequences above, still works, but job.py --fresh with its default folders deletes data/stream/; the demo script uses data/demo/ instead.