Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for 2025 #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added League_Scheduling_Challenger_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Juniors_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Lower_Farm_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Majors_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Minors_AAA_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Minors_AA_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Rookie_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Tee_Ball_solution.pkl
Binary file not shown.
Binary file added League_Scheduling_Upper_Farm_solution.pkl
Binary file not shown.
28 changes: 13 additions & 15 deletions fieldpick/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
keep_columns = [
'Week_Number',
'Home_Team',
'Away_Team',
'Date',
'Start',
'End',
'Location',
'Field',
]
'Away_Team',
'Date',
'Start',
'End',
'Location',
'Field',
]
scFrame = scFrame[keep_columns]
scFrame.dropna(subset=['Home_Team'], inplace=True)

Expand All @@ -42,7 +42,6 @@
scFrame.index.name = "SortOrder"



# for col in scFrame.columns:
# if col not in keep_columns:
# print(col)
Expand All @@ -59,21 +58,20 @@
uFrame = cFrame.query("Division != Division")
publish_df_to_gsheet(uFrame, worksheet_name="Unassigned")

import time
# time.sleep(3)

divisionFrames = generate_schedules(cFrame)
for division, division_frame in divisionFrames.items():
drop_columns = [
'Week_Number', 'Time_Length', 'Intended_Division',
'Day_of_Year', 'Division', "Datestamp",
"Home_Team", "Away_Team",
'Notes','Location', 'Field', 'Size',
'Type', 'Infield', 'Sunset', 'Region'
]
'Day_of_Year', 'Division', "Datestamp",
"Home_Team", "Away_Team",
'Notes', 'Location', 'Field', 'Size',
'Type', 'Infield', 'Sunset', 'Region'
]
for col in drop_columns:
if col in division_frame.columns:
division_frame = division_frame.drop(columns=col)
publish_df_to_gsheet(division_frame, worksheet_name=f"{division}")
logger.info("Sleeping for 10 second to avoid rate limit")
time.sleep(3)
time.sleep(10)
55 changes: 32 additions & 23 deletions fieldpick/assign_challenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,25 @@

logger = logging.getLogger()


def clear_row(frame, slot):
frame.loc[slot, ["Division", "Home_Team", "Home_Team_Name", "Away_Team", "Away_Team_Name", "Game_ID"]] = [
None,
None,
None,
None,
None,
None,
]
frame.loc[slot,
["Division",
"Home_Team",
"Home_Team_Name",
"Away_Team",
"Away_Team_Name",
"Game_ID"]] = [None,
None,
None,
None,
None,
None,
]

# @profile


def main():
# Main loop

Expand All @@ -58,27 +66,28 @@ def main():
tFrame = pd.read_pickle(save_file)

# Block off for Challenger
cFrame.update(reserve_slots(cFrame, day_of_week="Sunday", field="Riordan", start="13:30", division="Challenger"))
cFrame.update(reserve_slots(cFrame, day_of_week="Sunday", field="Tepper", start="14:00", division="Challenger"))
cFrame.update(
reserve_slots(cFrame, day_of_week="Sunday", field="McCoppin", start="09:00", division="Challenger", date="2023-03-12")
)


# Remove Challenger slot on 3/14/23
mothers_day = cFrame[cFrame["Date"] == "2023-05-14"].index
reserve_slots(
cFrame,
day_of_week="Sunday",
field="Riordan",
start="14:00",
division="Challenger"))
cFrame.update(
reserve_slots(
cFrame,
day_of_week="Sunday",
field="Tepper",
start="14:00",
division="Challenger"))

# Remove Challenger slot on 5/11/25
mothers_day = cFrame[cFrame["Date"] == "2025-05-11"].index
challenger = cFrame[cFrame["Division"] == "Challenger"].index
challenger_slots = mothers_day.intersection(challenger)
for slot in challenger_slots:
clear_row(cFrame, slot)

# Remove Challenger slot on opening day 3/4
opening_day = cFrame[cFrame["Date"] == "2023-03-05"].index
challenger = cFrame[cFrame["Division"] == "Challenger"].index
challenger_slots = opening_day.intersection(challenger)
for slot in challenger_slots:
clear_row(cFrame, slot)

save_frame(cFrame, "calendar.pkl")
publish_df_to_gsheet(cFrame, worksheet_name="Full Schedule")

Expand Down
Loading