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.Client
receives the packet from live timing API -
F1Bot.F1Session.Server
calls the functional code to process thisPacket
-
F1Bot.F1Session.LiveTimingHandlers
determines and calls the handler module for this packet -
F1Bot.F1Session.LiveTimingHandlers.SessionStatus
callsF1Session
function to update the state -
F1Bot.F1Session
updates its state with new session status and returns its new state + a 'session status change' event -
F1Bot.F1Session.Server
broadcasts the event viaF1Bot.PubSub
-
F1Bot.Output.Twitter
receives the session status change event and composes a Tweet -
F1Bot.ExternalApi.Twitter
chooses the configured Twitter client module (live or console for local testing) -
F1Bot.ExternalApi.Twitter.Console
outputs 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.