panelist

This module provides objects used to retrieve panelists, panelist information and panelist details from a copy of the Wait Wait Don’t Tell Me! Stats database.

Panelist

class wwdtm.panelist.Panelist(connect_dict=None, database_connection=None)

This class contains functions used to retrieve panelist data from a copy of the Wait Wait Stats database.

Parameters:
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

retrieve_all()

Returns a list of dictionary objects containing panelist ID, name and slug string for all panelists.

Return type:

List[Dict[str, Any]]

Returns:

List of all panelists and their corresponding information. If panelists could not be retrieved, an empty list is returned.

retrieve_all_details()

Returns a list of dictionary objects containing panelist ID, name, slug string and appearance information for all panelists.

Return type:

List[Dict[str, Any]]

Returns:

List of all panelists and their corresponding information and appearances. If panelists could not be retrieved, an empty list is returned.

retrieve_all_ids()

Returns a list of all panelist IDs from the database, sorted by panelist name.

Return type:

List[int]

Returns:

List of all panelist IDs. If panelist IDs could not be retrieved, an empty list is returned.

retrieve_all_slugs()

Returns a list of all panelist slug strings from the database, sorted by panelist name.

Return type:

List[str]

Returns:

List of all panelist slug strings. If panelist slug strings could not be retrieved, an empty list is returned.

retrieve_by_id(panelist_id)

Returns a dictionary object containing panelist ID, name and slug string for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, Any]

Returns:

Dictionary containing panelist information. If panelist information could not be retrieved, an empty dictionary is returned.

retrieve_by_slug(panelist_slug)

Returns a dictionary object containing panelist ID, name and slug string for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, Any]

Returns:

Dictionary containing panelist information. If panelist information could not be retrieved, an empty dictionary is returned.

retrieve_details_by_id(panelist_id)

Returns a dictionary object containing panelist ID, name, slug string and appearance information for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, Any]

Returns:

Dictionary containing panelist information and their appearances. If panelist information could not be retrieved, an empty dictionary is returned.

retrieve_details_by_slug(panelist_slug)

Returns a dictionary object containing panelist ID, name, slug string and appearance information for the requested Panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, Any]

Returns:

Dictionary containing panelist information and their appearances. If panelist information could not be retrieved, an empty dictionary is returned.

PanelistAppearances

class wwdtm.panelist.PanelistAppearances(connect_dict=None, database_connection=None)

This class contains functions that retrieve panelist appearance information from a copy of the Wait Wait Stats database.

Parameters:
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

retrieve_appearances_by_id(panelist_id)

Returns a list of dictionary objects containing appearance information for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, Any]

Returns:

Dictionary containing appearance counts and list of appearances for a panelist. If panelist appearances could not be retrieved, an empty dictionary is returned.

retrieve_appearances_by_slug(panelist_slug)

Returns a list of dictionary objects containing appearance information for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, Any]

Returns:

Dictionary containing appearance counts and list of appearances for a panelist. If panelist appearances could not be retrieved, an empty dictionary is returned.

retrieve_yearly_appearances_by_id(panelist_id)

Returns a dictionary containing panelist appearances broken down by year, for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[int, int]

Returns:

Dictionary containing scoring breakdown by year. If panelist appearances could not be retrieved, an empty dictionary is returned.

retrieve_yearly_appearances_by_slug(panelist_slug)

Returns a dictionary containing panelist appearances broken down by year, for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[int, int]

Returns:

Dictionary containing scoring breakdown by year. If panelist appearances could not be retrieved, an empty dictionary is returned.

PanelistScores

class wwdtm.panelist.PanelistScores(connect_dict=None, database_connection=None)

This class contains functions used to retrieve panelist scores from a copy of the Wait Wait Stats database.

Parameters:
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

retrieve_scores_by_id(panelist_id)

Returns a list of panelist scores for appearances for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

List[int]

Returns:

List containing panelist scores. If panelist scores could not be retrieved, an empty list is returned.

retrieve_scores_by_slug(panelist_slug)

Returns a list of panelist scores for appearances for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

List[int]

Returns:

List containing panelist scores. If panelist scores could not be retrieved, an empty list is returned.

retrieve_scores_grouped_list_by_id(panelist_id)

Returns a panelist’s score grouping for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, List[int]]

Returns:

Dictionary containing two lists, one containing scores and one containing counts of those scores. If panelist scores could not be retrieved, an empty dictionary is returned.

retrieve_scores_grouped_list_by_slug(panelist_slug)

Returns a panelist’s score grouping for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, List[int]]

Returns:

Dictionary containing two lists, one containing scores and one containing counts of those scores. If panelist scores could not be retrieved, an empty dictionary is returned.

retrieve_scores_grouped_ordered_pair_by_id(panelist_id)

Returns a list of tuples containing a score and the corresponding number of instances a panelist has scored that amount for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

List[Tuple[int, int]]

Returns:

List of tuples containing scores and score counts. If panelist scores could not be retrieved, an empty list is returned.

retrieve_scores_grouped_ordered_pair_by_slug(panelist_slug)

Returns a list of tuples containing a score and the corresponding number of instances a panelist has scored that amount for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

List[Tuple[int, int]]

Returns:

List of tuples containing scores and score counts. If panelist scores could not be retrieved, an empty list is returned.

retrieve_scores_list_by_id(panelist_id)

Returns a dictionary containing two lists, one with show dates and one with corresponding scores for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, List]

Returns:

Dictionary containing a list show dates and a list of scores. If panelist scores could not be retrieved, an empty dictionary is returned.

retrieve_scores_list_by_slug(panelist_slug)

Returns a dictionary containing two lists, one with show dates and one with corresponding scores for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, List]

Returns:

Dictionary containing a list show dates and a list of scores. If panelist scores could not be retrieved, an empty dictionary is returned.

retrieve_scores_ordered_pair_by_id(panelist_id)

Returns a list of tuples containing a show date and the corresponding score for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

List[Tuple[str, int]]

Returns:

List of tuples containing show dates and scores. If panelist scores could not be retrieved, an empty list is returned.

retrieve_scores_ordered_pair_by_slug(panelist_slug)

Returns a list of tuples containing a show date and the corresponding score for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

List[Tuple[str, int]]

Returns:

List of tuples containing show dates and scores. If panelist scores could not be retrieved, an empty list is returned.

PanelistStatistics

class wwdtm.panelist.PanelistStatistics(connect_dict=None, database_connection=None)

This class contains functions used to retrieve data from a copy of the Wait Wait Stats database and calculate statistics for panelists.

Parameters:
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

retrieve_bluffs_by_id(panelist_id)

Returns a dictionary containing the number of chosen Bluffs and correct Bluffs for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, int]

Returns:

Dictionary containing panelist Bluff counts. If panelist Bluff counts could not be returned, an empty dictionary will be returned.

retrieve_bluffs_by_slug(panelist_slug)

Returns a dictionary containing the number of chosen Bluffs and correct Bluffs for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, int]

Returns:

Dictionary containing panelist Bluff counts. If panelist Bluff counts could not be returned, an empty dictionary will be returned.

retrieve_rank_info_by_id(panelist_id)

Returns a dictionary with ranking information for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, int]

Returns:

Dictionary containing panelist ranking information. If panelist ranking information could not be returned, an empty dictionary will be returned.

retrieve_rank_info_by_slug(panelist_slug)

Returns a dictionary with ranking information for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, int]

Returns:

Dictionary containing panelist ranking information. If panelist ranking information could not be returned, an empty dictionary will be returned.

retrieve_statistics_by_id(panelist_id)

Returns a dictionary containing panelist statistics, ranking data, and scoring data for the requested panelist ID.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Dict[str, Any]

Returns:

Dictionary containing panelist statistics. If panelist statistics could not be returned, an empty dictionary will be returned.

retrieve_statistics_by_slug(panelist_slug)

Returns a dictionary containing panelist statistics, ranking data, and scoring data for the requested panelist slug string.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Dict[str, Any]

Returns:

Dictionary containing panelist statistics. If panelist statistics could not be returned, an empty dictionary will be returned.

PanelistUtility

class wwdtm.panelist.PanelistUtility(connect_dict=None, database_connection=None)

This class contains supporting functions used to check whether a panelist ID or slug string exists or to convert an ID to a slug string, or vice versa.

Parameters:
  • connect_dict (Optional[Dict[str, Any]]) – Dictionary containing database connection settings as required by mysql.connector.connect

  • database_connection (Optional[connect]) – mysql.connector.connect database connection

convert_id_to_slug(panelist_id)

Converts a panelist’s ID to the matching panelist slug string value.

Parameters:

panelist_id (int) – Panelist ID

Return type:

Optional[str]

Returns:

Panelist slug string, if a match is found

convert_slug_to_id(panelist_slug)

Converts a panelist’s slug string to the matching panelist ID value.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

Optional[int]

Returns:

Panelists ID, if a match is found

id_exists(panelist_id)

Checks to see if a panelist ID exists.

Parameters:

panelist_id (int) – Panelist ID

Return type:

bool

Returns:

True or False, based on whether the panelist ID exists

slug_exists(panelist_slug)

Checks to see if a panelist slug string exists.

Parameters:

panelist_slug (str) – Panelist slug string

Return type:

bool

Returns:

True or False, based on whether the panelist slug string exists