Git Product home page Git Product logo

polarforecast-api's Introduction

PolarForecast-API

This is a repository to store the API and data analysis components of the Polar Forecast FRC Scouting System.

The Polar Forecast API is Powered by The Blue Alliance. For more FRC related data, check out thebluealliance.com

Setup development environment

The polar forecast development environment uses a local redis image to work with data. The redis image can be setup easily with docker using the command below.

docker run -p 6379:6379 --name pf-redis redis redis-server --save 60 1 --loglevel warning

Environment variables

The following environment variables are used by the Polar Forecast API for configuring the user environment. PF_REDIS_HOST - Specifies the Host IP of the redis database. Defaults to localhost PF_REDIS_PORT - Specifies the Port of the redis database. Defaults to 6379 PF_TBA_API_KEY - Specifies the API key to be used with the blue alliance API. There is no default value for this variable. If not specified, the Polar Forecast API will be limited to cached data only.

Caching Setup

The Polar Forecast uses REDIS for caching data as it is acquired. The redis cache is used for both raw blue alliance data, as well as processed data created by polar forecast. All data loaded into the cache is stored as string encoded json data. When data is loaded into the cache, metadata is added to the data record itself for future utility. The metadata currently follows the following format.

{
    "tba":bool -> True if the data is directly cached from the blue alliance.
    "last_modified":float -> unixtime of when the data was stored
    "etag": str -> The etag given to the data the last time it was retrieved from the blue alliance.
}

To Simplify data storage all data access should be done using the get and store methods from data.py. These methods will automatically handle etags and caching to simplify things for a user accessing the cache. For blue alliance entries users can forcibly update the entry by passing the update parameter to the cache.

Running the Application

The PolarForecastAPI can be run using the following command

python3 -m uvicorn pf_api:app --host 0.0.0.0 --port 8000

polarforecast-api's People

Contributors

john-wiens avatar johnwiens avatar michael7371 avatar

Watchers

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