football-docs 0.17.2 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/data/docs.db +0 -0
- package/dist/reep.js +106 -23
- package/docs/reep/download-duckdb-csv.md +55 -12
- package/docs/reep/identity-and-ids.md +4 -0
- package/docs/reep/overview.md +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -314,7 +314,7 @@ metrics:sources` re-checks every card quote against its live source.
|
|
|
314
314
|
| BeSoccer | 16 | api-access, api-endpoints, data-provenance |
|
|
315
315
|
| Driblab | 32 | api-access, api-endpoints, data-model, data-provenance |
|
|
316
316
|
| ESPN | 21 | api-access, scoreboard, match-summary, teams-and-standings, identity-and-coverage |
|
|
317
|
-
| Reep |
|
|
317
|
+
| Reep | 32 | overview, identity-and-ids, download-duckdb-csv, api, data-provenance |
|
|
318
318
|
| TheSportsDB | 20 | api-access, api-endpoints, livescore, identity-surfaces, data-provenance |
|
|
319
319
|
| FotMob | 5 | identity-surfaces, data-provenance |
|
|
320
320
|
| Soccerdonna | 5 | identity-surfaces, data-provenance |
|
|
@@ -325,7 +325,7 @@ metrics:sources` re-checks every card quote against its live source.
|
|
|
325
325
|
| VALD | 318 | api-access, api-endpoints, per-product endpoints and schemas (tenants, profiles, forcedecks, nordbord, forceframe, smartspeed, dynamo, humantrak), identity-surfaces, data-provenance |
|
|
326
326
|
| Metric cards | 101 | xg, npxg, xg_assisted, xa, ppda, progressive_passes, progressive_carries, xt, vaep, field_tilt, pass_completion; see [Metric cards](#metric-cards) |
|
|
327
327
|
|
|
328
|
-
**3,
|
|
328
|
+
**3,514 searchable chunks** across 31 providers and tools (the metric cards count as one).
|
|
329
329
|
|
|
330
330
|
STATSports, Firstbeat, Hawkin Dynamics and VALD sell wearables and testing devices.
|
|
331
331
|
Their APIs return a customer's own athlete data, which includes personal and health
|
package/data/docs.db
CHANGED
|
Binary file
|
package/dist/reep.js
CHANGED
|
@@ -26,6 +26,29 @@ const textResult = (text, isError = false) => ({
|
|
|
26
26
|
isError: isError || undefined,
|
|
27
27
|
content: [{ type: "text", text }],
|
|
28
28
|
});
|
|
29
|
+
/** How a non-live provider ID is marked, from bridges.upstream_status. */
|
|
30
|
+
function upstreamLabel(status) {
|
|
31
|
+
if (!status)
|
|
32
|
+
return "";
|
|
33
|
+
if (status === "retired")
|
|
34
|
+
return "retired by the provider";
|
|
35
|
+
if (status === "removed")
|
|
36
|
+
return "removed from the provider's list";
|
|
37
|
+
return `upstream status: ${status}`;
|
|
38
|
+
}
|
|
39
|
+
// bridges.upstream_status arrived in the 2026-09-26 release; older files lack it.
|
|
40
|
+
const upstreamColumn = new WeakMap();
|
|
41
|
+
function hasUpstreamStatus(register) {
|
|
42
|
+
let known = upstreamColumn.get(register);
|
|
43
|
+
if (!known) {
|
|
44
|
+
known = register
|
|
45
|
+
.query("SELECT count(*) AS n FROM information_schema.columns WHERE table_name = 'bridges' AND column_name = 'upstream_status'", {})
|
|
46
|
+
.then((rows) => Number(rows[0]?.n ?? 0) > 0)
|
|
47
|
+
.catch(() => false);
|
|
48
|
+
upstreamColumn.set(register, known);
|
|
49
|
+
}
|
|
50
|
+
return known;
|
|
51
|
+
}
|
|
29
52
|
function parseQuery(args) {
|
|
30
53
|
const provider = args.provider?.trim().toLowerCase();
|
|
31
54
|
const id = args.id?.trim();
|
|
@@ -80,25 +103,34 @@ async function localRegister(path, options) {
|
|
|
80
103
|
*/
|
|
81
104
|
async function followRedirects(register, start) {
|
|
82
105
|
let current = start;
|
|
106
|
+
const seen = new Set([start]);
|
|
83
107
|
for (let hop = 0; hop < 5; hop++) {
|
|
84
108
|
const next = await register.query("SELECT to_id, reason FROM redirects WHERE from_id = $id", { id: current });
|
|
85
109
|
if (!next.length)
|
|
86
|
-
|
|
110
|
+
return { id: current };
|
|
87
111
|
const to = next[0].to_id == null ? "" : String(next[0].to_id).trim();
|
|
88
112
|
if (!to) {
|
|
89
113
|
const reason = next[0].reason == null ? "" : String(next[0].reason).trim();
|
|
90
114
|
return { id: current, tombstone: { id: current, reason, requested_id: current === start ? undefined : start } };
|
|
91
115
|
}
|
|
116
|
+
// A loop has no survivor: report it as withdrawn, as the reep package does.
|
|
117
|
+
if (seen.has(to))
|
|
118
|
+
return { id: current, tombstone: { id: start, reason: "redirect_loop" } };
|
|
119
|
+
seen.add(to);
|
|
92
120
|
current = to;
|
|
93
121
|
}
|
|
94
|
-
|
|
122
|
+
// Still redirecting after 5 steps (the published ledger is flat, so this
|
|
123
|
+
// should not happen): no survivor was reached.
|
|
124
|
+
return { id: current, tombstone: { id: start, reason: "redirect_loop" } };
|
|
95
125
|
}
|
|
96
126
|
async function localLookup(register, q) {
|
|
97
127
|
let ids = [];
|
|
128
|
+
const upstream = await hasUpstreamStatus(register);
|
|
129
|
+
const upstreamCol = upstream ? "upstream_status" : "NULL AS upstream_status";
|
|
98
130
|
if (q.kind === "provider") {
|
|
99
131
|
const params = { provider: q.provider, id: q.id };
|
|
100
|
-
let sql =
|
|
101
|
-
"WHERE b.provider = $provider AND b.external_id = $id";
|
|
132
|
+
let sql = `SELECT DISTINCT b.reep_id, b.namespace, ${upstream ? "b.upstream_status" : "NULL AS upstream_status"} ` +
|
|
133
|
+
"FROM bridges b JOIN entities e USING (reep_id) WHERE b.provider = $provider AND b.external_id = $id";
|
|
102
134
|
if (q.namespace) {
|
|
103
135
|
sql += " AND b.namespace = $namespace";
|
|
104
136
|
params.namespace = q.namespace;
|
|
@@ -107,11 +139,15 @@ async function localLookup(register, q) {
|
|
|
107
139
|
sql += " AND e.entity_type = $type";
|
|
108
140
|
params.type = q.type;
|
|
109
141
|
}
|
|
110
|
-
ids = (await register.query(`${sql} LIMIT ${MAX_RESULTS}`, params)).map((r) =>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
ids = (await register.query(`${sql} LIMIT ${MAX_RESULTS}`, params)).map((r) => {
|
|
143
|
+
// A retired ID still resolves, so stored old IDs keep working; say so.
|
|
144
|
+
const status = upstreamLabel(r.upstream_status == null ? "" : String(r.upstream_status).trim());
|
|
145
|
+
return {
|
|
146
|
+
reep_id: String(r.reep_id),
|
|
147
|
+
matched: `${q.provider} / ${String(r.namespace ?? "")}: ${q.id}${status ? ` (${status})` : ""}`,
|
|
148
|
+
matched_namespace: String(r.namespace ?? ""),
|
|
149
|
+
};
|
|
150
|
+
});
|
|
115
151
|
}
|
|
116
152
|
else if (q.kind === "reep_id") {
|
|
117
153
|
ids = [{ reep_id: q.reepId }];
|
|
@@ -145,9 +181,28 @@ async function localLookup(register, q) {
|
|
|
145
181
|
const entity = await register.query("SELECT reep_id, label, entity_type FROM entities WHERE reep_id = $id", {
|
|
146
182
|
id: target.id,
|
|
147
183
|
});
|
|
148
|
-
if (!entity.length)
|
|
184
|
+
if (!entity.length) {
|
|
185
|
+
// A redirect that ends at an ID with no entity in this release has no
|
|
186
|
+
// survivor: report it rather than dropping the hit.
|
|
187
|
+
if (target.id !== hit.reep_id) {
|
|
188
|
+
tombstones.push({ id: hit.reep_id, reason: "target_not_in_release", target: target.id, matched: hit.matched });
|
|
189
|
+
}
|
|
149
190
|
continue;
|
|
150
|
-
|
|
191
|
+
}
|
|
192
|
+
// A release can leave a provider ID on a merged Reep ID, not on its survivor,
|
|
193
|
+
// so the survivor's own bridges are incomplete. Add the bridges of every ID
|
|
194
|
+
// merged into it (through chains, bounded), marked with the merged ID.
|
|
195
|
+
const bridges = await register.query([
|
|
196
|
+
"WITH RECURSIVE merged(id, depth) AS (",
|
|
197
|
+
" SELECT from_id, 1 FROM redirects WHERE to_id = $id",
|
|
198
|
+
" UNION ALL",
|
|
199
|
+
" SELECT r.from_id, m.depth + 1 FROM redirects r JOIN merged m ON r.to_id = m.id WHERE m.depth < 5",
|
|
200
|
+
")",
|
|
201
|
+
`SELECT provider, namespace, external_id, ${upstreamCol}, CASE WHEN reep_id = $id THEN NULL ELSE reep_id END AS via`,
|
|
202
|
+
"FROM bridges WHERE reep_id = $id OR reep_id IN (SELECT id FROM merged)",
|
|
203
|
+
"ORDER BY provider, namespace, external_id, via NULLS FIRST",
|
|
204
|
+
].join("\n"), { id: target.id });
|
|
205
|
+
const own = new Set();
|
|
151
206
|
found.push({
|
|
152
207
|
reep_id: target.id,
|
|
153
208
|
label: String(entity[0].label),
|
|
@@ -155,11 +210,24 @@ async function localLookup(register, q) {
|
|
|
155
210
|
requested_id: target.id === hit.reep_id ? undefined : hit.reep_id,
|
|
156
211
|
matched: hit.matched,
|
|
157
212
|
matched_namespace: hit.matched_namespace,
|
|
158
|
-
bridges: bridges
|
|
213
|
+
bridges: bridges
|
|
214
|
+
.map((b) => ({
|
|
159
215
|
provider: String(b.provider),
|
|
160
216
|
namespace: String(b.namespace ?? ""),
|
|
161
217
|
external_id: String(b.external_id),
|
|
162
|
-
|
|
218
|
+
via: b.via == null ? undefined : String(b.via),
|
|
219
|
+
upstream_status: b.upstream_status == null ? undefined : String(b.upstream_status).trim() || undefined,
|
|
220
|
+
}))
|
|
221
|
+
.filter((b) => {
|
|
222
|
+
// The survivor's own bridge wins over the same provider ID on a merged ID.
|
|
223
|
+
const key = `${b.provider}\u0000${b.namespace}\u0000${b.external_id}`;
|
|
224
|
+
if (own.has(key))
|
|
225
|
+
return false;
|
|
226
|
+
own.add(key);
|
|
227
|
+
return true;
|
|
228
|
+
})
|
|
229
|
+
// Live provider IDs first: those are the ones to map to.
|
|
230
|
+
.sort((x, y) => Number(Boolean(x.upstream_status)) - Number(Boolean(y.upstream_status))),
|
|
163
231
|
});
|
|
164
232
|
}
|
|
165
233
|
if (q.kind === "reep_id" && tombstones.length)
|
|
@@ -176,8 +244,12 @@ function tombstoneText(t) {
|
|
|
176
244
|
: t.reason === "withheld"
|
|
177
245
|
? "is withheld (reason: withheld). It is a live, corroborated ID that a publication rule (for example named " +
|
|
178
246
|
"teams or the season horizon) keeps out of this release."
|
|
179
|
-
:
|
|
180
|
-
|
|
247
|
+
: t.reason === "redirect_loop"
|
|
248
|
+
? "is withdrawn (reason: redirect_loop). Its redirects form a loop, or never reach a survivor."
|
|
249
|
+
: t.reason === "target_not_in_release"
|
|
250
|
+
? `is withdrawn: it redirects to ${t.target ?? "an ID"}, which has no entity in this release.`
|
|
251
|
+
: `has a tombstone in the redirects table (reason: ${t.reason || "none given"}) with no survivor.`;
|
|
252
|
+
return (`${matched}${via}Reep ID ${t.id} ${what} There is no survivor ID. Do not treat it as an unknown ID: ` +
|
|
181
253
|
"it was published, and the ID will never be reused.");
|
|
182
254
|
}
|
|
183
255
|
/**
|
|
@@ -340,15 +412,17 @@ function sqlFor(q) {
|
|
|
340
412
|
return [
|
|
341
413
|
"-- A bridge can name a merged Reep ID: follow its redirect to the survivor. An empty",
|
|
342
414
|
"-- to_id is a tombstone (redirect_reason de_corroborated or withheld), not a merge.",
|
|
415
|
+
"-- upstream_status: empty for a live ID, retired or removed when the provider no longer uses it.",
|
|
343
416
|
"SELECT b.reep_id AS bridged_id, r.reason AS redirect_reason, e.reep_id, e.label, e.entity_type,",
|
|
344
|
-
" o.provider, o.namespace, o.external_id",
|
|
417
|
+
" o.provider, o.namespace, o.external_id, coalesce(o.upstream_status, '') AS upstream_status",
|
|
345
418
|
"FROM bridges b",
|
|
346
419
|
"LEFT JOIN redirects r ON r.from_id = b.reep_id",
|
|
347
420
|
"JOIN entities e ON e.reep_id = coalesce(nullif(r.to_id, ''), b.reep_id)",
|
|
348
|
-
"
|
|
421
|
+
"-- The survivor's provider IDs, plus any still attached to an ID merged into it.",
|
|
422
|
+
"JOIN bridges o ON o.reep_id = e.reep_id OR o.reep_id IN (SELECT from_id FROM redirects WHERE to_id = e.reep_id)",
|
|
349
423
|
`WHERE b.provider = ${quote(q.provider)}${q.namespace ? ` AND b.namespace = ${quote(q.namespace)}` : ""}`,
|
|
350
424
|
` AND b.external_id = ${quote(q.id)}`,
|
|
351
|
-
"ORDER BY o.provider, o.namespace;",
|
|
425
|
+
"ORDER BY coalesce(o.upstream_status, '') <> '', o.provider, o.namespace;",
|
|
352
426
|
].join("\n");
|
|
353
427
|
}
|
|
354
428
|
if (q.kind === "reep_id") {
|
|
@@ -357,12 +431,15 @@ function sqlFor(q) {
|
|
|
357
431
|
"-- (reason de_corroborated) or withheld, not merged.",
|
|
358
432
|
`SELECT from_id, to_id, reason FROM redirects WHERE from_id = ${quote(q.reepId)};`,
|
|
359
433
|
"",
|
|
360
|
-
"-- Then follow a merge redirect to the survivor, and list every provider ID
|
|
361
|
-
"
|
|
362
|
-
"
|
|
434
|
+
"-- Then follow a merge redirect to the survivor, and list every provider ID, including",
|
|
435
|
+
"-- any still attached to an ID merged into it (bridged_on names that ID).",
|
|
436
|
+
"SELECT e.reep_id, e.label, e.entity_type, b.provider, b.namespace, b.external_id, b.reep_id AS bridged_on,",
|
|
437
|
+
" coalesce(b.upstream_status, '') AS upstream_status",
|
|
438
|
+
"FROM entities e",
|
|
439
|
+
"JOIN bridges b ON b.reep_id = e.reep_id OR b.reep_id IN (SELECT from_id FROM redirects WHERE to_id = e.reep_id)",
|
|
363
440
|
`WHERE e.reep_id = coalesce((SELECT nullif(to_id, '') FROM redirects WHERE from_id = ${quote(q.reepId)}), ${quote(q.reepId)})`,
|
|
364
441
|
` AND NOT EXISTS (SELECT 1 FROM redirects WHERE from_id = ${quote(q.reepId)} AND coalesce(to_id, '') = '')`,
|
|
365
|
-
"ORDER BY b.provider, b.namespace;",
|
|
442
|
+
"ORDER BY coalesce(b.upstream_status, '') <> '', b.provider, b.namespace;",
|
|
366
443
|
].join("\n");
|
|
367
444
|
}
|
|
368
445
|
return [
|
|
@@ -408,7 +485,13 @@ function formatFound(found) {
|
|
|
408
485
|
lines.push(" (none)");
|
|
409
486
|
for (const b of f.bridges) {
|
|
410
487
|
const role = b.role && b.role !== "canonical_bridge" ? ` (${b.role})` : "";
|
|
411
|
-
|
|
488
|
+
const via = b.via ? ` (via merged ${b.via})` : "";
|
|
489
|
+
const status = upstreamLabel(b.upstream_status);
|
|
490
|
+
lines.push(` ${b.provider}${b.namespace ? ` / ${b.namespace}` : ""}: ${b.external_id}${role}${via}${status ? ` (${status})` : ""}`);
|
|
491
|
+
}
|
|
492
|
+
if (f.bridges.some((b) => b.upstream_status)) {
|
|
493
|
+
lines.push(" Provider IDs marked retired or removed are no longer in use at that provider. They still resolve, " +
|
|
494
|
+
"but map to the unmarked ones.");
|
|
412
495
|
}
|
|
413
496
|
}
|
|
414
497
|
else if (f.bridge_count !== undefined) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
source_url: https://reep.football/data/
|
|
3
3
|
source_type: curated
|
|
4
4
|
upstream_version: null
|
|
5
|
-
crawled_at: 2026-
|
|
5
|
+
crawled_at: 2026-10-13
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Reep download: DuckDB and CSV
|
|
@@ -55,7 +55,7 @@ before any bulk matching job.
|
|
|
55
55
|
| `bridges` | `provider, namespace, external_id, reep_id, rung, upstream_status` | The crosswalk: one row per provider ID. `rung` says how the bridge was corroborated; `upstream_status` says whether the provider still uses the ID. |
|
|
56
56
|
| `entities` | `reep_id, entity_type, status, label, gender, country, …` | One row per identity. |
|
|
57
57
|
| `aliases` | `reep_id, alias, kind, rank, language` | Alternate and historical names. |
|
|
58
|
-
| `redirects` | `from_id, to_id, reason` | IDs retired by a merge, pointing at the survivor
|
|
58
|
+
| `redirects` | `from_id, to_id, reason` | IDs retired by a merge, pointing at the survivor (`reason = merged`), plus a few tombstones with an empty `to_id`. The ledger is flat: a `to_id` is never itself a `from_id`. |
|
|
59
59
|
|
|
60
60
|
The DuckDB file is self-describing: `SHOW TABLES;` and `DESCRIBE bridges;`.
|
|
61
61
|
Source: [get-started guide](https://reep.football/get-started).
|
|
@@ -79,18 +79,51 @@ the live one. The examples below do this with
|
|
|
79
79
|
`coalesce(b.upstream_status, '') = ''`, which works whether the empty value
|
|
80
80
|
arrives as NULL or as an empty string.
|
|
81
81
|
|
|
82
|
+
### Bridges can name a merged Reep ID
|
|
83
|
+
|
|
84
|
+
When two Reep IDs merge, the losing ID keeps its bridge rows, and `redirects`
|
|
85
|
+
points it at the survivor. So a bridge's `reep_id` can be a merged ID. In release
|
|
86
|
+
`20261005T180536Z`, 4,211 bridges name a merged ID. For example,
|
|
87
|
+
`transfermarkt / spieler / 1146905` is bridged on `rp799a2e2f9861aa` (status
|
|
88
|
+
`redirected`, "Samuel Maslej"), which redirects to `rp277340b925e0d2`
|
|
89
|
+
("Samuel Mašlej"). The survivor's own bridges have no Transfermarkt row.
|
|
90
|
+
|
|
91
|
+
A join from `bridges` straight to `entities` and back to `bridges` therefore
|
|
92
|
+
lands on the merged entity and misses the survivor's other provider IDs. In that
|
|
93
|
+
release, mapping this Transfermarkt ID to Wyscout that way returns no Wyscout ID.
|
|
94
|
+
Resolve every bridge to its survivor first, and join on the survivor. One join is
|
|
95
|
+
enough, because the ledger is flat:
|
|
96
|
+
|
|
97
|
+
```sql
|
|
98
|
+
WITH rb AS ( -- every bridge, with the Reep ID it resolves to
|
|
99
|
+
SELECT b.*, coalesce(nullif(r.to_id, ''), b.reep_id) AS survivor_id
|
|
100
|
+
FROM bridges b
|
|
101
|
+
LEFT JOIN redirects r ON r.from_id = b.reep_id
|
|
102
|
+
)
|
|
103
|
+
SELECT * FROM rb LIMIT 5;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
An entity's full set of provider IDs is every `rb` row whose `survivor_id` is
|
|
107
|
+
its Reep ID. A tombstone (empty `to_id`) leaves the bridge on its own ID. The
|
|
108
|
+
examples below use `rb`. Checked on release `20261005T180536Z`.
|
|
109
|
+
|
|
82
110
|
## Map one provider's ID to another's
|
|
83
111
|
|
|
84
112
|
Two hops through the Reep ID. Swap the two provider clauses to go the other way.
|
|
85
113
|
|
|
86
114
|
```sql
|
|
87
115
|
-- Wyscout player ID → Reep ID → SkillCorner player ID
|
|
116
|
+
WITH rb AS (
|
|
117
|
+
SELECT b.*, coalesce(nullif(r.to_id, ''), b.reep_id) AS survivor_id
|
|
118
|
+
FROM bridges b
|
|
119
|
+
LEFT JOIN redirects r ON r.from_id = b.reep_id
|
|
120
|
+
)
|
|
88
121
|
SELECT a.external_id AS wyscout_id, e.reep_id, e.label,
|
|
89
122
|
b.external_id AS skillcorner_id
|
|
90
|
-
FROM
|
|
91
|
-
JOIN entities e
|
|
92
|
-
LEFT JOIN
|
|
93
|
-
ON b.
|
|
123
|
+
FROM rb a
|
|
124
|
+
JOIN entities e ON e.reep_id = a.survivor_id
|
|
125
|
+
LEFT JOIN rb b
|
|
126
|
+
ON b.survivor_id = e.reep_id
|
|
94
127
|
AND b.provider = 'skillcorner' AND b.namespace = 'player'
|
|
95
128
|
AND coalesce(b.upstream_status, '') = ''
|
|
96
129
|
WHERE a.provider = 'wyscout' AND a.namespace = 'player'
|
|
@@ -98,6 +131,9 @@ WHERE a.provider = 'wyscout' AND a.namespace = 'player'
|
|
|
98
131
|
-- → rp1b829f1d3468c4 · Declan Rice · skillcorner 12174
|
|
99
132
|
```
|
|
100
133
|
|
|
134
|
+
The same query for `transfermarkt / spieler / 1146905` to Wyscout returns
|
|
135
|
+
`rp277340b925e0d2` · Samuel Mašlej · wyscout 908077.
|
|
136
|
+
|
|
101
137
|
## Bridge a whole file in one pass
|
|
102
138
|
|
|
103
139
|
DuckDB reads CSV directly, so your own file joins without an import step.
|
|
@@ -105,16 +141,21 @@ DuckDB reads CSV directly, so your own file joins without an import step.
|
|
|
105
141
|
```sql
|
|
106
142
|
CREATE TABLE my_squad AS SELECT * FROM read_csv_auto('my_squad.csv');
|
|
107
143
|
|
|
144
|
+
WITH rb AS (
|
|
145
|
+
SELECT b.*, coalesce(nullif(r.to_id, ''), b.reep_id) AS survivor_id
|
|
146
|
+
FROM bridges b
|
|
147
|
+
LEFT JOIN redirects r ON r.from_id = b.reep_id
|
|
148
|
+
)
|
|
108
149
|
SELECT m.*, e.reep_id, e.label AS reep_label,
|
|
109
150
|
string_agg(DISTINCT b.external_id, '|') FILTER (WHERE b.provider = 'skillcorner') AS skillcorner_id,
|
|
110
151
|
string_agg(DISTINCT b.external_id, '|') FILTER (WHERE b.provider = 'opta') AS opta_id
|
|
111
152
|
FROM my_squad m
|
|
112
|
-
LEFT JOIN
|
|
153
|
+
LEFT JOIN rb a
|
|
113
154
|
ON a.provider = 'wyscout' AND a.namespace = 'player'
|
|
114
155
|
AND a.external_id = CAST(m.wyscout_id AS VARCHAR)
|
|
115
|
-
LEFT JOIN entities e
|
|
116
|
-
LEFT JOIN
|
|
117
|
-
ON b.
|
|
156
|
+
LEFT JOIN entities e ON e.reep_id = a.survivor_id
|
|
157
|
+
LEFT JOIN rb b
|
|
158
|
+
ON b.survivor_id = e.reep_id
|
|
118
159
|
AND (b.provider, b.namespace) IN (('skillcorner', 'player'), ('opta', 'person'))
|
|
119
160
|
AND coalesce(b.upstream_status, '') = ''
|
|
120
161
|
GROUP BY ALL;
|
|
@@ -131,8 +172,10 @@ per entity with a column per provider:
|
|
|
131
172
|
```sql
|
|
132
173
|
COPY (
|
|
133
174
|
PIVOT (
|
|
134
|
-
SELECT
|
|
135
|
-
FROM bridges b
|
|
175
|
+
SELECT e.reep_id, e.label, b.provider || '_' || b.namespace AS id_column, b.external_id
|
|
176
|
+
FROM bridges b
|
|
177
|
+
LEFT JOIN redirects r ON r.from_id = b.reep_id
|
|
178
|
+
JOIN entities e ON e.reep_id = coalesce(nullif(r.to_id, ''), b.reep_id)
|
|
136
179
|
WHERE e.entity_type = 'team'
|
|
137
180
|
AND coalesce(b.upstream_status, '') = ''
|
|
138
181
|
)
|
|
@@ -94,6 +94,10 @@ FROM my_saved_ids x
|
|
|
94
94
|
LEFT JOIN redirects r ON r.from_id = x.reep_id;
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
The same applies to the `reep_id` on a bridge row: a merged ID keeps its
|
|
98
|
+
bridges, so resolve it through `redirects` before joining. See "Bridges can name
|
|
99
|
+
a merged Reep ID" on the download page.
|
|
100
|
+
|
|
97
101
|
In the API, requesting a redirected ID returns HTTP 200 with the survivor, and
|
|
98
102
|
the body carries `requested_id` and `redirected_to` so the stored ID can be
|
|
99
103
|
updated. Source: [get-started guide](https://reep.football/get-started).
|
package/docs/reep/overview.md
CHANGED
|
@@ -58,10 +58,16 @@ that answers the question from the download.
|
|
|
58
58
|
What the answers say:
|
|
59
59
|
|
|
60
60
|
- A merged Reep ID is followed to its survivor, and the answer names both IDs.
|
|
61
|
-
This includes a provider ID whose bridge still names the merged ID.
|
|
61
|
+
This includes a provider ID whose bridge still names the merged ID. The
|
|
62
|
+
survivor's provider IDs include any still attached to an ID merged into it,
|
|
63
|
+
marked "(via merged <id>)".
|
|
62
64
|
- A withdrawn or withheld Reep ID (a tombstone in `redirects`, with an empty
|
|
63
65
|
`to_id`) is reported as withdrawn or withheld, with the reason. It is not
|
|
64
66
|
reported as unknown: it was published, and the ID is never reused.
|
|
67
|
+
- Provider IDs that the provider no longer uses (`upstream_status` retired or
|
|
68
|
+
removed, in a local register file) are marked, and listed after the live
|
|
69
|
+
ones. They still resolve, so an old stored ID keeps working, but map to the
|
|
70
|
+
unmarked ones. The Reep API does not return this field.
|
|
65
71
|
- A provider ID looked up without a namespace gets a note: which namespace it
|
|
66
72
|
matched in, or a warning when it matched in more than one. Pass the
|
|
67
73
|
namespace (or the entity type) to be sure of the entity.
|
package/package.json
CHANGED