Skip to content

Commit

Permalink
Merge pull request #599 from alan-turing-institute/update-2324
Browse files Browse the repository at this point in the history
updates for 2324 season
  • Loading branch information
jack89roberts authored Jul 14, 2023
2 parents 22c61fd + b58ecdf commit 735affe
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 16 deletions.
36 changes: 36 additions & 0 deletions airsenal/data/fifa_team_ratings_2324.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
team_name,att,mid,defn,ovr
Manchester City,85,87,84,85
Liverpool,84,82,84,84
Chelsea,83,79,83,83
Tottenham Hotspur,84,83,80,82
Manchester United,82,83,81,82
Arsenal,81,83,80,81
Leicester City,82,80,76,79
West Ham United,79,80,78,79
Newcastle United,79,78,79,79
Aston Villa,78,79,79,79
Wolverhampton Wanderers,78,80,74,78
Everton,78,77,76,77
Nottingham Forest,75,76,77,77
Crystal Palace,77,76,76,76
Leeds United,77,76,75,76
Fulham,77,76,74,76
Southampton,76,72,76,76
Brighton & Hove Albion,75,76,77,76
Brentford,76,75,74,75
Bournemouth,72,73,73,74
Burnley,74,73,73,73
Watford,72,71,74,73
West Bromwich Albion,73,72,71,72
Norwich City,72,71,72,72
Sheffield United,71,73,72,72
Middlesbrough,68,70,72,72
Hull City,71,70,68,70
Queens Park Rangers,71,68,71,70
Luton Town,70,70,69,69
Swansea City,69,70,68,69
Stoke City,69,69,69,69
Huddersfield Town,67,67,69,69
Sunderland,71,68,67,68
Cardiff City,67,68,68,68
Derby County,68,67,66,67
21 changes: 21 additions & 0 deletions airsenal/data/teams_2324.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name,full_name,season,team_id
ARS,Arsenal,2324,1
AVL,Aston Villa,2324,2
BOU,Bournemouth,2324,3
BRE,Brentford,2324,4
BHA,Brighton,2324,5
BUR,Burnley,2324,6
CHE,Chelsea,2324,7
CRY,Crystal Palace,2324,8
EVE,Everton,2324,9
FUL,Fulham,2324,10
LIV,Liverpool,2324,11
LUT,Luton,2324,12
MCI,Man City,2324,13
MUN,Man Utd,2324,14
NEW,Newcastle,2324,15
NFO,Nott'm Forest,2324,16
SHU,Sheffield United,2324,17
TOT,Spurs,2324,18
WHU,West Ham,2324,19
WOL,Wolves,2324,20
21 changes: 11 additions & 10 deletions airsenal/framework/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
"Brighton & Hove Albion FC",
"Brighton & Hove Albion",
],
"CHE": ["6", "Chelsea", "Chelsea FC"],
"CRY": ["7", "Crystal Palace", "Crystal Palace FC"],
"EVE": ["8", "Everton", "Everton FC"],
"FUL": ["9", "Fulham", "Fulham FC"],
"LEI": ["10", "Leicester City", "Leicester", "Leicester City FC"],
"LEE": ["11", "Leeds", "Leeds United", "Leeds Utd"],
"LIV": ["12", "Liverpool", "Liverpool FC"],
"BUR": ["6", "Burnley", "Burnley FC"],
"CHE": ["7", "Chelsea", "Chelsea FC"],
"CRY": ["8", "Crystal Palace", "Crystal Palace FC"],
"EVE": ["9", "Everton", "Everton FC"],
"FUL": ["10", "Fulham", "Fulham FC"],
"LIV": ["11", "Liverpool", "Liverpool FC"],
"LUT": ["12", "Luton", "Luton Town"],
"MCI": ["13", "Manchester City", "Man City", "Manchester City FC"],
"MUN": [
"14",
Expand All @@ -40,14 +40,15 @@
"Newcastle Utd",
],
"NFO": ["16", "Nott'm Forest", "Nottingham Forest"],
"SOU": ["17", "Southampton", "Southampton FC"],
"SHU": ["17", "Sheffield United", "Sheffield Utd"],
"TOT": ["18", "Tottenham Hotspur", "Spurs", "Tottenham Hotspur FC"],
"WHU": ["19", "West Ham United", "West Ham", "West Ham United FC"],
"WOL": ["20", "Wolves", "Wolverhampton Wanderers", "Wolverhampton Wanderers FC"],
"BUR": ["Burnley", "Burnley FC"],
"LEI": ["Leicester City", "Leicester", "Leicester City FC"],
"LEE": ["Leeds", "Leeds United", "Leeds Utd"],
"SOU": ["Southampton", "Southampton FC"],
"NOR": ["Norwich City", "Norwich"],
"WAT": ["Watford", "Watford FC"],
"SHU": ["Sheffield United", "Sheffield Utd"],
"WBA": ["West Bromwich Albion", "West Brom"],
"SUN": ["Sunderland"],
"SWA": ["Swansea City"],
Expand Down
18 changes: 12 additions & 6 deletions airsenal/framework/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,20 +1340,26 @@ def get_recent_minutes_for_player(
If current_gw is not given, we take it to be the most
recent finished gameweek.
"""
playerscores = get_recent_playerscore_rows(
player, num_match_to_use, season, last_gw, dbsession
playerscores = (
get_recent_playerscore_rows(
player, num_match_to_use, season, last_gw, dbsession
)
or []
)
# If the player has not played a match or two in the last
# `num_matches_to_use` matches, then we check a couple of gameweeks further
# back.
if not playerscores or len(playerscores) < num_match_to_use:
playerscores = get_recent_playerscore_rows(
player, num_match_to_use + 2, season, last_gw, dbsession
if len(playerscores) < num_match_to_use:
playerscores = (
get_recent_playerscore_rows(
player, num_match_to_use + 2, season, last_gw, dbsession
)
or []
)
if len(playerscores) > num_match_to_use:
playerscores = playerscores[-num_match_to_use:]

minutes = [r.minutes for r in playerscores] if playerscores else []
minutes = [r.minutes for r in playerscores]
# if going back num_matches_to_use from last_gw takes us before the start
# of the season, also include a minutes estimate using last season's data
if last_gw is None:
Expand Down

0 comments on commit 735affe

Please sign in to comment.