Dashboard: Stadium Night design system, 5-page Streamlit app, warehouse exporter

- src/export/warehouse.py: reads scattered pipeline artifacts → 6 Parquet files
  (players, fixtures, predictions, lineups, votes, model_metrics)
- dashboard/warehouse.py: read-only cached Parquet loader
- .streamlit/config.toml: dark theme base, server config
- dashboard/viz/template.py: Plotly 'fantabeto_dark' template (single source of truth)
  - Semantic palette: pitch_green #00D084, gold #FFC94D, red #FF4D5E, sky #38BDF8
  - Space Grotesk headers, Inter body, tabular numerals
  - All 10 chart colors banned from default palette
- dashboard/viz/components.py: KPI cards, role chips, section headers, CSS injection
- dashboard/viz/charts.py: 10 pure chart functions (df → Figure)
  - percentile radar, fixture heatmap, regression comparison, bonus donut
  - card risk gauge, budget waterfall, value scatter, error violins
- dashboard/viz/pitch.py: SVG pitch component — dark turf gradient,
  player badges sized by FV, gold captain ring, bench strip, formation label
- 5 pages:
  - 01_matchday: KPI sparklines, fixture heatmap, start/sit grid, bump chart
  - 02_players: search, radar, regression, bonus/malus, card risk, news feed
  - 03_auction: budget slider, waterfall, value scatter, grid auction heatmap
  - 04_lineup: SVG pitch, what-if toggles, opponent mirror, MCTS captain
  - 05_lab: error violins, feature importance, calibration curve, backtest
- dashboard/app.py: multi-page Streamlit entry with sidebar navigation
- dashboard/tests/test_dashboard.py: 18 unit tests (warehouse, template, charts, pitch)
- DASHBOARD.md: full architecture docs, design system reference
- 49 total tests passing (31 existing + 18 dashboard)
This commit is contained in:
ramseshk
2026-08-11 14:53:51 +08:00
parent 68670889c7
commit 65f5b66b05
19 changed files with 2217 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
"""Fantabeto 26/27 Dashboard — Project Al-Cihred.
Multi-page Streamlit app. Run with: streamlit run dashboard/app.py
"""
import streamlit as st
from dashboard.viz.components import inject_css
# Register the custom Plotly template
from dashboard.viz.template import stub_render # triggers template registration
PAGES = {
"⚽ Matchday": "dashboard.pages.01_matchday",
"👤 Players": "dashboard.pages.02_players",
"💰 Auction": "dashboard.pages.03_auction",
"📋 Lineup": "dashboard.pages.04_lineup",
"🧪 Model Lab": "dashboard.pages.05_lab",
}
def main():
st.set_page_config(
page_title="Fantabeto 26/27 — Project Al-Cihred",
page_icon="⚽",
layout="wide",
initial_sidebar_state="expanded",
)
inject_css()
st.sidebar.markdown("""
<div style="font-family:'Space Grotesk',sans-serif;font-size:22px;font-weight:700;color:#E5E7EB;margin-bottom:4px;">
⚽ FANTABETO
</div>
<div style="font-family:'Inter',sans-serif;font-size:11px;color:#9CA3AF;margin-bottom:16px;text-transform:uppercase;letter-spacing:1px;">
Project Al-Cihred · 26/27
</div>
""", unsafe_allow_html=True)
page = st.sidebar.radio("Navigation", list(PAGES.keys()), label_visibility="collapsed")
st.sidebar.divider()
st.sidebar.caption("Fantacalcio Bayesian Estimated Team's Outcome")
st.sidebar.caption("v2.0 · August 2026")
st.sidebar.caption("Data: Fantacalcio.it · FBref · api-football")
# Route to selected page
module_name = PAGES[page]
import importlib
mod = importlib.import_module(module_name)
mod.run()
if __name__ == "__main__":
main()