Giter Site home page Giter Site logo

motorsports-historic-data-api's Introduction

Motorsports historic data API

Old car crash

An API for motorsports historical data, starting with NASCAR data. Data include lists of Drivers, Teams, and Crew Chiefs along with Team/Car Standings and Race lists. Most endpoints allow variable specificity from 'all', down to specified by season (year) and series (i.e. Sprint Cup).

All Series designations conform to the convention specified below under Series Designations.

API Configuration & Initial Setup

The following section describes the steps necessary to set up the API from scratch.

Dependencies

Begin by installing all required dependencies. We recommend using virtualenv to isolate this environment. It is also recommended that you use pip for package management. When you are in your environment, run:

pip install -r requirements.txt

Environment Variables

This requires some environment variables that are not tracked. Create a .env file that includes the following:

DATABASE_URL=postgresql://localhost/{{your_local_db_name}}
DEBUG=True

Initialize Database

Requires having Postgres (on a mac, we use Postgres.app) installed on your machine. First, create your empty database. From the shell:

createdb "your_local_db_name"

Then create the tables.

honcho run python ./app/manage.py database upgrade

(If there is no migrations folder, which is the case early on, while we're trying to finalize the models, before you run upgrade you'll want to run the following.)

honcho run python ./app/manage.py database migrate

Local Development

After you have initialized the application per API Configuration & Initial Setup, running the API locally is easy:

./bin/devserver.sh

Now you can hit the API by navigating to http://127.0.0.1:5000/api/{endpoint}

Production

You can deploy this to any production environment you choose. Below we describe how to deploy to Heroku.

Create the application

Follow steps at Heroku.com

Push to application

git push heroku master

Testing

We use nose for running tests. To run the full test suite make sure Postgres is running then use:

nosetests -v test

The testing database is postgresql://localhost/historic_api_test by default and can be overridden by specifying the TEST_DATABASE_URL variable in your environment.

Other Stuff

Series Designations

* w - NASCAR Sprint Cup Series
* b - NASCAR Nationwide Series
* c - NASCAR Camping World Truck Series
* p - K&N Pro Series West
* e - K&N Pro Series East
* o - Indy Cup
* a - ARCA
* f - Formula One
* ga - GrandAm

Pit Rho Conventions

  • We deploy most of our applications to Heroku and structure them as described in The Twelve Factor App.
  • We typically keep all configuration variables in files like .env and .env.production which we source using foreman or the Python clone honcho.

Packages commonly used at Pit Rho

License

See the LICENSE file.

Contributors

motorsports-historic-data-api's People

Contributors

alejom99 avatar kljensen avatar gcallsen avatar

Stargazers

 avatar George Wambold avatar Joel Moxley  avatar  avatar Aton B avatar  avatar Justin Gill avatar

Watchers

 avatar Joel Moxley  avatar  avatar James Cloos avatar Erik Allen avatar Anthony Alves avatar  avatar  avatar  avatar  avatar Aton B 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.