Skip to content

betting_combat.feeds.catalog

catalog.py — the catalog feed: events, fighters, bouts (with results) and markets, one row each on our ids with every vendor’s id, combined from every provider in order.

CatalogFeed the feed: ``build`` (the whole history), ``update`` (the recent past and
the cards ahead), ``refresh`` (one card, in seconds: the card-day poll),
each a run of the stages below, then ``save``; ``check`` the card's
readiness (``checks.CardCheck``)
Report what a stage did: matched, minted, merged, unmatched (with why), notes

The stages, each rerunnable, each merging into the catalog (normalizers.Ids):

seed today's registry (``rounds_*``): our ids, once, when the catalog is empty
ufcstats the mirror: results, rounds and weight classes, birth dates, physicals, names
cito cards and bouts (new ones minted here: Cito lists a card first), ids, card
places, results, referees; the fighter directory's physicals and names
kalshi the calendar's fights: milestones (start, live link, provider ids), fighters'
competitor ids, and every market of the six UFC series
polymarket intl and US fights (game ids, event ids and slugs), fighters (team ids; US
teams carry FightMetric numbers), and their markets

A source’s row is found by a vendor id first; only one with none we know falls back to names and dates (today’s matcher), and a name match never stands against a vendor id that names another fighter (_ids_agree). A new card’s bouts are minted from Cito; every other source attaches to bouts we hold. One process writes the catalog at a time (LOCK: the card’s refresh, its live run and an update overlap on card day; each mints from what it loaded).

Classes

CatalogFeed

Bases: Feed

Events, fighters, bouts and markets from every provider, on our ids.

apply_seed

apply_seed(seed: Seed) -> Report

build

build(registry: Registry | None = None, start: dt.date = dt.date(1993, 11, 1), end: dt.date | None = None) -> list[Report]

The whole history: the registry’s ids (when the catalog is empty), then every source over start .. end (default: 120 days ahead).

check

check(day: dt.date, now: dt.datetime | None = None) -> CardCheck

The card on day as stored: its fights, each venue’s menu, the gaps.

from_cito

from_cito(start: dt.date, end: dt.date, with_directory: bool = True) -> Report

Cito’s cards over start .. end: events, bouts (new ones minted), results; on a card ahead, a bout Cito no longer lists is cancelled and a cancelled bout’s rebooking found. with_directory adds the fighter directory’s facts (3,500 fighters: the card-day poll goes without).

from_kalshi

from_kalshi(since: dt.datetime, created_since: dt.datetime | None = None) -> Report

The calendar’s fights from since, their fighters’ competitor ids, and the six series’ markets: every one (history included), or with created_since only those listed since (the card-day poll). A market binds to its fight by its event (the milestone’s), else by a sibling event of the same fight (KXUFCDISTANCE-26NOV14GANHOK beside KXUFCFIGHT-26NOV14GANHOK: props arrive on card day, before the milestone lists their events); one that binds nowhere is reported, never dropped quietly.

from_polymarket

from_polymarket(start: dt.date, end: dt.date, open_only: bool = False) -> Report

Intl and US fights over start .. end and their markets; open_only reads the fights still listed only (the card-day poll: no archive).

from_ufcstats

from_ufcstats() -> Report

from_wikipedia

from_wikipedia(list_json: str) -> Report

The venue of every card from Wikipedia’s ‘List of UFC events’ (the parse API’s JSON: prod’s wiki_event_lists snapshot for a build, consumers.wikipedia for an update), as the research read it (rounds.features.context: a row’s date, name, venue, place). A row binds to the card of its date ± a day (Wikipedia dates a card where it is held, UFCStats in the US: Sydney’s Saturday is UFCStats’s Friday) whose name shares the most of its words; a name sharing none, the card of its date alone. A row that binds none is reported.

load

load() -> Ids

The catalog as stored.

refresh

refresh(day: dt.date, since: dt.datetime | None = None) -> list[Report]

One card, in seconds (the card-day poll): Cito’s card (rebookings, cancellations, live ids), Kalshi’s fights from the day before and the markets listed since since (default: three days back), the venues’ open fights. The whole history is update’s.

save

save() -> dict[str, dict[str, int]]

Write every row merged or minted, tables in key order (events first); in each, the rows that gave a vendor id up first (a rekey: the unique index never sees it twice).

update

update(days_back: int = 14, days_ahead: int = 120) -> list[Report]

The recent past and the cards ahead: results, rebookings, new markets, links.

Report

miss

miss(what: str) -> None

note

note(what: str) -> None

Functions

prod_event_list

prod_event_list(db: DBClient) -> str | None

The latest ‘List of UFC events’ snapshot prod’s legacy flow landed (wiki_event_lists).

wiki_venues

wiki_venues(list_json: str) -> list[tuple[dt.date, str, str]]

(date, name, venue) of every event row of Wikipedia’s ‘List of UFC events’ (the parse API’s JSON). A venue (or place) cell spanning rows (rowspan: consecutive cards at one venue) is carried into the rows below it (found 2026-11-11: without it every Apex card of 2020-22 but the first had no venue, and the research’s parse had the same hole).