race_bot
race_bot copied to clipboard
An Elixir project dedicated to processing live data from Formula 1 races.
Race Bot
An Elixir project dedicated to processing live data from Formula 1 races.
Project's Website displays live telemetry and analysis (Work in progress).
Development & Demo Website displays telemetry of previous events to demonstate the functionality.
Guide for end users (Twitter)
Documentation
All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
Requirements
- Elixir 1.14+
- NodeJS 16+ to install NPM dependencies
Alternatively you can use asdf to manage tool versions, but be aware that it builds Erlang from source which
requires installation of additional system dependencies.
Basic usage
# Install dependencies
mix setup
# Configuration file `.env` must be created by copying `.env.example`
cp .env.example .env
# Copy .env into your environment variables - the application doesn't read .env file on its own
# Only works on fish terminal at the moment
source env.fish
# Generate documentation
mix docs
# Run locally
iex -S mix phx.server
# Run a backtest on an old session
iex -S mix backtest --url "http://livetiming.formula1.com/static/2022/2022-05-08_Miami_Grand_Prix/2022-05-07_Qualifying"
Intro
To get a general overview of the data flow and processing in this project, you can explore the project in this order:
Example packet: SessionStatus packet with status started
F1Bot.ExternalApi.SignalR.Clientreceives the packet from live timing APIF1Bot.F1Session.Servercalls the functional code to process thisPacketF1Bot.F1Session.LiveTimingHandlersdetermines and calls the handler module for this packetF1Bot.F1Session.LiveTimingHandlers.SessionStatuscallsF1Sessionfunction to update the stateF1Bot.F1Sessionupdates its state with new session status and returns its new state + a 'session status change' eventF1Bot.F1Session.Serverbroadcasts the event viaF1Bot.PubSubF1Bot.Output.Twitterreceives the session status change event and composes a TweetF1Bot.ExternalApi.Twitterchooses the configured Twitter client module (live or console for local testing)F1Bot.ExternalApi.Twitter.Consoleoutputs composed Tweet ("F1 Session just started") to your console
Contributing
Pull requests, bug reports and feature suggestions are welcome!
Thanks
💙 theOehrly/Fast-F1: For inspiration, their effort and documentation. Fast-F1 was extremely valuable in quickly understanding how F1's live timing service works.
💙 MultiViewer for F1: For tyre icons used in this project
License
This project is licensed under GNU Affero General Public License version 3, see LICENSE.md for details.