Intro to MyFantasyDashboard
MyFantasyDashboard (MFD) came from the dissatisfaction I got from looking at tables of data to see how my fantasy football team was doing. Since I’m a visual learner, I would much rather look at a graphic that makes it clear and obvious how I’m doing. With this annoyance in mind, and being the techie that I am, I figured ‘maybe I can just make something like this myself.’ And that’s where the MFD personal project spiral began.
There were 2 main things I felt were a requirement for this project as I started:
- Data had to come from Yahoo
- Since I was playing in Yahoo fantasy leagues, and Yahoo makes fantasy data readily available for users, this was a hard requirement (and a no brainer 🤷🏾♂️)
- Needs to be hosted somewhere
- Sharing this with others was something I wanted to have the option of doing at some point, and texting someone a link to click vs a file - to download, run, configure, blah, blah - was, again, a no brainer 🤷🏾♂️
With these requirements in mind, 3 questions needed to be answered:
- How do I get access to a user’s specific fantasy data?
- A. Yahoo provides a well documented guide for using OAuth 2.0 to access a user’s fantasy data, and also provides a useful authorization code flow diagram to aid in the implementation.
- How do I want the data to be visualized?
- A. A lot of brainstorming went into this (probably too much… 😅). Ultimately, I decided on a dashboard-esq view that focuses on your team vs your opponent’s team, has additional graphs to show historic data, and shows league wide metrics - an unaccomplished stretch goal. Here is the sticky note “dashboard” I used to map out how the actual dashboard would look:
- How slow is this going to be??
- Wasn’t sure. Figured it would probably be slow if it was going to be making calls to Yahoo each time I wanted to view the player data. But I also needed to get my hands dirty with the Yahoo API to understand all of its nuances.
Based on these requirements and my (partially) answered questions, I started building. The result was something I was okay with - it was simple, showed what I wanted to see, and I could send a link to others and have them use it too 🥳
Sample MFD graphs:
There were a few things I didn’t like though:
- Data to screen speed
- It took what felt like 2/3 mins from the time I clicked refresh on the dashboard to when the new data was updated. This is fine if you want a one-off snapshot view of your team, but having to wait this long while trying to have a ‘real-time’ view of your team is impractical.
- Repeated processing
- There were overlaps in players between my teams and as I switched from viewing one team’s dashboard to the next, the process of collecting those players’ data would be repeated. Since all the data was coming directly from Yahoo and there was nowhere to store the players’ data, the work was being repeated.
- Lack of persistence for analytics
- I am (probably) what the AI/ML experts would call a ‘script-kiddie’ AI/ML enthusiast. With that being said, I wanted to be able to run some of my own modeling on my fantasy teams. With the current flow of web app -> API -> processing Lambda -> Yahoo and back, there was no way I could run analyses on the data being collected.
To address these concerns, I implemented data storage on the backend. The idea was to only follow the flow mentioned above when getting details about the specific team - record, opponent, current roster, waiver order, etc. - and, when that data is collected, push the player keys into a table as the primary key to maintain uniqueness. There would then be a scheduled event that would kickoff a flow to collect stats on each player in the table and store the data in a different table. To collect the players’ stats, the data would then come from the players’ stats table instead of Yahoo.
Now that fantasy football season has ended (I didn’t even finish top4 to make the dance 🙁), I have set my sights on doing a similar pattern for other sports and in a more generic fashion. The big question I’m tackling next: can I display the same type of information I did for a fantasy team, but at the individual player level (Ex. Tom Brady) or individual team level (Ex. Chicago Bears - yes, they’re my favorite team 😅)?