Skip to content

betting_combat.rounds.features.sources

RawData: every source the round dataset reads, parsed once into clean tables.

Port of the research ufc/dataset/sources.py; the numbers must stay identical. The research read files; production receives the same tables as arguments (UfcTables) and never touches a path, so the data layer can fill them from the database.

bouts one row per UFC bout (fight_id = UFCStats fight URL id): event, date, card
position, both fighters (names + stable ids), result, method, finish round /
time, scheduled rounds, weight class, title, women.
round_stats one row per fight x round x fighter: every UFCStats round stat, parsed.
fighters one row per fighter id: height, reach, stance, date of birth.
segments Wikipedia card segment (main / prelim / early_prelim) per bout, where known.
judges MMADecisions: per judge per round scores for UFC decisions, where known.
odds pre-fight win probability per bout: sportsbook moneyline (2010 - Mar 2026)
or Kalshi card-start price (May 2025 on), de-vigged, with the source.
method_odds bookmakers' de-vigged P(KO), P(SUB), P(DEC) (2013 - 2024).

Fighter ids. UFCStats’ round stats carry names only. Each name maps to the fighter-details URL id in the fighter table; a few names belong to two different fighters, and those are told apart by the bout’s weight class against each candidate’s listed weight (then age at the fight). RawData.id_collisions lists every such assignment for review.

pandas 3 notes (the research ran pandas 2): every parsed date is kept at nanosecond resolution (pandas 3 parses to microseconds), and _text reproduces pandas 2’s astype(str) (a missing value becomes the text ‘nan’; pandas 3 would keep it missing).

Classes

RawData

The parsed source tables, each computed once on first use.

UfcTables

The raw inputs, each exactly as pd.read_csv(<file>) (no options) gives it.

event_details ufcstats_ufc_event_details.csv (EVENT, URL, DATE, LOCATION) fight_results ufcstats_ufc_fight_results.csv (one row per bout, main event first) fight_stats ufcstats_ufc_fight_stats.csv (one row per bout x round x fighter) fighter_tott ufcstats_ufc_fighter_tott.csv (height, weight, reach, stance, DOB) ufc_master ufc-master.csv (bookmakers’ method odds) fights_sportsbook fights_sportsbook.csv (de-vigged sportsbook moneylines) fights_kalshi fights_kalshi.csv (Kalshi card-start prices) wiki_events_json the text of wiki_ufc_events.json (Wikipedia’s ‘List of UFC events’, the MediaWiki parse API response) card_segments card_segments.csv (Wikipedia card segments; None if not scraped) judge_scores judge_scores.csv (MMADecisions; None if not scraped)