Models Module

Pydantic data models for NHL Scrabble Score Analyzer.

The models module provides type-safe data structures using Pydantic for validation, serialization, and documentation.

Overview

Data models for NHL Scrabble.

class nhl_scrabble.models.ConferenceStandings(name, total, teams, player_count, avg_per_team)[source][source]

Bases: object

Represents conference-level standings based on Scrabble scores.

name[source]

Conference name

total[source]

Total Scrabble score for all teams in the conference

teams[source]

List of team abbreviations in this conference

player_count[source]

Total number of players in the conference

avg_per_team[source]

Average score per team

name: str[source]
total: int[source]
teams: list[str][source]
player_count: int[source]
avg_per_team: float[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> standings = ConferenceStandings(
...     name="Eastern",
...     total=10000,
...     teams=["TOR", "MTL", "BOS", "NYR"],
...     player_count=100,
...     avg_per_team=2500.0
... )
>>> result = standings.to_dict()
>>> result['name']
'Eastern'
>>> len(result['teams'])
4
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the conference standings.

Examples

>>> standings = ConferenceStandings(
...     name="Eastern",
...     total=10000,
...     teams=["TOR", "MTL", "BOS", "NYR"],
...     player_count=100,
...     avg_per_team=2500.0
... )
>>> repr(standings)
"ConferenceStandings(name='Eastern', total=10000, teams=4)"
Return type:

str

__init__(name, total, teams, player_count, avg_per_team)[source]
class nhl_scrabble.models.DivisionStandings(name, total, teams, player_count, avg_per_team)[source][source]

Bases: object

Represents division-level standings based on Scrabble scores.

name[source]

Division name

total[source]

Total Scrabble score for all teams in the division

teams[source]

List of team abbreviations in this division

player_count[source]

Total number of players in the division

avg_per_team[source]

Average score per team

name: str[source]
total: int[source]
teams: list[str][source]
player_count: int[source]
avg_per_team: float[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> standings = DivisionStandings(
...     name="Atlantic",
...     total=5000,
...     teams=["TOR", "MTL", "BOS"],
...     player_count=75,
...     avg_per_team=1666.67
... )
>>> result = standings.to_dict()
>>> result['name']
'Atlantic'
>>> len(result['teams'])
3
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the division standings.

Examples

>>> standings = DivisionStandings(
...     name="Atlantic",
...     total=5000,
...     teams=["TOR", "MTL", "BOS"],
...     player_count=75,
...     avg_per_team=1666.67
... )
>>> repr(standings)
"DivisionStandings(name='Atlantic', total=5000, teams=3)"
Return type:

str

__init__(name, total, teams, player_count, avg_per_team)[source]
class nhl_scrabble.models.PlayerScore(first_name, last_name, full_name, first_score, last_score, full_score, team, division, conference, player_id=0, birthplace='', birth_country='', nationality='', position_code='', position='', position_type='')[source][source]

Bases: object

Represents a player with their Scrabble score information.

first_name[source]

Player’s first name

last_name[source]

Player’s last name

full_name[source]

Player’s full name (first + last)

first_score[source]

Scrabble score for first name

last_score[source]

Scrabble score for last name

full_score[source]

Total Scrabble score (first + last)

team[source]

Team abbreviation (e.g., ‘TOR’, ‘MTL’)

division[source]

Division name

conference[source]

Conference name

player_id[source]

NHL player ID (unique identifier, 0 if unknown)

birthplace[source]

Birthplace city and state/province (e.g., ‘Richmond Hill, ON’)

birth_country[source]

ISO country code (e.g., ‘CAN’, ‘USA’, ‘SWE’)

nationality[source]

Full country name (e.g., ‘Canada’, ‘United States’, ‘Sweden’)

position_code[source]

Single-letter position code (e.g., ‘C’, ‘L’, ‘R’, ‘D’, ‘G’)

position[source]

Full position name (e.g., ‘Center’, ‘Left Wing’, ‘Defense’, ‘Goalie’)

position_type[source]

Position category (e.g., ‘Forward’, ‘Defense’, ‘Goalie’)

first_name: str[source]
last_name: str[source]
full_name: str[source]
first_score: int[source]
last_score: int[source]
full_score: int[source]
team: str[source]
division: str[source]
conference: str[source]
player_id: int[source]
birthplace: str[source]
birth_country: str[source]
nationality: str[source]
position_code: str[source]
position: str[source]
position_type: str[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Return type:

dict[str, Any]

Returns:

Dictionary representation of player

Note

This is 2-3x faster than dataclasses.asdict() because it uses direct attribute access instead of reflection.

Examples

Convert player to dictionary:

>>> player = PlayerScore(
...     player_id=8478402,
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western",
...     birthplace="Richmond Hill, ON",
...     birth_country="CAN",
...     nationality="Canada"
... )
>>> result = player.to_dict()
>>> result['full_name']
'Connor McDavid'
>>> result['full_score']
35
>>> result['player_id']
8478402
__repr__()[source][source]

Return a string representation of the player.

Examples

String representation:

>>> player = PlayerScore(
...     player_id=8478402,
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western",
...     birthplace="Richmond Hill, ON",
...     birth_country="CAN",
...     nationality="Canada"
... )
>>> repr(player)
"PlayerScore(id=8478402, name='Connor McDavid', score=35, team='EDM')"
Return type:

str

__init__(first_name, last_name, full_name, first_score, last_score, full_score, team, division, conference, player_id=0, birthplace='', birth_country='', nationality='', position_code='', position='', position_type='')[source]
class nhl_scrabble.models.PlayoffTeam(abbrev, total, players, avg, conference, division, seed_type='', in_playoffs=False, division_rank=0, status_indicator='')[source][source]

Bases: object

Represents a team in playoff standings context.

abbrev[source]

Team abbreviation

total[source]

Total Scrabble score

players[source]

Number of players on the team

avg[source]

Average score per player

conference[source]

Conference name

division[source]

Division name

seed_type[source]

Playoff seed description (e.g., “Atlantic #1”, “Eastern WC1”)

in_playoffs[source]

Whether team has clinched a playoff spot

division_rank[source]

Rank within the division (1-based)

status_indicator[source]

Playoff status (p=Presidents’, z=Conference, y=Division, x=Playoff, e=Eliminated)

abbrev: str[source]
total: int[source]
players: int[source]
avg: float[source]
conference: str[source]
division: str[source]
seed_type: str[source]
in_playoffs: bool[source]
division_rank: int[source]
status_indicator: Literal['p', 'z', 'y', 'x', 'e', ''][source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> team = PlayoffTeam(
...     abbrev="TOR",
...     total=500,
...     players=25,
...     avg=20.0,
...     conference="Eastern",
...     division="Atlantic",
...     seed_type="Atlantic #1",
...     in_playoffs=True,
...     division_rank=1,
...     status_indicator="y"
... )
>>> result = team.to_dict()
>>> result['abbrev']
'TOR'
>>> result['in_playoffs']
True
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the playoff team.

Examples

>>> team = PlayoffTeam(
...     abbrev="TOR",
...     total=500,
...     players=25,
...     avg=20.0,
...     conference="Eastern",
...     division="Atlantic",
...     seed_type="Atlantic #1",
...     in_playoffs=True,
...     division_rank=1,
...     status_indicator="y"
... )
>>> repr(team)
"PlayoffTeam(abbrev='TOR', seed='Atlantic #1', status='y')"
Return type:

str

__init__(abbrev, total, players, avg, conference, division, seed_type='', in_playoffs=False, division_rank=0, status_indicator='')[source]
class nhl_scrabble.models.TeamScore(abbrev, name, total, players, division, conference)[source][source]

Bases: object

Represents a team with aggregated Scrabble score information.

abbrev[source]

Team abbreviation (e.g., ‘TOR’, ‘MTL’)

name[source]

Team full name (e.g., ‘Maple Leafs’, ‘Canadiens’)

total[source]

Total Scrabble score for all players on the team

players[source]

List of all players on the team with their scores

division[source]

Division name

conference[source]

Conference name

avg_per_player[source]

Average score per player (computed)

abbrev: str[source]
name: str[source]
total: int[source]
players: list[PlayerScore][source]
division: str[source]
conference: str[source]
avg_per_player: float[source]
__post_init__()[source][source]

Calculate average score per player after initialization.

Examples

Automatic calculation of average:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=70,
...     players=[player, player],
...     division="Pacific",
...     conference="Western"
... )
>>> team.avg_per_player
35.0
Return type:

None

to_dict(include_players=True)[source][source]

Convert to dictionary for JSON serialization.

Parameters:

include_players (bool) – Whether to include full player list (default: True)

Return type:

dict[str, Any]

Returns:

Dictionary representation of team

Examples

Convert team to dictionary (with players):

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=35,
...     players=[player],
...     division="Pacific",
...     conference="Western"
... )
>>> result = team.to_dict()
>>> result['abbrev']
'EDM'
>>> 'players' in result
True

Convert without players:

>>> result = team.to_dict(include_players=False)
>>> 'players' in result
False
>>> result['player_count']
1
property player_count: int[source]

Return the number of players on the team.

Examples

Get player count:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=70,
...     players=[player, player],
...     division="Pacific",
...     conference="Western"
... )
>>> team.player_count
2
__repr__()[source][source]

Return a string representation of the team.

Examples

String representation:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=500,
...     players=[player],
...     division="Pacific",
...     conference="Western"
... )
>>> repr(team)
"TeamScore(abbrev='EDM', total=500, players=1)"
Return type:

str

__init__(abbrev, name, total, players, division, conference)[source]

Player Models

Player data models.

class nhl_scrabble.models.player.PlayerScore(first_name, last_name, full_name, first_score, last_score, full_score, team, division, conference, player_id=0, birthplace='', birth_country='', nationality='', position_code='', position='', position_type='')[source][source]

Bases: object

Represents a player with their Scrabble score information.

first_name[source]

Player’s first name

last_name[source]

Player’s last name

full_name[source]

Player’s full name (first + last)

first_score[source]

Scrabble score for first name

last_score[source]

Scrabble score for last name

full_score[source]

Total Scrabble score (first + last)

team[source]

Team abbreviation (e.g., ‘TOR’, ‘MTL’)

division[source]

Division name

conference[source]

Conference name

player_id[source]

NHL player ID (unique identifier, 0 if unknown)

birthplace[source]

Birthplace city and state/province (e.g., ‘Richmond Hill, ON’)

birth_country[source]

ISO country code (e.g., ‘CAN’, ‘USA’, ‘SWE’)

nationality[source]

Full country name (e.g., ‘Canada’, ‘United States’, ‘Sweden’)

position_code[source]

Single-letter position code (e.g., ‘C’, ‘L’, ‘R’, ‘D’, ‘G’)

position[source]

Full position name (e.g., ‘Center’, ‘Left Wing’, ‘Defense’, ‘Goalie’)

position_type[source]

Position category (e.g., ‘Forward’, ‘Defense’, ‘Goalie’)

first_name: str[source]
last_name: str[source]
full_name: str[source]
first_score: int[source]
last_score: int[source]
full_score: int[source]
team: str[source]
division: str[source]
conference: str[source]
player_id: int[source]
birthplace: str[source]
birth_country: str[source]
nationality: str[source]
position_code: str[source]
position: str[source]
position_type: str[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Return type:

dict[str, Any]

Returns:

Dictionary representation of player

Note

This is 2-3x faster than dataclasses.asdict() because it uses direct attribute access instead of reflection.

Examples

Convert player to dictionary:

>>> player = PlayerScore(
...     player_id=8478402,
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western",
...     birthplace="Richmond Hill, ON",
...     birth_country="CAN",
...     nationality="Canada"
... )
>>> result = player.to_dict()
>>> result['full_name']
'Connor McDavid'
>>> result['full_score']
35
>>> result['player_id']
8478402
__repr__()[source][source]

Return a string representation of the player.

Examples

String representation:

>>> player = PlayerScore(
...     player_id=8478402,
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western",
...     birthplace="Richmond Hill, ON",
...     birth_country="CAN",
...     nationality="Canada"
... )
>>> repr(player)
"PlayerScore(id=8478402, name='Connor McDavid', score=35, team='EDM')"
Return type:

str

__init__(first_name, last_name, full_name, first_score, last_score, full_score, team, division, conference, player_id=0, birthplace='', birth_country='', nationality='', position_code='', position='', position_type='')[source]

Player

Base player information from NHL API.

Fields:

  • id - Player ID

  • firstName - Player’s first name

  • lastName - Player’s last name

  • sweaterNumber - Jersey number (optional)

  • positionCode - Position code (e.g., ‘C’, ‘LW’, ‘RW’, ‘D’, ‘G’)

  • headshot - URL to player headshot image

PlayerScore

class nhl_scrabble.models.player.PlayerScore(first_name, last_name, full_name, first_score, last_score, full_score, team, division, conference, player_id=0, birthplace='', birth_country='', nationality='', position_code='', position='', position_type='')[source][source]

Bases: object

Represents a player with their Scrabble score information.

first_name[source]

Player’s first name

last_name[source]

Player’s last name

full_name[source]

Player’s full name (first + last)

first_score[source]

Scrabble score for first name

last_score[source]

Scrabble score for last name

full_score[source]

Total Scrabble score (first + last)

team[source]

Team abbreviation (e.g., ‘TOR’, ‘MTL’)

division[source]

Division name

conference[source]

Conference name

player_id[source]

NHL player ID (unique identifier, 0 if unknown)

birthplace[source]

Birthplace city and state/province (e.g., ‘Richmond Hill, ON’)

birth_country[source]

ISO country code (e.g., ‘CAN’, ‘USA’, ‘SWE’)

nationality[source]

Full country name (e.g., ‘Canada’, ‘United States’, ‘Sweden’)

position_code[source]

Single-letter position code (e.g., ‘C’, ‘L’, ‘R’, ‘D’, ‘G’)

position[source]

Full position name (e.g., ‘Center’, ‘Left Wing’, ‘Defense’, ‘Goalie’)

position_type[source]

Position category (e.g., ‘Forward’, ‘Defense’, ‘Goalie’)

first_name: str[source]
last_name: str[source]
full_name: str[source]
first_score: int[source]
last_score: int[source]
full_score: int[source]
team: str[source]
division: str[source]
conference: str[source]
player_id: int[source]
birthplace: str[source]
birth_country: str[source]
nationality: str[source]
position_code: str[source]
position: str[source]
position_type: str[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Return type:

dict[str, Any]

Returns:

Dictionary representation of player

Note

This is 2-3x faster than dataclasses.asdict() because it uses direct attribute access instead of reflection.

Examples

Convert player to dictionary:

>>> player = PlayerScore(
...     player_id=8478402,
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western",
...     birthplace="Richmond Hill, ON",
...     birth_country="CAN",
...     nationality="Canada"
... )
>>> result = player.to_dict()
>>> result['full_name']
'Connor McDavid'
>>> result['full_score']
35
>>> result['player_id']
8478402
__repr__()[source][source]

Return a string representation of the player.

Examples

String representation:

>>> player = PlayerScore(
...     player_id=8478402,
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western",
...     birthplace="Richmond Hill, ON",
...     birth_country="CAN",
...     nationality="Canada"
... )
>>> repr(player)
"PlayerScore(id=8478402, name='Connor McDavid', score=35, team='EDM')"
Return type:

str

__init__(first_name, last_name, full_name, first_score, last_score, full_score, team, division, conference, player_id=0, birthplace='', birth_country='', nationality='', position_code='', position='', position_type='')[source]

Player with calculated Scrabble score.

Fields:

  • player - Player object

  • first_score - Score for first name

  • last_score - Score for last name

  • total - Total combined score

Example:

from nhl_scrabble.models.player import Player, PlayerScore
from nhl_scrabble.scoring import ScrabbleScorer

player = Player(
    id=8478402, firstName="Alexander", lastName="Ovechkin", sweaterNumber=8, positionCode="LW"
)

scorer = ScrabbleScorer()
player_score = scorer.score_player(player)
print(f"{player_score.player.firstName} {player_score.player.lastName}: {player_score.total}")
# Output: Alexander Ovechkin: 45

Team Models

Team data models.

class nhl_scrabble.models.team.TeamScore(abbrev, name, total, players, division, conference)[source][source]

Bases: object

Represents a team with aggregated Scrabble score information.

abbrev[source]

Team abbreviation (e.g., ‘TOR’, ‘MTL’)

name[source]

Team full name (e.g., ‘Maple Leafs’, ‘Canadiens’)

total[source]

Total Scrabble score for all players on the team

players[source]

List of all players on the team with their scores

division[source]

Division name

conference[source]

Conference name

avg_per_player[source]

Average score per player (computed)

abbrev: str[source]
name: str[source]
total: int[source]
players: list[PlayerScore][source]
division: str[source]
conference: str[source]
avg_per_player: float[source]
__post_init__()[source][source]

Calculate average score per player after initialization.

Examples

Automatic calculation of average:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=70,
...     players=[player, player],
...     division="Pacific",
...     conference="Western"
... )
>>> team.avg_per_player
35.0
Return type:

None

to_dict(include_players=True)[source][source]

Convert to dictionary for JSON serialization.

Parameters:

include_players (bool) – Whether to include full player list (default: True)

Return type:

dict[str, Any]

Returns:

Dictionary representation of team

Examples

Convert team to dictionary (with players):

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=35,
...     players=[player],
...     division="Pacific",
...     conference="Western"
... )
>>> result = team.to_dict()
>>> result['abbrev']
'EDM'
>>> 'players' in result
True

Convert without players:

>>> result = team.to_dict(include_players=False)
>>> 'players' in result
False
>>> result['player_count']
1
property player_count: int[source]

Return the number of players on the team.

Examples

Get player count:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=70,
...     players=[player, player],
...     division="Pacific",
...     conference="Western"
... )
>>> team.player_count
2
__repr__()[source][source]

Return a string representation of the team.

Examples

String representation:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=500,
...     players=[player],
...     division="Pacific",
...     conference="Western"
... )
>>> repr(team)
"TeamScore(abbrev='EDM', total=500, players=1)"
Return type:

str

__init__(abbrev, name, total, players, division, conference)[source]

Team

NHL team information.

Fields:

  • id - Team ID

  • abbrev - Team abbreviation (e.g., ‘TOR’, ‘MTL’)

  • name - Full team name

  • division - Division name

  • conference - Conference name

  • logo - URL to team logo

TeamScore

class nhl_scrabble.models.team.TeamScore(abbrev, name, total, players, division, conference)[source][source]

Bases: object

Represents a team with aggregated Scrabble score information.

abbrev[source]

Team abbreviation (e.g., ‘TOR’, ‘MTL’)

name[source]

Team full name (e.g., ‘Maple Leafs’, ‘Canadiens’)

total[source]

Total Scrabble score for all players on the team

players[source]

List of all players on the team with their scores

division[source]

Division name

conference[source]

Conference name

avg_per_player[source]

Average score per player (computed)

abbrev: str[source]
name: str[source]
total: int[source]
players: list[PlayerScore][source]
division: str[source]
conference: str[source]
avg_per_player: float[source]
__post_init__()[source][source]

Calculate average score per player after initialization.

Examples

Automatic calculation of average:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=70,
...     players=[player, player],
...     division="Pacific",
...     conference="Western"
... )
>>> team.avg_per_player
35.0
Return type:

None

to_dict(include_players=True)[source][source]

Convert to dictionary for JSON serialization.

Parameters:

include_players (bool) – Whether to include full player list (default: True)

Return type:

dict[str, Any]

Returns:

Dictionary representation of team

Examples

Convert team to dictionary (with players):

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=35,
...     players=[player],
...     division="Pacific",
...     conference="Western"
... )
>>> result = team.to_dict()
>>> result['abbrev']
'EDM'
>>> 'players' in result
True

Convert without players:

>>> result = team.to_dict(include_players=False)
>>> 'players' in result
False
>>> result['player_count']
1
property player_count: int[source]

Return the number of players on the team.

Examples

Get player count:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=70,
...     players=[player, player],
...     division="Pacific",
...     conference="Western"
... )
>>> team.player_count
2
__repr__()[source][source]

Return a string representation of the team.

Examples

String representation:

>>> player = PlayerScore(
...     first_name="Connor",
...     last_name="McDavid",
...     full_name="Connor McDavid",
...     first_score=20,
...     last_score=15,
...     full_score=35,
...     team="EDM",
...     division="Pacific",
...     conference="Western"
... )
>>> team = TeamScore(
...     abbrev="EDM",
...     name="Oilers",
...     total=500,
...     players=[player],
...     division="Pacific",
...     conference="Western"
... )
>>> repr(team)
"TeamScore(abbrev='EDM', total=500, players=1)"
Return type:

str

__init__(abbrev, name, total, players, division, conference)[source]

Team with aggregated player scores.

Fields:

  • team - Team object

  • player_scores - List of PlayerScore objects

  • total - Total team score

  • avg_per_player - Average score per player

  • player_count - Number of players

Example:

from nhl_scrabble.processors import TeamProcessor

processor = TeamProcessor()
team_scores = processor.process_teams(teams, all_players)

for team_score in team_scores:
    print(f"{team_score.team.name}: {team_score.total} points")

Standings Models

Standings data models.

class nhl_scrabble.models.standings.DivisionStandings(name, total, teams, player_count, avg_per_team)[source][source]

Bases: object

Represents division-level standings based on Scrabble scores.

name[source]

Division name

total[source]

Total Scrabble score for all teams in the division

teams[source]

List of team abbreviations in this division

player_count[source]

Total number of players in the division

avg_per_team[source]

Average score per team

name: str[source]
total: int[source]
teams: list[str][source]
player_count: int[source]
avg_per_team: float[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> standings = DivisionStandings(
...     name="Atlantic",
...     total=5000,
...     teams=["TOR", "MTL", "BOS"],
...     player_count=75,
...     avg_per_team=1666.67
... )
>>> result = standings.to_dict()
>>> result['name']
'Atlantic'
>>> len(result['teams'])
3
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the division standings.

Examples

>>> standings = DivisionStandings(
...     name="Atlantic",
...     total=5000,
...     teams=["TOR", "MTL", "BOS"],
...     player_count=75,
...     avg_per_team=1666.67
... )
>>> repr(standings)
"DivisionStandings(name='Atlantic', total=5000, teams=3)"
Return type:

str

__init__(name, total, teams, player_count, avg_per_team)[source]
class nhl_scrabble.models.standings.ConferenceStandings(name, total, teams, player_count, avg_per_team)[source][source]

Bases: object

Represents conference-level standings based on Scrabble scores.

name[source]

Conference name

total[source]

Total Scrabble score for all teams in the conference

teams[source]

List of team abbreviations in this conference

player_count[source]

Total number of players in the conference

avg_per_team[source]

Average score per team

name: str[source]
total: int[source]
teams: list[str][source]
player_count: int[source]
avg_per_team: float[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> standings = ConferenceStandings(
...     name="Eastern",
...     total=10000,
...     teams=["TOR", "MTL", "BOS", "NYR"],
...     player_count=100,
...     avg_per_team=2500.0
... )
>>> result = standings.to_dict()
>>> result['name']
'Eastern'
>>> len(result['teams'])
4
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the conference standings.

Examples

>>> standings = ConferenceStandings(
...     name="Eastern",
...     total=10000,
...     teams=["TOR", "MTL", "BOS", "NYR"],
...     player_count=100,
...     avg_per_team=2500.0
... )
>>> repr(standings)
"ConferenceStandings(name='Eastern', total=10000, teams=4)"
Return type:

str

__init__(name, total, teams, player_count, avg_per_team)[source]
class nhl_scrabble.models.standings.PlayoffTeam(abbrev, total, players, avg, conference, division, seed_type='', in_playoffs=False, division_rank=0, status_indicator='')[source][source]

Bases: object

Represents a team in playoff standings context.

abbrev[source]

Team abbreviation

total[source]

Total Scrabble score

players[source]

Number of players on the team

avg[source]

Average score per player

conference[source]

Conference name

division[source]

Division name

seed_type[source]

Playoff seed description (e.g., “Atlantic #1”, “Eastern WC1”)

in_playoffs[source]

Whether team has clinched a playoff spot

division_rank[source]

Rank within the division (1-based)

status_indicator[source]

Playoff status (p=Presidents’, z=Conference, y=Division, x=Playoff, e=Eliminated)

abbrev: str[source]
total: int[source]
players: int[source]
avg: float[source]
conference: str[source]
division: str[source]
seed_type: str[source]
in_playoffs: bool[source]
division_rank: int[source]
status_indicator: Literal['p', 'z', 'y', 'x', 'e', ''][source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> team = PlayoffTeam(
...     abbrev="TOR",
...     total=500,
...     players=25,
...     avg=20.0,
...     conference="Eastern",
...     division="Atlantic",
...     seed_type="Atlantic #1",
...     in_playoffs=True,
...     division_rank=1,
...     status_indicator="y"
... )
>>> result = team.to_dict()
>>> result['abbrev']
'TOR'
>>> result['in_playoffs']
True
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the playoff team.

Examples

>>> team = PlayoffTeam(
...     abbrev="TOR",
...     total=500,
...     players=25,
...     avg=20.0,
...     conference="Eastern",
...     division="Atlantic",
...     seed_type="Atlantic #1",
...     in_playoffs=True,
...     division_rank=1,
...     status_indicator="y"
... )
>>> repr(team)
"PlayoffTeam(abbrev='TOR', seed='Atlantic #1', status='y')"
Return type:

str

__init__(abbrev, total, players, avg, conference, division, seed_type='', in_playoffs=False, division_rank=0, status_indicator='')[source]

DivisionStandings

class nhl_scrabble.models.standings.DivisionStandings(name, total, teams, player_count, avg_per_team)[source][source]

Bases: object

Represents division-level standings based on Scrabble scores.

name[source]

Division name

total[source]

Total Scrabble score for all teams in the division

teams[source]

List of team abbreviations in this division

player_count[source]

Total number of players in the division

avg_per_team[source]

Average score per team

name: str[source]
total: int[source]
teams: list[str][source]
player_count: int[source]
avg_per_team: float[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> standings = DivisionStandings(
...     name="Atlantic",
...     total=5000,
...     teams=["TOR", "MTL", "BOS"],
...     player_count=75,
...     avg_per_team=1666.67
... )
>>> result = standings.to_dict()
>>> result['name']
'Atlantic'
>>> len(result['teams'])
3
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the division standings.

Examples

>>> standings = DivisionStandings(
...     name="Atlantic",
...     total=5000,
...     teams=["TOR", "MTL", "BOS"],
...     player_count=75,
...     avg_per_team=1666.67
... )
>>> repr(standings)
"DivisionStandings(name='Atlantic', total=5000, teams=3)"
Return type:

str

__init__(name, total, teams, player_count, avg_per_team)[source]

Division standings with team rankings.

Fields:

  • name - Division name

  • teams - List of TeamScore objects

  • total - Total division score

  • player_count - Total players in division

  • avg_per_team - Average score per team

ConferenceStandings

class nhl_scrabble.models.standings.ConferenceStandings(name, total, teams, player_count, avg_per_team)[source][source]

Bases: object

Represents conference-level standings based on Scrabble scores.

name[source]

Conference name

total[source]

Total Scrabble score for all teams in the conference

teams[source]

List of team abbreviations in this conference

player_count[source]

Total number of players in the conference

avg_per_team[source]

Average score per team

name: str[source]
total: int[source]
teams: list[str][source]
player_count: int[source]
avg_per_team: float[source]
to_dict()[source][source]

Convert to dictionary for JSON serialization.

Examples

>>> standings = ConferenceStandings(
...     name="Eastern",
...     total=10000,
...     teams=["TOR", "MTL", "BOS", "NYR"],
...     player_count=100,
...     avg_per_team=2500.0
... )
>>> result = standings.to_dict()
>>> result['name']
'Eastern'
>>> len(result['teams'])
4
Return type:

dict[str, Any]

__repr__()[source][source]

Return a string representation of the conference standings.

Examples

>>> standings = ConferenceStandings(
...     name="Eastern",
...     total=10000,
...     teams=["TOR", "MTL", "BOS", "NYR"],
...     player_count=100,
...     avg_per_team=2500.0
... )
>>> repr(standings)
"ConferenceStandings(name='Eastern', total=10000, teams=4)"
Return type:

str

__init__(name, total, teams, player_count, avg_per_team)[source]

Conference standings with team rankings.

Fields:

  • name - Conference name

  • teams - List of TeamScore objects

  • total - Total conference score

  • player_count - Total players in conference

  • avg_per_team - Average score per team