Data, TBA, and You

The Blue Alliance has lots of data, in fact, almost too much to try and find out what you want. Let’s talk about the formats you can get data from The Blue Alliance, and some starting points as to how to use it.


Data Dumps

Periodically, the internal data of a given season is pushed to our data repository on GitHub, containing files for all the teams listed in The Blue Alliance, every event we have on record, every award we have on record, every match, playoff, and alliance we have in the entire datastore of The Blue Alliance. This data is downloadable as a standalone file-set and can easily be imported into Excel, Google Sheets, or your analysis tool of choice. To download the entire repository, click the “Clone or Download” button in the top right corner of the repository, or you can download individual files with the “View Raw” button per-file.

Example format for the CSV files you’ll see in The Blue Alliance data repository.

 

But what if you need something live, where it gets data from 2019, like a scouting tool, for that, there’s the API!

APIv3

The Blue Alliance API (Application Programming Interface) not only makes both our iOS and our Android apps possible, but it’s also a fairly easy format to get data in for writing analysis programs, scouting apps, and more. You can actually see the type of data provided without generating an API key, so as long as you’re logged into your myTBA account!

Example API request as seen in Firefox. (“/team/frc254”) Cheesy!

 

The overall list of APIs available to developers and end users (Read v3, Write, etc.) as well as usage terms are available here, with Read APIv3 documentation and language libraries automatically generated with every new commit to TBA. “How do I use it”, you might ask. Well, for Python and JS programmers, all of the data is provided in JSON, making it pretty easy to use in your programs. There are libraries you can use to access the data pre-made, as mentioned earlier, but you also can just get the data via standard GET request with any HTTPS library. All you need to do is set the ‘X-TBA-Auth-Key’ to one. That being said it’s pretty straightforward.

All you need to do is log into your TBA Account and scroll down to “Read API Keys”, add a description, and click add! Done, just like that! Be sure to not share your key around or publish it online, treat it as you would a password.

A screenshot of what a Read API Key will look like once generated. Don’t worry, this one is just an example and doesn’t work. Be sure to generate your own!

One way you’re likely to use the program is to write scouting programs, so let’s take a look at what one might look like. My programs don’t use a generated library, but the idea is the same. First, let’s get a list of teams at an event and their rookie year.

APIv3 shows us that we have an endpoint titled “/event/{event key}/teams”, where event key is the one shown in the URL of the event.

Quickly dropping that into our browser confirms it has the data we want, as shown below.

Writing a quick script and running it yields the following results.

With the ripe knowledge of The Blue Alliance API, data dumps, and your individual skills to analyze and use the data from TBA, the power is now in your hands to build incredible things using our data. So build that next great scouting app, and show it off to us and the community.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s