All Stories
2-1-6-player-props-categories-endpointDoneEpic 2.1
Story 2.1.6: Player Props Categories Endpoint
Status: done
Tasks
- Task 1: Create Pydantic schemas for prop categories (AC: #2, #3)
- 1.1: Create `server/app/schemas/odds/props.py` with `PropCategory` model (id, name, player_count, prop_count)
- 1.2: Create `PropCategoriesResponse` model (fixture_id, categories list, meta dict)
- 1.3: Add unit tests for schema validation
- Task 2: Implement PropsService for category aggregation (AC: #2, #5)
- 2.1: Added `aggregate_prop_categories()` function to existing `props.py` (per constraint: add to existing router)
- 2.2: Implement category aggregation using existing `FOOTBALL_CATEGORIES`, `BASKETBALL_CATEGORIES`, etc.
- 2.3: Fetch player props from Optic Odds API via `get_fixtures_odds(is_main=False)`
- 2.4: Aggregate props by category using keyword matching
- 2.5: Calculate player_count (unique) and prop_count per category
- 2.6: Add unit tests for category aggregation logic (6 tests)
- Task 3: Create API endpoint with caching (AC: #1, #4, #6)
- 3.1: Added endpoint to existing `server/app/api/v1/endpoints/odds/props.py` router
- 3.2: Implement `GET /fixtures/{fixture_id}/props/categories` endpoint
- 3.3: Integrated with Redis cache using key pattern `odds:props:categories:{fixture_id}`
- 3.4: Configured with HOT cache strategy (300s TTL)
- 3.5: Added proper error handling (404 for missing fixture, 200 with empty for no props)
- 3.6: Router already registered (using existing props.py)
- 3.7: Add integration tests for endpoint (4 tests)
- Task 4: Optic Odds API integration (AC: #5)
- 4.1: Uses existing `get_fixtures_odds(fixture_ids=[id], is_main=False)` for player props
- 4.2: Reused existing OpticOddsAPIClient methods
- 4.3: Uses existing league-specific category mappings (FOOTBALL_CATEGORIES, etc.)
- 4.4: Handle API errors with proper exception handling
- Task 5: Performance validation (AC: #1, #3)
- 5.1: Added response_time_ms to meta in response
- 5.2: Validated response size under 3KB (test_response_size_under_3kb - 12 categories < 3072 bytes)
- 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