Skip to content

Data Classes

ThePlasmaGuy edited this page Mar 17, 2017 · 24 revisions

TBApi supports 6 major and 7 minor data classes, allowing users to pull information from The Blue Alliance API. The 6 major data classes are build directly based off of the 6 standard models available in The Blue Alliance API Documentation. The minor data classes exist due to non-standardized information between FRC Seasons, or non-standardized ways in which data is returned between different events or years through TBA.

Each of the methods provided through a TBAParser Object will return a standard object or list of standard objects based off of these 13 data classes. The sub-attributes of these data classes can be found in Class-level documentation below

Jump To:

Raw Data

Users can gather the raw data provided by The Blue Alliance API by simply calling StandardObject.raw. This will return the raw dictionaries gathered when parsing the JSON returned by the API.

TBATeam

This Class defines an FRC Team and provides it's standard information.

TBATeam.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBATeam.name

  • The "name" of the team, usually made up of it's sponsors. To get the name which the team will commonly go by, call TBATeam.nickname

TBATeam.nickname

  • The "nickname" of the team, and the name with which the team will commonly go by
  • Alias: TBATeam.name

TBATeam.team_number

  • The team number used to identify this team. While this is often used to get the team object, it can be useful when dealing with large lists of teams.
  • This is also different from the team_key used directly when gathering team information. This key can be accessed through TBATeam.key
  • Alias: TBATeam.number

TBATeam.key

  • The key used to gather information about FRC Teams through the API. In the form of frc0000 where 0000 is the team number with no leading zeros (aka frc2, frc254 or frc2403).

TBATeam.locality

  • The City of the team derived from parsing the address registered with FIRST by TBA.

TBATeam.region

  • The State of the team derived from parsing the address registered with FIRST by TBA.

TBATeam.country_name

  • The Country of the team derived from parsing the address registered with FIRST by TBA.
  • Alias: `TBATeam.country'

TBATeam.location

  • The Long form address that includes city, state, ZIP code, and country as provided by FIRST.

TBATeam.rookie_year

  • The first competition season in which the team participated.

TBATeam.motto

  • The Team's motto.

TBATeam.website

  • The Team Website set by the team in FIRST's Databases.

TBAEvent

This class defines an FRC Event and the associated data.

TBAEvent.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBAEvent.key

  • TBA event key with the format yyyy[EVENT_CODE], where yyyy is the year, and EVENT_CODE is the event code of the event.

TBAEvent.event_code

  • The Event Code for the given event. Similar to TBAEvent.key without the year, and as such it may be the same or different between years.

TBAEvent.name

  • Official name of event on record either provided by FIRST or organizers of offseason event.

TBAEvent.short_name

  • TBAEvent.name but doesn't include event specifiers, such as Regional or District. May be null, because data is not 100% standardized.

TBAEvent.official

  • (string: true / false) Whether this event used the official FMS.

TBAEvent.start_date

  • The starting date of the event. Pretty self explanatory.

TBAEvent.end_date

  • The ending date of the event. Pretty self explanatory.

TBAEvent.year

  • The year in which the event takes place.

TBAEvent.timezone

  • The timezone in which the event takes place. Useful for clock manipulation of standard event times.

TBAEvent.location

  • Long form address that includes city, and state provided by FIRST

TBAEvent.venue_address

  • Address of the event's venue, if available. Line breaks (\n) included.

TBAEvent.event_type

  • An integer that represents the event type as a constant.

TBAEvent.event_type_string

TBAEvent.event_district

  • An integer that represents the event district as a constant.

TBAEvent.event_district_string

TBAEvent.website

  • The event's website, if any.

TBAEvent.facebook_eid

  • Facebook. I just know this shows up occasionally when gathering data, so here it is.

TBAEvent.webcast

  • If the event has webcast data associated with it, this contains JSON data of the streams. This JSON is not parsed any further, because it is nowhere near standardized.

TBAEvent.alliances

  • If TBA has alliance selection data for this event, this contains a JSON array of the alliances. Alliance Data is practically nonexistent pre-2010. The captain is the first team, followed by their picks, in order. This is not parsed any further.

TBAEventStats

This class defines the statistics of a given FRC Event. The contents are variable, so it is worth checking manually whether the following attributes actually exist when requesting them from the Standard Object. Because it's not really standard.

TBAEventStats.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBAEventStats.opr

  • A TBAEventStatsCategory Object containing OPR Stats for a given event, if data exists. Else, attribute will not exist.

TBAEventStats.ccwm

  • A TBAEventStatsCategory Object containing CCWM Stats for a given event, if data exists. Else, attribute will not exist.

TBAEventStats.dpr

  • A TBAEventStatsCategory Object containing DPR Stats for a given event, if data exists. Else, attribute will not exist.

TBAEventStats.year_specific

  • Raw JSON dictionaries, containing the specific event stats for a given year. This attribute is not well documented, because it's contents are literally different for every single year, and sometimes on a per event basis as well. It is recommended that you heavily explore the contents of this attribute before attempting to use it for anything vital.

TBAEventStatsCategory

This class defines the event statistics for a specific event statistics category (aka OPR, DPR, etc.).

TBAEventStatsCategory.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBAEventStatsCategory.get_team(team) (method)

  • team can either be a raw team number, either as an integer or a string, or an actual team key in the format frc0000 as described above.
  • gets the individual statistic value for the given TBAEventStatsCategory for the provided team.
  • does not poll the API, so can be locally spammed without spamming the API, as long as the same TBAEventStatsCategory or TBAEventStats objects are used.

TBAEventRankings

This class defines the rankings for a given FRC event.

TBAEventRankings.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBAEventRankings.get_rank(rank) (method)

  • rank is a string or integer containing the desired rank number.
  • Pulls the TBAEventTeamRank object for a given rank.

TBAEventRankings.get_rank_by_team(team) (method)

  • team can either be a raw team number, either as an integer or a string, or an actual team key in the format frc0000 as described above.
  • Pulls the TBAEventTeamRank object for a given rank number.

TBAEventTeamRank

This class loosely defines the data returned by TBAEventRankings methods.

TBAEventTeamRank.keys

  • A list of keys which correspond to the data returned by TBAEventTeamRank.raw.

TBAEventTeamRank.raw

  • Raw Data Provided when parsing JSON returned by the API. Data corresponds to the keys in TBAEventTeamRank.keys.

TBAEventTeamRank.team_number

  • The Team Number associated with the Ranking Data.

TBAEventTeamRank.rank

  • The rank of the team associated with the Ranking Data.

TBADistrictPoints

This class defines the district points for a given FRC Event.

TBADistrictPoints.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBADistrictPoints.points

  • The Raw Points array used to calculate individual team points in TBADistrictPoints.get_team(). This is not an array of TBADistrictPointsTeam objects.

TBADistrictPoints.get_team(team_number) (method)

  • team_number is a string or integer containing a team's official team number as provided by FIRST.
  • Gets the TBADistrictPointsTeam object for a given team.

TBADistrictPointsTeam

This class defines the individual district points for a given team, as calculated by a TBADistrictPoints object.

TBADistrictPointsTeam.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBADistrictPointsTeam.total

  • The total district point value for the given team.

TBADistrictPointsTeam.alliance_points

  • The amount of district points gained based on alliances.

TBADistrictPointsTeam.award_points

  • The amount of district points gained through winning awards.

TBADistrictPointsTeam.qual_points

  • The amount of district points gained in qualification rounds.

TBADistrictPointsTeam.elim_points

  • The amount of district points gained in elimination rounds.

TBAMatch

This class defines an individual match at an FRC Event.

TBAMatch.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBAMatch.key

  • Match Key for the given Match.
  • Format: yyyy[EVENT_CODE]_[COMP_LEVEL]m[MATCH_NUMBER] with possible set_number appended to end.

TBAMatch.event_key

  • Event Key for the event at which the given match took place.

TBAMatch.match_number

  • The match number of the given match in the current competition level (TBAMatch.comp_level).

TBAMatch.set_number

  • The set number in a series of matches where more than one match is required in the match series.
  • Ex: 2010sc_qf1m2, would be match 2 in quarter finals 1.

TBAMatch.comp_level

  • The competition level the given match was played at. Ex: qm, ef, qf, sf, f.

TBAMatch.alliances

  • The Alliances that participated in the given match.

TBAMatch.score_breakdown

  • The score breakdown for the match's alliances.

TBAMatch.time

  • The UNIX timestamp of match time, as taken from the published schedule.

TBAMatch.time_string

  • Human Readable Time string for the given match, as published on the official schedule.
  • Of course, this may or may not be accurate, as events often run ahead or behind schedule.

TBAMatch.videos

  • A JSON array of videos associated with the given match.
  • These are currently not TBAMedia objects, so it is recommended to explore the format before using them in production.

TBAAward

This class defines in individual award given at an FRC Event.

TBAAward.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBAMedia

This class defines an individual piece of media as uploaded to The Blue Alliance.

TBAMedia.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBARobotGroup

This class defines a group of TBARobot objects.

TBARobotGroup.raw

  • Raw Data Provided when parsing JSON returned by the API.

TBARobot

This class defines an individual FRC Robot and it's associated data.

TBARobot.raw

  • Raw Data Provided when parsing JSON returned by the API.

Documentation is slow and takes a lot of time. Sorry that it is not already done. Lol