DWBoyGenius

BenchHack

Somebody had the great idea that we could automatically generate teams for our hockey club using age, arbitrary ranking and maybe a few other things.

I knew that if we had the fun little tool, I didn’t want to be manually pulling data from the a website every week. I thought we should also automatically get the data from the source, where we already have the list of players attending.

Screenshot of a chat with BenchApp telling me they don't have a public API.

We use a fantastic tool called BenchApp–which is even better when people use it–to manage our schedule and who is checking in or out. I figured we could use their API and just pull in all the data we needed and automate it. We have a PRO license after all.

Fortunately, I didn’t have to wait until Monday to be disappointed. I had already put together the script to generate the teams, so I figured I would manually scrape the site and extract the data.

Extracting the data

I really thought it was going to be terrible, but Beautiful Soup made it easy. The only real challenge was finding the data in the HTML before I could extract it programmatically.

It took a while to visit every game page from every season for every team. With having to wait for javascript to load and having to visit pages to change sessions variables, I think it took a little over an hour to capture everything I needed.

Aside from the BenchApp data, we maintain player rankings outside of the system. They aren’t available on the site in bulk and we’d have to visit every user profile to get it.

Exposing the data

Sharing all the data through Tableau was a no-brainer. It provides a simple interface to navigate the data and check out the automatically generated potential team lineups. See below. The names have been scrambled to protect the innocents.

Screenshot of a Tableau report showing BenchApp data and potential teams.

This weekend we’ll try the dynamic team generator and see how it works. Maybe we’ll let the group vote on 1 of the 5 randomly generated teams.

I can’t wait to replace all this manual work with API calls. The BenchApp API has been “in development” for a little over two years–soon! They do a great job over there and maybe they’ll need some, uh, ahem, help.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *