Using API calls in RapidMiner to fetch FIRST data
To do advanced analytics in RapidMiner with FIRST data, it would be useful to be able to use the available FIRST APIs to fetch data.
There are two API sources for reading FIRST data:
FRC Events API:
(https://frc-events.firstinspires.org/services/api)
To access this API, you need to register and receive a Username and Password
The Blue Alliance API:
(https://www.thebluealliance.com/apidocs)
To access this API, you need to have a user account on TBA and generate an authorization key (X-TBA-Auth-Key). This key can be generated on your TBA account page. Once you have generated the key, you can test the API calls on this page:
https://www.thebluealliance.com/apidocs/v3
Note that there is a very helpful app called Postman (https://www.postman.com/downloads/) which makes it easy to test API calls to either TBA or FRC Events API.
Example:
For a simple example, we would like to be able to read the OPR, DPR, and CCWMS for an event and visualize these rankings for each team. The API call looks like this:
https://www.thebluealliance.com/api/v3/event/2022mimil/oprs
Note that you can't simply load this URL in a browser. The X-TBA-Auth-Key must be included in a GET request header to the endpoint. You can use cURL from a command line or Postman to submit this query.
The data returned from this endpoint will be a JSON text array (example attached). We have tried using the Web Mining extension to get started:
We have not been able to do anything useful with the returned JSON data (due to our newbie-ness). Please advise on how we can get started using the data from these APIs. There is a huge amount of data in these repositories, especially match scoring data, which we think will be very useful in RapidMiner for building advanced strategies.
Answers
-
This JSON data that is accessed can be converted into tabular format for further visualization. Below is the snapshot of the data in tabular format after few operations using RapidMiner. Please find attached slides and RapidMiner process file for the details.
1 -
Thank you, Joseph! This is very helpful.
I have an additional question: is it necessary to convert the data type of the columns to real numbers? I'm wondering because when I click the column heading in the Results to sort on that column, it appears to sort "alphabetically". For example, sorting by the 'oprs' column:
0 -
Mike Young said:
Thank you, Joseph! This is very helpful.
I have an additional question: is it necessary to convert the data type of the columns to real numbers? I'm wondering because when I click the column heading in the Results to sort on that column, it appears to sort "alphabetically". For example, sorting by the 'oprs' column:
Yes, Mike you are right. We need to convert this to real. Parse Numbers do the job for us. I have attached process file for your reference.
0