Phase 03: Alias Systems - 2 plans created - 6 total tasks defined - Ready for execution Plan 1: Add NFL to canonicalization pipeline with aliases Plan 2: Add MLS, WNBA, NWSL to canonicalization pipeline Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7.5 KiB
7.5 KiB
phase, plan, type
| phase | plan | type |
|---|---|---|
| 03-alias-systems | 02 | execute |
Purpose: Secondary sports modules exist (Phase 2.1) but aren't integrated into canonicalization, preventing game→team→stadium linking. Output: All three secondary sports canonicalized with team and stadium alias support.
<execution_context> ~/.claude/get-shit-done/workflows/execute-phase.md ~/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/phases/03-alias-systems/03-01-SUMMARY.mdKey source files:
@Scripts/canonicalize_teams.py @Scripts/canonicalize_games.py @Scripts/canonicalize_stadiums.py @Scripts/mls.py @Scripts/wnba.py @Scripts/nwsl.py
Prior decisions:
- MLS uses soccer configuration capacities for shared NFL stadiums
- WNBA cross-references shared arena coordinates from nba.py and nhl.py
- NWSL cross-references shared stadium coordinates from mls.py
Patterns established (from 03-01):
- Team canonicalization: import {SPORT}_TEAMS, add {SPORT}_DIVISIONS dict, include in sport_mappings list
- Game resolution: TEAM_ABBREV_ALIASES dict maps alternate abbrevs to canonical team IDs
- Stadium aliases: HISTORICAL_STADIUM_ALIASES dict maps canonical_id to list of historical names
**canonicalize_games.py:**
Add MLS aliases to TEAM_ABBREV_ALIASES:
```python
# MLS
('MLS', 'LA'): 'team_mls_lag', # LA Galaxy
('MLS', 'LAFC'): 'team_mls_laf', # LAFC (Los Angeles FC)
('MLS', 'NYCFC'): 'team_mls_nyc', # NYC FC
('MLS', 'RBNY'): 'team_mls_nyr', # NY Red Bulls
('MLS', 'SJ'): 'team_mls_sje', # San Jose Earthquakes
('MLS', 'KC'): 'team_mls_skc', # Sporting KC
('MLS', 'DC'): 'team_mls_dcu', # DC United
('MLS', 'FCD'): 'team_mls_dal', # FC Dallas
('MLS', 'MON'): 'team_mls_mtl', # Montreal
```
**canonicalize_stadiums.py:**
Add MLS stadium historical aliases (recent renames only):
```python
# MLS
'stadium_mls_bmw_stadium': [
{'alias_name': 'adi stadium', 'valid_from': '2021-07-01', 'valid_until': '2024-01-01'},
],
'stadium_mls_shell_energy_stadium': [
{'alias_name': 'paypal park', 'valid_from': '2021-01-01', 'valid_until': '2024-06-01'},
{'alias_name': 'earthquakes stadium', 'valid_from': '2015-03-01', 'valid_until': '2020-12-31'},
{'alias_name': 'avaya stadium', 'valid_from': '2015-03-01', 'valid_until': '2020-12-31'},
],
'stadium_mls_geodis_park': [
# Opened 2022, no prior name
],
'stadium_mls_dignity_health_sports_park': [
{'alias_name': 'stubhub center', 'valid_from': '2013-06-01', 'valid_until': '2019-01-31'},
{'alias_name': 'home depot center', 'valid_from': '2003-06-01', 'valid_until': '2013-05-31'},
],
```
python Scripts/canonicalize_teams.py --verbose 2>&1 | grep -E "MLS:|Created.*teams"
MLS teams appear in output (29-30 teams depending on expansion), no critical warnings
Task 2: Add WNBA to canonicalization pipeline
Scripts/canonicalize_teams.py, Scripts/canonicalize_games.py, Scripts/canonicalize_stadiums.py
**canonicalize_teams.py:**
1. Update import: add WNBA_TEAMS from wnba module
`from wnba import WNBA_TEAMS`
2. Add WNBA_DIVISIONS dict (no divisions, just conferences, but map to None):
- Single key mapping per team to ('wnba', None)
- 13 teams: ATL, CHI, CON, DAL, IND, LVA, LAS, MIN, NYL, PHO, SEA, WAS, GSV
3. Add ('WNBA', WNBA_TEAMS) to sport_mappings list
**canonicalize_games.py:**
Add WNBA aliases to TEAM_ABBREV_ALIASES:
```python
# WNBA
('WNBA', 'LA'): 'team_wnba_las', # LA Sparks
('WNBA', 'LV'): 'team_wnba_lva', # Las Vegas Aces
('WNBA', 'NY'): 'team_wnba_nyl', # New York Liberty
('WNBA', 'PHX'): 'team_wnba_pho', # Phoenix Mercury
('WNBA', 'CONN'): 'team_wnba_con', # Connecticut Sun
('WNBA', 'WSH'): 'team_wnba_was', # Washington Mystics
```
**canonicalize_stadiums.py:**
WNBA shares arenas with NBA/NHL, so most aliases already exist. Add WNBA-specific entries if any:
```python
# WNBA (most share NBA arenas, which have existing aliases)
'stadium_wnba_gateway_center_arena': [
# College Park Center - no historical renames
],
```
python Scripts/canonicalize_teams.py --verbose 2>&1 | grep -E "WNBA:|Created.*teams"
WNBA teams appear in output (13 teams), no critical warnings
Task 3: Add NWSL to canonicalization pipeline
Scripts/canonicalize_teams.py, Scripts/canonicalize_games.py, Scripts/canonicalize_stadiums.py
**canonicalize_teams.py:**
1. Update import: add NWSL_TEAMS from nwsl module
`from nwsl import NWSL_TEAMS`
2. Add NWSL_DIVISIONS dict (no divisions in NWSL):
- 14 teams all map to ('nwsl', None): ANG, CHI, HOU, KC, LOU, NCC, NJY, ORL, POR, RAC, SD, SEA, UTA, WAS
3. Add ('NWSL', NWSL_TEAMS) to sport_mappings list
**canonicalize_games.py:**
Add NWSL aliases to TEAM_ABBREV_ALIASES:
```python
# NWSL
('NWSL', 'LA'): 'team_nwsl_ang', # Angel City FC (Los Angeles)
('NWSL', 'NC'): 'team_nwsl_ncc', # North Carolina Courage
('NWSL', 'GOTHAM'): 'team_nwsl_njy', # NJ/NY Gotham FC
('NWSL', 'NY'): 'team_nwsl_njy', # NJ/NY Gotham FC alt
('NWSL', 'LOU'): 'team_nwsl_lou', # Louisville (Racing Louisville)
('NWSL', 'RLC'): 'team_nwsl_lou', # Racing Louisville alt
```
**canonicalize_stadiums.py:**
NWSL shares stadiums with MLS, so most aliases already exist. Add NWSL-specific:
```python
# NWSL
'stadium_nwsl_cpkc_stadium': [
# Opened 2024, no prior name (first soccer-specific stadium built for NWSL team)
],
```
python Scripts/canonicalize_teams.py --verbose 2>&1 | grep -E "NWSL:|Created.*teams"
NWSL teams appear in output (13-14 teams), no critical warnings
Before declaring plan complete:
- [ ] `python Scripts/canonicalize_teams.py --verbose` shows MLS, WNBA, NWSL teams
- [ ] All three secondary sports have abbreviation aliases in canonicalize_games.py
- [ ] Stadium aliases added where applicable
- [ ] Total team count increased to ~180 (90 core + ~90 secondary)
<success_criteria>
- All tasks completed
- MLS, WNBA, NWSL teams appear in teams_canonical.json output
- Game resolution can handle common abbreviation variations for all sports
- Phase 3 complete (all 7 sports have alias support) </success_criteria>