betting_combat.feeds.fight_data
fight_data.py — the stats feed: the raw facts of the fights, on our ids.
FightDataFeed rounds(start, end) official per-round lines (Cito: one call per card, UFC 2 onward) snapshots(bouts) every live reading, kept whole (``payload``: raw first), its per-round lines (``live_rounds``) and its fight totals (``live_totals``: some fights' readings carry these and no round lines); Cito keeps the 200 newest per bout, from 2026-07-25 (checked 2026-11-17: 07-18 and earlier hold none; no paging); each round's start and the result as Cito saw them (``fight_events``); ``refetch`` re-reads stored bouts scorecards(years) judges' scores per round (MMADecisions), oriented to fighter A; ``scorecards_from`` lands rows already scraped (legacy table) odds(start, end) sportsbook prices per card (Cito, from 2026-06), a row per change careers(fighters) pro careers (Cito), each fight on our ids where we hold it rankings() today's boards (Cito), dated (New York): a day not read is lost build(start, end) all of the above over a date range; ``update`` the recent pastEvery part lands as it goes (a card, a bout, a fighter, a year at a time) and reports what failed
(failed: a part, a card, a page) instead of stopping; with resume (a build’s default) it
skips what is stored and final: a card whose completed bouts all have both corners’ lines, a
bout with Cito’s completed reading, a card’s odds read a full day after its date, a career that
holds the fighter’s last fight, a decision page already stored (a year whose decisions are all
scored and over two weeks old is not listed at all). A rerun asks only for the failed and the
unfinished. An archive snapshot is stored once: its received_at is when the archive was
first read, not when the reading was known live (that is captured_at + Cito’s lag); only a
card recorded live (kind stream) carries the live receive time. Rankings are dated by New
York’s day.
Nothing is computed beyond our ids and units: a round start is Cito’s capture time minus its
clock, as Cito’s own account (source cito). A card while it runs is live.card’s (the
clock that weighs every source, the stat lines at each bell), writing these same tables.
Classes
FightDataFeed
Bases: Feed
The stats tables, from Cito and MMADecisions, through the catalog’s ids.
build
build(start: dt.date, end: dt.date, resume: bool = True) -> dict[str, Any]careers
careers(fighters: list[str], resume: bool = False) -> dict[str, int]load
load() -> Idsodds
odds(start: dt.date, end: dt.date, resume: bool = False) -> dict[str, int]rankings
rankings() -> dict[str, int]reading_corners
reading_corners(b: Bout, raw: dict[str, Any] | None, base: dict[str, str] | None = None) -> dict[str, str]A reading’s corners to our fighters FROM THE READING ITSELF (its payload’s red / blue fighter: slug, else name), the
bout’s listed corner (a_corner) where the reading tells none (11-19 audit: B009117’s listing had the corners
swapped - every live count on the wrong fighter); a reading that disagrees with the listing is logged and wins.
rounds
rounds(start: dt.date, end: dt.date, resume: bool = False) -> dict[str, int]scorecards
scorecards(years: range, resume: bool = False) -> dict[str, int]A year at a time, each decision page landed with the year (a failed page is a
Failure, the year goes on); a decision page already stored is never asked again.
resume: a year is not listed at all when every decision of it the catalog holds has
its scorecards and it ended more than SCORES_FINAL ago.
scorecards_from
scorecards_from(scraped: list[dict[str, Any]]) -> dict[str, int]Scorecards already scraped (MMADecisions’ rows as the parser gives them: source,
date, fighter_1/2, judge, round, score_1/2), e.g. the legacy
judge_scores table: onto our bouts as a scrape would land them.
snapshots
snapshots(bouts: list[Bout], resume: bool = False, refetch: bool = False) -> dict[str, int]Every stored snapshot of these bouts (Cito keeps the 200 newest per bout, from 2026-07-25),
each kept whole with its round lines and fight totals. refetch: every reading Cito still
holds is written again (a reading stored before keeps its first read, received_at), for
bouts stored before the readings were kept whole.
update
update(days_back: int = 10) -> dict[str, Any]Functions
corner_fighters
corner_fighters(b: Bout) -> dict[str, str]Cito’s corners to our fighters (A’s corner known; else none: a reading’s lines skipped).
line_counts
line_counts(line: StatLine | LiveLine) -> dict[str, Any]snapshot_id
snapshot_id(b: Bout) -> str | NoneThe id Cito’s /snapshots answers for a bout: its live id, except where Cito’s live id is a
UFCStats one (‘ufcstats-…’: the 2026-07-25 .. 09-05 UFC cards, checked 2026-11-17, answer nothing),
then the FightMetric number (‘ufc-12961’, from cito_data_id).