Statbotics

Statbotics.io aims to modernize FRC data analytics through developing and distributing cutting-edge metrics and analysis. This Python API makes historical Elo and OPR statistics just a few Python lines away! Currently we support queries on teams, years, events, and matches. Read below for usage and documentation.

Visit https://statbotics.io for more content!

Usage

With Python>=3.6 and pip installed, run

pip install statbotics

Then in a Python file, create a Statbotics object and get started!

import statbotics

sb = statbotics.Statbotics()
print(sb.getTeam(254))

>> {'team':254, 'name': 'The Cheesy Poofs', 'state': 'CA', 'country': 'USA', 'district': 'None',
    'active': True, 'elo': 1860, 'elo_recent': 1972, 'elo_mean': 1898, 'elo_max': 2145}

Read below for more methods!

API Reference

class statbotics.main.Statbotics

Main Object for interfacing with the Statbotics API

getTeam(team, fields=['all'])

Function to retrieve information on an individual team

Parameters
  • team – Team Number, integer

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the team’s number, location (country, state, district), and Elo statistics (Current Elo, Recent Elo, Mean Elo, Max Elo)

getTeams(country=None, state=None, district=None, active=True, metric=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple teams

Parameters
  • country – Restrict based on country (select countries included)

  • state – US States and Canada provinces only. Can infer country.

  • district – Use 2 or 3-letter key (ex: FIM, NE, etc)

  • active – Restrict to active teams (played most recent season)

  • metric – Order output. Default descending, add ‘-‘ for ascending. (Ex: “-elo”, “team”, etc)

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the team, location, and Elo statistics

getYear(year, fields=['all'])

Function to retrieve information for a specific year

Parameters
  • year – Year, integer

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the year, match prediction statistics, and RP prediction statistics

getYears(metric=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple years

Parameters
  • metric – Order output. Default descending, add ‘-‘ for ascending. (Ex: “elo_acc”, “-opr_mse”, etc)

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the year and match/RP prediction statistics

getTeamYear(team, year, fields=['all'])

Function to retrieve information for a specific team’s performance in a specific year

Parameters
  • team – Team number, integer

  • year – Year, integer

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the team, year, and Elo/OPR statistics

getTeamYears(team=None, year=None, country=None, state=None, district=None, metric=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple (team, year) pairs

Parameters
  • team – Restrict based on a specific team number

  • country – Restrict based on country (select countries included)

  • state – US States and Canada provinces only. Can infer country.

  • district – Use 2 or 3-letter key (ex: FIM, NE, etc)

  • metric – Order output. Default descending, add ‘-‘ for ascending. (Ex: “elo_pre_champs”, “-opr_auto”, etc)

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the team, year, and OPR/Elo statistics

getEvent(event, fields=['all'])

Function to retrieve information for a specific event

Parameters
  • event – Event key, string (ex: “2019cur”)

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the event and Elo/OPR statistics

getEvents(year=None, country=None, state=None, district=None, type=None, week=None, metric=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple events

Parameters
  • year – Restrict by specific year, integer

  • country – Restrict based on country (select countries included)

  • state – US States and Canada provinces only. Can infer country.

  • district – Use 2 or 3-letter key (ex: FIM, NE, etc)

  • type – 0=regional, 1=district, 2=district champ, 3=champs, 4=einstein

  • week – Week of play, generally between 0 and 8

  • metric – Order output. Default descending, add ‘-‘ for ascending. (Ex: “elo_pre_playoffs”, “-opr_end”, etc)

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the team, event and Elo/OPR statistics

getTeamEvent(team, event, fields=['all'])

Function to retrieve information for a specific (team, event) pair

Parameters
  • team – Team number, integer

  • event – Event key, string (ex: “2019cur”)

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the event and Elo/OPR statistics

getTeamEvents(team=None, year=None, event=None, country=None, state=None, district=None, type=None, week=None, metric=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple (team, event) pairs

Parameters
  • team – Restrict by team number, integer

  • year – Restrict by specific year, integer

  • country – Restrict based on country (select countries included)

  • state – US States and Canada provinces only. Can infer country.

  • district – Use 2 or 3-letter key (ex: FIM, NE, etc)

  • type – 0=regional, 1=district, 2=district champ, 3=champs, 4=einstein

  • week – Week of play, generally between 0 and 8

  • metric – Order output. Default descending, add ‘-‘ for ascending. (Ex: “elo_pre_playoffs”, “-opr_end”, etc)

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the team, event and Elo/OPR statistics

getMatch(match, fields=['all'])

Function to retrieve information for a specific match

Parameters
  • match – Match key, string (ex: “2019cur_qm1”, “2019cmptx_f1m3”)

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the match, score breakdowns, and predictions

getMatches(year=None, event=None, elims=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple matches

Parameters
  • year – Restrict by specific year, integer

  • event – Restrict by specific event key, string

  • elims – Restrict to only elimination matches, default False

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the match, score breakdowns, and predictions

getTeamMatch(team, match, fields=['all'])

Function to retrieve information for a specific (team, match) pair

Parameters
  • team – Team number, integer

  • match – Match key, string (ex: “2019cur_qm1”, “2019cmptx_f1m3”)

  • fields – List of fields to return. The default is [“all”]

Returns

a dictionary with the team, match, alliance, and then elo

getTeamMatches(team=None, year=None, event=None, match=None, elims=None, limit=1000, offset=0, fields=['all'])

Function to retrieve information on multiple (team, match) pairs

Parameters
  • team – Restrict by team number, integer

  • year – Restrict by specific year, integer

  • event – Restrict by specific event key, string

  • elims – Restrict to only elimination matches, default False

  • limit – Limits the output length to speed up queries. Max 10,000

  • offset – Skips the first (offset) items when returning

  • fields – List of fields to return. Default is [“all”]

Returns

A list of dictionaries, each dictionary including the team, match, alliance, and then elo

Contribute

If you are interested in contributing, reach out to Abhijit Gupta (avgupta456@gmail.com) Source code is available at github.com/avgupta456/statbotics_api

Support

If you are having issues, please let us know. We welcome issues and pull requests at github.com/avgupta456/statbotics_api

License

The project is licensed under the MIT license.