Function: helper_nba_player_box()
helper_nba_player_box(
final):Row[]
Defined in: src/producers/espn_basketball_box.ts:593
NBA player box (sdv-py nba_player_box.helper_nba_player_box, hoopR
helper_espn_nba_player_box): one row per athlete from an ESPN Site v2 summary payload;
has plus_minus; lax gate.
Parameters
final
any
The ESPN summary payload (final.json) of one game. Reads header.id,
header.season.{year,type}, header.competitions[0].{date,competitors} and
boxscore.players[].{team,statistics[0].{keys,athletes}}.
Returns
Row[]
Row[]: one row per athlete, played athletes (with stats) then did-not-play ones,
sorted by home_away ("away" before "home", null last); [] when the payload has no
usable boxscore.
Throws
TypeError when header.competitions[0].date is not a string.
Throws
Error when that date does not parse as %Y-%m-%dT%H:%M[:%S] (a trailing Z is
stripped first).
Throws
RangeError when an id or score is a float inf string (Python int(float("inf"))).
Example
const summary = await sdv.nba.espnNbaSummary({ event_id: 401360428 });
const box = sdv.nba.helper_nba_player_box(summary);
typeof box[0].athlete_id; // "string" (ids are decimal strings)
Remarks
Shared by all four leagues (the others @see this block):
- Column order is WBB's canonical
dplyr::selectorder; NBA / WNBA insertplus_minusright afterfouls(kept a string such as"+16"); MBB movesactiveLAST. Only the columns present in the payload are emitted. - Id columns are decimal strings; Int32 stat columns parse only an ASCII
[+-]digitsstring in range (anything else isnull);minutesand the*_pctcolumns are numbers;game_date/game_date_timeareDates (see the module header). - Gate: the first team's first athlete must have a stats vector longer than 6 whose 7th entry
parses as a float; a stats / athletes count mismatch, a ragged stats vector or missing
keysreturns[](R'stryCatchskip). The STRICT gate (MBB, WBB) also requires the second team to ship athletes; the LAX gate (NBA, WNBA) publishes the first team's rows regardless. "M-A"pair stats (fieldGoalsMade-fieldGoalsAttemptedetc.) are split in place.reasonis emitted only when some athlete entry carries that key.