Sport::Analytics::NHL::Normalizer - normalize the merged boxscore, providing default values and erasing extra and redundant data.
Normalizes the merged boxscore, providing default values and erasing extra and redundant data.
These functions first summarize the events in the boxscore to help to try to find incosistencies with the summary in the player stats and in the team stats. Then all data in the boxscore is normalized and standardized, the PSTR, PEND and GEND events are added where necessary, and events are sorted and _id-ed properly.
use Sport::Analytics::NHL::Normalizer; my $event_summary = summarize($boxscore); normalize($boxscore);
The behaviour of the tests is controlled by several global variables: * $PLAYER_IDS - hashref of all player ids encountered.
assign_event_ids
Assigns flowing event ids to the boxscore events of the form:
* event_id : 1..@events * _id: game_id*10000 + event_id
Arguments: the events array reference Returns: void. Sets the events in the boxscore.
insert_pend
Inserts a PEND (Period End) event into the group of events of a given period.
Arguments:
* The arrayref of the events of the period * The number of the period * The last event of the period * The flag if the event ended the period (e.g. OT goal)
Returns: void. Modifies the period arrayref
insert_pstr
Inserts a PSTR (Period Start) event into the group of events of a given period.
* The arrayref of the events of the period * The number of the period * The first event of the period
normalize_boxscore
Does the module's main purpose: normalizes the boxscore
* boxscore to normalize * flag whether to skip summarizing
Returns: the $PLAYER_IDS hashref (q.v.) of all player ids encountered. Boxscore is modified.
normalize_event_by_type
Normalizes event according to its type.
Arguments: the event
Returns: void. The event is modified.
normalize_event_header
Normalizes event's "header" - the general data such as zone, game, strength, time data.
* The event * The boxscore
normalize_event_on_ice
Normalizes event's on ice player data - makes sure that only NHL player ids are there, and if a team's on ice data is not present, removes it completely.
Argument: the event
normalize_event_players_teams
Normalizes the teams and the players actively participating in the event.
normalize_events
Normalizes the boxscore's event and calls the lesser functions according to the event's data.
Argument: the boxscore
Returns: void. The boxscore is modified.
normalize_goal_event
Normalizes the specifics of the GOAL event.
normalize_header
Normalizes the game's header: date, location, attendance etc.
normalize_penl_event
Normalizes the specifics of the PENL event.
normalize_players
Normalizes the players on the rosters of the boxscore, their stats and strings.
Argument: the roster from the boxscore.
Returns: void. The roster is modified.
normalize_result
Produces and normalizes an extra sub-structure of game result of one of the forms: [2,0], [0,2], [2,1], [1,2], [1,1] - points gained by each of the teams. First number indicates away, second indicates home team.
Returns: void. The result is set in the boxscore.
normalize_team
Normalizes the data of a team in the NHL boxscore - coach, score, name, etc.
Argument: the boxscore team
Returns: void. The team is modified.
normalize_teams
Normalizes the teams in the NHL boxscore. Calls normalize_team (q.v.) and normalize_roster (q.v.)
sort_events
Sorts the events of the boxscore, inserting the PSTR, PEND and GEND events if necessary. The events are sorted by:
* Period * Timestamp * Event precedence rank (from PSTR (highest) to GEND (lowest)) * Event type * Event's active team
summarize
Generates a summary of events of a boxscore. Each playing event is converted into stats of the players and teams participating in it.
Returns: the summary of the events
summarize_goal
Summarizes the data of a GOAL event.
* the event summary * the goal event * the boxscore * the positions cache generated with Sport::Analytics::NHL::Tools (q.v.)
Returns: void. The event summary is modified.
summarize_other_event
Summarizes an event that is not a GOAL or a PENL.
* the event summary * the event
summarize_penalty
Summarizes the data of a PENL event.
* the event summary * the penalty event
More Hockey Stats, <contact at morehockeystats.com>
<contact at morehockeystats.com>
Please report any bugs or feature requests to contact at morehockeystats.com, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sport::Analytics::NHL::Normalizer. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
contact at morehockeystats.com
You can find documentation for this module with the perldoc command.
perldoc Sport::Analytics::NHL::Normalizer
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Sport::Analytics::NHL::Normalizer
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Sport::Analytics::NHL::Normalizer
CPAN Ratings
https://cpanratings.perl.org/d/Sport::Analytics::NHL::Normalizer
Search CPAN
https://metacpan.org/release/Sport::Analytics::NHL::Normalizer
To install Sport::Analytics::NHL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sport::Analytics::NHL
CPAN shell
perl -MCPAN -e shell install Sport::Analytics::NHL
For more information on module installation, please visit the detailed CPAN module installation guide.