Giter Club home page Giter Club logo

baseball's Introduction

Bat-Around Baseball Sim

Bat-Around Baseball Sim is a beginner friendly open-source project which allows you to simulate baseball games. Using real data from the 2017 season, the sim predicts the outcome of each at-bat.

Check out the current release at bat-around.com!

The project has a React front-end and a Flask/Python back-end.

Install requirements

NodeJS
In your terminal enter:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install npm

Or visit https://nodejs.org/en/
Python3
PyEnv or PipEnv or VirtualEnv (any virtual enviroment manager that works with pip)
First, activate your virtual environment

pip install -r requirements.txt

Build React

The React app uses create-react-app and is contained in the top-level folder frontend. The flask app sets its static directory to the build folder contained in frontend in order to serve the react app.

cd frontend
# install node modules
npm install
# build the app
npm run build

Run Flask

cd ..
python -m flask run

baseball's People

Contributors

briancaffey avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

yondav

baseball's Issues

Starting lineup update relies on CLI

Currently, to update the starting lineup, you need to use the command line interface. In Flask, there needs to be a display of available players and the ability to select them. Should we do this with a database? Relational or doc store?

remove unneeded functions from certain libraries

I wrote the baseball sim at the same time as when I was working on a rocket sim so I used some of the same libraries in both projects but much of what was put in for the rocket sim isn't needed here.

For example, in lib 'generalEquations' the library is currently billed as general math equations for rocket simulations. Very little of the library is used. I need to figure out what's used and get rid of the rest.

Branch naming style

I propose that we have a development ("develop" or "dev") branch and master branch (the currently deployed version).

We can have other short-lived branches that follow this style:

{reason}-{1 to 3 word description}-{id-type}-{id}

Reasons would be limited to "bug", "feature", "refactor", "hotfix" or "spike" (spike for experiments).

So for example, to work on issue #23, I could name it "feature-add-lineup-selector-issue-23". Maybe that's a bit long. Should we try to limit the description to a word? Or always use issues (rather than stories, or other ids). So it could be "feature-lineup-23"

I'm going to set up CICD (Travis CI probably) on the project so I don't know if that matters for branch names other than for separating develop and master.

Only two teams are currently available

The data is available for all players but currently, only two teams are supported. This issue is blocked by the previous issue #23. Once starting lineups can be entered on the fly, all teams can be supported.

advance_runners function is overly simple

The advance_runners function advances runners based on the base the hitter gets to (on a double, everyone moves forward two bases). But, for singles especially, decent runners can go from 1st to 3rd on a single. Perhaps there should be a "time to advance bases" concept where runners have a certain amount of time to advance based on the hit type? This is related to issue #11 as it lowers the overall score.

Project Goals

Current goals are to

  • create a better display of the current functionality in a Flask App.
  • add documentation
  • add license
  • add contribution guidelines
  • improve code quality

Add to the readme

  • Add install instructions
  • Add the project's current functionality
  • Add the project's direction and goals (which needs to be discussed)

Convert Sample Space dict to Named Tuples

The way the sample space is coded awkwardly encodes object like data as a string.

Here's what it looks like:

        self.sample_space = {
            'Walk: Base on balls': base_on_balls / outcomes,
            'Walk: Hit by pitch': stats['hbp'] / outcomes,
            'Walk: Intentional Walk': stats["ibb"] / outcomes,
            'Out: SO': stats["so"] / outcomes,

This needs to be coverted to named tuples. Something like ("Result Type", "Result Details", "Probability") and the code that uses it needs to be adjusted.

Average runs per game is low

The average runs per game tend to be around 2.7 for both teams.

  • Investigate what the avg should be
  • Are starting pitchers rotated
  • Do pitchers fatigue

Improve code style

The code needs to be modified to be compliant with PEP8. The library Flake8 should be used to check and fix issues.

Website Deployment

I'd love to share what we already have so I'd like to get a domain and deploy the site.

  • Create a team on Digital Ocean
  • Create a droplet
  • Create a Flask deployment following this tutorial
  • Install Node on the droplet
  • Adapt the tutorial to our site
  • Decide on a domain name
  • Register and point the domain at the droplet
  • Add TravisCI

Regarding the domain name, I've been trying to think of a better name for the project. I'm thinking "Pop-up Sim." Something like "Home Run Sim" would oversell the modest ambitions of the project and both pop-up-sim.com and popupsim.com are available. Do you have a preference between the two or other name suggestions?

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.