All Stories
2-1-7-player-props-by-category-endpointDoneEpic 2.1
Story 2.1.7: Player Props by Category Endpoint
Status: done
Tasks
- Task 1: Create Pydantic schemas for props by category (AC: #2, #6)
- 1.1: Create `PlayerProp` model (market, line, over, under) in `server/app/schemas/odds/props.py`
- 1.2: Create `PlayerWithProps` model (player_id, name, team, position, headshot, props list)
- 1.3: Create `PropsByCategoryResponse` model (fixture_id, category, players list, meta dict)
- 1.4: Add unit tests for schema validation (5 tests)
- Task 2: Extend PropsService for props by category (AC: #2, #5, #6)
- 2.1: Added `group_props_by_player_for_category()` function to existing `props.py` (per pattern from 2.1.6)
- 2.2: Fetch player props from Optic Odds API filtered by category
- 2.3: Group props by player and attach player metadata (team, position, headshot)
- 2.4: Support sportsbook filtering parameter
- 2.5: Add unit tests for grouping and filtering logic (6 tests)
- Task 3: Create API endpoint with caching (AC: #1, #4, #7)
- 3.1: Added `GET /fixtures/{fixture_id}/props/{category}` route to existing props.py router
- 3.2: Integrated with Redis cache using key pattern `props:{fixture_id}:{category}:{sportsbook}`
- 3.3: Configured with WARM cache strategy (60s TTL)
- 3.4: Added sportsbook query parameter with default "fanduel"
- 3.5: Added proper error handling (404 for missing fixture, 400 for invalid category)
- 3.6: Add integration tests for endpoint (5 tests)
- Task 4: Category validation and mapping (AC: #2, #5)
- 4.1: Defined VALID_CATEGORIES dict per sport (NFL, NBA, NHL, MLB, NCAA)
- 4.2: Used existing category keyword mappings from Story 2.1.6
- 4.3: Return 400 error for invalid category parameter
- 4.4: Add category validation unit tests (4 tests)
- Task 5: Performance validation (AC: #1, #3)
- 5.1: Added response_time_ms to meta in response
- 5.2: Validated response size under 20KB (test_response_size_under_20kb - 10 players with 4 props each < 20KB)
- 5.3: Tests validate functionality (live load testing deferred)
- 5.4: Cache hit/miss tracking verified via test_endpoint_cache_hit
Progress
Tasks5/5
Acceptance Criteria0
Total Tasks5