Building NFL Game Projection Models with Historical Scores, Weather, and Venue Data
Extract historical NFL scores, team EPA, kickoff temperature, wind speed, roof type, and stadium scoring profiles for game projection models.
Why environmental context matters as much as team strength
A projection model built solely on season-average points scored treats a calm 67°F afternoon game at Levi's Stadium identically to a freezing 26°F wind-swept AFC Championship at Empower Field at Mile High. Real 2025 postseason games in OpenPigskin's archive show how dramatically scoring environments diverge.
On 2026-01-25, the two Conference Championships produced completely opposite scripts: in Seattle (game_nfl_2025_21_LA_SEA at Lumen Field, outdoors, fieldturf, 41°F, 2 mph wind), the Seahawks beat the Rams 31–27 with +15.352 and +14.146 team EPA. Hours earlier in Denver (game_nfl_2025_21_NE_DEN at Empower Field at Mile High, outdoors, grass, 26°F, 10 mph wind), New England edged Denver 10–7 as both offenses posted deeply negative EPA (-14.895 and -19.009). Two weeks later at Levi's Stadium (67°F, 7 mph wind), Super Bowl LX finished 29–13 with 42 combined points.
With OpenPigskin's Developer plan and above, every game across 28 seasons (7,440 games from 1999-09-12 through 2026-11-25) exposes structured scores, venue metadata, roof, playing surface, weather, coaches, starting QBs and team EPA over REST.
Assemble the feature matrix from /v1/games, /v1/games/{id} and /v1/venues/{id}
Start by paging through historical matchups with GET /v1/games?season=2025&limit=100 (using meta.next_cursor formatted as date|game_id). Each summary item already gives you date, season, week, game_type, away/home scores, overtime, winner_id and venue (id, name, roof, surface).
For detailed modeling features, fetch GET /v1/games/{id} for weather (temp_f, wind_mph), quarter_scores, coaches, starting_qbs, referee and team_epa, and enrich each stadium once via GET /v1/venues/{id} for long-run avg_total_points and home_win_rate.
{
"data": {
"id": "game_nfl_2025_21_NE_DEN",
"season": 2025,
"week": 21,
"game_type": "CON",
"date": "2026-01-25",
"away": { "id": "team_nfl_ne", "abbr": "NE", "score": 10 },
"home": { "id": "team_nfl_den", "abbr": "DEN", "score": 7 },
"venue": {
"id": "venue_nfl_empower-field-at-mile-high",
"name": "Empower Field at Mile High",
"roof": "outdoors",
"surface": "grass"
},
"weather": { "temp_f": 26, "wind_mph": 10 },
"team_epa": { "away": -14.895, "home": -19.009 }
},
"meta": { "source": "nflverse", "licence": "CC BY 4.0" }
}Handle null indoor weather cleanly instead of imputing fake temperatures
OpenPigskin enforces a strict zero-fabrication policy: when a game is played indoors under a dome or closed roof, nflverse does not invent outdoor weather readings, so weather returns { temp_f: null, wind_mph: null }. You can see this directly on Super Bowl LIX (game_nfl_2024_22_KC_PHI at venue_nfl_mercedes-benz-superdome, roof: dome) and Week 18's game_nfl_2025_18_NO_ATL (venue_nfl_mercedes-benz-stadium, roof: closed).
In your feature engineering pipeline, never drop rows where temp_f is null (which would delete every dome game from your training set) and never zero-fill temperature (which makes a climate-controlled dome look like 0°F!). Instead, encode an explicit is_indoor binary feature from roof in {"dome", "closed"} and pair it with interaction features like wind_mph_outdoor and freezing_flag (not is_indoor and temp_f <= 32).
Stadium baselines from /v1/venues/{id} reinforce why roof type belongs in every total model: Mercedes-Benz Superdome (dome, sportturf) averages 51.30 points across 129 games (0.605 home win rate) and Mercedes-Benz Stadium (closed, fieldturf) averages 46.47 points across 79 games, whereas outdoor grass venues like Empower Field at Mile High (41.68 points across 66 games, 0.606 home win rate) and TIAA Bank Stadium (42.41 points across 64 games, 0.438 home win rate) score meaningfully lower.
Build leak-free rolling team EPA and weather features in Python
The most common bug in sports prediction models is lookahead leakage: using end-of-season team stats or postgame venue averages to predict Week 6. Because OpenPigskin returns games with exact ISO dates and season/week integers, sorting chronologically before computing rolling team means keeps your feature matrix strictly causal.
import json
import os
import urllib.request
from collections import defaultdict, deque
API_KEY = os.environ["OPENPIGSKIN_KEY"]
def get_json(path: str) -> dict:
req = urllib.request.Request(
f"https://openpigskinapi.com{path}",
headers={"Authorization": f"Bearer {API_KEY}"},
)
with urllib.request.urlopen(req) as resp:
return json.loads(resp.read().decode("utf-8"))
def build_feature_rows(game_ids: list[str], window: int = 5) -> list[dict]:
details = [get_json(f"/v1/games/{gid}")["data"] for gid in game_ids]
# Sort strictly chronologically so rolling stats only ever see prior games
details.sort(key=lambda g: (g["date"], g["id"]))
venue_cache: dict[str, dict] = {}
recent_margin = defaultdict(lambda: deque(maxlen=window))
recent_epa = defaultdict(lambda: deque(maxlen=window))
rows: list[dict] = []
for g in details:
vid = g["venue"]["id"] if g.get("venue") else None
if vid and vid not in venue_cache:
venue_cache[vid] = get_json(f"/v1/venues/{vid}")["data"]
vdoc = venue_cache.get(vid, {})
away, home = g["away"]["abbr"], g["home"]["abbr"]
roof = (g["venue"].get("roof") or "").lower() if g.get("venue") else ""
is_indoor = int(roof in {"dome", "closed"})
temp_f = g["weather"]["temp_f"]
wind_mph = g["weather"]["wind_mph"]
rows.append({
"game_id": g["id"],
"date": g["date"],
"home_team": home,
"away_team": away,
"home_roll_margin": round(sum(recent_margin[home]) / len(recent_margin[home]), 2) if recent_margin[home] else None,
"away_roll_margin": round(sum(recent_margin[away]) / len(recent_margin[away]), 2) if recent_margin[away] else None,
"home_roll_epa": round(sum(recent_epa[home]) / len(recent_epa[home]), 3) if recent_epa[home] else None,
"away_roll_epa": round(sum(recent_epa[away]) / len(recent_epa[away]), 3) if recent_epa[away] else None,
"is_indoor": is_indoor,
"is_turf": int((g["venue"].get("surface") or "").lower() != "grass") if g.get("venue") else 0,
"outdoor_wind_mph": 0 if is_indoor else (wind_mph if wind_mph is not None else None),
"freezing_outdoor": int(not is_indoor and temp_f is not None and temp_f <= 32),
"venue_avg_points": vdoc.get("avg_total_points"),
"venue_home_win_rate": vdoc.get("home_win_rate"),
"target_home_margin": g["home"]["score"] - g["away"]["score"],
"target_total_points": g["home"]["score"] + g["away"]["score"],
})
# Update rolling history AFTER emitting the pregame feature row
margin = g["home"]["score"] - g["away"]["score"]
recent_margin[home].append(margin)
recent_margin[away].append(-margin)
if g["team_epa"]["home"] is not None:
recent_epa[home].append(g["team_epa"]["home"])
if g["team_epa"]["away"] is not None:
recent_epa[away].append(g["team_epa"]["away"])
return rowsCombine historical training features with live /v1/schedule inference
Once your regression or gradient-boosted model is trained on historical nflverse records (CC BY 4.0 explicitly permits commercial ML training with attribution), score upcoming slates by pulling the next 14 days of matchups from GET /v1/schedule (source: ESPN, licence: null).
Because /v1/schedule normalizes teams to the same team_nfl_{abbr} IDs used in the archive, you can map upcoming kickoffs directly to each franchise's latest rolling EPA and margin states, look up the stadium via GET /v1/search?q=...&type=venue and GET /v1/venues/{id}, and check starting QB indoor/outdoor splits via GET /v1/players/{id}/splits before kickoff.