Variable: helper_nba_game_data
consthelper_nba_game_data: (pbp_txt,init) => [Record<string,any>,Init] =NBA.game_data
Defined in: src/producers/espn_basketball_pbp.ts:1028
NBA home / away identification (sdv-py helper_nba_game_data(pbp_txt, init)): [pbp_txt, init].
homeTeamSpread follows homeFavorite (a one-element array in init stays one, as numpy).
Parameters
pbp_txt
any
The trimmed game dict. Reads header.competitions[0]
(competitors[].{homeAway, team.{id,location,name,abbreviation}}, playByPlaySource, boxscoreSource) and
header.season. Never mutated: the touched header path is copied.
init
Init
The pickcenter dict (gameSpread, overUnder, homeFavorite,
gameSpreadAvailable), all four keys required.
Returns
[Record<string, any>, Init]
[pbp_txt, init]: the game dict with timeouts: {}, teamInfo (= the copied
header.competitions[0], now carrying home / away team objects), season,
playByPlaySource, boxscoreSource, the four spread keys and homeTeamSpread
(+|spread| when home is favored, else -|spread|); and init extended with homeTeamId,
homeTeamMascot, homeTeamName, homeTeamAbbrev, homeTeamNameAlt and the five awayTeam*
twins.
Throws
Error prefixed KeyError: / IndexError: when a read key or competitor is absent;
ValueError: when a team id is not an int; TypeError: when init.gameSpread is not a
number (Python abs).
Example
const init = sdv.nba.helper_nba_pickcenter(summary);
const [txt, init2] = sdv.nba.helper_nba_game_data(summary, init);
init2.homeTeamAbbrev;
Remarks
Shared by all four leagues (the others @see this block): the team ids in init are py ints
(JS numbers) here; they become decimal strings only in the plays rows. homeTeamNameAlt is
the location with Stat... shortened to St. The first competitor's homeAway decides which
side is home.