Giter Club home page Giter Club logo

batronic's Introduction

batronic

stephan.com 2014

In fullfilment of a coding test

Overview

For this scenario, we have been asked to write an application that will be used to provide information about baseball player statistics.

Usage

Uses sqlite, so there's no need to db:create. Use DATABASE_ENV instead of RAILS_ENV

Expects Ruby 2

Assumptions

All requests currently are based on data in the hitting file. Future requests of the system will require data from a pitching file as well. Consider this in the design.

note I am assuming that all computed values should be limited to three significant digits after the decimal point, per baseball convention.

Requirements

When the application is run, use the provided data and calculate the following results and write them to STDOUT.

  1. Most improved batting average( hits / at-bats) from 2009 to 2010. Only include players with at least 200 at-bats.
  2. Slugging percentage for all players on the Oakland A's (teamID = OAK) in 2007.
  3. Who was the AL and NL triple crown winner for 2011 and 2012. If no one won the crown, output "(No winner)"

Formulae:

Batting average = hits / at-bats

Slugging percentage = ((Hits – doubles – triples – home runs) + (2 * doubles) + (3 * triples) + (4 * home runs)) / at-bats

Triple crown winner – The player that had the highest batting average AND the most home runs AND the most RBI in their league. It's unusual for someone to win this, but there was a winner in 2012. “Officially” the batting title (highest league batting average) is based on a minimum of 502 plate appearances. The provided dataset does not include plate appearances. It also does not include walks so plate appearances cannot be calculated. Instead, use a constraint of a minimum of 400 at-bats to determine those eligible for the league batting title.

Data

All the necessary data is available in the two csv files attached:

  • Batting-07-12.csv

    Contains all the batting statistics from 2007-2012.

    Column header key

    • AB – at-bats
    • H – hits
    • 2B – doubles
    • 3B – triples
    • HR – home runs
    • RBI – runs batted in
  • Master-small.csv

    Contains the demographic data for all baseball players in history through 2012.

References

http://exposinggotchas.blogspot.com/2011/02/activerecord-migrations-without-rails.html http://blog.flatironschool.com/post/58164473975/connecting-ruby-active-record-without-rails

batronic's People

Contributors

stephancom avatar

Watchers

 avatar James Cloos 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.