Connect Any MLB Player In History to Jamie Moyer!



Why Jamie Moyer?

Jamie Moyer is a hometown hero for me. He is the only professional baseball player to ever come out of my small-town high school and he had an incredibly long and successful career that included helping to lead my beloved Phillies to their 2008 World Series victory. Moyer's time in MLB spanned 26 years and almost 700 games played for 9 different teams across both the NL and AL. The sheer number of players with whom he's shared a roster over the years makes him an ideal candidate for a baseball-themed Six Degrees of Kevin Bacon** game.

 

What Do I Do?

Simply type the name of any MLB player in history into the text box above, select their name from the list that appears, and hit the red button. The website will show you the most direct path that connects the player you entered to Jamie Moyer. To choose Mike Trout as an example, Mike Trout was teammates with Raul Ibanez on the 2014 Angels and Raul Ibanez was teammates with Jamie Moyer on the 1997 Mariners. For our purposes, a connection is considered to be made any time that Player A played on the same team as Player B in the same year. Unfortunately, my data cannot yet account for in-season transactions so there may be instances when Player A was traded away in spring and Player B came up from the minors in the fall that would still be considered a connection even though they weren't technically on the team at the same time. If you happen to discover any of these anomalies, I would appreciate you emailing them to me so I can use them to test with if I ever attempt to develop mid-season changes functionality. 

 

I Have A Suggestion/Comment

This website was created as a pet project, mainly so I could learn the Neo4j graph database. It ended up turning out pretty cool so I thought I'd put it on the web for everyone to access. Please note that I am a broke college student so this site is using the cheapest/free versions of everything: it is not set up for performance or scaling so please be patient with slow response times/downtime. I love hearing from end users and am happy to consider any suggestions and comments you have but please remember this is my part-part-part-time gig so don't expect miracles! Feel free to email me at info@sixdegreesofjamiemoyer.com.

 

How Did You Build This? (for normal people)

MAGIC!   

 

How Did You Build This? (for nerds)

I chose to do this project because I'm a fan of Jamie Moyer and because I wanted to get some experience with a graph database. Graph databases structure information into related nodes which makes them ideally suited for the way baseball players are connected to each other through the teams they've played on. I chose to use Neo4j specifically because it's a very popular graph database technology and they had a free version I could play around with (did I mention I'm broke?). To populate the graph database, I needed a list of baseball team rosters by year which I could not find easily online so I had to create that data. I downloaded the .CSV files of Sean Lahman's baseball player data and imported them into a PostgreSQL database. I then used SQL to create a temporary table that keyed all the players on a combination of team plus year (essentially creating yearly rosters) and then used Python to load that roster table into Neo4j. Once the graph database was populated, I created REST APIs in Flask so that the database could interface with a web UI. I used a JavaScript library to assist with the autocomplete functionality when you type in a player's name. I then played around with the HTML until I had a passable-looking front end and deployed it all to the cheapest webhosting provider I could find.  

 

**What the Heck Is Six Degrees of Kevin Bacon? 

Kevin Bacon is an actor who starred in hundreds of movies and television shows across several decades. In 1994, three college students invented a game called Six Degrees of Kevin Bacon where the premise is that you should be able to connect any actor/actress to Kevin Bacon in 6 or fewer hops. You can connect actors when they've starred in the same film or TV show together. So, for example, Nicolas Cage starred in Fast Times at Ridgemont High with Sean Penn, who starred in Mystic River with Kevin Bacon. 

 


Acknowledgments:

All player headshots linked from https://www.baseball-reference.com/

Dataset used to construct the yearly team rosters: Sean Lahman (http://www.seanlahman.com/)

Team logos: Sportslogos.net (https://www.sportslogos.net/) and RetroSeasons.com (https://www.retroseasons.com/)