feat(espn-service): expand API with news, injuries, transactions & at…#15
Merged
Conversation
…hlete stats ## New Database Models - NewsArticle - stores ESPN news articles (site API + Now API), keyed on espn_id - Injury - league injury reports (snapshot-style refresh per league) - Transaction - signings, trades, waivers (upsert on espn_id) - AthleteSeasonStats - per-athlete season stats from common/v3 endpoint Migration: 0002_injury_newsarticle_transaction_athleteseasonstats ## New Ingestion Services (apps/ingest/services.py) - NewsIngestionService - update_or_create on espn_id - InjuryIngestionService - full snapshot delete+re-insert per league - TransactionIngestionService - update_or_create on espn_id - AthleteStatsIngestionService - update_or_create on composite key ## New Celery Tasks + Beat Schedules - refresh_news_task / refresh_all_news_task (Beat: every 30 min) - refresh_injuries_task / refresh_all_injuries_task (Beat: every 4 hours) - refresh_transactions_task / refresh_all_transactions_task (Beat: every 6 hours) ## New REST API Endpoints GET /api/v1/news/ - filterable by sport, league, date_from, search GET /api/v1/injuries/ - filterable by sport, league, status, team GET /api/v1/transactions/ - filterable by sport, league, date_from GET /api/v1/athlete-stats/ - filterable by sport, league, season, athlete_espn_id POST /api/v1/ingest/news/ - manual news ingest trigger POST /api/v1/ingest/injuries/ - manual injury snapshot trigger POST /api/v1/ingest/transactions/ - manual transaction ingest trigger ## New Management Commands python manage.py ingest_news [--sport X --league Y] [--limit N] python manage.py ingest_injuries [--sport X --league Y] python manage.py ingest_transactions [--sport X --league Y] ## Other Changes - Updated admin.py with list_display, list_filter, search for all 4 new models - Updated serializers (list + detail variants for news/injuries/transactions/athlete-stats) - Added docker-compose.test.yml for local Docker-based test runs - Added 21 new tests in tests/test_ingestion_new.py (145 total, all passing) - Added ESPN audit findings: 11 new espn_client methods, 6 API domains documented - Updated CELERY_BEAT_SCHEDULE in base.py with 3 new periodic task entries - Corrected standings endpoint bug (was using /apis/site/v2/, now /apis/v2/) - Expanded ALL_LEAGUES_CONFIG to cover 50+ league slugs across 12 sports
…d Docker testing - Expanded API Endpoints table: added /api/v1/news/, /api/v1/injuries/, /api/v1/transactions/, /api/v1/athlete-stats/ (GET + detail) - Added Ingest Triggers sub-section with all 5 POST endpoints - Added Database Models table covering all 11 models with ingestion source - Added Celery Beat Schedule reference table - Added Management Commands section with ingest_news / ingest_injuries / ingest_transactions examples - Added Docker Testing section with docker-compose.test.yml usage - Updated Example Usage curl examples to include injuries and news
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…hlete stats
New Database Models
Migration: 0002_injury_newsarticle_transaction_athleteseasonstats
New Ingestion Services (apps/ingest/services.py)
New Celery Tasks + Beat Schedules
New REST API Endpoints
GET /api/v1/news/ - filterable by sport, league, date_from, search
GET /api/v1/injuries/ - filterable by sport, league, status, team
GET /api/v1/transactions/ - filterable by sport, league, date_from
GET /api/v1/athlete-stats/ - filterable by sport, league, season, athlete_espn_id
POST /api/v1/ingest/news/ - manual news ingest trigger
POST /api/v1/ingest/injuries/ - manual injury snapshot trigger
POST /api/v1/ingest/transactions/ - manual transaction ingest trigger
New Management Commands
python manage.py ingest_news [--sport X --league Y] [--limit N]
python manage.py ingest_injuries [--sport X --league Y]
python manage.py ingest_transactions [--sport X --league Y]
Other Changes