Commit graph

26 commits

Author SHA1 Message Date
Chris Parsons
7970cb6a9c feat: add FIFA World Cup 48-team bracket template with group stage and projected scoring
- Add FIFA_48 bracket template with 12 groups of 4, knockout stage of 32
- Add tournament groups schema, model, and GroupStageDisplay component
- Add projected/expected value scoring to standings and team breakdowns
- Add docker-compose for local PostgreSQL development
- Move DRAFT_ORDER_IMPLEMENTATION.md to plans directory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 22:30:12 -08:00
Chris Parsons
79ec477a98 feat: implement Expected Value System with ICM probability calculator
Implements Phase 5.2 of the EV system with Harville-Malmuth Independent Chip Model
for calculating participant placement probabilities from futures odds.

## Key Features

### ICM Probability Calculator
- Implements Harville-Malmuth method for distributing probabilities
- Converts American odds to championship probabilities
- Generates P(1st) through P(8th) for all participants
- Column-normalized: each placement sums to 100% across all teams
- Works with any number of participants (not limited to 8)

### Admin UI - Futures Odds Entry
- Enter American odds (e.g., +550, -200) for championship futures
- Live preview of ICM-calculated probability distributions
- Displays all 8 placement probabilities
- Persists odds for editing on subsequent visits
- Automatic probability normalization (removes bookmaker vig)

### Database Schema Updates
- Renamed participant_expected_values.season_id → sports_season_id
- Updated foreign key to reference sports_seasons instead of seasons
- Added source_odds field to store original futures odds
- Migration 0025: Column rename and FK update
- Migration 0026: Add source_odds field

### Model Layer
- participant-expected-value: CRUD operations for probability distributions
- Supports multiple probability sources (manual, futures_odds, elo_simulation)
- Automatic EV calculation based on league scoring rules
- Probability validation and normalization

### Service Layer
- icm-calculator: Harville-Malmuth probability distribution
- probability-engine: Odds conversion and Elo utilities (for future use)
- bracket-simulator: Monte Carlo simulation (for future hybrid approach)
- ev-calculator: Expected value computation from probabilities

## Technical Details

- Uses exponential decay favoring top positions for strong teams
- Preserves championship probability ordering in final distributions
- Row sums vary (strong teams ~100%, weak teams lower)
- All probabilities between 0-1, mathematically valid
- Comprehensive test suite: 97 tests passing

## Future Enhancements

- Hybrid approach: ICM pre-playoffs, bracket simulation during playoffs
- Integration with league-specific scoring rules
- Historical probability tracking for accuracy analysis

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 22:19:46 -08:00
Chris Parsons
da1a17f2d3 Refactor code structure for improved readability and maintainability 2025-11-03 13:16:37 -08:00
Chris Parsons
a3b8fa6309 feat: Implement bracket expansion plan to support various tournament structures
- Added a comprehensive plan for bracket expansion, including support for 4, 8, 16, 32, and 68 team formats.
- Introduced a template-based bracket system with predefined templates for NCAA March Madness, NFL Playoffs, NBA Playoffs, and simple brackets.
- Updated UI flow for bracket creation, allowing admins to select templates and assign participants flexibly.
- Enhanced database schema to accommodate new scoring rules and bracket templates.
- Proposed updates to scoring logic to handle non-scoring rounds and participant placements correctly.
- Documented implementation phases for gradual rollout of new features.
- Addressed critical bugs in the playoff event processing and scoring logic, ensuring proper advancement and scoring rules across multiple leagues.
2025-11-03 09:36:16 -08:00
Chris Parsons
e49bb3df8b feat: Add scoring event and results management with comprehensive scoring rules and standings tracking 2025-10-28 23:50:50 -07:00
Chris Parsons
ad16f9d046 feat: Add comprehensive scoring system database schema
- Add scoringPattern and eventType enums for 4 scoring patterns
    (single_elimination_playoff, page_playoff, season_standings, qualifying_points)
  - Add 8 placement point fields to seasons table (1st-8th) with defaults
  - Add scoring pattern fields to sportsSeasons table (scoringPattern, totalMajors, etc.)
  - Create 10 new tables:
    - scoring_events: Individual games, tournaments, races
    - event_results: Participant results per event
    - playoff_matches: Bracket tracking for playoffs
    - participant_qualifying_totals: QP aggregation for golf/tennis
    - qualifying_point_config: Configurable QP values per sport
    - team_sport_scores: Aggregated scores per sport
    - team_standings: Current standings with tiebreakers
    - team_standings_snapshots: Daily snapshots for 7-day tracking
    - participant_expected_values: EV calculations per league
    - participant_season_results: F1 current points tracking
  - Add all necessary relations for new tables
  - Update test fixtures with new required scoring fields
2025-10-28 23:40:11 -07:00
Chris Parsons
ff97e25438 feat: add autodraft status and team connection indicators to draft grid 2025-10-21 23:22:17 -07:00
Chris Parsons
6c5c9f709b feat: add public draft board and simplify draft speed settings 2025-10-20 15:03:11 -07:00
Chris Parsons
9d41508fd0 feat: add draft API routes and implement draft room pick controls 2025-10-18 14:55:26 -07:00
Chris Parsons
469a85a0f8 feat: add draft pick, queue, and timer models with database schema updates 2025-10-16 00:32:48 -07:00
Chris Parsons
dd9d385f16 feat: add draft date/time selection to league creation and settings 2025-10-15 22:02:21 -07:00
Chris Parsons
501c5b183f feat: add draft rounds configuration to league settings 2025-10-15 21:50:02 -07:00
Chris Parsons
0e68bd2037 feat: add bulk participant creation and expected value field 2025-10-15 21:21:33 -07:00
Chris Parsons
fdfce98d87 feat: add draft order management with UI for manual and random ordering 2025-10-15 08:58:35 -07:00
Chris Parsons
6c0684f3d7 feat: add team settings route and logo URL field to teams table 2025-10-14 22:04:37 -07:00
Chris Parsons
61929536a1 feat: add username field to users and display in league views 2025-10-14 21:20:58 -07:00
Chris Parsons
8c65ac9590 feat: add invite code system for league seasons with member access control 2025-10-14 12:20:36 -07:00
Chris Parsons
94586564e2 refactor: remove isRequired field from season sports and templates 2025-10-13 15:00:59 -07:00
Chris Parsons
c343521706 feat: add icon support for sports with file upload and active seasons display 2025-10-13 10:30:47 -07:00
Chris Parsons
dc727b6f3f feat: add sports and participant models with admin user functionality 2025-10-12 21:16:00 -07:00
Chris Parsons
5f32ec05af feat: add current season tracking and active league listing by user 2025-10-11 21:10:01 -07:00
Chris Parsons
48bca99f37 refactor: remove guest book feature and update league settings success flow 2025-10-11 01:03:31 -07:00
Chris Parsons
9749fc8b77 feat: add user model, routes, and Clerk webhook integration 2025-10-11 00:53:39 -07:00
Chris Parsons
9dc033b2a0 feat: add commissioner model and league management features 2025-10-11 00:29:04 -07:00
Chris Parsons
5c957249ad feat: add fantasy league schema and new league routes 2025-10-11 00:07:39 -07:00
Chris Parsons
3117080592 Initial commit from create-react-router 2025-10-10 23:04:50 -07:00