{
  "status": "reproduced",
  "retrievedUtc": "2026-11-26T03:29:37Z",
  "rawFile": {
    "url": "https://github.com/nflverse/nflverse-data/releases/download/schedules/games.csv",
    "sha256": "7ba3801b1440fb89e6e7a9cb5dc2d5950015f6e43552aa9914b837ceaef11cba",
    "bytes": 2192476
  },
  "subsetHash": {
    "expected": "b5b3e34f8962de10006e50b6a986caec837a5394c372d8e7a872ee978df2bd4c",
    "computed": "b5b3e34f8962de10006e50b6a986caec837a5394c372d8e7a872ee978df2bd4c",
    "match": true,
    "rows": 1599,
    "changedRows": []
  },
  "counts": {
    "train": {
      "games": 1055,
      "home_win": 550,
      "tie": 5,
      "away_win": 500
    },
    "calibrate": {
      "games": 272,
      "home_win": 151,
      "tie": 0,
      "away_win": 121
    },
    "test": {
      "games": 272,
      "home_win": 145,
      "tie": 0,
      "away_win": 127
    }
  },
  "figures": [
    {
      "name": "subset.rows",
      "claimed": 1599,
      "recomputed": 1599,
      "match": true
    },
    {
      "name": "train.games",
      "claimed": 1055,
      "recomputed": 1055,
      "match": true
    },
    {
      "name": "train.home_win",
      "claimed": 550,
      "recomputed": 550,
      "match": true
    },
    {
      "name": "train.tie",
      "claimed": 5,
      "recomputed": 5,
      "match": true
    },
    {
      "name": "train.away_win",
      "claimed": 500,
      "recomputed": 500,
      "match": true
    },
    {
      "name": "calibrate.games",
      "claimed": 272,
      "recomputed": 272,
      "match": true
    },
    {
      "name": "test.games",
      "claimed": 272,
      "recomputed": 272,
      "match": true
    },
    {
      "name": "test.home_win",
      "claimed": 145,
      "recomputed": 145,
      "match": true
    },
    {
      "name": "test.tie",
      "claimed": 0,
      "recomputed": 0,
      "match": true
    },
    {
      "name": "test.away_win",
      "claimed": 127,
      "recomputed": 127,
      "match": true
    },
    {
      "name": "baseline.brier",
      "claimed": 0.498,
      "recomputed": 0.49803751479043673,
      "match": true
    },
    {
      "name": "baseline.log_loss",
      "claimed": 0.6968,
      "recomputed": 0.696817516223574,
      "match": true
    },
    {
      "name": "raw_elo.brier",
      "claimed": 0.441,
      "recomputed": 0.44099998449685524,
      "match": true
    },
    {
      "name": "raw_elo.log_loss",
      "claimed": 0.6368,
      "recomputed": 0.6368097349942433,
      "match": true
    },
    {
      "name": "scaled_elo.brier",
      "claimed": 0.4366,
      "recomputed": 0.43663490098717705,
      "match": true
    },
    {
      "name": "scaled_elo.log_loss",
      "claimed": 0.6279,
      "recomputed": 0.627934745825669,
      "match": true
    },
    {
      "name": "T",
      "claimed": 0.816,
      "recomputed": 0.8159597251130954,
      "match": true
    },
    {
      "name": "2022_17_BUF_CIN.raw_rows",
      "claimed": 0,
      "recomputed": 0,
      "match": true
    }
  ],
  "T": 0.8159597251130954,
  "missingGame": {
    "id": "2022_17_BUF_CIN",
    "rawRows": 0,
    "matchupRowIds": [],
    "reason": "The NFL postponed the game after Bills safety Damar Hamlin suffered cardiac arrest, then cancelled it without resuming play. The league said completing it would have left the set of playoff qualifiers the same and delayed the playoffs by a week. The game therefore had no final result. The downloaded CSV contains zero rows for the game by ID and by season, week and matchup.",
    "sourceUrl": "https://www.nfl.com/news/week-17-buffalo-cincinnati-game-will-not-be-resumed-neutral-afc-championship-gam",
    "postponementSourceUrl": "https://www.nfl.com/news/nfl-announces-bills-bengals-game-will-not-be-resumed-this-week"
  },
  "teamCodeChanges": {
    "2020": {
      "removed": [
        "OAK"
      ],
      "added": [
        "LV"
      ]
    }
  },
  "timingDiagnostics": {
    "earlierWeekGamesOnOrAfterCutoff": {},
    "sameTeamUpdateOrderReversals": [],
    "minimumDaysBetweenWeeks": 2
  },
  "licence": {
    "name": "Creative Commons Attribution 4.0 International (CC BY 4.0)",
    "url": "https://raw.githubusercontent.com/nflverse/nflverse-data/main/LICENSE.md",
    "quotedLines": {
      "reuse": "reproduce and Share the Licensed Material, in whole or\n               in part; and",
      "credit": "identification of the creator(s) of the Licensed"
    },
    "creditLine": "Source: nflverse game/schedule data, maintained by Lee Sharpe, CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This audit selected 2019–2024 regular-season games and derived outcome counts and model scores.",
    "commercialReuse": "permitted",
    "commercialReuseScope": "nflverse permits commercial reuse of its CC BY 4.0 distribution, including these schedule fields, subject to the licence terms. Give attribution and identify modifications when sharing. Independent third-party rights are unclear from the sources reviewed.",
    "policySourceUrl": "https://github.com/nflverse",
    "maintainerSourceUrl": "https://nflreadr.nflverse.com/reference/load_schedules.html"
  },
  "dictionary": {
    "url": "https://nflreadr.nflverse.com/articles/dictionary_schedules.html",
    "quotedLines": {
      "location": "Neutral if the game is being played at a neutral location.",
      "gameday": "The date on which the game occurred."
    },
    "role": "Field definitions for the cutoff and home advantage. Reuse and credit terms come from the repository licence."
  },
  "leakageAndRuleAmbiguity": [
    "At each season-week cutoff the model uses only completed regular-season rows from lower-numbered weeks with gameday strictly before that week’s first gameday, plus prior-season ratings. All forecasts in the week use the same rating state. There were no late earlier-week rows and the shortest same-season gap from the last game of one week to the first of the next was two calendar days.",
    "Eligible games update ratings chronologically by gameday, kickoff and game ID. Each Elo update recomputes the expected home score from the ratings immediately before that update, moving the home and away ratings by equal and opposite amounts. The measured update order had no same-team reversals.",
    "Ratings are keyed by literal schedule team codes. The team-code set changes from OAK to LV between 2019 and 2020, so the first LV rating starts at 1500. A franchise-identity interpretation could carry the OAK rating across the change. The brief leaves that mapping unspecified.",
    "The smoothed baseline and raw tie probability are fixed from 2019–2022. Calibration fits T from chronological 2023 forecasts only by minimising mean natural-log loss. In 2024 T stays fixed while Elo can learn from eligible earlier-week 2024 results. This is a rolling weekly backtest.",
    "Multiclass Brier sums squared errors across the three classes and averages over games. Counts use exact equality and metrics and T are compared after rounding to four decimal places."
  ],
  "limitations": [
    "The checksum covers only the eleven specified columns of the selected games. The source CSV is mutable and there is no prior raw snapshot in the brief for a whole-file comparison.",
    "The audit uses a retrospectively downloaded schedule. It checks date and week ordering, while the exact publication times of scores and any schedule revisions were unavailable from the CSV.",
    "The calibration and test splits each contain zero ties. Their aggregate scores establish neither tie calibration nor performance in other seasons."
  ],
  "script": "import csv\nimport hashlib\nimport io\nimport json\nimport math\nimport sys\nfrom collections import Counter, defaultdict\nfrom datetime import date\nfrom itertools import pairwise\nfrom pathlib import Path\n\nURL = 'https://github.com/nflverse/nflverse-data/releases/download/schedules/games.csv'\nEXPECTED = 'b5b3e34f8962de10006e50b6a986caec837a5394c372d8e7a872ee978df2bd4c'\nCOLUMNS = ('game_id season game_type week gameday gametime away_team '\n           'away_score home_team home_score location').split()\nOUTCOMES = ('home_win', 'tie', 'away_win')\nSPLITS = {'train': range(2019, 2023), 'calibrate': (2023,), 'test': (2024,)}\nMISSING = '2022_17_BUF_CIN'\n\n\ndef scored(game):\n    return all(game[field] not in ('', 'NA') for field in ('home_score', 'away_score'))\n\n\ndef outcome(game):\n    difference = int(game['home_score']) - int(game['away_score'])\n    return 1 - ((difference > 0) - (difference < 0))\n\n\ndef chronology(game):\n    return game['gameday'], game['gametime'], game['game_id']\n\n\ndef elo(games):\n    by_season = defaultdict(list)\n    for game in games:\n        by_season[int(game['season'])].append(game)\n    forecasts = {}\n    late = {}\n    same_team_updates = []\n    ratings = defaultdict(lambda: 1500.0)\n\n    def expectation(game):\n        home, away = game['home_team'], game['away_team']\n        advantage = 0 if game['location'] == 'Neutral' else 48\n        return 1 / (1 + 10 ** (-(ratings[home] - ratings[away] + advantage) / 400))\n\n    def update(game):\n        change = 20 * (1 - outcome(game) / 2 - expectation(game))\n        ratings[game['home_team']] += change\n        ratings[game['away_team']] -= change\n\n    tau = 6 / 1058\n    for season, season_games in sorted(by_season.items()):\n        for team in ratings:\n            ratings[team] = 1500 + (2 / 3) * (ratings[team] - 1500)\n        by_week = defaultdict(list)\n        for game in season_games:\n            by_week[int(game['week'])].append(game)\n        remaining = sorted(season_games, key=chronology)\n        processed = []\n        for week, week_games in sorted(by_week.items()):\n            cutoff = min(game['gameday'] for game in week_games)\n            eligible = [game for game in remaining\n                        if int(game['week']) < week and game['gameday'] < cutoff]\n            blocked = [game['game_id'] for game in remaining\n                       if int(game['week']) < week and game['gameday'] >= cutoff]\n            if blocked:\n                late[f'{season}-{week}'] = blocked\n            for game in eligible:\n                update(game)\n            processed.extend(eligible)\n            remaining = [game for game in remaining if game not in eligible]\n            for game in week_games:\n                e = expectation(game)\n                forecasts[game['game_id']] = ((1 - tau) * e, tau, (1 - tau) * (1 - e))\n        for game in remaining:\n            update(game)\n        processed.extend(remaining)\n        last_game = {}\n        for game in processed:\n            for team in (game['home_team'], game['away_team']):\n                previous = last_game.get(team)\n                if previous and chronology(previous) > chronology(game):\n                    same_team_updates.append([previous['game_id'], game['game_id']])\n                last_game[team] = game\n    return forecasts, late, same_team_updates\n\n\ndef softmax(scores):\n    shifted = [math.exp(score - max(scores)) for score in scores]\n    total = sum(shifted)\n    return tuple(value / total for value in shifted)\n\n\ndef evaluate(rows):\n    brier = math.fsum(sum((p - (i == y)) ** 2 for i, p in enumerate(prob))\n                      for prob, y in rows) / len(rows)\n    loss = -math.fsum(math.log(prob[y]) for prob, y in rows) / len(rows)\n    return brier, loss\n\n\ndef fit_inverse_temperature(rows):\n    # The log loss is convex in inverse temperature. Its derivative is\n    # the expected log raw probability minus that of the observed class.\n    def gradient(beta):\n        return math.fsum(sum(p * log_p for p, log_p in zip(\n            softmax([beta * value for value in logs]), logs)) - logs[y]\n                         for logs, y in rows)\n\n    low, high = 0.0, 1.0\n    assert gradient(low) < 0\n    while gradient(high) <= 0:\n        high *= 2\n        assert high <= 1024\n    for _ in range(64):\n        mid = (low + high) / 2\n        if gradient(mid) < 0:\n            low = mid\n        else:\n            high = mid\n    return (low + high) / 2\n\n\ndef main():\n    raw = Path(sys.argv[1]).read_bytes()\n    all_games = list(csv.DictReader(io.StringIO(raw.decode('utf-8'), newline='')))\n    regular = [game for game in all_games if game['game_type'] == 'REG'\n               and 2019 <= int(game['season']) <= 2024]\n    games = sorted(filter(scored, regular), key=lambda game: game['game_id'])\n    assert len({game['game_id'] for game in games}) == len(games)\n    canonical = ','.join(COLUMNS) + '\\n' + ''.join(\n        ','.join(game[col] for col in COLUMNS) + '\\n' for game in games)\n    digest = hashlib.sha256(canonical.encode('utf-8')).hexdigest()\n    splits = {split: [game for game in games if int(game['season']) in seasons]\n              for split, seasons in SPLITS.items()}\n    counts = {}\n    for split, subset in splits.items():\n        tally = Counter(map(outcome, subset))\n        counts[split] = {'games': len(subset), **{label: tally[i]\n                                               for i, label in enumerate(OUTCOMES)}}\n    raw_forecasts, late, reversals = elo(games)\n    baseline = tuple((counts['train'][label] + 1) / (counts['train']['games'] + 3)\n                     for label in OUTCOMES)\n    calibration = [(tuple(map(math.log, raw_forecasts[game['game_id']])), outcome(game))\n                   for game in splits['calibrate']]\n    beta = fit_inverse_temperature(calibration)\n    temperature = 1 / beta\n    test = [(raw_forecasts[game['game_id']], outcome(game)) for game in splits['test']]\n    scores = {\n        'baseline': evaluate([(baseline, y) for _, y in test]),\n        'raw_elo': evaluate(test),\n        'scaled_elo': evaluate([(softmax([beta * math.log(p) for p in prob]), y)\n                                for prob, y in test]),\n    }\n    figures = []\n\n    def compare(name, claimed, actual, digits=None):\n        match = actual == claimed if digits is None else round(actual, digits) == claimed\n        figures.append(dict(name=name, claimed=claimed, recomputed=actual, match=match))\n\n    compare('subset.rows', 1599, len(games))\n    for split, expected in {'train': (1055, 550, 5, 500), 'calibrate': (272,),\n                            'test': (272, 145, 0, 127)}.items():\n        for label, value in zip(('games', *OUTCOMES), expected):\n            compare(f'{split}.{label}', value, counts[split][label])\n    for name, expected in {'baseline': (0.4980, 0.6968), 'raw_elo': (0.4410, 0.6368),\n                           'scaled_elo': (0.4366, 0.6279)}.items():\n        for metric, claimed, actual in zip(('brier', 'log_loss'), expected, scores[name]):\n            compare(f'{name}.{metric}', claimed, actual, 4)\n    compare('T', 0.816, temperature, 4)\n    matching = [game for game in all_games if game['game_id'] == MISSING]\n    compare('2022_17_BUF_CIN.raw_rows', 0, len(matching))\n    matchup = [g['game_id'] for g in all_games\n               if (g['season'], g['week'], g['away_team'], g['home_team'])\n               == ('2022', '17', 'BUF', 'CIN')]\n    week_dates = defaultdict(list)\n    season_teams = defaultdict(set)\n    for game in games:\n        season = int(game['season'])\n        week_dates[season, int(game['week'])].append(date.fromisoformat(game['gameday']))\n        season_teams[season].update((game['home_team'], game['away_team']))\n    gap = min((min(week_dates[b]) - max(week_dates[a])).days\n              for a, b in pairwise(sorted(week_dates)) if a[0] == b[0])\n    team_changes = {str(b): {'removed': sorted(season_teams[a] - season_teams[b]),\n                             'added': sorted(season_teams[b] - season_teams[a])}\n                    for a, b in pairwise(sorted(season_teams))\n                    if season_teams[a] != season_teams[b]}\n    print(json.dumps({\n        'status': 'reproduced' if digest == EXPECTED and all(f['match'] for f in figures)\n                  else 'differs',\n        'retrievedUtc': Path(sys.argv[2]).read_text().strip(),\n        'rawFile': {'url': URL, 'sha256': hashlib.sha256(raw).hexdigest(), 'bytes': len(raw)},\n        'subsetHash': {'expected': EXPECTED, 'computed': digest, 'match': digest == EXPECTED,\n                       'rows': len(games), 'changedRows': [] if digest == EXPECTED else None},\n        'counts': counts,\n        'figures': figures,\n        'T': temperature,\n        'missingGame': {'id': MISSING, 'rawRows': len(matching), 'matchupRowIds': matchup},\n        'teamCodeChanges': team_changes,\n        'timingDiagnostics': {'earlierWeekGamesOnOrAfterCutoff': late,\n                              'sameTeamUpdateOrderReversals': reversals,\n                              'minimumDaysBetweenWeeks': gap},\n    }, indent=2))\n\n\nif __name__ == '__main__':\n    main()\n",
  "commands": [
    "curl -fsSL --max-time 40 https://github.com/nflverse/nflverse-data/releases/download/schedules/games.csv -o games.csv && date -u +%FT%TZ > retrieved.txt",
    "python3 audit.py games.csv retrieved.txt > computed.json"
  ],
  "reproductionInstructions": "In a working directory save the script field verbatim as audit.py, then run commands in order. computed.json contains the numeric audit and timing diagnostics. The cited source review is recorded here."
}
