Spaces:
Sleeping
Sleeping
Commit History
-
Merge remote: resolve mlb_starters.py conflict — keep conn param + remote team canonical map
Remote added _MLB_TEAM_CANONICAL, _canonical_team, _normalize_person, _names_match, build_oddsapi_starter_fallback_map, merge_probable_starters_with_odds_fallback, fetch_mlb_current_roster_map, and lookup_batter_current_team. Combined with our conn=None parameter and pitcher_resolution_log logging additions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>abe5c7e -
Accuracy overhaul: pitcher resolution logging, baseline recalibration, vig fix, XGBoost blend
Phase 1: Unified pitcher name normalization (normalize_pitcher_name), added pitcher_resolution_log table with logging from mlb_starters, live feed, and statcast lookup. Color-coded debug page section for resolution audit. Phase 2: Baseline HR probability 0.045 → 0.036 (empirical MLB 2024 per-PA rate). Phase 3: HR edge now uses single-sided vig removal (p / 1.055) instead of circular two-way normalization. Added kelly_pct to recommendation output. Phase 4: Removed double-counted temperature/wind adjustments from context_adjustment.py — environment_model.py owns all weather signals. Phase 5: BET threshold 6%/78 → 3.5%/72; WATCH 2.5%/62 → 1.5%/58. Phase 6: XGBoost HR delta blended at 20% weight when xgb_blend_eligible. Added validate_xgb_batch() for batch-level sanity checks. Phase 7: Hit-type distribution corrected — singles 0.76→0.62, doubles 0.20→0.33 (empirical MLB 2024 non-HR hit mix). Phase 9: edge.py converted to re-exports from no_vig_props.py (single source of truth for al…21151ce -
Fix debug dashboard 10-minute hang — limit unbounded DB reads
- Add LIMIT 2000 to read_recommendation_audit_view CTE query - Add read_recommendation_logs_recent() with LIMIT 2000 (replaces full table scan) - Add LIMIT 2000 to read_batter_prop_audit_view query - Replace read_table("recommendation_logs") with read_recommendation_logs_recent in _load_debug_audit_bundle() - Wrap _load_debug_audit_bundle() call site in 15s thread timeout so a slow DB never blocks the full page render Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>19017e4
-
Perf: parallelize TheOddsAPI event loop, fix schema init overhead
- provider_theoddsapi: replace serial per-event HTTP loop (worst case 457s) with ThreadPoolExecutor(max_workers=8) + 45s wall-clock cap via concurrent.futures.wait; adds _fetch_event_odds() helper - database/db: initialize_schema() now runs once per process lifetime via _schema_initialized guard + lock instead of on every get_connection() - shared_baseline: wrap 8 sequential snapshot DB reads in a daemon thread with 20s wall-clock timeout; returns degraded bundle on timeout - app.py: wrap replace_cached_upcoming_props_bundle() write in a daemon thread with 15s timeout so cache persist never blocks the render path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>bd7830d -
Recover props terminal UI redesign; fix pitcher filter and cache hang
- Restore be663f7 'Redesign Props page terminal UI' (521 insertions) lost during HF Space recovery git reset - Fix _filter_probable_starters_to_slate() to use _canonical_team() instead of _normalize_team_key() so 'sfg' matches 'san francisco giants' - Add LIMIT 5000 to cached_upcoming_props_rows query to prevent 5+ min full-table scan as table grows unbounded - Wrap read_cached_upcoming_props_bundle() in thread+10s timeout; on timeout raises RuntimeError caught by existing except block → falls through to live HTTP fetch - Re-apply timeout banner (360s auto-reload) and async _maybe_log_props Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0b4a187 -
Remove Fangraphs from Props runtime
c4cd7c6 -
Remove Fangraphs starter fallback in favor of MLB and Odds API
0dfe795 -
Add safe FanGraphs starter fallback
51b1a14
-
Preserve usable HR snapshot during degraded refresh
e5071ce -
Add DraftKings-first HR supplemental coverage
7e836ba -
Complete multi-book HR source coverage
5591dd3 -
Improve multi-book props coverage reconciliation
66db1db -
Make debug snapshot reads retry-safe
a937adb -
Optimize serving path with row-based snapshots
88f040e -
Improve load-time caching and baseline snapshots
c4ae8c3
-
Personalize props model voice
4c8e6d6 -
Expand props with verdicts strikeouts and loader
6989587 -
Upgrade props HR calibration and Fangraphs fallback
0010624 -
Redesign HR props command center
49fb892
-
Fix batter_prop_outcomes explosion: dedup audit view + scoped grading
Root cause: read_recommendation_audit_view produced Cartesian-product rows (source tables written every 3s × no dedup in JOIN), and Step 3 appended the full inflated history on every game completion with no game_pk filter and no conflict guard. Fixes applied: - read_recommendation_audit_view: DISTINCT ON CTEs on both sides of the JOIN before joining; latest_outcomes scoped to market='hr' to prevent future market-multiplication - Step 3: filter audit_df to current game_pk; scoped delete before insert (idempotent per game) - Step 4: read/delete/insert scoped to current game_pk only (stops full-table churn) - build_batter_prop_outcome_rows_from_audit: dedup on (game_pk, batter_name, market) before returning - Manual debug button: replace instead of insert (idempotent) - ensure_batter_prop_outcomes_table: CREATE UNIQUE INDEX on (game_pk, batter_name, market) as hard backstop post-rebuild - New helpers: delete_batter_prop_outcomes_for_game, read_batter_prop_outcomes_for_game …22080c8
-
Fix QueuePool exhaustion: close leaked connections + widen pool + fix 2026 retry loop
- _fire_completion: add finally block to always close fresh_conn, preventing daemon threads from leaking connections that exhaust the pool - remote_db: raise pool_size 5→10, max_overflow 10→20, pool_timeout 30→60 to tolerate burst connections during live game windows - render_statcast_retry_fragment: exclude games in live_pitch_mix_2026 from pending query so 2026 games no longer perpetually re-trigger _fire_completion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>07da77f -
Add live 2026 pitch/PA tables and migrate Card Lab to new sources
New tables live_pitch_mix_2026 (pitch-level) and live_batter_game_log_2026 (PA-level) are created in db.py and wired into the post-game ingestion pipeline in game_completion.py. Card Lab queries are year-gated: 2026 hitter/pitcher cards and all Game Summary cards now read from the new live tables (no 3-table JOIN), while 2021-2025 cards continue using statcast_event_core. Game Summary hitter rows are now sourced from live_batter_game_log_2026 (one row per PA, real batter identity via MLBAM ID) instead of grouping pitch-level data by pitcher name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>9846940 -
Debug tab: fix caption disappears via st.toggle (no session_state write)
Replace st.button + manual session_state with st.toggle so the sidebar radio no longer resets to Dashboard on click. Also includes game-completion pipeline (on_game_complete, statcast retry fragment) and statcast core schema initialization. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d8c9977
-
Card Lab: fix player classification, column aliases, pitcher ID flow
Root cause fixes: - Remove batter_stand/pitcher_hand/xwoba aliases that broke all model lookups (models expect stand, p_throws, estimated_woba_using_speedangle) - Restore bb.bb_type + add ec.pitcher to pitcher SELECT for feature builders - Hitter list: add events NOT IN filter to exclude pitchers with rare ABs - Pitcher list: LEFT JOIN to name map (no LIMIT), fallback "Pitcher {id}", NULL names sorted last; returns list[tuple[int,str]] keyed by pitcher ID - Pitcher window query: accept pitcher_id directly, remove name→id lookup UX/perf: - Cached hitter/pitcher list wrappers (_cached_hitters/_cached_pitchers, 10m TTL) - Game summary player filter: explicit session_state binding for rerender - Add idx_statcast_game_pk index for game summary player dropdown Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6776cb9 -
Card Lab: fix image crash, name normalization, query pruning, DB indexes
- Replace st.image(use_container_width=True) with width=700 (ImageMixin compat) - Add normalize_name() helper: 'Last, First' -> 'First Last' for all dropdowns (format_func only — raw DB values unchanged for queries) - Game Summary player filter: remove LIMIT, 'Full Game' sentinel, normalized labels - Prune 13 unused columns from hitter query + remove plate_location JOIN - Prune plate_location JOIN from pitcher query (ax/ay/az/effective_speed/spin_axis removed) - Add idx_statcast_player_date + idx_statcast_pitcher_date to initialize_schema() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>a80f497
-
Feedback tab + Batch 13 debug refinements + rebrand to Kasper
- Add Feedback nav tab (CockroachDB-backed submit + display) - Add missing snap_after_family_zone_* and snap_after_pulled_contact_* checkpoints to simulator - Add arsenal_drift_applied_scale to drift model output and simulator passthrough - Expand debug ladder to 12 steps with HR/Hit/TB2P toggle - Rebrand dashboard header to Kasper with updated product description - Add arsenal_drift_model.py and rolling_form_model.py (Batch 13 models) - Add debug_page.py (Batch 13 full debug dashboard) - Opportunity model and pitcher adjustment updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b3ac245 -
CockroachDB cutover + XGBoost evaluation fix + requirements cleanup
- All 6 runtime tables now CockroachDB-backed via SQLAlchemy (db.py full rewrite, remote_db.py lazy engine) - XGBoost evaluation pipeline: pd.read_sql(text(...)) read path fix + lineup_slot JOIN fix (xgb_hr_evaluation.py) - config/settings.py: removed dead DUCKDB_PATH constant - app.py: updated caption DuckDB → CockroachDB - requirements.txt: remove duckdb==1.1.2 (unused), add xgboost (required by shadow model) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>c884cb3 -
Batch 14: HR props odds-injection layer + Props page
- Add fetch_all_upcoming_hr_props() bulk fetch (single API call, no game filter) - Add Caesars (williamhill_us) to provider supported books; document Pinnacle path - Add analytics/props_mapper.py: get_player_hr_prob() with source tracking (internal_model_baseline via compute_batter_baseline, fallback to unavailable); modular map_hr_props_to_model() with injectable prob_fn - Add upcoming_hr_props table to durable DuckDB schema - Add visualization/props_page.py: Props page with all-book + best-line views, sportsbook filter, min-edge slider, edge-sorted table, DB logging - Replace Players tab with Props tab in app navigation Deferred: Batch 13, Batch 12.5 follow-up, Pinnacle integration, CLV, bankroll sizing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>2099da5 -
Batch 12.5D: XGBoost shadow model + evaluation pipeline + lineup_slot JOIN fix
- Add XGBoost HR/hit/TB2P models (trainer, dataset builder, shadow integration) - Add evaluation pipeline with 3-key JOIN (game_pk + batter_name + lineup_slot) - Fix lineup_slot schema in both DB tables with safe migration - Normalize lineup_slot in both logger paths for consistent JOIN - Add placeholder-odds disclaimer to Edge/ROI evaluation output - Add .gitignore excluding .claude/ and __pycache__ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>71c16c1
-
Update database/remote_db.py
Verified signature29665de
-
Update database/remote_db.py
Verified signature423e1d1 -
Create remote_db.py
Verified signature3b5d530
-
Update database/db.py
Verified signature32be934
-
Update database/db.py
Verified signaturee9d1f6c -
Update database/db.py
Verified signature851b5bb -
Update database/db.py
Verified signatureb351835 -
Update database/db.py
Verified signature55216ea -
Update database/db.py
Verified signaturee6c79b8 -
Update database/db.py
Verified signaturea607955 -
Update database/db.py
Verified signature0b18c92 -
Update database/db.py
Verified signatureec425bd
-
Rename database/db.txt to database/db.py
Verified signature9fcd1ff -
Upload 31 files
Verified signature5c10d18