Variable: helper_nba_pbp_features
consthelper_nba_pbp_features: (game_id,pbp_txt,init) =>Record<string,any> =NBA.pbp_features
Defined in: src/producers/espn_basketball_pbp.ts:1059
NBA play features + timeouts (sdv-py helper_nba_pbp_features(game_id, pbp_txt, init)):
quarters, 720-second ladder.
Parameters
game_id
unknown
The ESPN event id; becomes the Int32 game_id column.
pbp_txt
any
The game dict after helper_nba_game_data. Reads header.season and plays.
init
Init
The init dict helper_nba_game_data returned.
Returns
Record<string, any>
{ ...pbp_txt, plays, timeouts }: plays as Row[] (py's columns, in order; ids as
decimal strings) and timeouts as
{ [homeTeamId]: { "1": ids, "2": ids }, [awayTeamId]: {...} } of timeout play ids split by half.
Throws
Error prefixed KeyError: when init.homeTeamId / awayTeamId is absent, plus
everything _playsFrame and _features throw.
Throws
TypeError when a play / team id is a JS number beyond Number.MAX_SAFE_INTEGER.
Example
const [txt, init2] = sdv.nba.helper_nba_game_data(summary, sdv.nba.helper_nba_pickcenter(summary));
const done = sdv.nba.helper_nba_pbp_features(401360428, txt, init2);
done.plays[0]["start.game_seconds_remaining"]; // 2880 for a first-quarter play at 12:00
Remarks
Shared by all four leagues (the others @see this block):
- A team timeout (
RegularTimeOut,ShortTimeOut,Full/Short/No/Reset Timeout; official / TV timeouts excluded) is credited to the play's ownteam.id; a play without one falls back to the side's abbreviation / location / mascot / alt name as a whole word in the play text (case-insensitive). - Every lag / lead /
game_play_numberop is pergame_id. - NBA:
period.number/qtr/periodInt32;clock.displayValueandtimeget a"0:"prefix when the clock has no colon;clock.minutes/clock.secondsFloat32; ladders 720 / 1440 / 2160 / 2880, OT 300; timeouts split atperiod <= 2. - Season and the team-id columns are cast Int32 for NBA / WNBA and left as is for MBB / WBB.
timeoutskeys are strings here (py: ints); JS orders integer keys ascending.