Skip to content

betting_combat.feeds.profiles

profiles.py — the profiles feed: every fighter’s UFC.com athlete page on our ids, and his pedigree before the UFC read from it (contracts.profiles).

ProfilesFeed
seed(pages, index) the pages the fight-level research pulled (``data/ufc/fight_level/raw``:
one HTML per fighter, verified, and its index): parsed with the same
parser the live pull uses (``providers.ufccom``)
update(start, end) the pages of every fighter with a bout in ``start`` .. ``end`` and no
page read since his last fight (a new record), one request every 15 s
pedigrees() the pedigree of every page with text (facts or Q&A) not read since
the page was (``feeds.pedigree``: rules on the text, no model)
build = seed, then every fighter with a bout since ``PROFILES_FROM`` and no page yet (the
research's span: UFC.com's pages of earlier fighters are rare and thin)

A page is a fighter’s only when it says so: his Octagon debut within a day of his first bout, or a fight it lists on one of his bout dates (is_him); a page that is not (a namesake) is never landed. A debut fighter’s page cannot say so before his first fight: it waits for the next run. Every fighter without a page (no slug answered, none verified) is missed.

Classes

ProfilesFeed

Bases: Feed

UFC.com’s athlete pages and the pedigrees read from them, through the catalog’s ids.

build

build(pages: Path | None = None, index: Path | None = None) -> dict[str, Any]

The research’s pages first (when given), then every fighter still without one.

load

load() -> Ids

pedigrees

pedigrees(fighters: list[str] | None = None) -> dict[str, Any]

The pedigree of every page with text not read since the page was (fighters: only those), read by rules (feeds.pedigree).

seed

seed(pages: Path, index: Path) -> dict[str, int]

The research’s pulled pages (index: fighter_id, slug, verified, how, fetched_at).

update

update(start: dt.date, end: dt.date) -> dict[str, int]

The pages of the fighters with a bout in start .. end not read since their last fight (none yet, or older than it).