All Stories
2-1-8-player-profile-props-endpointDoneEpic 2.1
Story 2.1.8: Player Profile Props Endpoint
Status: done
Tasks
- Task 1: Create Pydantic schemas for player profile props (AC: #2, #6, #7)
- 1.1: Create `PropWithOdds` model (market, line, category, over, under) in `server/app/schemas/odds/props.py`
- 1.2: Create `SportsbookOdds` model for multi-sportsbook comparison (sportsbook, odds_data)
- 1.3: Create `PlayerProfileProp` model (market, line, category, sportsbook_odds list)
- 1.4: Create `PlayerProfileResponse` model (fixture_id, player info, props_by_category dict, meta dict)
- 1.5: Add unit tests for schema validation
- Task 2: Extend PropsService for player profile props (AC: #2, #3, #7)
- 2.1: Add `aggregate_player_props_multi_sportsbook()` function for player-centric aggregation
- 2.2: Fetch all player props from Optic Odds API for the specified player
- 2.3: Support multi-sportsbook data aggregation (combine FanDuel + DraftKings odds)
- 2.4: Group props by category (passing, rushing, receiving, etc.)
- 2.5: Attach player metadata (name, team, position, headshot) from Optic Odds API
- 2.6: Add unit tests for aggregation and grouping logic
- Task 3: Create API endpoint with caching (AC: #1, #5, #8)
- 3.1: Add `GET /fixtures/{fixture_id}/props/player/{player_id}` route to `server/app/api/v1/endpoints/odds/props.py`
- 3.2: Integrate with Redis cache using key `props:player:{fixture_id}:{player_id}:{sportsbooks}`
- 3.3: Configure WARM cache strategy (60s TTL for player props)
- 3.4: Add sportsbooks query parameter (comma-separated, default "fanduel")
- 3.5: Add proper error handling (404 for missing fixture/player, 200 with empty props if player exists but has no props)
- 3.6: Add integration tests for endpoint
- Task 4: Multi-sportsbook odds aggregation (AC: #3)
- 4.1: Create utility function to merge odds from multiple sportsbooks
- 4.2: Handle cases where prop exists in one sportsbook but not another
- 4.3: Sort sportsbooks in consistent order (FanDuel first as default)
- 4.4: Add unit tests for odds aggregation edge cases
- Task 5: Performance validation (AC: #1, #4, #5)
- 5.1: Add response time logging/metrics for endpoint via `log_optic_odds_request()`
- 5.2: Validate response size under 10KB per player (test verifies typical response < 10KB)
- 5.3: Run load test with 50 concurrent requests (target p95 < 500ms) - **DEFERRED** to backlog
- 5.4: Verify cache hit ratio > 90% after warmup - **DEFERRED** to backlog
- 5.5: Test with edge cases (player with no props, multiple sportsbooks)
Progress
Tasks5/5
Acceptance Criteria0
Total Tasks5