Jon Solow
commited on
Commit
·
1727748
1
Parent(s):
a8d8ee5
Move playoff team definition to playoffs.py
Browse files- src/domain/playoffs.py +43 -0
- src/domain/teams.py +0 -23
- src/pages/10_Set_Your_Lineup.py +5 -3
src/domain/playoffs.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
PLAYOFF_WEEK_TO_SCHEDULE_WEEK = {
|
2 |
1: "WildCard",
|
3 |
2: "Division",
|
@@ -26,3 +29,43 @@ PLAYOFF_WEEK_TO_NAME = {
|
|
26 |
}
|
27 |
|
28 |
CURRENT_PLAYOFF_WEEK = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from domain import teams
|
2 |
+
|
3 |
+
|
4 |
PLAYOFF_WEEK_TO_SCHEDULE_WEEK = {
|
5 |
1: "WildCard",
|
6 |
2: "Division",
|
|
|
29 |
}
|
30 |
|
31 |
CURRENT_PLAYOFF_WEEK = 1
|
32 |
+
|
33 |
+
|
34 |
+
PLAYOFFS_TEAMS = {
|
35 |
+
1: [
|
36 |
+
teams.baltimore_ravens.rosters_short_name,
|
37 |
+
teams.miami_dolphins.rosters_short_name,
|
38 |
+
teams.kansas_city_chiefs.rosters_short_name,
|
39 |
+
teams.houston_texans.rosters_short_name,
|
40 |
+
teams.cleveland_browns.rosters_short_name,
|
41 |
+
teams.san_francisco_49ers.rosters_short_name,
|
42 |
+
teams.dallas_cowboys.rosters_short_name,
|
43 |
+
teams.detroit_lions.rosters_short_name,
|
44 |
+
teams.philadelphia_eagles.rosters_short_name,
|
45 |
+
teams.los_angeles_rams.rosters_short_name,
|
46 |
+
teams.tampa_bay_buccaneers.rosters_short_name,
|
47 |
+
teams.buffalo_bills.rosters_short_name,
|
48 |
+
teams.pittsburgh_steelers.rosters_short_name,
|
49 |
+
teams.green_bay_packers.rosters_short_name,
|
50 |
+
],
|
51 |
+
2: [],
|
52 |
+
3: [],
|
53 |
+
4: [],
|
54 |
+
}
|
55 |
+
|
56 |
+
PLAYOFF_TEAM_DEF_PLAYER: list[tuple[teams.NFLTeam, str]] = [
|
57 |
+
(teams.baltimore_ravens, ""),
|
58 |
+
(teams.miami_dolphins, ""),
|
59 |
+
(teams.kansas_city_chiefs, ""),
|
60 |
+
(teams.houston_texans, ""),
|
61 |
+
(teams.cleveland_browns, ""),
|
62 |
+
(teams.san_francisco_49ers, ""),
|
63 |
+
(teams.dallas_cowboys, ""),
|
64 |
+
(teams.detroit_lions, ""),
|
65 |
+
(teams.philadelphia_eagles, ""),
|
66 |
+
(teams.los_angeles_rams, ""),
|
67 |
+
(teams.tampa_bay_buccaneers, ""),
|
68 |
+
(teams.buffalo_bills, ""),
|
69 |
+
(teams.pittsburgh_steelers, ""),
|
70 |
+
(teams.green_bay_packers, ""),
|
71 |
+
]
|
src/domain/teams.py
CHANGED
@@ -289,27 +289,4 @@ washington_football_team = NFLTeam(
|
|
289 |
)
|
290 |
|
291 |
|
292 |
-
PLAYOFFS_TEAMS = {
|
293 |
-
1: [
|
294 |
-
baltimore_ravens.rosters_short_name,
|
295 |
-
miami_dolphins.rosters_short_name,
|
296 |
-
kansas_city_chiefs.rosters_short_name,
|
297 |
-
houston_texans.rosters_short_name,
|
298 |
-
cleveland_browns.rosters_short_name,
|
299 |
-
san_francisco_49ers.rosters_short_name,
|
300 |
-
dallas_cowboys.rosters_short_name,
|
301 |
-
detroit_lions.rosters_short_name,
|
302 |
-
philadelphia_eagles.rosters_short_name,
|
303 |
-
los_angeles_rams.rosters_short_name,
|
304 |
-
tampa_bay_buccaneers.rosters_short_name,
|
305 |
-
buffalo_bills.rosters_short_name,
|
306 |
-
pittsburgh_steelers.rosters_short_name,
|
307 |
-
green_bay_packers.rosters_short_name,
|
308 |
-
],
|
309 |
-
2: [],
|
310 |
-
3: [],
|
311 |
-
4: [],
|
312 |
-
}
|
313 |
-
|
314 |
-
|
315 |
SCHEDULE_NAME_TO_PFR_NAME_MAP = {t.rosters_short_name: t.team_full_name for t in ALL_TEAMS}
|
|
|
289 |
)
|
290 |
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
SCHEDULE_NAME_TO_PFR_NAME_MAP = {t.rosters_short_name: t.team_full_name for t in ALL_TEAMS}
|
src/pages/10_Set_Your_Lineup.py
CHANGED
@@ -7,8 +7,8 @@ from config import DEFAULT_ICON
|
|
7 |
from shared_page import common_page_config
|
8 |
|
9 |
from domain.constants import SEASON
|
10 |
-
from domain.playoffs import PLAYOFF_WEEK_TO_NAME, CURRENT_PLAYOFF_WEEK, ROSTER_WEEK_TO_PLAYOFF_WEEK
|
11 |
-
from domain.teams import SCHEDULE_NAME_TO_PFR_NAME_MAP
|
12 |
from queries.nflverse.github_data import get_weekly_rosters
|
13 |
from queries.pfr.league_schedule import get_season_time_map
|
14 |
from login import check_password
|
@@ -89,7 +89,7 @@ def player_options_from_df(df_options) -> dict[str, dict[int, list[PlayerOption]
|
|
89 |
return options_map
|
90 |
|
91 |
|
92 |
-
@st.cache_data(ttl=60 * 60 * 24)
|
93 |
def load_options():
|
94 |
df_rosters = get_weekly_rosters()
|
95 |
|
@@ -117,6 +117,8 @@ def load_options():
|
|
117 |
df_rosters["in_playoffs"] = df_rosters.apply(lambda x: x.team in PLAYOFFS_TEAMS[x.week], axis=1)
|
118 |
|
119 |
df_rosters = df_rosters[df_rosters.in_playoffs]
|
|
|
|
|
120 |
player_options = player_options_from_df(df_rosters)
|
121 |
return player_options
|
122 |
|
|
|
7 |
from shared_page import common_page_config
|
8 |
|
9 |
from domain.constants import SEASON
|
10 |
+
from domain.playoffs import PLAYOFF_WEEK_TO_NAME, CURRENT_PLAYOFF_WEEK, ROSTER_WEEK_TO_PLAYOFF_WEEK, PLAYOFFS_TEAMS
|
11 |
+
from domain.teams import SCHEDULE_NAME_TO_PFR_NAME_MAP
|
12 |
from queries.nflverse.github_data import get_weekly_rosters
|
13 |
from queries.pfr.league_schedule import get_season_time_map
|
14 |
from login import check_password
|
|
|
89 |
return options_map
|
90 |
|
91 |
|
92 |
+
# @st.cache_data(ttl=60 * 60 * 24)
|
93 |
def load_options():
|
94 |
df_rosters = get_weekly_rosters()
|
95 |
|
|
|
117 |
df_rosters["in_playoffs"] = df_rosters.apply(lambda x: x.team in PLAYOFFS_TEAMS[x.week], axis=1)
|
118 |
|
119 |
df_rosters = df_rosters[df_rosters.in_playoffs]
|
120 |
+
# st.dataframe(df_rosters)
|
121 |
+
st.write(df_rosters.position.unique())
|
122 |
player_options = player_options_from_df(df_rosters)
|
123 |
return player_options
|
124 |
|