<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tom Pedron on Medium]]></title>
        <description><![CDATA[Stories by Tom Pedron on Medium]]></description>
        <link>https://medium.com/@tompedron?source=rss-8ce69e1adb96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PCEcly05hHoiI8CM2y9Q9A.jpeg</url>
            <title>Stories by Tom Pedron on Medium</title>
            <link>https://medium.com/@tompedron?source=rss-8ce69e1adb96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 08:56:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tompedron/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[FantasyHockeyHelper — Technical Improvements 2024–2025]]></title>
            <link>https://tompedron.medium.com/fantasyhockeyhelper-technical-improvements-2024-2025-eb82e14e1454?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb82e14e1454</guid>
            <category><![CDATA[fantasy-sports-software]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[fantasy-sports-app]]></category>
            <category><![CDATA[fantasy-sports]]></category>
            <category><![CDATA[fantasy-hockey]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Sun, 01 Sep 2024 14:31:03 GMT</pubDate>
            <atom:updated>2024-09-02T23:52:53.379Z</atom:updated>
            <content:encoded><![CDATA[<h3>FantasyHockeyHelper — Technical Improvements 2024–2025</h3><p>The hockey season is almost back and so is <a href="http://fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a>! As usual, I’ve written a blog post that will give an overview of the improvements I’ve made to the site for the upcoming season so you can draft your team and manage it all season long using my Fantasy-Score algorithm and other tools I’ve made.</p><h3>Login/Signup/Connect with Yahoo! Sports</h3><p>Finally! After years of saying “ughh I’ll get to it later”, I’ve finally implemented Oauth and now you can login to <a href="http://fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a> (aka FHH) with your Yahoo account. Why Yahoo you may ask? Well its the most populate Fantasy Hockey Managing Software (as far as I know, there are others like ESPN or Fantrax but I’ve only used Yahoo for the last few years.</p><p><strong>For now ITS JUST LOGIN </strong>but on signup when you accept scopes (aka permissions my app can do on your belalf on Yahoo, I can see your basic account info (so I know your email address so you can login via Yahoo) and I can access your Fantasy Sports Teams. This will allow me to implement new features to sync your team on Yahoo to FHH (so you do not need to do this manually anymore).</p><p>At this time I do not plan to do anything around altering your rosters in Yahoo from FHH. Just a sync to FHH to reflect changes to your team for evaluation. While that might be cool, it feels outside the scope of the problems I want to work on and adds risk around any bugs in my app hurting your team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abnVCLLbiM_yxuhSDCva6Q.png" /><figcaption>Click on the Connect With Yahoo! button</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtYOCvr6uXzQAy4ToqY_gg.png" /><figcaption>Go through the sign in process with Yahoo</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*t8w5vg7AoZmxGoH0cORrIg.png" /><figcaption>Read and accept the scopes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQsVJTh6PQgCKfJSecGg-g.png" /><figcaption>You are now logged in to FHH through Yahoo</figcaption></figure><p>You can also go to <a href="https://login.yahoo.com/myaccount/activity/">https://login.yahoo.com/myaccount/activity/</a> to disconnect your Yahoo account from FHH via the Connected Apps &gt; Fantasy Hockey Helper V2 &gt; Details &gt; Remove Access &gt; Disconnect</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AaxeK7bxV7uGnlJQHgTEiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TX4J2bAutERgEJxtkl3pyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*vkSwqOl0cmLjRl_I-jtqqg.png" /></figure><h3>In-Season Player Trends Visualization</h3><p>Technically I wrote this new feature in February 2024 during the season (really the best time to write new features is when I think of them) but since it wasn’t in a blog post before, I’ve added it here. I’ve added graphs to be able to visualize a player’s performance over the course of the season. You can access this from any active player’s profile page. Below is Auston Matthew’s production across all tracked statistics in comparison to his peers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d9mZRCmi0bRiFHuO" /><figcaption>Initially tweeted out on Feb 23 <a href="https://x.com/TPedr0n/status/1761072659360555259/photo/1">https://x.com/TPedr0n/status/1761072659360555259/photo/1</a></figcaption></figure><p>The tool being used for visualization is <a href="https://canvasjs.com/">https://canvasjs.com</a>, a simple client-side JS library to visualize a set of data points returned in the server-side HTML from the main Ruby on Rails app.</p><h3>In-Season Player Comparison</h3><p>Also, once the season starts, you can select 2 players for evaluating a trade/waivers/whatever and see a similar graph tracking their performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*jJlHv3w1mDXMC4RB" /><figcaption>Originally tweeted on Feb 22 <a href="https://x.com/TPedr0n/status/1760740630517698909/photo/1">https://x.com/TPedr0n/status/1760740630517698909/photo/1</a></figcaption></figure><h3>Re-Wrote NHL Schedule Data Collection</h3><p>I have a confession: the team schedule data I was presenting not coming directly from an NHL source, but instead, a random google doc someone actively maintained that was easy to scrape. However, they have since stopped up updating it and honestly, it was time to start doing this myself via the NHL API.</p><p>Big shout out to Github user @Zmalski who documented the official NHL API here: <a href="https://github.com/Zmalski/NHL-API-Reference">https://github.com/Zmalski/NHL-API-Reference</a>.</p><p>I am now retrieving schedule data from the official NHL Schedule API, determining B2B, off-night and Yahoo Scheduling info from them too to keep existing feature parity. The Team Schedules page looks the exact same (for now) but under the hood its all different and new. Previously I would scrape the data daily to a csv, write it to an S3 bucket (in case the doc was unavailable), then read it back and parse it to the database. Now, I just hit the NHL API for each NHL team, parse the data into schedule objects and write it to the database. Saved a couple steps too and maybe some S3 costs too, even though document storage is dirt cheap.</p><p>Now that I am in control, I expect I will make further improvements to this page as the season goes on and I think of things to do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb82e14e1454" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FantasyHockeyHelper — Technical Improvements 2023–2024]]></title>
            <link>https://tompedron.medium.com/fantasyhockeyhelper-technical-improvements-2023-2024-d5e5d5da45d6?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5e5d5da45d6</guid>
            <category><![CDATA[fantasy-sports-app]]></category>
            <category><![CDATA[ruby-on-rails-development]]></category>
            <category><![CDATA[fantasy-sports]]></category>
            <category><![CDATA[fantasy-hockey]]></category>
            <category><![CDATA[fantasy-sports-software]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Sat, 16 Sep 2023 16:44:29 GMT</pubDate>
            <atom:updated>2023-09-16T16:44:29.897Z</atom:updated>
            <content:encoded><![CDATA[<h3>FantasyHockeyHelper — Technical Improvements 2023–2024</h3><p>I’ve been hard at work this summer making some more improvements to <a href="https://www.fantasyhockeyhelper.ca/draft_center">FantasyHockeyHelper.ca</a> for the upcoming season. Below is a summary of the changes.</p><h3>Points Pools Support</h3><p>The app now has the concept of “Pool Types”. We still support the “head-to-head categories pools” (as the default pool type) that it was initially made for, but now I also let you configure your rankings for simpler “points pools” where you receive points for the output from your players and get ranked by total points, instead of winning individual categories against an opponent team.</p><p>The default values provided for each stat category are based on the default values that Yahoo Fantasy offers, see: <a href="https://help.yahoo.com/kb/SLN6815.html">https://help.yahoo.com/kb/SLN6815.html</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlhY8uMa2d-vQKPxPiavjQ.png" /><figcaption>The Choose Stats section toggles between checkbox and numeric inputs based on the chosen Pool type.</figcaption></figure><p>“Points pools” have much less focus on balanced-output across statistic categories (and in my opinion are less interesting than categories pools), and were very simple to support with the existing codebase. From feedback from other users of the app and from comments on Reddit, there has been a desire to support “points pools” so I was happy to add it to the app.</p><p>I believe that for “points pools”, the best rankings are generated using pro-rated stats and career stats with a recency bias. However, you can generate rankings based on the same offerings offered for categories pools (with the exception of factoring in strength of your drafted team, player age and overvaluing offense).</p><p>Note that the Fantasy Score generated for these pools is a total predicted based on all the stats from the period of time factored in, so if you include the last 3 years of stats, then the score will reflect 3 years of stats aggregated. Really, the Fantasy Score is not quite as important as the ranking of a player relative to other players.</p><h3>Cloud Improvements</h3><p>Last year I migrated the app’s cloud hosting to <a href="https://railway.app/">Railway</a> after Heroku removed their free tier offerings. This resulted in far more database space at a cheaper cost, allowing me to implement last year’s big feature, time-series rankings during the season. Overall this was a big win!</p><p>One thing I had wanted to take care of but had not had the time was a rearchitecting of the system that re-generates stats for players daily during the season. The way that worked previously was that each morning, a script ran on my local computer to scrape new stats from the internet, then made an active connection to the app’s production database (using a Railway shell) and ran a script (a ruby rake task) that would generate and insert new rankings to the database using a local deployment of the app (confusing, I know). This worked fine, but had an annoying hard requirement on my local computer running and having an active authentication with Railway to open the connection to the production database. There were times in the past where one of these things failed while I was away from my computer, resulting in stale stats in the website that I had to manually correct later on.</p><p>I have now moved that entire process to Railway as well using a second Railway compute service that spins up daily on a Cron schedule and runs the same process I described above in the cloud, removing the requirement of my local laptop running it. There are some improvements to the script as well to store the scraped stats files in AWS S3 and then load them back from there so that I have a copy of these stats from each day accessible if needed.</p><p>I will be on my honeymoon in Italy later this hockey season and this change will save me the worry of leaving my laptop on full-time during those weeks with no way to resolve issues if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AbsUQyZ1AlTp4rRVjYpJ_A.png" /><figcaption>Two compute services, one always on for the app to run and one that runs for a minute each morning on a schedule.</figcaption></figure><p>Thats about it, I hope you enjoy using the tool this season and if you run into any issues or have any questions or feedback, please reach out! Happy drafting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5e5d5da45d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FantasyHockeyHelper 2022–2023 Season Preview]]></title>
            <link>https://tompedron.medium.com/fantasyhockeyhelper-2022-2023-season-preview-a5296b20e7b8?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5296b20e7b8</guid>
            <category><![CDATA[hockey-analytics]]></category>
            <category><![CDATA[fantasy-sports-software]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[fantasy-sports]]></category>
            <category><![CDATA[fantasy-hockey]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Thu, 22 Sep 2022 13:23:46 GMT</pubDate>
            <atom:updated>2022-09-23T11:56:37.674Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m traveling to Montreal for a work trip next week and I may or may not have pressured my team into attending the Habs vs Jets pre-season game on the Thursday. Yup, its Fall now and the NHL is back soon! I can’t wait, not just to watch my beloved Habs chase Connor Bedard all season, but also for all the blood, sweat and tears I am going to pour into fantasy hockey. Draft season is around the corner!</p><p>I’ve been working all summer (again) to prepare <a href="https://www.fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a>, both for the draft before the season starts and for regularly showing in-season player rankings too! There’s several new improvements I’ve implemented, I hope you find them helpful in managing your fantasy team.</p><h3>1. Fantasy Score Algorithm Improvements</h3><p>While the hypothesis of the Fantasy Score rankings is that all selected statistic categories are equally as important, that&#39;s not necessarily true when considering the value of offense. Connor McDavid is going to go first overall in most category-based drafts even though he puts up a mediocre number of blocks which makes sense. And later in the regular season once the break-out players have been identified and scooped up, finding offensive power on waivers is much more difficult than finding a heavy hitter with lots of PIMs.</p><p>Clearly, offense is valued highly when selecting players, and that should come into play when ranking the players too. When configuring your Fantasy Score algorithm, you can open the “Configure Statistics” menu, check the “Highly value offense?” config box and regenerate the page. This will alter the rankings to ensure that high-offense players rise higher than they otherwise would when all categories were ranked equally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*xdRfhaXDWKNmfVIw062oEA.png" /><figcaption>Available for the pre-season draft rankings and during the regular season too!</figcaption></figure><p>This is not a change in my approach to the Fantasy Score algorithm, all statistics should still be considered on equal footing and putting together a team strong in most categories is a recipe for success. Again, winning the blocks category is as important (and often easier) than winning the goals category. However, the reality is that offensive output is harder to acquire than defensive output.</p><p>Also, there have been several small alterations to the logic that filters out outliers in data to help improve the rankings.</p><h3>2. Time Series Fantasy Score Rankings</h3><p>This is one of the big features I’ve been thinking about for a while, specific to the in-season player rankings (not available on pre-season draft rankings). To help you pick up the best waiver-wire picks or decide which players to drop, you can now view time series data of fantasy score rankings for:</p><ul><li>The whole season (all you could see previously)</li><li>The last month</li><li>The last 2 weeks</li><li>The last week</li></ul><p>This will help you identify players on hot streaks and slumps, helping you make the best choice based on recent data.</p><p>Simply open up “Filter Skaters” menu and select your Time Period Filter (full season by default) and regenerate the rankings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*jENsR1S-LiBV3kfmIzP4xw.png" /><figcaption>This feature will be available once the regular season starts!</figcaption></figure><h3>3. UI Improvements</h3><p>I’ve been pretty open about not being a frontend developer with an eye for design. I work in servers and APIs and JSON professionally, however after enough pushing from various trusted folks and users, I decided to try to improve the look and feel of the site. Its still doesn’t look like a 2022-calibre modern website and there are tons of things that can be improved still, but at least its not from the 90&#39;s anymore.</p><p>The site is still server-side rendered HTML via Ruby on Rails ERB, however I am now leveraging <a href="https://mdbootstrap.com/">Bootstrap + Material Design</a> (aka MDB) to make the website nicer.</p><p>Below are some of the improvements you’ll see:</p><h4><strong>Improved Fantasy Score Rankings Heat Map</strong></h4><p>No longer am I representing table cell stat strength using a rainbow gradient that doesn’t mean a lot on first glance, a fire-based heat map is much more intuitive! The hotter the table cell, the better the stat value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*1PQxwycQNBKO6pK0kiKcCA.png" /><figcaption>Fire hot. Hot good.</figcaption></figure><h4><strong>Paginated tables with search</strong></h4><p>Thanks to MDB, I can render a full skaters table via server-side HTML and then have it simply presented in smaller, bite-sized pages with a fast client-side search too! This makes it easier to return more skaters to the page, previously I was limiting it to 150 skaters to prevent page rendering from taking too long.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*KFs6rPxFjy7pC2FbYxc-Cw.png" /><figcaption>No more CTRL-F-ing around the page! You can also search by team abbreviation too.</figcaption></figure><h4><strong>Fantasy Team Averages in the Skaters Table</strong></h4><p>When signed in, you can view your drafted Fantasy Team’s statistic averages across your chosen statistic categories in the skaters table on both the pre-season and in-season player rankings in order to help you keep your strengths and weaknesses in mind when selecting players.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*_0rFZt7-5h18JtpQetYZIw.png" /><figcaption>This team seems to need more blocks (note that stats shown above are prorated).</figcaption></figure><h4>Collapsible Configuration Menus</h4><p>Remember the ugly HTML web form used to configure the Fantasy Score that I had previously? It practically took up the whole page, well its gone! Now you can view the configurations as needed by clicking any of the buttons presented on any skater pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*vLPxC88smZYG6_Ta8qPHnQ.png" /><figcaption>So many options!</figcaption></figure><h3>4. Platform Migration</h3><p>Previously, I was deploying the Ruby on Rails application through Heroku. I was paying $9 USD per month for the lowest paid-tier “dyno” (computing service) and I was using the free-tier Postgres database. The dyno worked well for the traffic I had but the database limited how many rows I could save to it. To save on costs, I was storing some data (like team schedules) in summarized manners (JSONB and array blobs containing semi-structured data) to squeeze more data into a single table row. It was also causing me to deprioritize implementing data-heavy features like the Time Series data (see section 2) and I was regularly having to clear out some junk data which was kind of a pain.</p><p>However, that changes in August! <a href="https://blog.heroku.com/next-chapter">Heroku made the mistake of removing support for free-tier</a> databases this year and since I knew I was already overpaying for their lowest-tier dyno, I wasn&#39;t willing to pay another $15 USD per month to get the lowest paid-tier Postgres offering.</p><p>So, I very quickly migrated the app to <a href="https://railway.app/">Railway.app</a>, an alternative offering to Heroku which charges based on actual usage and has much better pricing. As a result, the app has more computing power, much more database capacity (enabling the Time Series stats feature, see section 2), and a slightly cheaper price tag! Win-Win-Win!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ag4JIb8F12MFmAQI_h8mhw.png" /><figcaption>A quick look at the Railway dashboard.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5296b20e7b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FantasyHockeyHelper — 2021–2022 NHL Preview]]></title>
            <link>https://tompedron.medium.com/fantasyhockeyhelper-2021-2022-nhl-preview-18aac55a3993?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/18aac55a3993</guid>
            <category><![CDATA[fantasy-sports-app]]></category>
            <category><![CDATA[fantasy-hockey]]></category>
            <category><![CDATA[moneyball]]></category>
            <category><![CDATA[fantasy-sports]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Fri, 01 Oct 2021 00:38:44 GMT</pubDate>
            <atom:updated>2021-10-01T00:38:44.210Z</atom:updated>
            <content:encoded><![CDATA[<h3>FantasyHockeyHelper — 2021–2022 NHL Preview</h3><p>A week before the last NHL season began, I started FantasyHockeyHelper.ca and wrote a web app to help me optimize drafting multiple fantasy hockey teams with various pool settings. This year, I’m excited to continue that project, and I’ve been working hard all summer to get ready for the 2021–2022 season. The goal has grown from just helping me win a few hundred bucks in my own pools though. I also want to provide some value to the fantasy hockey community and continue experimenting with hockey statistics. This blog post serves as a short update on what I’ve been working on and some thoughts about the upcoming fantasy season.</p><h3>1. Summer Changelog</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*IbH6ZONy9eyyKG-2KxdqFg.png" /><figcaption>Configure your Fantasy Score algorithm with various stat categories and historical data settings!</figcaption></figure><h4>1.1 Account No Longer Required</h4><p>Good news! I have opened up the website to new visitors. You no longer need to sign-up to access the meat and potatoes of the website: Draft Center, Current Season Rankings, Team Schedules, etc. Previously I thought that website growth would come from forcing people to signup which enables some additional features related to actually drafting a team. I no longer think that is the case and I would like as many people as possible to be able to benefit from the rankings, regardless of signup.</p><h4>1.2 Fantasy Team Strengths/Weaknesses into Fantasy Score</h4><p>This feature was very important to me this summer. I thought about how I could dynamically rank players based on their actual Draft Center rankings and also based on the strengths and weaknesses of their drafted team as they drafted it. Now, every time you load Draft Center, we also load the player(s) in your in-progress team, determine the strengths and weaknesses for the configured pool categories, and try to determine which available players are strong in the areas that your team is weak and weak in the areas that your team is strong. The goal is to prioritize a well-rounded team that can win all pool stat categories. There is no point in absolutely dominating your opponent in goal scoring when you could have spread that player strength out so that you still win in goals and can also win in hits and the other non-scoring categories. Drafting based on just points is tempting and feels “right” but remember, fantasy hockey (at least in these categories pools) is very different than real hockey.</p><p><strong>NOTE:</strong> This feature is only available when you are signed in since drafting a team requires being able to save team data to your account.</p><h4>1.3 Age Curve</h4><p>The Fantasy Score dynamically factors in the player’s age into the mix. This was on my list of things to improve after drafting Ryan Getzlaf mid-draft when in hindsight that was far too early considering his age and eventual output. As players exit the prime of their careers, it is standard to see a dropoff in performance. Now, we try to include that in the final rankings to help prevent drafting an aging player who had their last decent season last year, or at least don’t draft them too early!</p><h4>1.4 Improved Schedule Analysis</h4><p>A small win I decided to implement was to allow a user to get more insights out of the Team Schedules page. It now includes how many back-to-back games and how many off-night games a team has in a given week which can be something to consider when decided to pick up or drop a player and when deciding which players you start and which players you bench.</p><p>There is definitely more work that can be done here to factor in the strength of opponents into this and is something I’d like to explore further during the season. Perhaps some sort of schedule score can be generated based on current team power rankings and their upcoming week’s schedule and then factored into an individual player’s fantasy score?</p><h4>1.5 Sticky Pool Configs</h4><p>This was a big usability improvement for the site. Whenever you set your pool configurations via the Draft Center or Current Rankings pages, they persist across pages so you don’t need to keep defining your Fantasy Score algorithm every time you visit the website.</p><p><strong>NOTE:</strong> This feature is only available when you are signed in since we need an account in order to save pool configuration data.</p><h4>1.6 Things I Didn&#39;t Get To</h4><p>I had an ambitious roadmap of work that I wanted to do this summer but I wasn’t able to get to it all.</p><p>I wanted to integrate closely with the existing Yahoo Fantasy Hockey app, but it was such a large amount of work with unknowns. It required the time to really scope and spike out to see what use cases were feasible. It&#39;s still on my wishlist to let a user login using Yahoo and import their current team roster for analysis and insights.</p><p>Adding in Goalies to the mix was also something I wanted to do. I’m a goalie myself, I think about hockey goaltending daily. Unfortunately for fantasy hockey, with the stats used and the type of role goaltending plays in setting your lineup, it just never became a very interesting problem to solve so it kept getting deprioritized. Goalies in fantasy hockey are based mostly on their team stats. Wins are a team stat counted towards goalies. Shots and GAA as well. Saves and Save Percentage a bit less so. Shutouts are very random. The solution is to pick 2 goalies you know were good last year who are playing on good teams this year in primary roles.</p><p>Lastly, as you’ve probably noticed if you had visited FantasyHockeyHelper.ca last season and just checked it out now, it looks about the same, its not the most pretty or modern-looking website. This is a side project with limited resources and I’m not someone who gets too excited about writing UIs and make list views pretty. I didn’t work much on improving the front-end and I hope you don’t mind! Maybe next summer…</p><h3>2. How Will This Season Be Different?</h3><h4>2.1 Less Team-Games Lost to COVID</h4><p>I ranted about this in my 2020–2021 season review blog: COVID was such a pain in the ass when it came to setting lineups. Some teams had no COVID issues, some teams didn’t play for weeks. If you happened to draft players from those teams, good or bad, their status was often unknown, they were unable to play for long periods of time, and Yahoo often didn’t make them IR eligible. It seems like this season will be much more normal due to high league vaccination rates, and with that hopefully comes some stability in the schedule and player eligibility.</p><p>As well, this season’s schedule should be much more normal and we won’t have some teams dealing with tough schedules containing many back-to-backs and 4 game-weeks. Hopefully, teams will not have to reschedule games due to outbreaks too. This will be a nice change of pace after last season!</p><h4>2.2 Man-Games Lost To Vaccination Status</h4><p>Some players are not getting vaccinated. This is something to consider when drafting players since they are are more likely to miss games due to illness/suspected illness and they will run into border issues. For example, Tyler Bertuzzi is a great player but he won’t be playing a single game in Canada including against divisional rivals Montreal, Toronto and Ottawa. That will also harm the success of the Detroit Red Wings, something to consider when drafting others from their team.</p><h4>2.3 Seattle is an Unknown</h4><p>Honestly, I’m not super excited about the roster they’ve put together in Seattle. It&#39;s a group of underdogs not unlike the Vegas Golden Knights a few years ago, but I don’t think they used their leverage over other teams like they could have as they made no pre-draft agreements with the other teams. They also left a lot of good players on the table and their big free-agent splash was Goalie Phillip Grubauer (who is solid, don’t get me wrong). I’d be wary of picking up players from this team early in your draft, there are many unknowns about who (if anyone) is going to step up on this team. Also, it will be interesting to see how another weak team in the Pacific Division will inflate the stats of the dominant Golden Knights as a team or an individual like Connor McDavid on the Oilers.</p><h4>2.4 Olympics Break</h4><p>The Olympics are happening in early 2022 and the NHL is going! As a hockey fan I’m excited! As a fantasy hockey manager, it&#39;s another factor to consider. Top players will be going to China for this intense tournament which can be a fatigue and injury risk. Really this is minor but notable considering the Winter Olympics only happen every 4 years and last time the NHL didn’t even go.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18aac55a3993" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FantasyHockeyHelper.ca — 2021 Season Review]]></title>
            <link>https://tompedron.medium.com/fantasyhockeyhelper-ca-2021-season-review-8811b7d27f5f?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/8811b7d27f5f</guid>
            <category><![CDATA[fantasy-sports]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[fantasy-hockey]]></category>
            <category><![CDATA[nhl]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Thu, 20 May 2021 01:51:37 GMT</pubDate>
            <atom:updated>2021-09-27T22:08:58.215Z</atom:updated>
            <content:encoded><![CDATA[<h3>FantasyHockeyHelper.ca — 2020–2021 Season Review</h3><p><strong>NOTE: </strong>This blog post is a follow-up to <a href="https://tompedron.medium.com/money-puck-optimizing-your-fantasy-hockey-draft-using-statistics-and-ruby-4c516908e9af">https://tompedron.medium.com/money-puck-optimizing-your-fantasy-hockey-draft-using-statistics-and-ruby-4c516908e9af</a>.</p><p><strong>TITLE EDIT: </strong>Note that I have renamed this to reflect that technically this season was the 2020–2021 season, even though it only started in early 2021.</p><p>I started <a href="http://fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a> in early January 2021 to keep me busy during Ontario’s seemingly never-ending COVID lockdown (big shout out to Doug Ford for making this so much worse than it had to be). I used the app to help draft my 2 Fantasy Hockey teams by ranking players in a way that I thought made sense. Mainly, by prioritizing players that produced in all relevant stat categories and had done so consistently over the past few seasons. The tool grew over the season to rank players by the current season too in order to support team management and waiver pickups. It’s been a fun journey building this project and I think it helped me a lot in my 2 leagues. I’d like to reflect on how it all went now that the regular season is over.</p><h3>1. End of Season Fantasy Score Rankings</h3><p>First, I’d like to show the final rankings from the app. Remember this is ranking for fantasy hockey and not real hockey!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/0*6ja56YwiGWmJjSx1.png" /><figcaption>The Fantasy Score is generated by an aggregation of the numbers that also define this color legend (10–0).</figcaption></figure><h4>1.1 Forwards</h4><p>Below are the top 10 forwards based on the Fantasy Score algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*rUZCel4m7m2FIdMv2sg4fg.png" /></figure><p>I want to specifically point out that while Connor McDavid obviously had an incredible year with 105 points in 56 games, he still wasn’t getting it done in all of the stat categories, allowing others with a more “complete” fantasy hockey game to pass him. In fantasy Hockey, you can crush your team in the Goals and Assists categories, but being weak on blocks, hits and PIM will still result in a loss. Still, I do think McDavid should be ranked higher though and I touch on this more later in section 4.4.</p><h4>1.2 Defensemen</h4><p>Below are the top 10 defensemen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*D-vVKlGvnmH7TLRZg2OdLg.png" /></figure><h3>2. Continued Development of FantasyHockeyHelper</h3><p>I spent a lot of time continuing to build the website post-drafts. I didn’t start immediately though, as I had put in a TON of hours in the 5 days leading up to the January 13th start of the NHL season. The app was quite different even between my first and second drafts. I was tired and also didn&#39;t know what to do next. I had some high-level ideas but no immediate quick wins which were all I had energy for up until early March. I also felt confident in my drafted rosters and thought I would be able to cruise to victory without much more work. I was wrong.</p><p>As I’m sure anyone who played Fantasy Hockey this season knows, this season was a trainwreck! Games were canceled, sometimes with little notice, and often rescheduled to after the Fantasy season ended. Full teams were shut down for weeks on end and Yahoo didn’t always make them IR-eligible. Sometimes your best players were unable to play for an undetermined period of time or were out quarantining for 2 weeks after being traded to a Canadian team. Getting your minimum goalie starts was often a challenge. You had to manage and prioritize your limited weekly Waiver pickups carefully to fill in the gaps without using them too soon in the week in case you suddenly lost a player and their important man-games. It was a challenging season but also a good time-sink while being stuck inside all day.</p><p>Due to COVID, some drafting mistakes (that I’ll talk about in more detail in section 3), and an over-investment in playing fantasy hockey this year, I eventually found that I needed more tools to get the job done.</p><h4>2.1 Team Schedule Views For Maximizing Man-Games</h4><p>For all the reasons mentioned about losing man-games due to COVID, I found myself struggling to pick the best player on waivers. One thing I began factoring in more than usual was man-games in a week. When trying to increase how many hits my team has, that 1 extra man-game on a Sunday afternoon to end the week could make all the difference. Finding out how many games a player plays in a week is easy of course, but having to do it 10 or 20 times every few days is a process that was screaming for some sort of automation or helper tool.</p><p>I knew I needed a way to calculate it and knew that generally, man-games are more of a team stat than a player stat. I need to know how many games does the team of the player I am interested in play this week and next week? If I pick a player that is playing lots this week and next, that might save me a transaction next week.</p><p>Implementing this was pretty easy. I inspected the API calls being made on NHL.com’s schedule page, changed the start/end-date parameters to cover the full season (normally it runs for a smaller period of time), ran the HTTP call, and saved the JSON response (it was several MBs).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*cc2M-TPxLfyuM50DBF49bA.png" /><figcaption>376093 lines of JSON, 14.1MB</figcaption></figure><p>I wrote a rake script to parse the data into rows in a database. I went for a denormalized form where each team has a single schedule instance with a nested JSON blob containing the data for each game (just date, home team, and away team). This made some of the code for all this kinda ugly but I did this to save money. The app is running on a Hobby-tier Postgres database on Heroku and they limit how many rows you have but not how many columns you have or how much data is stored in those columns. Since each team schedule has a small upper bound of 56 games this season, I figured it would perform fine and save me some money. It did.</p><p>From there, I made a simple page to display the number of man-games a team had last week, this week, and next week in order to help note which teams are playing a lot when looking for potential Waiver pickups. See: <a href="https://fantasyhockeyhelper.ca/team_schedules">https://fantasyhockeyhelper.ca/team_schedules</a></p><p>One thing I did not do is keep the team schedules up to date as games were postponed and rescheduled due to COVID. This caused the game counts for last week, this week, and next week to sometimes be inaccurate. Oops! I should have made this an easily repeatable process I could run daily with a reloaded schedule. Hopefully, this won’t be an issue I need to worry about in the 2021–2022 season as the pandemic comes to an end (knock on wood).</p><h4>2.2 Rank Players By Current Stats</h4><p>Being able to rank players based on the current season was an obvious want even before the season started. I developed the Fantasy Score algorithm script used for drafting to be easily repeatable and basically just required an input CSV of player stats, so I roughly knew how to accomplish this task using current stats. I also knew that I needed a new page different from the one I used to draft teams (renamed to “Draft Center”, see: <a href="https://fantasyhockeyhelper.ca/draft_center">https://fantasyhockeyhelper.ca/draft_center</a>) to view this different ranking. The “Draft Center” is for looking at the last 1–3 years of stats. This new page, “Current Season Rankings (see: <a href="https://fantasyhockeyhelper.ca/curr_season_rankings">https://fantasyhockeyhelper.ca/curr_season_rankings</a>) was for looking at this season’s (and only this season’s) stats. Very similar pages, some similar configurations (including pro-rating options), different purposes.</p><p>The blocker here was getting data easily and repeatedly. The data source of the last 3 seasons&#39; stats (for the “Draft Center”) was just CSVs I put together through a somewhat manual process I did begrudgingly without bothering to automate it because it was a 1-and-done process. Getting current and up-to-date stats every day required finding a reliable data source, automation of retrieving data from them and loading them into the app. My real issue was just finding this data source. I thought it would be a pain to deal with but it wasn’t too bad in the end.</p><p>I built a crawler in Ruby using Nokogiri (an HTML parser gem, see: <a href="https://nokogiri.org/">https://nokogiri.org</a>) to scrape stats from a website and save them into CSV format (the same one as the format from the CSVs I had manually pulled for the last 3 seasons). I run that crawler on my local machine, send the result CSV to the app server, then run a remote rake script to process the new dataset which updates the “Current Season Rankings” page. All this is automated on a cronjob so the website is always up to date.</p><p>I wish I had done this sooner, I didn’t implement it until a little over halfway through the season. It would have been so helpful early on in the season when the Waiver wire was full of talent that was eventually picked up and held on to by teams.</p><p>Implementing this also provided some nice bonuses to the app:</p><ul><li>I no longer needed to manually update the team of players when they got traded. I could just update a player’s team based on the daily stats which had this information.</li><li>Rookies (players who were not in the system previously since they did not play last season) were suddenly present in the system once they played their first game.</li></ul><h4>2.3 No More Required Invite Codes</h4><p>I started the website requiring an invite code. I had hoped that this would protect me from spam accounts and give off a vibe of exclusivity. I think it became more of a barrier to sign-up in the end and I got rid of this requirement eventually. The website is free for all signups, no code is needed. Go for it!</p><h3>3. How Did My Pools Go?</h3><p>I played in 2 pools this season, each of which was drafted using <a href="http://fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a>. This section serves as a follow-up to my post-draft reviews from section 6 of <a href="https://tompedron.medium.com/money-puck-optimizing-your-fantasy-hockey-draft-using-statistics-and-ruby-4c516908e9af">https://tompedron.medium.com/money-puck-optimizing-your-fantasy-hockey-draft-using-statistics-and-ruby-4c516908e9af</a>.</p><h4>3.1 Chel21</h4><p>I placed 9/16 in this pool, though I did had a solid second half of the season (I credit in part due to having current stats in <a href="http://fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a> and almost made the playoffs (only top 8 moved on).</p><p>I made critical errors in the draft that made the season an uphill battle. The biggest one was obviously drafting Carey Price with the 3rd overall pick. I love the Habs, I made an emotional pick over a logical and safer one. If I really wanted to go “Goalie First” as I wrote, I should have gone with someone safer like Andrei Vasilevsky. I’ll note that I did still do okay in terms of drafting goaltending with Philip Grubauer of Colorado later on but regardless, a 3rd overall pick was wasted and would have made all the difference as I spent so much effort mining the Waiver wire for scoring power.</p><p>Another error was drafting Anthony DeAngelo who was banished from the league. I wrote that “Tony DeAngelo is an awful human but he plays a pretty okay game of fantasy hockey.” However, you can’t play a good game of fantasy hockey if you aren’t playing any hockey at all.</p><p>As well, several players on my team had mediocre years. Phillip Danualt took like half a season to score his first goal. Ryan Getzlaf finally regressed this year due to age (more on that in section 4.3). Pierre Luc Dubois had a down season that included a 2-week quarantine on his way to Winnipeg. Tanner Pearson regressed too. Tyler Bertuzzi did have a good start to the season but spent the majority of it in an IR slot.</p><p>By the end of the season, my team barely resembled the one I drafted. It was probably the biggest turnover of a fantasy roster I had ever seen.</p><h4>3.2 Canada Cup</h4><p>I came in first in the regular season and the core of my team (Mark Scheifele, Jimothy Timothy Miller, Elias Lindholm, and Jeff Petry) carried my team the whole way. Ryan Nugent-Hopkins was a good pick as well but I traded him for Matthew Tkachuk towards the end of the season as he (and his brother even more so) are beasts when it comes to the Fantasy Score algorithm. They do it all, even though Matthew did regress a bit on the score sheet this season.</p><p>I again picked Price too early (same mistake as in Chel21) but that pick also came with Jake Allen since we drafted a team’s goalie tandem, and he held my team together all season. Absolutely the MVP for the Habs this year.</p><p>I’ll note that I did end up losing the consolation playoff final (technically a 4th place finish) but in fantasy hockey playoffs where 1 week of play will make or break you, combined with all the complications of COVID and man-games lost, it doesn’t worry me too much.</p><h3>4. What’s Next For FantasyHockeyHelper.ca?</h3><h4>4.1 No Playoffs This Year</h4><p>First of all, I’m not going to support playoff pools, at least for this season. I don’t think it would be worth the effort especially considering most playoff pools don’t allow for tinkering with lineups. You set it and forget it!</p><p>Maybe I’ll do something for next year, but it would need to include some sort of bracket selection to help you prioritize players on your chosen teams.</p><h4>4.2 Personalized Fantasy Score For Your Team During The Season</h4><p>The Fantasy Score needs to connect back to the team you’ve drafted. If you keep your fantasy team up to date on the app (a manual process for now), it should know your team’s strengths and weaknesses. And now that there are up-to-date stats loaded too, the app knows what categories you are struggling with right now. This should be reflected in the fantasy score since really, the best Waiver pickup for your team may not be the best pickup for another’s team when each team has different strengths and weaknesses.</p><h4>4.3 Draft Center Fantasy Score Improvements</h4><p>The Fantasy Score algorithm used for drafting needs to consider factors other than the last 1–3 years of stats. Below are a few examples of ideas I want to play around with this summer:</p><p>We know that players tend to regress as they get older. It shouldn’t have been a surprise to me that Ryan Getzlaf finally had a mediocre year (17 points, ~29 in a full season) after consistently trending downwards for the last few years. He’s 36 years old now, if anything it should have happened sooner.</p><p>The algorithm also needs to better filter out outliers that skew the data in negative ways. I tried to do this by running the Fantasy Score algorithm, marking players under a certain threshold as outliers, then rerunning the algorithm on everyone else again to get a better score and this <em>mostly</em> works but could be better.</p><h4>4.4 Recognizing Greatness</h4><p>Still on the topic of outliers, I don’t think the Fantasy Score algorithm recognizes greatness enough. Connor McDavid ranks 8th overall for forwards in Fantasy Score, which is very good, but what he did this season was just unbelievable. His 72 assists alone would have put him in second for scoring in the league behind his teammate Leon Draisaitl. When you have a player getting 1.5–2x the assists of any other top-tier players, that needs to mean something more. I think his score should be higher. If he had scored the same amount of assists as Brad Marchand his score would be about the same. To me that is wrong and this logic can easily apply to other stat categories too. More tinkering needs to be done for this.</p><h4>4.5 Goalies</h4><p>I want to figure out how to evaluate goalies so I can rank them for the Draft Center and Current Season Stats pages. It’s on my roadmap for the Fall but I’m still not sure how best to accomplish it. The stats they are evaluated on are often considered team stats. Goalies who have more wins generally play on stronger teams. Goalies with lower GAA often play on teams with strong defense. Perhaps I should be considering goalies based on team strength and schedule strength? I’ll let this keep marinating over the summer…</p><h4>4.6 Frontend Improvements</h4><p>As I mentioned in my first blog, I am not a frontend developer, and I don’t really want to be. It doesn’t interest me, I’d much rather work with JSON (but I don’t others do). The website is built in basic Rails + HTML ERB. It does the job, it&#39;s not super ugly, but obviously, there is room for improvement. I’m not going to rewrite the site in React, I like server-side rendered web pages. But I do want to make the site look a bit nicer and more intuitive to use. My girlfriend gave me a critique of things to improve so I’ll see what I come up with.</p><h4>4.7 Integrate with Yahoo Sports?</h4><p>This is a stretch goal. Yahoo Sports does have a developer API, see: <a href="https://developer.yahoo.com/fantasysports/guide/">https://developer.yahoo.com/fantasysports/guide</a>. If I could have users log in to <a href="http://fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a> through OAuth with their Yahoo account, I could do a lot of cool things like:</p><ul><li>Easily load a user’s team(s) so it&#39;s no longer a manual process to keep them in sync.</li><li>Regularly load which players are available on Waivers so that the “Current Season Stats” is up to date and only shows players who are actually available.</li><li>Perform analysis of the teams a user is facing each week to further optimize the Fantasy Score algorithm towards areas of weakness and maybe even advise on lineup decisions each day!</li><li>Perhaps I could get current stats from Yahoo and do-away with my web scraping work?</li></ul><p>I’m still pondering the possibilities but there’s a lot of power in gaining more access to the pool data.</p><h3>5. Conclusion</h3><p>This was and still is a really fun project for me and I look forward to building on it over the summer. There’s lots of work to do and I hope to deliver a more polished and mature project in September in advance of Fantasy Hockey drafts for the 2021–2022 season.</p><p>If you have any questions, feedback, or want to help out in some way, please get in touch!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8811b7d27f5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Money-Puck: Optimizing Your Fantasy Hockey Draft Using Statistics and Ruby]]></title>
            <link>https://tompedron.medium.com/money-puck-optimizing-your-fantasy-hockey-draft-using-statistics-and-ruby-4c516908e9af?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c516908e9af</guid>
            <category><![CDATA[fantasy-hockey]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[nhl]]></category>
            <category><![CDATA[hockey]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Wed, 13 Jan 2021 22:54:35 GMT</pubDate>
            <atom:updated>2021-05-20T01:53:46.685Z</atom:updated>
            <content:encoded><![CDATA[<p>NOTE: See <a href="https://tompedron.medium.com/fantasyhockeyhelper-ca-2021-season-review-8811b7d27f5f?postPublishedType=initial">https://tompedron.medium.com/fantasyhockeyhelper-ca-2021-season-review-8811b7d27f5f</a> for an end-of-season follow-up to this post.</p><h3>1. Introduction</h3><p>I’ve been playing fantasy hockey for about 15 years now. That means that technically I’ve been sports-gambling since I was a child. One year I actually won my Dad’s office playoff pool (I don’t know why they let a child join to be honest) with a prize of ~$800 dollars which bought me an Xbox 360 and Rock Band (his coworkers weren’t pleased)! Illegalities aside, fantasy hockey is an incredibly fun, several-months long game that further ignites my interest in professional hockey and brings friends, teammates, and coworkers together in pursuit of a small cash prize and bragging rights that they “know hockey the best”.</p><p>The first step to joining a league is to draft a team. When you draft a team, you try to pick the best available players of course. The best players that come to mind usually are the ones scoring the most goals and assists like Connor McDavid or Sidney Crosby. But when you add more and more statistic categories to your pools that are all weighted the same (as in, winning the goals category is equally as important as winning the penalty minutes category), theoretically a goon who gets in lots of fights could be as valuable as a player potting 40 goals a season. It really does make you wonder, how do I determine who the best player available is?</p><h3>2. What is Fantasy Hockey?</h3><p>Taking a step back, if you&#39;ve never played, fantasy hockey is like most fantasy sports. You draft a fantasy team comprised of players from across teams in the NHL that you think will score the most points. A web-app like <a href="https://hockey.fantasysports.yahoo.com/">Yahoo! Fantasy Sports</a> or <a href="https://www.pickuphockey.com/">PickupHockey.com</a> keeps track of the total points your players pick up and ranks the fantasy teams from first to worst.</p><p>Fantasy sports are pretty common in pop culture, there was even a 7-season sitcom called “The League” centered around a small, close-knit Fantasy Football league.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUQWz_3Bi_Fs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUQWz_3Bi_Fs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUQWz_3Bi_Fs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/badc9acd6ba48a6ea63deb17f5e8443f/href">https://medium.com/media/badc9acd6ba48a6ea63deb17f5e8443f/href</a></iframe><p>There are many pool types and they can be as simple as “Points Only” pools where you accumulate team points for the points your drafted players score as the season progresses (such as 2 points per goal, 1 point for an assist). They can also be quite complex, such as <a href="https://help.yahoo.com/kb/head-to-head-scoring-yahoo-fantasy-sln6212.html">“Head to Head Category” pools</a> where each fantasy team plays one other team each week and fights to win points based on winning various statistic categories (from the obvious goals, assists and goalie wins to the more unintuitive hits, penalty minutes, blocks, powerplay points, and faceoff wins).</p><h3>3. Hockey Homework</h3><p>Doing your homework is critical in preparing for a fantasy draft. Usually, I’ll prepare by making a list of key players I want to draft, buy <a href="https://thehockeynews.store/products/november-16-2020-2020-21-ultimate-fantasy-pool-guide-7311">The Hockey News’ yearly Pool guide</a> which has projections for the upcoming season and hope for the best. But this year I took a different approach and did more homework than I ever have before! I began to define an algorithm that would help me rank players factoring in all the statistic categories measured in the fantasy hockey pools I participate in (goals, assists, hits, penalty minutes, blocks, shots, faceoff wins, powerplay points, and shorthanded points).</p><p>In the end, I needed to find a way to compare each statistical category equally against each other, not to determine how many penalty minutes equates to 1 goal or how many faceoff-wins is equal to 1 assist, but to help me generate a single “Fantasy Score” that ranks players by “completeness” across all of the statistical categories. If I could strategically draft players that may not be getting the most goals or assists but were still scoring at a high enough rate while also putting in the work in the other categories, I could build a team that allowed my team to compete every week in every category.</p><p>This algorithm had to:</p><ul><li>Compare skaters to only their peers in the league (forwards only against forwards, defensemen only against defensemen) to ensure we don’t undervalue defensemen who don’t usually score the points that forwards do but are still key pieces in a fantasy team (they often do more of the shot-blocking and hitting).</li><li>Analyze the most recent NHL season’s player stats but also look at stats from the last few seasons to avoid filtering out players like Josh Anderson who had an off-year last season.</li><li>Be able to prorate stats over a full standard 82 game season to put the players on an even footing and not ignore players like Vladimir Tarasenko who was injured for most of last season (and is still recovering) but put up 10 points in 10 games beforehand and has generally been a high scoring forward for most of his career.</li><li>Be configurable to include a different set of categories for each fantasy league.</li><li>Filter out low-end and outlier players that negatively skewed the results of the high-end players that you do want to draft. When there are more and more players who do not contribute to the stat categories factored in, it makes it harder to distinguish between the better players.</li><li>Be scalable and dynamic so I could quickly generate Fantasy Score rankings for different sets of stat categories, positions, and settings without waiting around for possibly thousands of calculations, database reads/writes and HTTP calls to execute.</li><li>It had to help project the most effective, smart, and reliable skaters to draft based on history without team allegiance or emotions getting involved (for goalies, that&#39;s another story I’ll dig into later on).</li></ul><p>This homework assignment started off as a small exercise in napkin math and very quickly became a week-long obsession that consumed every spare moment I had in order to have something useful ready by draft day, culminating in something I’m really proud and excited about: a complete, dynamic, and configurable web-app!</p><h3>4. Fantasy Hockey Helper Dot See Eh</h3><p><a href="https://www.fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a> is the result of my hard work. This website performs everything I had hoped to do to support my 2 fantasy hockey drafts this winter and much more! It has the last 3 NHL seasons’ skater statistics loaded in the database and analyzed to rank the best players to draft. It also has sign-up and login functionality gated by single-use invite codes (I have provided some at the bottom of this blog for you to use), mock draft features, and individual skater view pages too.</p><h4>4.1 Dynamic Fantasy Score Rankings</h4><p>FantasyHockeyHelper is highly configurable so that it applies to both of my fantasy pools and other people’s pools too (each pool is unique with different stat categories being factored in). I implemented a simple form that would allow for setting all of these along with statistic preferences and more:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*5Xosb8rWTvpRwYhBrqVY9g.png" /></figure><h4>4.2 Mock Draft Your Team</h4><p>The tool really becomes more than a glorified spreadsheet with this feature. Each player in the Fantasy Score rankings has a “Draft” (or if already drafted, an “Undraft” button) along with a “Hide” button to allow for building out your team as you draft and removing players that are no longer available from your rankings list.</p><p>You can view your team as you build it on the “My Fantasy Team” page which presents an average of the strength of your team for each category in the bottom row. While you may draft according to the Fantasy Score rankings, you may still have categories that you are stronger or weaker in to keep in mind for your next pick.</p><p>See section 6 to see the Fantasy Teams I ended up drafting.</p><h4>4.3 Color Coded Assessment</h4><p>There is also a color-coded assessment system (a pretty CSS gradient) for each individual stat column and player in the rankings table as well as the dynamically calculated Fantasy Score indicating how strongly they rank among their peers across all the categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*U8dMaV44uNK2ZqUYVecz5w.png" /><figcaption>The Fantasy Score is generated by an aggregation of the numbers that also define this color legend (10–0).</figcaption></figure><p>What I ended up with was a Fantasy Score player rankings table that looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*1O95IdazfH96rJj3uJXA7A.png" /><figcaption>In this example, we are only looking at the top 15 Forwards with prorated stats from just last season for the categories presented in the table.</figcaption></figure><p>The above makes sense to me! While JT Miller may not exactly be a household name, last season he was a great fantasy player in so many ways! And there is no Connor McDavid in sight, remember this is “fantasy” hockey and McDavid does not block shots, take penalty minutes or make hits at an elite level in comparison to his peers (he does however have the <a href="https://edifyedmonton.com/style/homes-interiors/97th-heaven/">creepiest house</a> in the NHL but that&#39;s not relevant to the rankings)!</p><p>I shared the link to the app with friends, around the internet in various fantasy hockey spaces, and on Twitter with invite codes and got 10 beta users to sign up. It was so rewarding to get feedback from real people (see section 7 for more) saying they liked my project and that they actually used it to draft their teams! It influenced me to build out an admin panel for me to keep track of application usage and metrics like “most actioned-upon skaters” and “number of logins per user”.</p><h3>5. Technology</h3><p>The website is hosted in <a href="http://www.heroku.com/">Heroku</a>. I love Heroku, I used it at a previous job and saw the benefits of offloading operations management to a 3rd party and focusing instead on product development, user satisfaction, and quick iteration. All my other web-dev companies have had an expensive DevOps team managing the application in AWS and it was always so much work. I know my way around AWS (I achieved my Cloud Practitioner and Solutions Architect certifications last year and have done a number of freelance gigs involving AWS) but it seemed like a headache I didn’t want to deal with for this project just to save a couple bucks. Heroku links to my private Github repository and auto-deploys on code merge to the master branch. I started out on the free tier Dynos for the app but decided to upgrade to the Hobby tier (only $7 a month) for the SSL support. Heroku also auto-setup a free-tier Postgres database for me that allows a maximum of 10K records to be stored. That’s more than enough for now.</p><p>I bought a .ca domain name (the <a href="http://www.fantasyhockeyhelper.com/">.com domain</a> is taken but does not seem to have anything going on) and configured DNS using AWS Route 53, with a Cloudfront distribution securely pointing to the Heroku deployment of the app. At the time of writing this, I’m still waiting for DNS configurations to propagate so that HTTPS is working (if the website seems to be down, you can go to <a href="https://fantasy-hockey-helper.herokuapp.com/">https://fantasy-hockey-helper.herokuapp.com</a> instead).</p><p>The app is written using Ruby on Rails on both the backend and the frontend. The frontend is also leveraging HTML, CSS/ Bootstrap, and JS as well as ERB (embedded Ruby) because frontend development is not my strong suit and I don’t know how to build something quickly using something more modern like <a href="https://reactjs.org/">React</a>. The website at this time does look like something from 10 years ago but that&#39;s fine! The HTML presented is server-side rendered, it&#39;s fast, lightweight, and easy for me to tinker with!</p><p>For analysis of the NHL statistics, I am leveraging a statistics gem called “<a href="https://github.com/thirtysixthspan/descriptive_statistics">Descriptive Statistics</a>”. It works really well with ActiveRecord models (part of the Ruby on Rails framework) and made a lot of my Fantasy Score algorithm fairly easy to implement.</p><p>For the sign-up and login functionality, I am leveraging a gem called <a href="https://github.com/heartcombo/devise">Devise</a>. It’s pretty commonly used in Rails apps and out of the box it does so much! I modified it to require an Invite Code string in the sign-up form which was pretty simple.</p><p>The result of combining all these technologies is a cloud-hosted website I could easily deploy code to (calling it a production deployment felt funny to me since this a pet project) that stored all the data I needed and allowed users to run my Fantasy Score algorithm dynamically and on-demand. I explain all this as pretty trivial (and for the most part it was) but having all this free or cheap technology available these days is so powerful! 10 years ago, putting this project together with similar results would have been impossible in the 1-week timeframe I had to work with.</p><h3>6. Draft Results</h3><p>As mentioned above, I participated in 2 fantasy drafts leading up to the start of the 2021 NHL regular season (Wednesday, January 13th, 2021). Below are reviews and reflections about each draft and the findings I found in relation to how I could improve FantasyHockeyHelper.</p><h4>6.1 Draft 1: “Chel 21”</h4><p>This fantasy league is one that I’ve been playing in for many years run by a childhood friend. There are 16 teams in this league and it&#39;s a very long draft process (usually a little over 2 hours). This draft went well despite FantasyHockeyHelper not being entirely complete (or at least not in the state it would be in for Draft 2):</p><ul><li>There was no prorated stats option yet.</li><li>Only last season’s stats were loaded into the system.</li><li>The Fantasy Score algorithm needed some further tinkering and optimizations.</li></ul><p>I was positioned to draft the 3rd overall pick and decided that my strategy was to pick a top goalie right away. Remember that there are only 31 NHL teams, ~31 starting goalies, and ~62 full-time goalie positions). With this many teams in the fantasy league and 2 active Goalie spots on the fantasy roster (meaning you probably want to draft 3 goalies in total), securing top-notch goaltending was critical since there won’t be much talent available on the waiver list throughout the season and goaltending stats make up approximately a third of the statistic categories. With that in mind, I decided that goaltending would make-or-break you in this league and unfortunately, FantasyHockeyHelper would not be able to help with that since it&#39;s only for skaters (for now). So I did what any die-hard Habs fan would do and drafted Carey Price at 3rd overall (and was laughed at for it in the in-draft chat room but I stand by it). I have very high hopes for the Habs this season and after seeing what a well-rested Price was able to accomplish in the “Toronto Bubble” during the playoffs last summer, I had to pick him up. It also makes it easy to name my team “The Price is Right” which is a nice bonus.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXYnJkFrPGG4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXYnJkFrPGG4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXYnJkFrPGG4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/352fbd3c67e86a3a81cdd0360560a46e/href">https://medium.com/media/352fbd3c67e86a3a81cdd0360560a46e/href</a></iframe><p>I continued my “Goalie-First” strategy by securing 2 more starting goalies in Phillip Grubauer (COL) drafted in round 3 and Mackenzie Blackwood (NJD) in round 11, giving me ~10% of all starting goalies in the league.</p><p>From there, I began to heavily rely on the FantasyHockeyHelper rankings and put together a team that doesn&#39;t exactly scream “Stanley Cup Contender” in real hockey but in fantasy hockey, it has solid numbers across all statistic categories that make up a strong contender in this fantasy league.</p><p>Below is the team I ended up with (note that the goalies I drafted in rounds 1, 3, and 11 are not shown):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*DG12j2tWV7mr8BePZNfgxg.png" /><figcaption>Note the stats presented in this view are just from last season and not prorated.</figcaption></figure><p>Some notes I want to make about the players above:</p><ul><li>Max Pacioretty does it all in the key categories! A complete player not nearly appreciated enough during his time in Montreal.</li><li>Tony DeAngelo is an awful human but he plays a pretty okay game of fantasy hockey. Real hockey though, <a href="https://www.youtube.com/watch?v=s080COHwmv8">not so much</a>…</li><li>I’ve got some heavy reliance on the duo of Danault &amp; Tatar who play on the Habs top line with Brendan Gallagher and are absolutely elite at 5-on-5 play (not something currently factored into my algorithm and not exactly a bonus since we have categories for powerplay and shorthanded points but not for even-strength).</li><li>Bryan Rust is ranked very high on my rankings (#5) and I was quite pleased to pick him up so late. This is a clear example of FantasyHockeyHelper helping me identify high quality and not-obvious talent.</li></ul><p>I also learned a lot about my tool from the draft:</p><ul><li>There was no “Hide Player” functionality implemented then (I hadn’t even considered it yet) but during the draft I very quickly began to lose track of which players in my rankings were still available in the pool, making it harder to make picks in a timely manner.</li><li>Only factoring in last season’s stats caused a serious recency bias to affect my Fantasy Score rankings.</li></ul><h4>6.2 Draft 2: “Canada Cup”</h4><p>This is a league I run with some friends from my hockey team, high school, and my brother. Its a small 6-team league and because of this year’s fascinating North Division (all Canadian teams in one division playing each other 9–10 times this season due to the Canada/USA border shutdown), we decided to limit drafting to the 7 Canadian teams since realistically, us Habs, Leafs, and Sens fans are likely only going to be paying attention to Canadian hockey for the next few months.</p><p>FantasyHockeyHelper and I were much more prepared for this draft:</p><ul><li>I had implemented the “Hide Player” functionality.</li><li>I rewrote the entire Fantasy Score algorithm and underlying data model over 2 days to load in the last 3 years of NHL stats and offer statistic options for considering only last season, the last 3 seasons equally, and the last 3 seasons with a recency bias towards last season (my personal favorite option).</li><li>I implemented a new Players filter to return just players on Canadian teams which also required writing a rake script to make updates to all players that joined or left Canadian teams over the off-season (welcome to the Habs Tyler Toffoli).</li></ul><p>Since there are so few goalies available (7 teams * 2 spots = 14), we decided that each team will draft the starter of 1 team, thereby claiming all goalies on that team (the last round of the draft was reserved for picking up the backup goalie to put in a bench spot). I was positioned to draft 2nd overall and just like in Draft 1, I went with Carey Price. With so few goalies available and no ability to pick up any goaltending help off the waiver wire other than whatever goalies are on the Ottawa Senators this season (sorry Matt Murray), it seemed obvious to go “Goalie-First” again with the expectation that FantasyHockerHelper would help me make some smart picks in later rounds, making up for lack of star skaters I would end up drafting.</p><p>I followed my rankings much more strictly in this pool (with one exception explained later) partly due to the Fantasy Score algorithm improvements I implemented after Draft 1 but also because there was much less obvious talent to choose from in the later rounds when our pool was limited to only a quarter of the league. The draft became quite difficult around round 8 as strong players became less and less obvious. I noticed my tool became really helpful in determining which players even played on Canadian teams!</p><p>Below is the team I ended up with (note that the goalies I drafted in rounds 1 and 14 (Jake Allen) are not shown):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*hnjaIpMnAkMn8P-ZJ9AriA.png" /><figcaption>Forgive my css skills…</figcaption></figure><p>Some notes I want to make about the players above:</p><ul><li>Mark Scheifele is highly underrated! He is a top 5 centerman in the North Division.</li><li>I never thought I would be so happy to be able to draft Tyler Myers in a fantasy pool.</li><li>I only went off the board from my Fantasy Score rankings list once when I drafted Jonathan Drouin in round 11 because I have faith he is going to tear it up this season with Nick Suzuki and newly acquired <a href="https://twitter.com/JohnLuTSNMtl/status/1348690145432784897">“PowerHorse” Josh Anderson</a>. Before getting injured last season, he had 15 points in 19 games, got injured, and returned too soon to lack-luster results. Then after the COVID-break, he was tied for the team-lead in scoring over the Habs’ 2 round summer Playoff run. The algorithm I put together doesn&#39;t take playoff scoring into account nor does it consider the healthiness of players after returning from an injury.</li><li>Unfortunately for me, JT Miller is now in a 2-week quarantine due to a possible COVID exposure. I picked up <a href="https://www.youtube.com/watch?v=aL_2JuCJJP4">Ilya “Soup” Mikheyev</a> (TOR) off of waivers to temporarily fill that void. I have similar hopes for him that I do for Jonathan Drouin.</li><li>Luca Sbisa got stolen off of waivers by Nashville after the draft so I had to drop him as per league rules. I picked up Travis Hamonic (VAN) as a replacement purely because he had the highest Fantasy Score of the remaining defensemen. In FantasyHockeyHelper we trust!</li></ul><h3>7. Feedback and Findings</h3><p>Below are some snippets of feedback I was sent by my beta users (edited only to add some sentence structure where needed):</p><blockquote>“So I like your tool, and will definitely become a customer once you get up and running assuming your projections go well, however you’re missing a lot more categories as options. For my league you’re missing points, +/-, and goalie categories. Your tool is one that we need though. Good luck!”</blockquote><blockquote>“I think it&#39;s pretty cool. Will be nice to add goalies to the mix. Also to consider the strength of the schedule, I know that is more of an NFL concept, but I think it impacts the NHL as well to a certain extent, more so this year.”</blockquote><blockquote>“So far its pretty cool, I like how it works. It would also be cool to put priority on certain stats (depending on if you want to punt a stat in order to maximize your other stats). But it is definitely super useful.”</blockquote><blockquote>“It would be cool to be able to export into CSV.”</blockquote><p>For me, I have some things I found too:</p><ul><li>Factoring in the age of the player would be another interesting variable to include in the Fantasy Score calculation. Forwards often hit the prime of their career in their mid-late 20s and begin to slow down in their early 30s.</li><li>Ranking players by Fantasy Score definitely helps you pick a player to draft in each round but you also need to factor in what round is the best to draft a player in. If you think you can pick up a very underrated player with a high Fantasy Score in a later round and draft someone more obvious in an earlier round, it&#39;s important to not leave value on the table to go for the sleeper picks that FantasyHockeyHelper may be providing. This is why in Draft 1, I waited to pick up Bryan Rust in round 9 despite being ranked at position 5 last season (prorated).</li><li>The Fantasy Score ranking ideally pushes you to draft players that are strong in all categories but does not (yet) dynamically compare your under-construction Fantasy Team to the remaining players to recommend players that are strong in your weak categories. This would require a large change to the algorithm though.</li><li>The AVG row in the “My Fantasy Team” page does not factor in which draft position each player was taken at and likely looks pretty blue or purple on the Color Assessment gradient after a long draft. Max Pacioretty is a good pick in the second round but I would argue that my pick of Ryan Getzlaf in the 13th round was a more valuable pickup in comparison to the talent still available at that time. But that doesn’t get factored in.</li><li>I need better data. All Forwards are marked as position = “F” when ideally I would like Centerman marked as position = “C” so I can ensure that we only factor in the Faceoff-Wins category for Centerman. Right now if that statistic is included then the Forward rankings skew towards Centermen.</li></ul><h3>8. What’s Next?</h3><p>I loved working on this project more than any personal project I’ve ever worked on. It combined my love of backend development with my love of hockey and fantasy hockey! What could be better?</p><p>While the draft season is over for now since the NHL regular season begins tonight, I have big plans to continue building out the project with the goal of having a much more mature, polished product ready to go for the start of the next NHL season (or maybe even the 2021 NHL playoff season though playoff fantasy hockey can be a bit of a different game with a different strategy around picking players from teams you think will go far). I have algorithm tweaks I want to include, website features to implement, other pool types to consider, more statistical data to capture, and many UX and visual improvements to make.</p><p>I also want to write a follow-up blog once the NHL regular season and fantasy season is over in early May when I will hopefully have a couple of fantasy league championships to my name and some prize money in my bank account too. I want to see if my “Goalie-First” strategy was right (please don’t let me down Jesus Price). I want to see if JT Miller’s last season was not a fluke. I want to see if my algorithm was actually helpful in determining success in category pools. I want to know what can be improved!</p><p>If you are interested in taking a look at <a href="https://www.fantasyhockeyhelper.ca/">FantasyHockeyHelper.ca</a>, here are 10 single-use invite codes (first-come-first-serve):</p><ul><li>MEDIUM1</li><li>MEDIUM2</li><li>MEDIUM3</li><li>MEDIUM4</li><li>MEDIUM5</li><li>MEDIUM6</li><li>MEDIUM7</li><li>MEDIUM8</li><li>MEDIUM9</li><li>MEDIUM10</li></ul><p>Thanks for reading and please get in touch if you have any thoughts or questions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c516908e9af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Porting a Static Website From GoDaddy to AWS]]></title>
            <link>https://tompedron.medium.com/porting-a-static-website-from-godaddy-to-aws-8a8b18b56dbf?source=rss-8ce69e1adb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a8b18b56dbf</guid>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[route-53]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[godaddy]]></category>
            <dc:creator><![CDATA[Tom Pedron]]></dc:creator>
            <pubDate>Thu, 12 Nov 2020 00:09:27 GMT</pubDate>
            <atom:updated>2020-11-12T02:14:10.434Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my new blog! Welcome! I hope to post things here from time to time that will be helpful to others.</p><p>I had an old blog, it was <a href="http://www.tpedron.com/blog"><em>www.tpedron.com/blog</em></a>, a hosted WordPress app I had running on GoDaddy as part of my Basic Linux hosting package with the rest of my website. I had been paying approximately $150 CAD a year to GoDaddy (and had been since around 2015) to host a very simple static personal website (just HTML, CSS, JS + some file hosting), and this WordPress blog. I basically never used the blog and overall I had been paying for a lot more managed services and support from GoDaddy than I needed. I recently completed my AWS Solutions Architect Certification and didn’t really require GoDaddy to hold my hand anymore. I knew I could do this myself on AWS for far less (might cost me upwards of $25 CAD a year). So I did!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*CGBqgujBE9QKkT1msWz6oA.png" /></figure><p>Below are the steps.</p><h3>1. Initiate Domain Transfer on GoDaddy</h3><p>On GoDaddy, I logged in and went to the products page. I first turned off the auto-renewal of my hosting package (this was approx. 30 days in advance). At this point, I committed to going through with this process.</p><p>Next, I turned off the domain lock setting and domain privacy protection settings (considered a downgrade on my plan) so I could begin the <em>tpedron.com</em> domain transfer process. I had to do this to enable retrieving the authorization code which was disabled.</p><p>Now that the “Get transfer authorization code” button enabled, I followed the steps to retrieve the code and saved it to a text file.</p><h3>2. Accept Transfer on AWS Route53</h3><p>Next, I logged into the AWS Route53 service console &gt; Registered Domains and clicked on the “Transfer Domain” button. I went through the steps to select the domain name I wanted to transfer (which was <em>tpedron.com</em> of course), provided the transfer code, and selected the option to copy DNS settings from my existing DNS provider (also GoDaddy). This ensured that while the domain was being configured and in flux that the domain would still temporarily point to the old deployment of my website on GoDaddy.</p><p>Once this step was complete, the domain transfer was pending approval by GoDaddy and listed under the Domains &gt; Pending Requests section.</p><p>This domain transfer process cost me~$12 USD/$18 CAD.</p><h3>3. Complete Transfer on GoDaddy</h3><p>I went back to GoDaddy and refreshed the products page a few times (it took some time for the website to reflect the state of the domain transfer). Eventually, the domain was shown in a transfer pending state with an Approve button which I clicked. The domain disappeared from the page and only my soon-to-be expired hosting package remained.</p><h3>4. AWS Receives Confirmation</h3><p>After a few minutes, AWS received approval confirmation from GoDaddy and the transfer was completed. I received a confirmation email as well. It said this process could take some time but for me, it was pretty instantaneous. I navigated to Domains &gt; Registered Domains to find my domain name listed there.</p><p>Before continuing configuring Route53, I needed to port the actual website(HTML, CSS, JS, and other files like PDFs, images) over. Once completed, I could then return and point the domain name at the new website deployment by configuring the DNS records.</p><h3>5. Create an AWS S3 Website</h3><p>No need for me to reinvent the wheel on this, just follow the steps listed here to deploy a static website to S3. <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html</a></p><p>Once complete, I had a non-secure hosting of my website with a URL that looked like: <em>http://&lt;bucket name&gt;.s3-website.&lt;region&gt;.amazonaws.com/</em></p><p>After following these steps and while still in the S3 console, I created 1 more private bucket to hold logs from Cloudfront (optional).</p><h3>6. Create a CloudFront Distribution</h3><p>In the AWS console, I then navigated to the CloudFront service. I created a new Web distribution (deployed it to all edge locations for performance reasons) with the origin domain name being the s3 bucket containing my website. I skipped the steps related to SSL certs/ alternate domains but would return later on to take care of that. I also set up default logging to the logs bucket I mentioned in step 5 (optional).</p><p>After the distribution was created, I was able to access a CloudFront distributed version of my website over HTTPS and HTTP with a URL that looked like <em>https://&lt;cloudfront id&gt;.cloudfront.net</em>.</p><p>I then navigated to the Behaviors configuration of the Distribution and updated it so that it redirects HTTP to HTTPS and allows GET, HEAD, and OPTIONS methods.</p><h3>7. AWS Hosted Zone</h3><p>With the newly created (and incomplete) CloudFront distribution information, I went back to Route53 to create a Hosted Zone to define the DNS records for the website and the domain. Creating a Hosted Zone provided me with the NS (Name Servers) and SOA (Start of Authority record) that were fine as they were.</p><p>I then created the following additional records:</p><ul><li>An A (IPV4) record with an empty name (so it&#39;s just tpedron.com) that aliases to the Cloudfront distribution (<em>&lt;cloudfront id&gt;.cloudfront.net</em>).</li><li>An A (IPV4) record with name www that also aliases to the CloudFront distribution (<em>&lt;cloudfront id&gt;.cloudfront.net</em>). This allows tpedron.com and <a href="http://www.tpedron.com/">www.tpedron.com</a> to go to the same target.</li></ul><p>In the next step, a process kicks off that will introduce a CNAME record to this Hosted Zone that references an SSL certificate.</p><h3>8. Request certificate in ACM</h3><p>I navigated to the AWS Certificate Manager (ACM) service and requested a new DNS validation certificate with the following domains:</p><ul><li><em>*.tpedron.com</em></li><li><a href="http://www.tpedron.com/"><em>www.tpedron.com</em></a></li><li><em>tpedron.com</em></li></ul><p>That request went into a pending validation status. Expanding the record in the table revealed a button “Create Record in Route53”. I clicked it and it created the CNAME DNS record on the hosted zone I created in Route53 previously.</p><p>This process was fairly quick and within a couple of minutes the certificate request went into an Issued state.</p><h3>9. Update CloudFront Distribution With Certificate</h3><p>I went back to the Cloudfront Distribution, clicked edit, and set my Alternate Domain names to be the same values I set on my certificate request:</p><ul><li><em>*.tpedron.com</em></li><li><a href="http://www.tpedron.com/"><em>www.tpedron.com</em></a></li><li><em>tpedron.com</em></li></ul><p>I also set my SSL certificate to be a custom certificate and selected the one I had just been issued. Then I saved.</p><h3>10. Update Registered Domain NS to match hosted zone</h3><p>When I transferred my domain I selected the option to pull in the Name Servers from my previous DNS provider. Since I am hosting the website elsewhere and that deployment is ready in CloudFront, I needed to update the Name Servers on the Registered Domain to map to my Hosted Zone (setting this was in a different spot in the AWS console than the Hosted Zone DNS NS record). There was probably a way to set the NS values as part of the domain transfer process but I did not do that.</p><p>First, I copied all 4 NS values I had in my record to a text file, then navigated to Registered Domains &gt; tpedron.com &gt; Name Servers &gt; Add or edit name servers. This opened a window where I could paste the 4 new NS values I had and remove the old ones that came with my domain transfer. Saving this kicks off a process on Route53 to finalize the changes and emails you when complete.</p><h3>11. Wait for DNS changes to Propagate</h3><p>DNS changes do not immediately propagate to the rest of the internet. It&#39;s a process that involves other systems refreshing their caches and can take up to 48 hours.</p><p>You can check using a tool like <a href="http://dns.squish.net/">http://dns.squish.net/</a> to see what NS records are registered with your domain.</p><p>At this point, porting tpedron.com to AWS was complete. Look at that lock icon, it&#39;s beautiful!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*g1ujkM3brmFWqltDdCBn9Q.png" /><figcaption>Secure!</figcaption></figure><h3>12. Change Deployment Script</h3><p>While my website is easy to maintain and the configurations are pretty much set in stone at this point, I still didn’t want to have to open up the AWS S3 console and drag my changed files in every time I made a change to my website (which is really just updating my <em>index.html</em> file 95% of the time). With my AWS credentials set as ENV vars, I wrote a simple shell script that will copy the latest version of my <em>index.html</em> file to the s3 bucket that hosts my website and then initiates a manual cache invalidation of the CloudFront Distribution to ensure the latest changes to my files are distributed online:</p><pre>#!/bin/bash</pre><pre>aws s3 cp index.html s3://&lt;website bucket name&gt;/index.html</pre><pre>aws cloudfront create-invalidation \</pre><pre>     --distribution-id &lt;cloudfront distribution id&gt; \</pre><pre>     --paths &quot;/*&quot;</pre><p>This process takes a minute or so to complete.</p><p>Hope that helps anyone!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a8b18b56dbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>