def failed_job_options_prompt(self): prompt = "\nCurrent options:" choices = { f"{MENU_NUMBERS.get(1)} Retry Job": "RETRY", f"{EMOJIS.get('BACK')} Return to Failed Jobs": None, } return user_options_prompt(choices, prompt, clear_screen=False)
def select_game_operation_prompt(self): prompt = "What would you like to do at this point?" choices = { f"{MENU_NUMBERS.get(1)} Analyze Pitching Data": "INVESTIGATE", f"{MENU_NUMBERS.get(2)} Attempt to Combine Data (Again)": "RETRY", f"{EMOJIS.get('BACK')} Return to Previous Menu": None, } return user_options_prompt(choices, prompt)
def game_id_prompt(self): choices = { f"{EMOJIS.get('BOLT')} {game_id}": game_id for game_id in self.all_eligible_games_in_season } choices[f"{EMOJIS.get('BACK')} Return to Previous Menu"] = None prompt = "Select the BBRef.com Game ID to combine scraped data:" return user_options_prompt(choices, prompt)
def incomplete_job_options_prompt(self): prompt = "\nCurrent options:" choices = { f"{MENU_NUMBERS.get(1)} Execute Job": "RUN", f"{MENU_NUMBERS.get(2)} Cancel Job": "CANCEL", f"{EMOJIS.get('BACK')} Return to Incomplete Jobs": None, } return user_options_prompt(choices, prompt, clear_screen=False)
def report_options_prompt(self): choices = { f"{MENU_NUMBERS.get(1)} Season": "SEASON", f"{MENU_NUMBERS.get(2)} Single Date": "SINGLE_DATE", f"{MENU_NUMBERS.get(3)} Date Range": "DATE_RANGE", f"{EMOJIS.get('BACK')} Return to Main Menu": None, } return user_options_prompt(choices, PROMPT_TEXT)
def game_date_prompt(self): choices = { f"{EMOJIS.get('BOLT')} {game_date.strftime(DATE_MONTH_NAME)}": game_date for game_date in self.all_dates_with_eligible_games } choices[f"{EMOJIS.get('BACK')} Return to Previous Menu"] = None prompt = "Select a date to combine scraped data for all games that took place on that date" return user_options_prompt(choices, prompt)
def select_patch_prompt(self): prompt = ( "You can attempt to patch all games with invald PitchFX data by selecting the first " "option below. Or, you can investigate each game in detail by selecting the second " "option.") choices = { f"{MENU_NUMBERS.get(1)} Patch all Games": "ALL", f"{MENU_NUMBERS.get(2)} Patch a Single Game": "ONE", f"{EMOJIS.get('BACK')} Return to Previous Menu": None, } return user_options_prompt(choices, prompt)
def get_single_date_report_type_from_user(self): choice_text1 = f"{MENU_NUMBERS.get(1)} Detail Report" choice_text2 = f"{MENU_NUMBERS.get(2)} Detail Report + Missing PitchFx IDs" choice_text3 = f"{MENU_NUMBERS.get(3)} Detail Report + Missing PitchFx IDs + Game Status" choices = { choice_text1: Report.DATE_DETAIL_ALL_DATES, choice_text2: Report.DATE_DETAIL_MISSING_PITCHFX, choice_text3: Report.SINGLE_DATE_WITH_GAME_STATUS, f"{EMOJIS.get('BACK')} Return to Previous Menu": None, } return user_options_prompt(choices, PROMPT_TEXT)
def audit_type_prompt(self): prompt = ( "For games where all data has been scraped, would you like to combine and audit the " "data for all games in the same season, all games on a single date or for a single " "game?") choices = { f"{MENU_NUMBERS.get(1)} By Season": "SEASON", f"{MENU_NUMBERS.get(2)} By Date": "DATE", f"{MENU_NUMBERS.get(3)} By Game": "GAME", f"{EMOJIS.get('BACK')} Return to Main Menu": None, } return user_options_prompt(choices, prompt)
def audit_report_season_prompt(self): prompt = "Select an MLB season from the list below:" years_with_errors = [ year for year in self.app.audit_report.keys() if self.app.audit_report[year].get("invalid_pfx", []) or self.app.audit_report[year].get("pfx_error", []) or self.app.audit_report[year].get("failed", []) ] choices = { f"{MENU_NUMBERS.get(num)} {year}": year for num, year in enumerate(years_with_errors, start=1) } choices[f"{EMOJIS.get('BACK')} Return to Previous Menu"] = None return user_options_prompt(choices, prompt)
def get_date_range_report_type_from_user(self): choice_text1 = f"{MENU_NUMBERS.get(1)} Dates Missing Data (Summary)" choice_text2 = f"{MENU_NUMBERS.get(2)} All Dates In Range (Summary)" choice_text3 = f"{MENU_NUMBERS.get(3)} Dates Missing Data (Detail)" choice_text4 = f"{MENU_NUMBERS.get(4)} All Dates In Range (Detail)" choice_text5 = f"{MENU_NUMBERS.get(5)} All Dates In Range + Missing PitchFx IDs (Detail)" choices = { choice_text1: Report.DATE_SUMMARY_MISSING_DATA, choice_text2: Report.DATE_SUMMARY_ALL_DATES, choice_text3: Report.DATE_DETAIL_MISSING_DATA, choice_text4: Report.DATE_DETAIL_ALL_DATES, choice_text5: Report.DATE_DETAIL_MISSING_PITCHFX, f"{EMOJIS.get('BACK')} Return to Previous Menu": None, } return user_options_prompt(choices, PROMPT_TEXT)
def sync_direction_prompt(self): prompt = ( 'Please choose the "direction" of the sync operation. Files in the source location ' "are compared to files in the destination, if a source file does not exist in the " "destination, it will be copied to the destination. Files that exist in both " "locations are compared, if the destination file is older it will be replaced by " "the updated version from the source location. Files are never deleted from either " "location during a sync.") SYNC_UP_MENU_CHOICE = "Sync Up: Local Folder (Source) -> S3 Bucket (Dest)" SYNC_DOWN_MENU_CHOICE = "Sync Down: S3 Bucket (Source) -> Local Folder (Dest)" choices = { f"{MENU_NUMBERS.get(1)} {SYNC_UP_MENU_CHOICE}": SyncDirection.UP_TO_S3, f"{MENU_NUMBERS.get(2)} {SYNC_DOWN_MENU_CHOICE}": SyncDirection.DOWN_TO_LOCAL, f"{EMOJIS.get('BACK')} Return to Main Menu": None, } return user_options_prompt(choices, prompt)