Database file
fetch_games_teamwins() runs for the first time. It contains two tables: games (raw ingested data) and team_game_stats (engineered features for ML).
games table
Stores one row per team per game. Each NBA game produces two rows — one for each team.
Populated by fetch_games_teamwins().
CREATE TABLE statement
Columns
Unique NBA game identifier. Combined with
team_id to form the primary key.Date of the game as returned by the NBA API.
Numeric NBA team identifier. Combined with
game_id to form the primary key.Team abbreviation (e.g.,
"LAL", "BOS").Opponent team abbreviation.
Points scored by the team in this game.
Points scored by the opponent in this game.
Total rebounds for the team.
Total rebounds for the opponent.
Total assists for the team.
Total assists for the opponent.
1 if the team played at home; 0 if away. Derived from the MATCHUP field ("vs." = home, "@" = away).1 if the team won; 0 if the team lost.team_game_stats table
Stores engineered features computed from the games table. This table is the direct input to the ML training step.
Populated by generate_features_teamwins(). The table is fully replaced each time that function runs.
CREATE TABLE statement
Columns
NBA game identifier. Primary key.
Team abbreviation.
Opponent team abbreviation.
team_points_roll - opponent_points_roll. Positive values indicate the team is outscoring opponents on average.Elo rating difference between the two teams. Currently always
0 — reserved for future use.1 if the team played at home; 0 if away.1 if the team won; 0 if the team lost. Target variable for the classifier.Rolling average of points scored by the team over the last N games (default N=5).
Rolling average of points scored by the opponent over the last N games (default N=5).
Rolling average of rebounds for the team over the last N games.
Rolling average of rebounds for the opponent over the last N games.
Rolling average of assists for the team over the last N games.
Rolling average of assists for the opponent over the last N games.
elo_diff is present in the schema but is always stored as 0. It is excluded from the feature set used by the current ML model. See train_model_teamwins() for the exact feature columns used during training.