Skip to content

Commit a1f86bb

Browse files
authored
Merge pull request #546 from nanotaboada/feat/normalize-dataset-543
feat(data): normalize dataset to 2022 FIFA World Cup squad (#543)
2 parents a81abcd + 8c4b284 commit a1f86bb

File tree

7 files changed

+102
-70
lines changed

7 files changed

+102
-70
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ This project uses famous football coaches as release codenames, following an A-Z
4949
mutation key, full replace PUT, in-memory caching, integration-only
5050
tests (#482)
5151

52+
### Changed
53+
54+
- Normalize player dataset: add Lo Celso (squad 27) as test fixture,
55+
add Almada (squad 16) as seeded substitute, correct
56+
Martínez/Fernández/Mac Allister/Messi field values, replace
57+
pre-computed UUIDs with canonical UUID v5 values (namespace
58+
`FIFA_WORLD_CUP_QATAR_2022_ARGENTINA_SQUAD`); bundled
59+
`storage/players-sqlite3.db` rebuilt from seed scripts — Docker
60+
deployments with a persisted volume will continue to use the old
61+
database until the volume is recreated (`docker compose down -v &&
62+
docker compose up --build`) (#543)
63+
- Align CRUD test fixtures: Lo Celso (squad 27) for Create and Delete,
64+
Messi (squad 10) for Retrieve, Damián Martínez (squad 23) for Update
65+
(#543)
66+
5267
---
5368

5469
## [2.0.0 - Capello] - 2026-03-17

rest/players.rest

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Accept: application/json
2020

2121
# ------------------------------------------------------------------------------
2222
# POST /players/ — Create
23-
# Thiago Almada (squad 16): not seeded in the database, used as the creation
23+
# Giovani Lo Celso (squad 27): not seeded in the database, used as the creation
2424
# fixture. No id in the body; the server generates a UUID v4 on creation.
2525
# ------------------------------------------------------------------------------
2626

@@ -29,15 +29,14 @@ POST {{baseUrl}}/players/
2929
Content-Type: application/json
3030

3131
{
32-
"firstName": "Thiago",
33-
"middleName": "Ezequiel",
34-
"lastName": "Almada",
35-
"dateOfBirth": "2001-04-26T00:00:00.000Z",
36-
"squadNumber": 16,
37-
"position": "Attacking Midfield",
38-
"abbrPosition": "AM",
39-
"team": "Atlanta United FC",
40-
"league": "Major League Soccer",
32+
"firstName": "Giovani",
33+
"lastName": "Lo Celso",
34+
"dateOfBirth": "1996-07-09T00:00:00.000Z",
35+
"squadNumber": 27,
36+
"position": "Central Midfield",
37+
"abbrPosition": "CM",
38+
"team": "Real Betis Balompié",
39+
"league": "La Liga",
4140
"starting11": false
4241
}
4342

@@ -51,11 +50,11 @@ Accept: application/json
5150

5251
# ------------------------------------------------------------------------------
5352
# GET /players/{player_id} — Retrieve by UUID (surrogate key, internal)
54-
# Emiliano Martínez (squad 23): UUID v5, seeded by seed_001.
53+
# Lionel Messi (squad 10): UUID v5, seeded by seed_001.
5554
# ------------------------------------------------------------------------------
5655

5756
### GET /players/{player_id} — Retrieve a Player by UUID
58-
GET {{baseUrl}}/players/b04965e6-a9bb-591f-8f8a-1adcb2c8dc39
57+
GET {{baseUrl}}/players/acc433bf-d505-51fe-831e-45eb44c4d43c
5958
Accept: application/json
6059

6160
# ------------------------------------------------------------------------------
@@ -69,7 +68,8 @@ Accept: application/json
6968

7069
# ------------------------------------------------------------------------------
7170
# PUT /players/squadnumber/{squad_number} — Update
72-
# Emiliano Martínez (squad 23): seeded by seed_001.
71+
# Damián Martínez (squad 23): seeded by seed_001. Updates firstName Damián →
72+
# Emiliano and clears middleName.
7373
# ------------------------------------------------------------------------------
7474

7575
### PUT /players/squadnumber/{squad_number} — Update an existing Player
@@ -91,8 +91,8 @@ Content-Type: application/json
9191

9292
# ------------------------------------------------------------------------------
9393
# DELETE /players/squadnumber/{squad_number} — Delete
94-
# Thiago Almada (squad 16): created by POST above.
94+
# Giovani Lo Celso (squad 27): created by POST above.
9595
# ------------------------------------------------------------------------------
9696

9797
### DELETE /players/squadnumber/{squad_number} — Delete an existing Player
98-
DELETE {{baseUrl}}/players/squadnumber/16
98+
DELETE {{baseUrl}}/players/squadnumber/27

storage/players-sqlite3.db

0 Bytes
Binary file not shown.

tests/player_stub.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def existing_player():
3535
Creates a test stub for an existing Player.
3636
"""
3737
return Player(
38-
id="b04965e6-a9bb-591f-8f8a-1adcb2c8dc39",
39-
first_name="Emiliano",
40-
middle_name="",
38+
id="01772c59-43f0-5d85-b913-c78e4e281452",
39+
first_name="Damián",
40+
middle_name="Emiliano",
4141
last_name="Martínez",
4242
date_of_birth="1992-09-02T00:00:00.000Z",
4343
squad_number=23,
@@ -55,16 +55,15 @@ def nonexistent_player():
5555
No id is provided; the server generates a UUID on creation.
5656
"""
5757
return Player(
58-
first_name="Thiago",
59-
middle_name="Ezequiel",
60-
last_name="Almada",
61-
date_of_birth="2001-04-26T00:00:00.000Z",
62-
squad_number=16,
63-
position="Attacking Midfield",
64-
abbr_position="AM",
65-
team="Atlanta United FC",
66-
league="Major League Soccer",
67-
starting11=0,
58+
first_name="Giovani",
59+
last_name="Lo Celso",
60+
date_of_birth="1996-07-09T00:00:00.000Z",
61+
squad_number=27,
62+
position="Central Midfield",
63+
abbr_position="CM",
64+
team="Real Betis Balompié",
65+
league="La Liga",
66+
starting11=False,
6867
)
6968

7069

tests/test_main.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,18 @@ def test_request_put_player_squadnumber_existing_response_status_no_content(clie
225225
squad_number = existing_player().squad_number
226226
player = existing_player()
227227
player.first_name = "Emiliano"
228-
player.middle_name = ""
229-
# Act
230-
response = client.put(
231-
PATH + "squadnumber/" + str(squad_number), json=player.__dict__
232-
)
233-
# Assert
234-
assert response.status_code == 204
228+
player.middle_name = None
229+
try:
230+
# Act
231+
response = client.put(
232+
PATH + "squadnumber/" + str(squad_number), json=player.__dict__
233+
)
234+
# Assert
235+
assert response.status_code == 204
236+
finally:
237+
# Teardown — restore Damián Martínez to its seeded state
238+
seed = existing_player()
239+
client.put(PATH + "squadnumber/" + str(seed.squad_number), json=seed.__dict__)
235240

236241

237242
def test_request_put_player_squadnumber_mismatch_response_status_bad_request(client):

tools/seed_001_starting_eleven.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
# ---------------------------------------------------------------------------
4646
STARTING_ELEVEN = [
4747
{
48-
"id": "b04965e6-a9bb-591f-8f8a-1adcb2c8dc39",
49-
"firstName": "Emiliano",
50-
"middleName": None,
48+
"id": "01772c59-43f0-5d85-b913-c78e4e281452",
49+
"firstName": "Damián",
50+
"middleName": "Emiliano",
5151
"lastName": "Martínez",
5252
"dateOfBirth": "1992-09-02T00:00:00.000Z",
5353
"squadNumber": 23,
@@ -58,7 +58,7 @@
5858
"starting11": 1,
5959
},
6060
{
61-
"id": "4b166dbe-d99d-5091-abdd-95b83330ed3a",
61+
"id": "da31293b-4c7e-5e0f-a168-469ee29ecbc4",
6262
"firstName": "Nahuel",
6363
"middleName": None,
6464
"lastName": "Molina",
@@ -71,7 +71,7 @@
7171
"starting11": 1,
7272
},
7373
{
74-
"id": "98123fde-012f-5ff3-8b50-881449dac91a",
74+
"id": "c096c69e-762b-5281-9290-bb9c167a24a0",
7575
"firstName": "Cristian",
7676
"middleName": "Gabriel",
7777
"lastName": "Romero",
@@ -84,7 +84,7 @@
8484
"starting11": 1,
8585
},
8686
{
87-
"id": "6ed955c6-506a-5343-9be4-2c0afae02eef",
87+
"id": "d5f7dd7a-1dcb-5960-ba27-e34865b63358",
8888
"firstName": "Nicolás",
8989
"middleName": "Hernán Gonzalo",
9090
"lastName": "Otamendi",
@@ -97,7 +97,7 @@
9797
"starting11": 1,
9898
},
9999
{
100-
"id": "c8691da2-158a-5ed6-8537-0e6f140801f2",
100+
"id": "2f6f90a0-9b9d-5023-96d2-a2aaf03143a6",
101101
"firstName": "Nicolás",
102102
"middleName": "Alejandro",
103103
"lastName": "Tagliafico",
@@ -110,7 +110,7 @@
110110
"starting11": 1,
111111
},
112112
{
113-
"id": "a6c4fc8f-6950-51de-a9ae-2c519c465071",
113+
"id": "b5b46e79-929e-5ed2-949d-0d167109c022",
114114
"firstName": "Ángel",
115115
"middleName": "Fabián",
116116
"lastName": "Di María",
@@ -123,7 +123,7 @@
123123
"starting11": 1,
124124
},
125125
{
126-
"id": "a9f96b98-dd44-5216-ab0d-dbfc6b262edf",
126+
"id": "0293b282-1da8-562e-998e-83849b417a42",
127127
"firstName": "Rodrigo",
128128
"middleName": "Javier",
129129
"lastName": "de Paul",
@@ -136,46 +136,46 @@
136136
"starting11": 1,
137137
},
138138
{
139-
"id": "e99caacd-6c45-5906-bd9f-b79e62f25963",
139+
"id": "d3ba552a-dac3-588a-b961-1ea7224017fd",
140140
"firstName": "Enzo",
141141
"middleName": "Jeremías",
142142
"lastName": "Fernández",
143143
"dateOfBirth": "2001-01-17T00:00:00.000Z",
144144
"squadNumber": 24,
145145
"position": "Central Midfield",
146146
"abbrPosition": "CM",
147-
"team": "Chelsea FC",
148-
"league": "Premier League",
147+
"team": "SL Benfica",
148+
"league": "Liga Portugal",
149149
"starting11": 1,
150150
},
151151
{
152-
"id": "e4d80b30-151e-51b5-9f4f-18a3b82718e6",
152+
"id": "9613cae9-16ab-5b54-937e-3135123b9e0d",
153153
"firstName": "Alexis",
154154
"middleName": None,
155155
"lastName": "Mac Allister",
156156
"dateOfBirth": "1998-12-24T00:00:00.000Z",
157157
"squadNumber": 20,
158158
"position": "Central Midfield",
159159
"abbrPosition": "CM",
160-
"team": "Liverpool FC",
160+
"team": "Brighton & Hove Albion",
161161
"league": "Premier League",
162162
"starting11": 1,
163163
},
164164
{
165-
"id": "0159d6c7-973f-5e7a-a9a0-d195d0ea6fe2",
165+
"id": "acc433bf-d505-51fe-831e-45eb44c4d43c",
166166
"firstName": "Lionel",
167167
"middleName": "Andrés",
168168
"lastName": "Messi",
169169
"dateOfBirth": "1987-06-24T00:00:00.000Z",
170170
"squadNumber": 10,
171171
"position": "Right Winger",
172172
"abbrPosition": "RW",
173-
"team": "Inter Miami CF",
174-
"league": "Major League Soccer",
173+
"team": "Paris Saint-Germain",
174+
"league": "Ligue 1",
175175
"starting11": 1,
176176
},
177177
{
178-
"id": "7fef88f7-411d-5669-b42d-bf5fc7f9b58b",
178+
"id": "38bae91d-8519-55a2-b30a-b9fe38849bfb",
179179
"firstName": "Julián",
180180
"middleName": None,
181181
"lastName": "Álvarez",

0 commit comments

Comments
 (0)