Store hit placement on atbats and hits collections
kruser opened this issue · 1 comments
MLB stores an X,Y coordinate on each hit. They use this as a visualization for their GameDay apps, but it would be better served to store it as an angle in the field, where the range of the field is covered by 90 degrees.
An example of a game of hits
http://gd2.mlb.com/components/game/mlb/year_2013/month_07/day_13/gid_2013_07_13_colmlb_lanmlb_1/inning/inning_hit.xml
Storing this data underneath pitch and atbat documents would allow us to query hit placement based on counts, pitch types, pitch placement, etc.
I have added hit data to the atbat and pitch collections. This is for all hit balls in play (not foul balls). In addition to the x/y coordinates I added a HitAdjuster.pm module to calculate the angle of the hit (on the field, not in the air) and also to estimate the distance.
Take a look at the 'hip' property in the atbats or pitches collection. Note that it is normal for a pitch or atbat not to have a 'hip' property as not all pitches or atbats result in a hit ball.
Note that if you have previously collected data using atbat-mondodb you should drop those collections and recollect.
db.atbats.drop()
db.games.drop()
db.pitches.drop()