get_blank_gameweeks
Identify upcoming blank gameweeks in Fantasy Premier League and affected teams to plan your squad effectively. Specify the number of gameweeks to analyze for optimal strategy.
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
| Name | Required | Description | Default |
|---|---|---|---|
| num_gameweeks | No |
Input Schema (JSON Schema)
{
"properties": {
"num_gameweeks": {
"default": 5,
"title": "Num Gameweeks",
"type": "integer"
}
},
"title": "get_blank_gameweeksArguments",
"type": "object"
}
Implementation Reference
- Core handler function that implements get_blank_gameweeks tool logic: fetches gameweeks, fixtures, and teams data to identify upcoming blank gameweeks where certain teams have no fixtures, returning structured list of affected gameweeks and 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
- Usage of get_blank_gameweeks as a helper function within the league fixture analysis tool to identify blank gameweeks in the specified range.try: from ..resources.fixtures import get_blank_gameweeks, get_double_gameweeks blank_gameweeks = await get_blank_gameweeks(end_gw - start_gw + 1) double_gameweeks = await get_double_gameweeks(end_gw - start_gw + 1) except Exception as e: logger.error(f"Error getting blank/double gameweeks: {e}") blank_gameweeks = [] double_gameweeks = []
- Import statement for get_blank_gameweeks from fixtures resources.from ..resources.fixtures import get_blank_gameweeks, get_double_gameweeks