get_blank_gameweeks
Identify upcoming Premier League gameweeks without fixtures to help Fantasy Premier League managers plan team selections and transfers effectively.
Instructions
Get information about upcoming blank gameweeks where teams don't have fixtures
Args:
num_gameweeks: Number of upcoming gameweeks to check (default: 5)
Returns:
Information about blank gameweeks and affected teams
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| num_gameweeks | No |
Implementation Reference
- The main handler function that fetches FPL API data for gameweeks, fixtures, and teams, then identifies upcoming blank gameweeks (gameweeks where some teams have no fixtures) by comparing teams with and without fixtures in each upcoming gameweek. Returns a list of blank gameweeks with affected teams.async def get_blank_gameweeks(num_gameweeks: int = 5) -> List[Dict[str, Any]]: """ Identify upcoming blank gameweeks where teams don't have a fixture. Args: num_gameweeks: Number of upcoming gameweeks to analyze Returns: List of blank gameweeks with affected teams """ # Get gameweek data all_gameweeks = await api.get_gameweeks() all_fixtures = await api.get_fixtures() team_data = await api.get_teams() # Get current gameweek current_gw = None for gw in all_gameweeks: if gw.get("is_current", False) or gw.get("is_next", False): current_gw = gw break if not current_gw: return [] current_gw_id = current_gw["id"] # Limit to specified number of upcoming gameweeks upcoming_gameweeks = [gw for gw in all_gameweeks if gw["id"] >= current_gw_id and gw["id"] < current_gw_id + num_gameweeks] # Map team IDs to names team_map = {t["id"]: t for t in team_data} # Results to return blank_gameweeks = [] # Analyze each upcoming gameweek for gameweek in upcoming_gameweeks: gw_id = gameweek["id"] # Get fixtures for this gameweek gw_fixtures = [f for f in all_fixtures if f.get("event") == gw_id] # Get teams with fixtures this gameweek teams_with_fixtures = set() for fixture in gw_fixtures: teams_with_fixtures.add(fixture.get("team_h")) teams_with_fixtures.add(fixture.get("team_a")) # Identify teams without fixtures (blank gameweek) teams_without_fixtures = [] for team_id, team in team_map.items(): if team_id not in teams_with_fixtures: teams_without_fixtures.append({ "id": team_id, "name": team.get("name", f"Team {team_id}"), "short_name": team.get("short_name", "") }) # If teams have blank gameweek, add to results if teams_without_fixtures: blank_gameweeks.append({ "gameweek": gw_id, "name": gameweek.get("name", f"Gameweek {gw_id}"), "teams_without_fixtures": teams_without_fixtures, "count": len(teams_without_fixtures) }) return blank_gameweeks