Sync Stats

Player season statistics

Sync Stats

Fetches Detroit Lions player season statistics. Powers the Stats page showing top performers.

API Endpoint

GET https://api.lionschedule.me/api/v1/football/stats/?season=2025&team_id=8
Parameter Default Description
season 2025 NFL season year
team_id 8 Detroit Lions team ID

What It Does

  1. Fetches season stats for all Lions players
  2. Matches each stat row to a cached Player record
  3. Creates or updates PlayerSeasonStats records (unique on player + team + season + category)

Data Stored

PlayerSeasonStats: player (FK), team (FK), season, category, games_played, pass_yards, pass_touchdowns, interceptions, rush_yards, rush_touchdowns, receptions, receiving_yards, receiving_touchdowns, total_tackles, sacks, field_goals_made, total_points, stat_value, stat_label, rank, raw (full JSON)

Response Structure

{
  "stats": [
    {
      "player_id": 4426515,
      "category": "passing",
      "games_played": 17,
      "pass_yards": 4575,
      "pass_touchdowns": 35,
      "interceptions": 11,
      "value": "4,575",
      "label": "Passing Yards",
      "rank": 5
    }
  ]
}

Schedule

Every 6 hours during the season. Stats update after each game.

Management Command

python manage.py sync_stats --season 2025 --triggered-by manual

Dependencies

Requires sync_core and sync_players to have run first.