Dec 9th, 2017: [EN][Kibana] A Competitive Edge in Sports

I play adult league ice hockey here in California. I don’t make time to practice, so my only ice time is during games. Given this, is there something I can do between games to give my team an edge? Yes! GRAPHS! Everybody loves graphs, right? Check out this graph-story about Stephen Curry’s incredible outlier performance in basketball.

Our hockey league posts the score sheets online, and after putting these sheets into Elasticsearch, I can build a pre-game report in Kibana. Since logs are my jam, I transform the score sheets into structured log events: game time, season, team, level, player, referee, etc. Each season is about 100,000 events.

My scoresheet scraper takes each score sheet and produces a sequence of events as JSON:

{
    "player": {
        "number": 22,
        "name": "Jordan Sissel"
    },
    "infraction": "Interference",
    "minutes": 2,
    "time": {
        "game": 820,
        "period": 1,
        "real": "2017-10-10T23:13:40.000+00:00"
    },
    "level": "Adult Division 7B",
    "scorekeep": "Thomas Holford",
    "referees": [ "Dave Gaul", "Michael Stivers" ]
    "location": "San Jose East",
    "season": 40,
    "team": "Hectors Pool Service",
    "event": "penalty",
}

What’s in the pre-game report? Top scorers, top penalty earners, and activity over the past year. The idea is to tell us which opponents need extra defensive coverage, who is most likely to lose their cool (haha, ice! It’s cold!) and take a penalty during a game, etc.

Starting top-left and going clockwise, these are the Kibana visualizations in the report: Heatmap of players and scoring events; TSVB “Top N” for penalties, vertical bar of hockey activity over a date histogram, and a data table with the rows using a terms aggregation on player name (and the metric is a sum of the penalty minutes).

What about penalty-takers? Well, Kibana lets me zoom in with just a click, and it shows me David (top penalty earner) takes penalties that generally happen in close-quarters (roughing, high-sticking, slashing, and the like):

Knowing this pattern gives us an advantage! You can use this knowledge try and draw a penalty when David is covering you on the ice.


Telling More Stories

This data set is pretty large, and I enjoy telling stories with data. What else can we learn from this data?

I can certainly tell you who is on Santa’s naughty list by looking at who has earned the most penalty time this year:

The above visual is a data table and setting the metrics to “Sum of minutes” and split rows with a terms aggregation on the player.name.keyword field.

What’s the league’s favorite (most common) penalty?

Ice is slippery! Naturally, this means that we fall down a lot. Maybe this is why the most common penalty is tripping!

image7

This visual is a metric using a terms aggregation on the infraction field with a count of 1.

What are the most common penalties?

This tag cloud visual uses a terms aggregation on the ‘infraction’ field.

As I browsed this list, I wondered: What is “whining”? I know what whining means, but is this defined by the league? I checked the rule book and was unable to find it, unfortunately. I suppose it’s all up to the referee’s discretion. There were only two whining penalties handed out this year. One of them was a massive 10-minute penalty, which is a game misconduct, and it ejects you from the game!

Lesson learned: Keep my mouth shut the next time the referee makes a call I have some opinions about!

Know Your Referees

If you know the referee’s history, maybe know what you can get away with on the ice? :wink:

Above is a Heatmap with a terms aggregations on referees and infractions with both axes limited to 10 items.

It’s getting a bit chippy out there!

General hockey experience tells me that aggression trends upwards during the game. Does the data confirm this experience?

This is a vertical bar chart with a histogram over the ‘game’ time (60 minutes in a game) with 1-minute buckets. You can see a clear upward trend across the game and also something I didn’t expect: the first two minutes of each period have far fewer penalties. In contrast, the end of each period (each period is 20 minutes) experiences a massive spike in penalties.

Kibana makes for good storytelling and also help gives my team a little bit of an edge on the ice. Be careful out there: the ice is slippery!

3 Likes

Always interesting to see data in action like that. And on a non "technical" subject.
I loved the use of heatmap. And the last barchart reminds me this one!

1 Like