-
Notifications
You must be signed in to change notification settings - Fork 19
Normalize player dataset to 2022 FIFA World Cup Argentina squad (26 players) #543
Description
Summary
Normalize the player dataset and test fixtures to the canonical 2022 FIFA World Cup Argentina squad. This covers five areas: correcting field values for four players, replacing all pre-computed UUIDs with the canonical UUID v5 set, adding the two missing players (Almada as a seeded substitute and Lo Celso as the test fixture), aligning player_stub.py and tests to the cross-repo CRUD fixture convention, and updating the REST file.
1. Data corrections (4 players)
These values reflect the squads as they were in November 2022 during the World Cup.
| Squad | Player | Field | Current (wrong) | Correct |
|---|---|---|---|---|
| 23 | Damián Martínez | firstName | Emiliano | Damián |
| 23 | Damián Martínez | middleName | (empty) | Emiliano |
| 24 | Enzo Fernández | team | Chelsea FC | SL Benfica |
| 24 | Enzo Fernández | league | Premier League | Liga Portugal |
| 20 | Alexis Mac Allister | team | Liverpool FC | Brighton & Hove Albion |
| 10 | Lionel Messi | team | Inter Miami CF | Paris Saint-Germain |
| 10 | Lionel Messi | league | Major League Soccer | Ligue 1 |
Note: Ángel Di María (squad 11) already has
abbrPosition = "RW"— no change needed.
The firstName/middleName fix for Martínez is required because the UUID v5 formula uses the legal birth first name (Damián), and the canonical Update fixture semantics are: seed has firstName=Damián, middleName=Emiliano; the PUT test changes firstName → Emiliano, middleName → null.
2. Replace all pre-computed UUIDs with canonical UUID v5 values
Namespace: f201b13e-c670-473d-885d-e2be219f74c8 (FIFA_WORLD_CUP_QATAR_2022_ARGENTINA_SQUAD)
Formula: uuidv5("{firstName}-{lastName}", namespace) — UTF-8, legal birth first name, exact as stored in DB.
The seed scripts (seed_001_starting_eleven.py, seed_002_substitutes.py) contain pre-computed UUIDs that were generated with a different namespace. Replace all 26 values with the canonical set:
| Squad | Player | UUID v5 |
|---|---|---|
| 23 | Damián Martínez | 01772c59-43f0-5d85-b913-c78e4e281452 |
| 26 | Nahuel Molina | da31293b-4c7e-5e0f-a168-469ee29ecbc4 |
| 13 | Cristian Romero | c096c69e-762b-5281-9290-bb9c167a24a0 |
| 19 | Nicolás Otamendi | d5f7dd7a-1dcb-5960-ba27-e34865b63358 |
| 3 | Nicolás Tagliafico | 2f6f90a0-9b9d-5023-96d2-a2aaf03143a6 |
| 11 | Ángel Di María | b5b46e79-929e-5ed2-949d-0d167109c022 |
| 7 | Rodrigo de Paul | 0293b282-1da8-562e-998e-83849b417a42 |
| 24 | Enzo Fernández | d3ba552a-dac3-588a-b961-1ea7224017fd |
| 20 | Alexis Mac Allister | 9613cae9-16ab-5b54-937e-3135123b9e0d |
| 10 | Lionel Messi | acc433bf-d505-51fe-831e-45eb44c4d43c |
| 9 | Julián Álvarez | 38bae91d-8519-55a2-b30a-b9fe38849bfb |
| 1 | Franco Armani | 5a9cd988-95e6-54c1-bc34-9aa08acca8d0 |
| 12 | Gerónimo Rulli | c62f2ac1-41e8-5d34-b073-2ba0913d0e31 |
| 2 | Juan Foyth | 5fdb10e8-38c0-5084-9a3f-b369a960b9c2 |
| 4 | Gonzalo Montiel | bbd441f7-fcfb-5834-8468-2a9004b64c8c |
| 6 | Germán Pezzella | d8bfea25-f189-5d5e-b3a5-ed89329b9f7c |
| 8 | Marcos Acuña | dca343a8-12e5-53d6-89a8-916b120a5ee4 |
| 25 | Lisandro Martínez | 98306555-a466-5d18-804e-dc82175e697b |
| 5 | Leandro Paredes | 9d140400-196f-55d8-86e1-e0b96a375c83 |
| 14 | Exequiel Palacios | d3b0e8e8-2c34-531a-b608-b24fed0ef986 |
| 17 | Alejandro Gómez | 7cc8d527-56a2-58bd-9528-2618fc139d30 |
| 18 | Guido Rodríguez | 191c82af-0c51-526a-b903-c3600b61b506 |
| 15 | Ángel Correa | b1306b7b-a3a4-5f7c-90fd-dd5bdbed57ba |
| 16 | Thiago Almada | ecec27e8-487b-5622-b116-0855020477ed |
| 21 | Paulo Dybala | 7941cd7c-4df1-5952-97e8-1e7f5d08e8aa |
| 22 | Lautaro Martínez | 79c96f29-c59f-5f98-96b8-3a5946246624 |
Lo Celso (squad 27, UUID f8d13028-0d22-5513-8774-08a2332b5814) is not seeded — he is the test fixture only (see §4).
3. Add two missing squad members
Thiago Almada (Squad 16) — add to seed_002_substitutes.py
Almada is in the canonical 26-player seeded squad but is currently absent from the seed scripts (only referenced in the nonexistent_player() test stub). Add him as a seeded substitute:
| Field | Value |
|---|---|
| id | ecec27e8-487b-5622-b116-0855020477ed |
| firstName | Thiago |
| middleName | Ezequiel |
| lastName | Almada |
| dateOfBirth | 2001-04-26 |
| squadNumber | 16 |
| position | Attacking Midfield |
| abbrPosition | AM |
| team | Atlanta United FC |
| league | Major League Soccer |
| starting11 | false |
Giovani Lo Celso (Squad 27) — test fixture only, NOT seeded
Lo Celso was in Argentina's preliminary squad for Qatar 2022 before suffering a hamstring injury and being replaced by Almada. He is not seeded — his squad number (27) sits outside the 1–26 seeded range, making him safe to use as the CREATE/DELETE test fixture: a POST for him never conflicts with seeded data, and a failed cleanup leaves only a non-seeded surplus record.
| Field | Value |
|---|---|
| id | f8d13028-0d22-5513-8774-08a2332b5814 |
| firstName | Giovani |
| lastName | Lo Celso |
| squadNumber | 27 |
| position | Central Midfield |
| abbrPosition | CM |
| team | Real Betis Balompié |
| league | La Liga |
| starting11 | false |
4. Test fixture alignment (tests/player_stub.py)
Current fixtures vs. canonical convention:
| Operation | Current | Canonical |
|---|---|---|
| Create | Thiago Almada (squad 16) | Giovani Lo Celso (squad 27) |
| Retrieve | Lionel Messi (squad 10) via GET /squadnumber/10 | Lionel Messi (squad 10) ✓ |
| Update | Damián Martínez (squad 23) | ✓ (requires firstName/middleName correction — see §1) |
| Delete | Thiago Almada (squad 16) | Giovani Lo Celso (squad 27) |
Changes to player_stub.py
nonexistent_player() — replace Almada (squad 16) with Lo Celso (squad 27):
def nonexistent_player():
return Player(
first_name="Giovani",
last_name="Lo Celso",
date_of_birth="1996-07-09T00:00:00.000Z",
squad_number=27,
position="Central Midfield",
abbr_position="CM",
team="Real Betis Balompié",
league="La Liga",
starting11=False,
)existing_player() — correct Martínez to use canonical firstName, middleName, and UUID:
def existing_player():
return Player(
id="01772c59-43f0-5d85-b913-c78e4e281452",
first_name="Damián",
middle_name="Emiliano",
last_name="Martínez",
date_of_birth="1992-09-02T00:00:00.000Z",
squad_number=23,
position="Goalkeeper",
abbr_position="GK",
team="Aston Villa FC",
league="Premier League",
starting11=True,
)5. Test changes (tests/test_main.py)
CREATE / DELETE tests
Update all references from squad_number=16 (Almada) to squad_number=27 (Lo Celso).
PUT test — add teardown to restore Martínez
The PUT test changes firstName from Damián to Emiliano in the real SQLite database. Without a restore step, the next test run finds Emiliano already set and the existing_player() stub no longer matches. Add a teardown after the PUT describe block (or use a fixture with yield) that restores Martínez to its seeded state:
# After PUT test: restore Damián Martínez
response = client.put(
"/players/squadnumber/23",
json={
"firstName": "Damián",
"middleName": "Emiliano",
"lastName": "Martínez",
"dateOfBirth": "1992-09-02T00:00:00.000Z",
"squadNumber": 23,
"position": "Goalkeeper",
"abbrPosition": "GK",
"team": "Aston Villa FC",
"league": "Premier League",
"starting11": True,
},
)
assert response.status_code == 2046. REST file (rest/players.rest)
| Request | Current | Change to |
|---|---|---|
| POST (Create) | Thiago Almada, squad 16 | Giovani Lo Celso, squad 27 |
| GET by UUID | Martínez UUID b04965e6-... |
acc433bf-d505-51fe-831e-45eb44c4d43c (Messi) |
| GET by squad number | Messi, squad 10 | ✓ no change |
| PUT (Update) | Martínez squad 23, firstName Emiliano | firstName Damián → Emiliano, middleName null (body update reflects canonical update semantics) |
| DELETE | Almada, squad 16 | Lo Celso, squad 27 |
7. Seed scripts and database
Update in seed_001_starting_eleven.py:
- Replace all 11 hardcoded UUIDs with canonical v5 values
- Fix Martínez:
firstName→Damián,middleName→Emiliano - Fix Messi:
team→Paris Saint-Germain,league→Ligue 1 - Fix Fernández:
team→SL Benfica,league→Liga Portugal - Fix Mac Allister:
team→Brighton & Hove Albion
Update in seed_002_substitutes.py:
- Replace all 14 hardcoded UUIDs with canonical v5 values
- Add Almada (squad 16) as the 15th substitute entry
Rebuild storage/players-sqlite3.db by running both seed scripts after the changes.
8. Files to change
| File | Change |
|---|---|
tools/seed_001_starting_eleven.py |
Update all 11 UUIDs; fix Martínez/Messi/Fernández/Mac Allister field values |
tools/seed_002_substitutes.py |
Update all 14 UUIDs; add Almada (squad 16) as 15th entry |
storage/players-sqlite3.db |
Rebuild from seed scripts |
tests/player_stub.py |
nonexistent_player() → Lo Celso (27); existing_player() → canonical Martínez |
tests/test_main.py |
POST/DELETE squad 16 → 27; add PUT teardown to restore Martínez |
rest/players.rest |
CREATE/DELETE → Lo Celso (27); GET by UUID → Messi UUID; PUT body reflects Damián→Emiliano update |
CHANGELOG.md |
Add entry under [Unreleased] |
9. CHANGELOG entry
### Changed
- Normalize player dataset: add Lo Celso (squad 27) as test fixture, add Almada (squad 16) as seeded substitute, correct Martínez/Fernández/Mac Allister/Messi field values, replace pre-computed UUIDs with canonical UUID v5 values (namespace FIFA_WORLD_CUP_QATAR_2022_ARGENTINA_SQUAD)
- Align CRUD test fixtures: Lo Celso (squad 27) for Create and Delete, Messi (squad 10) for Retrieve, Damián Martínez (squad 23) for Update10. Version bump and Docker note
Bump to 2.1.0-<next-codename> following the alphabetical football manager naming convention (current: 2.0.0-capello, next codename starts with D).
Existing Docker volumes must be removed before restarting to pick up the rebuilt database:
docker compose down -v
docker compose up --build