podyum-stats-converter
v0.5.4
Published
Denormalizing game stats from event-centric to player-centric
Downloads
3
Readme
podyum-stats-converter
Converting game stats that are event-centric into the player centric format.
Usage
var statisticsConverter = require('podyum-stats-converter');
var actions; // event-centric json
var fieldLength; // field length in meters (integer)
var playerCentricJson = statisticsConverter.convert(actions, fieldLength);
event-centric vs. player-centric formats
Event-centric game statistics json format:
"actions": [
{
"defensive_team_id": <def_team_id>,
"quarter": <quarter>,
"offensive_team_id": <off_team_id>,
"events": [
{
"ball_start_position": {
"on_offensive_side": true,
"yard": 50
},
"down_number": 1,
"type": "Scrimmage",
"distance": 10
},
{
"type": "Pass",
"ball_position": {
"on_offensive_side": fakse,
"yard": 50
},
"player_id": <player_id>
}
]
}
]
Player-centric game statistics json format:
{
"player_id_1": {
"fumble_recovered": 3,
"rushing_yards": 21,
"tackles": 2,
"fumbles": 1
},
"player_id_2": {
"kickoff_attempts": 2,
"kickoff_touchbacks": 2
}
}