Skip to content

feat(schema): provider_name in Odds and OddsLine - #249

Merged
tunjayoff merged 1 commit into
mainfrom
feat/schema-odds-provider-name
Nov 21, 2026
Merged

tunjayoff merged 1 commit into
mainfrom
feat/schema-odds-provider-name

Conversation

@tunjayoff

Copy link
Copy Markdown
Owner

Open item of 03-implementation-plan.md section 20: a provider_name field in schema v1.

What

  • Odds and OddsLine (sofascore_scraper/schema/models.py) get provider_name: Optional[str] right after provider_id.
  • mappers.odds_from_payload fills it from the built-in table sports.ODDS_PROVIDERS (B4, feat: show odds providers by name (B4) #192) via sports.odds_provider(); null when the id is unknown or absent. odds_lines copies it to every row.
  • Derived at mapping time: nothing stored changes, no SofaScore request.

Schema version

Adding a field is free under 04-schema-v1.md section 3, so schema_version stays 1. A dated amendment note at the top of 04 says so.

Regenerated

  • tests/golden/schema/json_schema.json (REGEN_SCHEMA_GOLDEN=1)
  • generated field tables of Odds / OddsLine in 04-schema-v1.md (REGEN_SCHEMA_DOC=1), plus the two examples by hand
  • docs/api/openapi-v1.json (the Odds record of /events/{id}/odds/{key})
  • frontend/src/api/v1/schema.ts (npm run gen:api); vue-tsc -b clean, vitest 388 passed

Export

The odds dataset gains the column provider_name after provider_id (tabular columns follow the model's field order via leaf_paths). No export golden pins odds columns; the header assertion in tests/test_odds_slices.py was updated.

Docs

CHANGELOG (Unreleased → Added); 04-schema-v1.md (tables, examples, the provider prose, amendment note); 03 section 20 bullet marked done and the M20 row; 02-services.md and 05-web-ui.md no longer call the field open.

Tests

  • New assertions: provider 1 → bet365, 1528, 1781 named, unknown 5 → null, no provider → null, lines and export rows carry the name.
  • ruff clean; full suite 9880 passed, 45 skipped, 27 deselected.

The bookmaker's name is derived from the built-in table sports.ODDS_PROVIDERS
when the record is mapped (null for an unknown id); nothing stored changes and
no request is made. An added field is free in schema v1, so schema_version stays 1.
Regenerated: the JSON Schema golden, the generated tables and examples of
04-schema-v1.md, docs/api/openapi-v1.json and frontend/src/api/v1/schema.ts.
@tunjayoff
tunjayoff merged commit 4e43854 into main Nov 21, 2026
8 checks passed
@tunjayoff
tunjayoff deleted the feat/schema-odds-provider-name branch November 21, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant