feat(03-02): add WNBA to canonicalization pipeline
- Import WNBA_TEAMS from wnba module - Add WNBA_DIVISIONS dict (single league structure, no divisions) - Add WNBA to sport_mappings for team canonicalization - Update arena_key to use 'arena' for WNBA (like NBA/NHL) - Add WNBA team abbreviation aliases (LV, LAS, NYL, PHX, etc.) - Add WNBA stadium aliases (Michelob Ultra Arena, Gateway Center, etc.) Total teams: 167 (13 WNBA teams added) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,14 @@ TEAM_ABBREV_ALIASES = {
|
|||||||
('MLS', 'FCD'): 'team_mls_dal', # FC Dallas
|
('MLS', 'FCD'): 'team_mls_dal', # FC Dallas
|
||||||
('MLS', 'MON'): 'team_mls_mtl', # Montreal
|
('MLS', 'MON'): 'team_mls_mtl', # Montreal
|
||||||
('MLS', 'LAF'): 'team_mls_lafc', # LAFC alt
|
('MLS', 'LAF'): 'team_mls_lafc', # LAFC alt
|
||||||
|
|
||||||
|
# WNBA
|
||||||
|
('WNBA', 'LV'): 'team_wnba_lva', # Las Vegas Aces
|
||||||
|
('WNBA', 'LAS'): 'team_wnba_la', # LA Sparks
|
||||||
|
('WNBA', 'NYL'): 'team_wnba_ny', # New York Liberty
|
||||||
|
('WNBA', 'PHX'): 'team_wnba_pho', # Phoenix Mercury
|
||||||
|
('WNBA', 'CONN'): 'team_wnba_con', # Connecticut Sun
|
||||||
|
('WNBA', 'WSH'): 'team_wnba_was', # Washington Mystics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -233,6 +233,20 @@ HISTORICAL_STADIUM_ALIASES = {
|
|||||||
{'alias_name': 'lower.com field', 'valid_from': '2021-07-01'}, # Current name with period
|
{'alias_name': 'lower.com field', 'valid_from': '2021-07-01'}, # Current name with period
|
||||||
{'alias_name': 'new crew stadium', 'valid_from': '2021-07-01', 'valid_until': '2021-07-01'},
|
{'alias_name': 'new crew stadium', 'valid_from': '2021-07-01', 'valid_until': '2021-07-01'},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
# WNBA (most share NBA/NHL arenas with existing aliases; these are WNBA-specific arenas)
|
||||||
|
'stadium_wnba_michelob_ultra_arena': [
|
||||||
|
{'alias_name': 'mandalay bay events center', 'valid_from': '1999-03-01', 'valid_until': '2021-01-01'},
|
||||||
|
],
|
||||||
|
'stadium_wnba_gateway_center_arena': [
|
||||||
|
# Gateway Center Arena opened 2018, WNBA-specific venue
|
||||||
|
],
|
||||||
|
'stadium_wnba_wintrust_arena': [
|
||||||
|
# Wintrust Arena opened 2017, WNBA-specific venue
|
||||||
|
],
|
||||||
|
'stadium_wnba_college_park_center': [
|
||||||
|
# College Park Center opened 2012, university venue
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from typing import Optional
|
|||||||
# Import team mappings from scraper
|
# Import team mappings from scraper
|
||||||
from scrape_schedules import NBA_TEAMS, MLB_TEAMS, NHL_TEAMS, NFL_TEAMS
|
from scrape_schedules import NBA_TEAMS, MLB_TEAMS, NHL_TEAMS, NFL_TEAMS
|
||||||
from mls import MLS_TEAMS
|
from mls import MLS_TEAMS
|
||||||
|
from wnba import WNBA_TEAMS
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
@@ -252,6 +253,23 @@ MLS_DIVISIONS = {
|
|||||||
'VAN': ('mls_western', None),
|
'VAN': ('mls_western', None),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WNBA_DIVISIONS = {
|
||||||
|
# WNBA has no divisions (single league structure)
|
||||||
|
'ATL': ('wnba', None),
|
||||||
|
'CHI': ('wnba', None),
|
||||||
|
'CON': ('wnba', None),
|
||||||
|
'DAL': ('wnba', None),
|
||||||
|
'GSV': ('wnba', None),
|
||||||
|
'IND': ('wnba', None),
|
||||||
|
'LVA': ('wnba', None),
|
||||||
|
'LA': ('wnba', None),
|
||||||
|
'MIN': ('wnba', None),
|
||||||
|
'NY': ('wnba', None),
|
||||||
|
'PHO': ('wnba', None),
|
||||||
|
'SEA': ('wnba', None),
|
||||||
|
'WAS': ('wnba', None),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# FUZZY MATCHING
|
# FUZZY MATCHING
|
||||||
@@ -402,7 +420,7 @@ def canonicalize_teams(
|
|||||||
warnings = []
|
warnings = []
|
||||||
|
|
||||||
# Determine arena key based on sport
|
# Determine arena key based on sport
|
||||||
arena_key = 'arena' if sport in ['NBA', 'NHL'] else 'stadium'
|
arena_key = 'arena' if sport in ['NBA', 'NHL', 'WNBA'] else 'stadium'
|
||||||
|
|
||||||
# Get division structure
|
# Get division structure
|
||||||
division_map = {
|
division_map = {
|
||||||
@@ -411,6 +429,7 @@ def canonicalize_teams(
|
|||||||
'NHL': NHL_DIVISIONS,
|
'NHL': NHL_DIVISIONS,
|
||||||
'NFL': NFL_DIVISIONS,
|
'NFL': NFL_DIVISIONS,
|
||||||
'MLS': MLS_DIVISIONS,
|
'MLS': MLS_DIVISIONS,
|
||||||
|
'WNBA': WNBA_DIVISIONS,
|
||||||
}.get(sport, {})
|
}.get(sport, {})
|
||||||
|
|
||||||
for abbrev, info in team_mappings.items():
|
for abbrev, info in team_mappings.items():
|
||||||
@@ -485,6 +504,7 @@ def canonicalize_all_teams(
|
|||||||
('NHL', NHL_TEAMS),
|
('NHL', NHL_TEAMS),
|
||||||
('NFL', NFL_TEAMS),
|
('NFL', NFL_TEAMS),
|
||||||
('MLS', MLS_TEAMS),
|
('MLS', MLS_TEAMS),
|
||||||
|
('WNBA', WNBA_TEAMS),
|
||||||
]
|
]
|
||||||
|
|
||||||
for sport, team_map in sport_mappings:
|
for sport, team_map in sport_mappings:
|
||||||
|
|||||||
Reference in New Issue
Block a user