This is a simple application for processing (semi)-live statistics from currently live MLB games. The program persists checking until all games of the day are completed.
- Setup a .env with a Postgres & Redis URL (with
redis://orpostgresql://) with the username and password included in the url, example ispostgresql://postgres:password@host:port/databasefor Postgres, andredis://redis:password@host:post. - Setup a Postgres database by running an automigrate script from the PickemAPI, which this ties into.
- Setup a Redis cache, which this will be writing into.
- Build the app through
go build *.go -o [dest path]. - Run the application through the binary that was just built. (
./[dest path])
The Pick'em project allows users to select games that are currently live. This particular app allows us to process the statistics within a reasonable amount of time, about every pitch or so (if we want to in the future.) Go's simple concurrency model allows us to do this quite easily, and lets us update games in real time, and deliver the answers once the final score arrives.
We can't necessarily do this in the Python API as it would require a little too much overhead. Doing this in a separate, cron job application would allow this to take little memory but provide a lot of data for us to use, especially in the future.
This is part of a suite of repositories that make up the entire Baseball Pick'em app. See the API (Python/FastAPI) and frontend (React/Vite) in their respective items.