falcon_alliance.Team

class falcon_alliance.Team(*args, **kwargs)

Class representing a team’s metadata with methods to get team specific data.

key

TBA team key with the format frcXXXX with XXXX representing the team number.

Type:

str

team_number

Official team number issued by FIRST.

Type:

int

nickname

Team nickname provided by FIRST.

Type:

str, optional

name

Official long name registered with FIRST.

Type:

str, optional

school_name

Name of team school or affilited group registered with FIRST.

Type:

str, optional

city

City of team derived from parsing the address registered with FIRST.

Type:

str, optional

state_prov

State of team derived from parsing the address registered with FIRST.

Type:

str, optional

country

Country of team derived from parsing the address registered with FIRST.

Type:

str, optional

address

Will be None, for future development.

Type:

str, optional

postal_code

Postal code from the team address.

Type:

str, optional

gmaps_place_id

Will be None, for future development.

Type:

str, optional

gmaps_url

Will be None, for future development.

Type:

str, optional

lat

Will be None, for future development.

Type:

float, optional

lng

Will be None, for future development.

Type:

float, optional

location_name

Will be None, for future development.

Type:

str, optional

website

Official website associated with the team.

Type:

str, optional

rookie_year

First year the team officially competed.

Type:

int, optional

motto

Team’s motto as provided by FIRST. This field is deprecated and will return None - will be removed at end-of-season in 2019.

Type:

str, optional

home_championship

Location of the team’s home championship each year as a key-value pair. The year (as a string) is the key, and the city is the value.

Type:

dict, optional

average(year: range | int, metric: Metrics, *, event_code: str | None = None) float

Retrieves the average of a certain metric based on the year.

Parameters:
  • year (range, int) – An integer representing the year to apply the metric to or a range object representing the years to apply the metric to.

  • metric (Metrics) – An Enum object representing which metric to use to find the average of something relating to a team of your desire.

  • event_code (str, optional) – A string representing which event to apply a certain metric to for finding the maximum based on said metric (optional).

Returns:

A float representing the average match score if Metrics.MATCH_SCORE is passed into metric or a float representing the average OPR/DPR/CCWM of a team for a certain year.

Return type:

float

awards(year: range | int | None = None) List[Award]

Retrieves all awards a team has gotten either during its career or during certain year(s).

Parameters:

year (int, range, optional) – An integer representing a year that the awards should be returned for or a range object representing the years that awards should be returned from. Can be None if no year is passed in as it is an optional parameter.

Returns:

A list of Award objects representing each award a team has got based on the parameters; may be empty if the team has gotten no awards.

Return type:

List[falcon_alliance.Award]

districts() List[District]

Retrieves a list of districts representing each year this team was in said district.

If a team has never been in a district, the list will be empty.

Returns:

A list of districts representing each year this team was in said district if a team has participated in a district, otherwise returns an empty list.

Return type:

List[falcon_alliance.District]

event(event_key: str, *, awards: bool = False, matches: bool = False, simple: bool = False, keys: bool = False, status: bool = False) List[Award] | EventTeamStatus | List[str | Match]

Retrieves and returns a record of teams based on the parameters given.

Parameters:
  • event_key (str) – An event key (a unique key specific to one event) to retrieve data from.

  • awards (bool) – A boolean that specifies whether the awards a team got during a match should be retrieved. Cannot be True in conjunction with matches.

  • matches (bool) – A boolean that specifies whether the matches a team played in during an event should be retrieved. Cannot be True in conjunction with awards.

  • simple (bool) – A boolean that specifies whether the results for each event’s matches should be ‘shortened’ and only contain more relevant information. Do note that simple should only be True in conjunction with matches.

  • keys (bool) – A boolean that specifies whether only the keys of the matches the team played should be returned. Do note that keys should only be True in conjunction with matches

  • status (bool) – A boolean that specifies whether a key/value pair of the status of the team during an event should be returned. status should only be the only boolean out of the parameters that is True when using it.

Returns:

A list of Match objects representing each match a team played or an EventTeamStatus object to represent the team’s status during an event or a list of strings representing the keys of the matches the team played in or a list of Award objects to represent award(s) a team got during an event.

Return type:

Union[List[falcon_alliance.Award], falcon_alliance.EventTeamStatus, List[Union[falcon_alliance.Match, str]]]

events(year: range | int = None, simple: bool = False, keys: bool = False, statuses: bool = False) List[str | Event] | Dict[str, EventTeamStatus]

Retrieves and returns a record of events based on the parameters given.

Parameters:
  • year (int, range, optional) – An integer that specifies if only the events the team participated from that year should be retrieved. If year is a range object, it will return all events that the team participated in during that timeframe. If year isn’t passed in, this method will return all events the team has ever participated in.

  • simple (bool) – A boolean that specifies whether the results for each event should be ‘shortened’ and only contain more relevant information.

  • keys (bool) – A boolean that specifies whether only the names of the events this team has participated in should be returned.

  • statuses (bool) – A boolean that specifies whether a key/value pair of the statuses of teams in an event should be returned.

Returns:

A list of Event objects for each event that was returned or a list of strings representing the keys of the events or a dictionary with team keys as the keys of the dictionary and an EventTeamStatus object representing the status of said team as the values of the dictionary.

Return type:

Union[List[Union[falcon_alliance.Event, str]], Dict[str, falcon_alliance.EventTeamStatus]]

location() Tuple[float, float] | None

Retrieves the location of the team based on its postal code.

Returns:

Returns a tuple containing the latitude and longitude or None if it couldn’t find a location for the team.

Return type:

Optional[Tuple[float, float]]

matches(year: range | int, event_code: str | None = None, simple: bool | None = False, keys: bool | None = False) List[Match]

Retrieves all matches a team played from certain year(s).

Parameters:
  • year (int, range) – An integer representing the year to retrieve a team’s matches from or a range object representing all the years matches a team played should be retrieved from.

  • event_code (str) – A string representing the code of an event (the latter half of a key, eg ‘iri’ instead of ‘2022iri’). Used for filtering matches a team played to only those in a certain event. Can be None if all matches a team played want to be retrieved.

  • simple (bool) – A boolean representing whether each match’s information should be stripped to only contain relevant information. Can be False if simple isn’t passed in.

  • keys (bool) – A boolean representing whether only the keys of the matches a team played from said year should be returned. Can be False if keys isn’t passed in.

Returns:

A list of Match objects representing each match a team played based on the conditions; might be empty if team didn’t play matches in the specified year(s).

Return type:

List[falcon_alliance.Match]

max(year: range | int, metric: Metrics, *, event_code: str | None = None) Match | Tuple[float, Event]

Retrieves the maximum of a certain metric based on the year.

Parameters:
  • year (range, int) – An integer representing the year to apply the metric to or a range object representing the years to apply the metric to.

  • metric (Metrics) – An Enum object representing which metric to use to find the maximum of something relating to a team of your desire.

  • event_code (str, optional) – A string representing which event to apply a certain metric to for finding the maximum based on said metric (optional).

Returns:

A Match object representing the match with the maximum score if Metrics.MATCH_SCORE is passed into metric or a tuple containing the maximum OPR/DPR/CCWM for a team and the event where the team had said maximum OPR/DPR/CCWM if Metrics.OPR, Metrics.DPR or Metrics.CCWM is passed into metric.

Return type:

Union[Match, tuple[float, falcon_alliance.Event]]

media(year: range | int, media_tag: str | None = None) List[Media]

Retrieves all the media of a certain team based off the parameters.

Parameters:
  • year (int, range) – An integer representing a year to retrieve a team’s media from or a range object representing all the years media from a team should be retrieved from.

  • media_tag (str) – A string representing the type of media to be returned. Can be None if media_tag is not passed in.

Returns:

A list of Media objects representing individual media from a team.

Return type:

List[falcon_alliance.Media]

min(year: range | int, metric: Metrics, *, event_code: str | None = None) Match | Tuple[float, Event]

Retrieves the minimum of a certain metric based on the year.

Parameters:
  • year (range, int) – An integer representing the year to apply the metric to or a range object representing the years to apply the metric to.

  • metric (Metrics) – An Enum object representing which metric to use to find the minimum of something relating to a team of your desire.

  • event_code (str, optional) – A string representing which event to apply a certain metric to for finding the minimum based on said metric (optional).

Returns:

A Match object representing the match with the minimum score if Metrics.MATCH_SCORE is passed into metric or a tuple containing the minimum OPR/DPR/CCWM for a team and the event where the team had said minimum OPR/DPR/CCWM if Metrics.OPR, Metrics.DPR or Metrics.CCWM is passed into metric.

Return type:

Union[Match, tuple[float, falcon_alliance.Event]]

robots() List[Robot]

Retrieves a list of robots representing each robot for every year the team has played if they named the robot.

If a team has never named a robot, the list will be empty.

Returns:

A list of robots representing each year a team has registered its robot onto TBA, if a team hasn’t named a robot before it returns an empty list.

Return type:

List[falcon_alliance.Robot]

social_media() List[Media]

Retrieves all social media accounts of a team registered on TBA.

Returns:

A list of Media objects representing each social media account of a team. May be empty if a team has no social media accounts.

Return type:

List[falcon_alliance.Media]

years_participated() List[int]

Returns all the years this team has participated in.