Skip to main content

Variable: BASKETBALL_BOX_PRODUCERS

const BASKETBALL_BOX_PRODUCERS: object

Defined in: src/producers/espn_basketball_box.ts:714

{ league: { helper_<lg>_player_box, helper_<lg>_team_box } }: the box producers keyed by league, which src/index.ts merges onto sdv.nba / sdv.wnba / sdv.mbb / sdv.wbb under both the snake_case name and a camelCase alias.

Type Declaration​

mbb​

mbb: object

mbb.helper_mbb_player_box​

helper_mbb_player_box: (final) => Row[]

MBB player box (sdv-py mbb_player_box.helper_mbb_player_box, hoopR helper_espn_mbb_player_box): no plus_minus; strict gate; active last.

Parameters​
final​

any

The ESPN summary payload of one men's college game (same keys as the NBA helper).

Returns​

Row[]

Row[], one row per athlete, with active as the last column; [] when unusable or when the second team ships no athletes.

Example​
const summary = await sdv.mbb.espnMbbSummary({ event_id: 401638645 });
const box = sdv.mbb.helper_mbb_player_box(summary);
See​

helper_nba_player_box for the shared column, dtype, gate and error rules.

mbb.helper_mbb_team_box​

helper_mbb_team_box: (final) => Row[]

MBB team box (sdv-py helper_mbb_team_box; hoopR helper_espn_mbb_team_box; shared basketball core).

Parameters​
final​

any

The ESPN summary payload of one men's college game (same keys as the NBA helper).

Returns​

Row[]

Row[] of two team rows; [] when unusable.

Example​
const summary = await sdv.mbb.espnMbbSummary({ event_id: 401638645 });
const teams = sdv.mbb.helper_mbb_team_box(summary);
See​

helper_nba_team_box for the shared column, gate and error rules.

nba​

nba: object

nba.helper_nba_player_box​

helper_nba_player_box: (final) => Row[]

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::select order; NBA / WNBA insert plus_minus right after fouls (kept a string such as "+16"); MBB moves active LAST. Only the columns present in the payload are emitted.
  • Id columns are decimal strings; Int32 stat columns parse only an ASCII [+-]digits string in range (anything else is null); minutes and the *_pct columns are numbers; game_date / game_date_time are Dates (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 keys returns [] (R's tryCatch skip). 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-fieldGoalsAttempted etc.) are split in place.
  • reason is emitted only when some athlete entry carries that key.

nba.helper_nba_team_box​

helper_nba_team_box: (final) => Row[]

NBA team box (sdv-py helper_nba_team_box, which delegates to the shared wbb_team_box.helper_wbb_team_box; hoopR helper_espn_nba_team_box): one row per team from an ESPN Site v2 summary payload.

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.teams[].{team,statistics}.

Returns​

Row[]

Row[] of exactly two rows (team 0 then team 1): the game columns, team_* meta, team_home_away / team_score / team_winner, the stat columns, then opponent_team_*; [] when the payload has no usable boxscore.

Throws​

TypeError when header.competitions[0].date is not a string, or a competitor is null (Python in on None).

Throws​

Error when that date does not parse as %Y-%m-%dT%H:%M[:%S].

Throws​

RangeError when a team id or score is a float inf string.

Example​
const summary = await sdv.nba.espnNbaSummary({ event_id: 401360428 });
const teams = sdv.nba.helper_nba_team_box(summary);
teams.length; // 2
Remarks​

Shared by all four leagues (the others @see this block):

  • The same core runs for every league; there is no per-league column divergence.
  • Stat columns are ordered alphabetically by their ESPN name (R tidyr::spread), with the "M-A" pairs split in place; the column set is the union of both rows (row-1 order first).
  • Returns [] (R's tryCatch skip) when either team's statistics is empty, a team repeats a stat name, winner is absent from BOTH competitors, or a split "M-A" stat is missing for both teams.
  • Each team's competitor is the index-aligned one when the ids match, else the other; an unparseable id on either side leaves team_home_away / team_score / team_winner null.
  • Id columns are decimal strings; the *_pct columns are numbers; the rest of the dtype rules are those of helper_nba_player_box.

wbb​

wbb: object

wbb.helper_wbb_player_box​

helper_wbb_player_box: (final) => Row[]

WBB player box (sdv-py wbb_player_box.helper_wbb_player_box, wehoop helper_espn_wbb_player_box): no plus_minus; strict gate.

Parameters​
final​

any

The ESPN summary payload of one women's college game (same keys as the NBA helper).

Returns​

Row[]

Row[], one row per athlete, in WBB's canonical column order; [] when unusable or when the second team ships no athletes.

Example​
const summary = await sdv.wbb.espnWbbSummary({ event_id: 401587390 });
const box = sdv.wbb.helper_wbb_player_box(summary);
See​

helper_nba_player_box for the shared column, dtype, gate and error rules.

wbb.helper_wbb_team_box​

helper_wbb_team_box: (final) => Row[]

WBB team box (sdv-py wbb_team_box.helper_wbb_team_box, the shared core itself; wehoop helper_espn_wbb_team_box).

Parameters​
final​

any

The ESPN summary payload of one women's college game (same keys as the NBA helper).

Returns​

Row[]

Row[] of two team rows; [] when unusable.

Example​
const summary = await sdv.wbb.espnWbbSummary({ event_id: 401587390 });
const teams = sdv.wbb.helper_wbb_team_box(summary);
See​

helper_nba_team_box for the shared column, gate and error rules.

wnba​

wnba: object

wnba.helper_wnba_player_box​

helper_wnba_player_box: (final) => Row[]

WNBA player box (sdv-py wnba_player_box.helper_wnba_player_box, wehoop helper_espn_wnba_player_box): has plus_minus; lax gate.

Parameters​
final​

any

The ESPN summary payload of one WNBA game (same keys as the NBA helper).

Returns​

Row[]

Row[], one row per athlete, in the NBA / WNBA column order; [] when unusable.

Example​
const summary = await sdv.wnba.espnWnbaSummary({ event_id: 401320565 });
const box = sdv.wnba.helper_wnba_player_box(summary);
See​

helper_nba_player_box for the shared column, dtype, gate and error rules.

wnba.helper_wnba_team_box​

helper_wnba_team_box: (final) => Row[]

WNBA team box (sdv-py helper_wnba_team_box; wehoop helper_espn_wnba_team_box; shared basketball core).

Parameters​
final​

any

The ESPN summary payload of one WNBA game (same keys as the NBA helper).

Returns​

Row[]

Row[] of two team rows; [] when unusable.

Example​
const summary = await sdv.wnba.espnWnbaSummary({ event_id: 401320565 });
const teams = sdv.wnba.helper_wnba_team_box(summary);
See​

helper_nba_team_box for the shared column, gate and error rules.

Remarks​

Every member is a pure (final) => Row[]; the map is the single registration point.

Example​

BASKETBALL_BOX_PRODUCERS.mbb.helper_mbb_team_box(summary);