/FRCModeling

Build predictive models for FRC matches.

Primary LanguageJupyter NotebookMIT LicenseMIT

FRCDataAnalytics

The goal of this repo is to generate predictive models for FRC matches. The folders are structured by competition year. See 2019/generate_training_data.py for a very bare-bones approach to producing input examples. I've achieved about 68% accuracy using a random forest implementation (four-fold cross-validation) using only the team names as inputs. Note however this uses information from the future to predict past results. Lots of work to do to add more features (even historical features) and also build towards only predicting forwards in time.

The rest of this README has auto-generated details about the swagger API generated from https://www.thebluealliance.com/swagger/api_v3.json I encountered some unexpected webcast types and made minor modifications to models\webcast.py to handle them. See https://github.com/swagger-api/swagger-codegen#online-generators for more information on auto-generating client API code. Note there's a lot of missing information below. Start from 2019/generate_training_data.py for a working example.

For 2020 notebooks see the 2020 folder.

swagger-client details

Overview

Information and statistics about FIRST Robotics Competition teams and events.

Authentication

All endpoints require an Auth Key to be passed in the header X-TBA-Auth-Key. If you do not have an auth key yet, you can obtain one from your Account Page. A User-Agent header may need to be set to prevent a 403 Unauthorized error.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 3.04.1
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com//.git

(you may need to run pip with root permission: sudo pip install git+https://github.com//.git)

Then import the package:

import swagger_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['X-TBA-Auth-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-TBA-Auth-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.TBAApi(swagger_client.ApiClient(configuration))
if_modified_since = 'if_modified_since_example' # str | Value of the `Last-Modified` header in the most recently cached response by the client. (optional)

try:
    api_response = api_instance.get_status(if_modified_since=if_modified_since)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling TBAApi->get_status: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://www.thebluealliance.com/api/v3

Class Method HTTP request Description
TBAApi get_status GET /status
DistrictApi get_district_events GET /district/{district_key}/events
DistrictApi get_district_events_keys GET /district/{district_key}/events/keys
DistrictApi get_district_events_simple GET /district/{district_key}/events/simple
DistrictApi get_district_rankings GET /district/{district_key}/rankings
DistrictApi get_district_teams GET /district/{district_key}/teams
DistrictApi get_district_teams_keys GET /district/{district_key}/teams/keys
DistrictApi get_district_teams_simple GET /district/{district_key}/teams/simple
DistrictApi get_districts_by_year GET /districts/{year}
DistrictApi get_event_district_points GET /event/{event_key}/district_points
DistrictApi get_team_districts GET /team/{team_key}/districts
EventApi get_district_events GET /district/{district_key}/events
EventApi get_district_events_keys GET /district/{district_key}/events/keys
EventApi get_district_events_simple GET /district/{district_key}/events/simple
EventApi get_event GET /event/{event_key}
EventApi get_event_alliances GET /event/{event_key}/alliances
EventApi get_event_awards GET /event/{event_key}/awards
EventApi get_event_district_points GET /event/{event_key}/district_points
EventApi get_event_insights GET /event/{event_key}/insights
EventApi get_event_match_timeseries GET /event/{event_key}/matches/timeseries
EventApi get_event_matches GET /event/{event_key}/matches
EventApi get_event_matches_keys GET /event/{event_key}/matches/keys
EventApi get_event_matches_simple GET /event/{event_key}/matches/simple
EventApi get_event_op_rs GET /event/{event_key}/oprs
EventApi get_event_predictions GET /event/{event_key}/predictions
EventApi get_event_rankings GET /event/{event_key}/rankings
EventApi get_event_simple GET /event/{event_key}/simple
EventApi get_event_teams GET /event/{event_key}/teams
EventApi get_event_teams_keys GET /event/{event_key}/teams/keys
EventApi get_event_teams_simple GET /event/{event_key}/teams/simple
EventApi get_event_teams_statuses GET /event/{event_key}/teams/statuses
EventApi get_events_by_year GET /events/{year}
EventApi get_events_by_year_keys GET /events/{year}/keys
EventApi get_events_by_year_simple GET /events/{year}/simple
EventApi get_team_event_awards GET /team/{team_key}/event/{event_key}/awards
EventApi get_team_event_matches GET /team/{team_key}/event/{event_key}/matches
EventApi get_team_event_matches_keys GET /team/{team_key}/event/{event_key}/matches/keys
EventApi get_team_event_matches_simple GET /team/{team_key}/event/{event_key}/matches/simple
EventApi get_team_event_status GET /team/{team_key}/event/{event_key}/status
EventApi get_team_events GET /team/{team_key}/events
EventApi get_team_events_by_year GET /team/{team_key}/events/{year}
EventApi get_team_events_by_year_keys GET /team/{team_key}/events/{year}/keys
EventApi get_team_events_by_year_simple GET /team/{team_key}/events/{year}/simple
EventApi get_team_events_keys GET /team/{team_key}/events/keys
EventApi get_team_events_simple GET /team/{team_key}/events/simple
EventApi get_team_events_statuses_by_year GET /team/{team_key}/events/{year}/statuses
ListApi get_district_events GET /district/{district_key}/events
ListApi get_district_events_keys GET /district/{district_key}/events/keys
ListApi get_district_events_simple GET /district/{district_key}/events/simple
ListApi get_district_rankings GET /district/{district_key}/rankings
ListApi get_district_teams GET /district/{district_key}/teams
ListApi get_district_teams_keys GET /district/{district_key}/teams/keys
ListApi get_district_teams_simple GET /district/{district_key}/teams/simple
ListApi get_event_teams GET /event/{event_key}/teams
ListApi get_event_teams_keys GET /event/{event_key}/teams/keys
ListApi get_event_teams_simple GET /event/{event_key}/teams/simple
ListApi get_event_teams_statuses GET /event/{event_key}/teams/statuses
ListApi get_events_by_year GET /events/{year}
ListApi get_events_by_year_keys GET /events/{year}/keys
ListApi get_events_by_year_simple GET /events/{year}/simple
ListApi get_team_events_statuses_by_year GET /team/{team_key}/events/{year}/statuses
ListApi get_teams GET /teams/{page_num}
ListApi get_teams_by_year GET /teams/{year}/{page_num}
ListApi get_teams_by_year_keys GET /teams/{year}/{page_num}/keys
ListApi get_teams_by_year_simple GET /teams/{year}/{page_num}/simple
ListApi get_teams_keys GET /teams/{page_num}/keys
ListApi get_teams_simple GET /teams/{page_num}/simple
MatchApi get_event_match_timeseries GET /event/{event_key}/matches/timeseries
MatchApi get_event_matches GET /event/{event_key}/matches
MatchApi get_event_matches_keys GET /event/{event_key}/matches/keys
MatchApi get_event_matches_simple GET /event/{event_key}/matches/simple
MatchApi get_match GET /match/{match_key}
MatchApi get_match_simple GET /match/{match_key}/simple
MatchApi get_match_timeseries GET /match/{match_key}/timeseries
MatchApi get_team_event_matches GET /team/{team_key}/event/{event_key}/matches
MatchApi get_team_event_matches_keys GET /team/{team_key}/event/{event_key}/matches/keys
MatchApi get_team_event_matches_simple GET /team/{team_key}/event/{event_key}/matches/simple
MatchApi get_team_matches_by_year GET /team/{team_key}/matches/{year}
MatchApi get_team_matches_by_year_keys GET /team/{team_key}/matches/{year}/keys
MatchApi get_team_matches_by_year_simple GET /team/{team_key}/matches/{year}/simple
TeamApi get_district_rankings GET /district/{district_key}/rankings
TeamApi get_district_teams GET /district/{district_key}/teams
TeamApi get_district_teams_keys GET /district/{district_key}/teams/keys
TeamApi get_district_teams_simple GET /district/{district_key}/teams/simple
TeamApi get_event_teams GET /event/{event_key}/teams
TeamApi get_event_teams_keys GET /event/{event_key}/teams/keys
TeamApi get_event_teams_simple GET /event/{event_key}/teams/simple
TeamApi get_event_teams_statuses GET /event/{event_key}/teams/statuses
TeamApi get_team GET /team/{team_key}
TeamApi get_team_awards GET /team/{team_key}/awards
TeamApi get_team_awards_by_year GET /team/{team_key}/awards/{year}
TeamApi get_team_districts GET /team/{team_key}/districts
TeamApi get_team_event_awards GET /team/{team_key}/event/{event_key}/awards
TeamApi get_team_event_matches GET /team/{team_key}/event/{event_key}/matches
TeamApi get_team_event_matches_keys GET /team/{team_key}/event/{event_key}/matches/keys
TeamApi get_team_event_matches_simple GET /team/{team_key}/event/{event_key}/matches/simple
TeamApi get_team_event_status GET /team/{team_key}/event/{event_key}/status
TeamApi get_team_events GET /team/{team_key}/events
TeamApi get_team_events_by_year GET /team/{team_key}/events/{year}
TeamApi get_team_events_by_year_keys GET /team/{team_key}/events/{year}/keys
TeamApi get_team_events_by_year_simple GET /team/{team_key}/events/{year}/simple
TeamApi get_team_events_keys GET /team/{team_key}/events/keys
TeamApi get_team_events_simple GET /team/{team_key}/events/simple
TeamApi get_team_events_statuses_by_year GET /team/{team_key}/events/{year}/statuses
TeamApi get_team_matches_by_year GET /team/{team_key}/matches/{year}
TeamApi get_team_matches_by_year_keys GET /team/{team_key}/matches/{year}/keys
TeamApi get_team_matches_by_year_simple GET /team/{team_key}/matches/{year}/simple
TeamApi get_team_media_by_tag GET /team/{team_key}/media/tag/{media_tag}
TeamApi get_team_media_by_tag_year GET /team/{team_key}/media/tag/{media_tag}/{year}
TeamApi get_team_media_by_year GET /team/{team_key}/media/{year}
TeamApi get_team_robots GET /team/{team_key}/robots
TeamApi get_team_simple GET /team/{team_key}/simple
TeamApi get_team_social_media GET /team/{team_key}/social_media
TeamApi get_team_years_participated GET /team/{team_key}/years_participated
TeamApi get_teams GET /teams/{page_num}
TeamApi get_teams_by_year GET /teams/{year}/{page_num}
TeamApi get_teams_by_year_keys GET /teams/{year}/{page_num}/keys
TeamApi get_teams_by_year_simple GET /teams/{year}/{page_num}/simple
TeamApi get_teams_keys GET /teams/{page_num}/keys
TeamApi get_teams_simple GET /teams/{page_num}/simple

Documentation For Models

Documentation For Authorization

apiKey

  • Type: API key
  • API key parameter name: X-TBA-Auth-Key
  • Location: HTTP header

Author