Coder Social home page Coder Social logo

homers's Introduction

Home Runs

This is a Flask app that links to every home run hit. It comes with a few commands for importing home run data.

This app was a lazy Saturday project, and is in no way affiliated with or endorsed by MLB.

Running this app

First, fork and clone this repo.

Installing requirements

This app's requirements can be installed via pip:

$ pip install -r requirements.txt

Set up the database

This app was written for and testing using Postgres, but should be compatible with other database platforms through SQLAlchemy.

Create a database, and then

  1. Update SQLALCHEMY_DATABASE_URI in either homers.config or homers.local_config. Alternately, this app will read DATABASE_URL from your environment before trying the config.
  2. Run the create_db task:
$ python tasks.py create_db

After these steps, you should have an empty database.

Importing data from MLB

This app comes with the ability to import game data from MLBAM. This importer is run through tasks.py:

$ python tasks.py import_games

Games can be imported one of two ways: by day and by year.

Games by day

To import games for one or more dates, provide one or more -d arguments to import_games. Dates given should be given as YYYY-MM-DD.

$ python tasks.py import_games -d 2014-05-01 -d 2014-04-01

Games by year

To import games for an entire year, use the -y flag:

$ python tasks.py import_games -y 2014

Imports are powered by mlbma-utils.

Running the web server

Running the Flask development server is as simple as:

$ python tasks.py run

Data sources

Below are examples of the data sources used:

Linking pbp and media data

Data is linked by reading game descriptions and media manifests, and joining by the shared field, sv_id.

  • sv_id in pbp data: game/inning/[top/bottom]/atbat/pitch[sv_id]
  • sv_id in media list: highlights/media/keywords/keyword[sv_id]

Todo

  • Re-enable "homers for date" view
  • Player filtering

homers's People

Contributors

mattdennewitz avatar

Watchers

Jeremy Bowers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.