Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

brentrager/dynastyscore

Repository files navigation

Dynasty Score

A fantasy football analytics platform that ranked every team in your dynasty league — combining expert redraft projections, dynasty asset values, and roster depth into a single score.

Hosted at dynastyscore.com, Dynasty Score helped fantasy football managers answer the question every dynasty owner obsesses over: "How does my team actually stack up?"


What It Did

You entered your league ID, configured your roster settings, and Dynasty Score did the rest:

  1. Pulled your entire league's rosters from Fleaflicker, MyFantasyLeague, or Yahoo Fantasy
  2. Scraped real-time expert consensus rankings from FantasyPros — both redraft and dynasty
  3. Computed six distinct team power rankings for every team in your league
  4. Generated shareable results with Open Graph previews for social media

The result was a comprehensive view of every team's competitive position — not just who's winning now, but who's built for the future.

The Rankings

Dynasty Score generated six ranking views, each telling a different story:

Ranking What It Measured
Redraft Starter Best starting lineups based on current-season expert projections
Dynasty Starter Best starting lineups based on long-term dynasty asset value
Combined Starter Blended redraft + dynasty value — the "win now AND later" metric
Redraft Depth Full roster depth scored against redraft rankings (2x starter slots)
Dynasty Depth Full roster depth scored against dynasty rankings
Combined Depth The ultimate team score — total roster value across both time horizons

An Age Rankings view also showed each team's average roster age, highlighting which teams were building young and which were mortgaging the future.

How the Scoring Algorithm Worked

The ranking engine was the heart of the project:

  • Each player on a roster was matched against FantasyPros expert consensus rankings using fuzzy name matching across platforms
  • Players were slotted into optimal starting lineups based on customizable roster configurations (QB, RB, WR, TE, FLEX, K, DST, IDP)
  • FLEX positions intelligently selected the best available RB/WR/TE; IDP slots selected the best DL/LB/DB
  • Unrostered or unranked players received a penalty score, so thin rosters were punished appropriately
  • Depth rankings doubled the starter slots to evaluate bench strength
  • Combined rankings merged redraft and dynasty rank values, creating a unified score that balanced short-term and long-term team value
  • Teams were sorted by total score (lower = better), producing a definitive league power ranking

Platform Integrations

Fantasy Platforms

  • Fleaflicker — HTML scraping of league pages to extract rosters, team names, and player data
  • MyFantasyLeague — JSON API integration for leagues, rosters, and detailed player data including birthdates for age calculations
  • Yahoo Fantasy — Full 3-legged OAuth flow using YQL, allowing users to authenticate and pull their private league data

Rankings Data

  • FantasyPros — Real-time scraping of expert consensus rankings across every combination of:
    • Scoring format: Standard, Half-PPR, Full PPR
    • Time horizon: Weekly, Season, Rest-of-Season, Dynasty
    • Position: QB, RB, WR, TE, FLEX, K, DST, DL, LB, DB, IDP

Tech Stack

  • Python 2 with Flask for the web framework
  • SQLAlchemy + Flask-SQLAlchemy for database persistence (cached rankings and shareable images)
  • BeautifulSoup for HTML parsing across Fleaflicker and FantasyPros
  • YQL / OAuth for Yahoo Fantasy integration
  • Bootstrap 3 + custom CSS for the frontend
  • html2canvas for client-side screenshot generation of rankings
  • uWSGI for production deployment
  • jQuery + FancyBox for interactive UI elements

Roster Configuration

Dynasty Score supported full roster customization, including league formats that most tools ignored:

  • Standard offensive positions (QB, RB, WR, TE, K)
  • FLEX slots (RB/WR/TE)
  • Defense/Special Teams (DST)
  • Full IDP support (DL, LB, DB, generic IDP)
  • Configurable slot counts for every position

Project Structure

dynastyscore/
├── app.py                          # Flask app initialization and config
├── dynasty.py                      # Main route handlers and request processing
├── dynasty_rankings_generator.py   # Core ranking algorithm engine
├── model.py                        # SQLAlchemy models (Rankings, Images, OAuth tokens)
├── player_database.py              # MFL player database builder
├── config.py                       # Logging, configuration, and utilities
├── util.py                         # HTTP helpers, HTML stripping, age calculations
├── wsgi.py                         # uWSGI entry point
├── external_apis/
│   ├── league.py                   # Abstract league base class
│   ├── fleaflicker.py              # Fleaflicker roster scraper
│   ├── myfantasyleague.py          # MFL API integration
│   ├── yahoo.py                    # Yahoo Fantasy OAuth + YQL integration
│   ├── fantasypros.py              # FantasyPros rankings scraper
│   └── rankings.py                 # Rankings base class
├── templates/                      # Jinja2 HTML templates
│   ├── base.html                   # Layout with nav, Bootstrap, analytics
│   ├── form_page.html              # League input form
│   ├── rankings_loaded.html        # Shareable rankings page with Open Graph
│   ├── rankings_loader.html        # AJAX loading screen
│   └── rankings.html               # Rankings display partial
└── static/                         # CSS, JS, fonts, images

Why I'm Proud of This

Dynasty Score was born from a real need in the dynasty fantasy football community. At the time, there wasn't a tool that could take your actual league rosters, pull real-time expert rankings, and give you a comprehensive power ranking that balanced both short-term competitiveness and long-term dynasty value.

Building it meant solving some genuinely interesting problems:

  • Cross-platform player matching — Player names are formatted differently on every platform (Fleaflicker uses "T. Brady", MFL uses "Brady, Tom", Yahoo uses full names, FantasyPros has its own format). The fuzzy matching system handled all of these edge cases including team abbreviation differences (LA vs LAR vs RAM).
  • Optimal lineup construction — The algorithm had to correctly slot players into the best possible lineup considering position constraints, FLEX eligibility, and IDP configurations, then do it all again at 2x depth.
  • Real-time data aggregation — Every rankings request pulled live data from multiple external sources, parsed it, cross-referenced it, and computed results on the fly.
  • Yahoo OAuth — Implementing the full 3-legged OAuth dance for Yahoo's YQL API to access private league data was a project in itself.

This was a real product that real people used to settle dynasty league arguments. It had a domain, a donate button, Google Analytics, and shareable results with social media previews. It was the kind of project where the intersection of sports obsession and engineering passion produced something genuinely useful.


Built in 2018. A testament to what happens when you care too much about both fantasy football and clean code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors