FantasyMetrix provides past and present statistics along with advanced metrics derived from NFL players using the Yahoo Fantasy Sports API.
Please make sure to include in your request:
1) The name of a current player who has played at least one game in the NFL
2) The name of a valid metric which correlates to that player's position
3) The year pertaining to an NFL season ranging from 2001 – Present
4) Providing a regular season week number ranging from Week 1 – 17 is optional
Current Metrics: games played, passing attempts, completions, passing yards, yards per attempt, passing touchdowns, interceptions, rushing attempts, rushing yards, yards per carry, yards from scrimmage, rushing touchdowns, targets, receptions, receiving yards, yards per reception, yards per target, receiving touchdowns, total touchdowns, return touchdowns, 2 point conversions, fumbles, fantasy points, ppr points, passing attempts per game, passing yards per game, rushing attempts per game, rushing yards per game, targets per game, receptions per game, receiving yards per game, yards from scrimmage per game, fantasy points per game, ppr points per game, catch rate
PurposeInspired by my passion for Fantasy Football, I created this skill so users can discover advanced metrics of NFL players without having to lift a finger. Whether you're curious about the performance of players on your fantasy team or doing research for an article you're writing or simply fact-checking a close colleague's preposterous assertion, FantasyMetrix has all the answers. To read more about my journey into creating this skill, check out my blog post here.
Intent SchemaThere are two ways a user can invoke the skill with a specific request. The first is through the OneShotMetricIntent, which provides a successful response if at least 3 of the 4 slot types (player, metric, and season) are given. Otherwise, if a user simply forgets to name one or two of the slot types, the MissingSlotIntent will prompt the user to provide the missing the slot values needed in order to make a successful API call. To view the entire intent schema, click here.
Slot TypesIncluding a home card for every response was crucial in terms of understanding how Alexa interpreted the pronunciation of player names. For several players, I had to add multiple spelling variations for their names to make sure the API call was working properly. If a user receives a response stating that the information they have provided is invalid, Alexa will prompt the user to check the voice feedback to make sure that she heard them correctly. In almost all cases, the invalid request will be the result of a mispronunciation of the given player's name. To view the entire list of players, click here.
Of the 34 current available metrics, I would say that about half of them are raw numbers retrieved by the API call. The other half are calculations derived from those numbers and based on simple arithmetic.
Instead of creating custom slot values for the season numbers, I decided to go with Amazon's built-in slot type for four digit numbers so users can make a request for a given year in a variety of different ways. For example, two thousand and sixteen would be equivalent to saying twenty sixteen, which would also be the same as saying two zero one six.
Sample UtterancesUser testing is an essential aspect for creating a successful Alexa skill. No matter how many utterances I seem to add, the list will continue to grow as I witness new users make different variations of requests. To view the entire list of sample utterances, click here.
Possible ResponsesThere are several possible responses that Alexa will provide based on a given request made by a user:
- If a week value is provided in the request, and it is equal to the player's Bye Week for that specific season, then Alexa will respond with: "I'm sorry, but [player] was on a Bye for [week] of the [season] season. Please try using a different week."
- If an advanced metric involving the targets metric is requested and the season value provided is earlier than the 2014 season, then Alexa will respond with: "I'm sorry, but the targets metric is only available for players beginning from the 2014 season."
- If an advanced metric is requested based on per game statistics and a week value is also provided, then Alexa will respond with: "I'm sorry, but [metric] is not a valid metric when providing a week number."
- If a valid player name, metric name, week value, and season value are provided in a user's request, and the API call retrieves a metric value based on the given information, then Alexa will respond with: "During [week] of the [season] season, [player] had [metric_value] [metric]."
- If a valid player name, metric name, and season value are provided in a user's request, and the API call retrieves a metric value based on the given information, then Alexa will respond with: "During the [season] season, [player] had [metric_value] [metric]."
- If a valid player name, metric name, week value, and season value are provided in a user's request, but the API call does not retrieve a metric value based on the given information, then Alexa will respond with: "I'm sorry, but [player] did not play in [week] of the [season] season."
- If a valid player name, metric name, and season value are provided in a user's request, but the API call does not retrieve a metric value based on the given information, then Alexa will respond with: "I'm sorry, but [player] did not play in a single game during the [season] season."
- If all else fails and the API call is not successful for whatever reason, then Alexa will respond with: "I'm sorry, but the information you have provided is invalid. Please check the Voice Feedback to make sure I heard you correctly."
Whether it's adding additional advanced metrics, player names, or different variations of sample utterances, I am learning new ways to improve this skill everyday. Most importantly, I have had a blast creating something which I never thought was possible. Any feedback is greatly appreciated. To enable the latest version of FantasyMetrix, simply click here.
Comments