# F1-dashboard

![Dashboard](documentation/screen.png)

This F1-dashboard allows you to record and replay races, visualizing relavant data such as driver position and location, Race Control Messages and more.

## Usage

> Full API examples are available as [bruno](https://www.usebruno.com/downloads) commands. Refer to them when experiencing difficulties, especially during recording.

> All requests mentioned below are "POST" requests except for getting the Session List, which is a "GET" request.

### Playing back a Race

1. Visit the starting page of the vue web application.
2. Select one of the available races
3. The race will start automatically
4. Use the provided Buttons to navigate history. Use the timestep and lap counter syncronize your dashboard with a playback.

### Recording a Race

A race can only be recorded when the OpenF1 api is providing data. Start a recording by calling `http://localhost/api/recording/start`. For all Recording API Endpoints, no `user_id` needs to be supplied.

To stop recording the current session, call `http://localhost/api/recording/stop`. Verify that the race has been recorded by getting the session list.

## Using Example Race Recordings

Use docker compose to run the application and run [main.sql](./sql/main.sql) in the database container to fill the database with data (this can take several minutes).

After starting, visit localhost:80 to visit the webapp and select a race to play back.

## Used Technologies

- (OpenF1 API)[https://openf1.org/]
- Vue.js
- Python
- Traefik
- Postgres

## API Endpoints

| Action          | Address              | Method |
| --------------- | -------------------- | ------ |
| Start Recording | /api/recording/start | POST   |
| Stop Recording  | /api/recording/stop  | POST   |
| Start Playback  | /api/playback/start  | POST   |
| Stop Playback   | /api/playback/stop   | POST   |
| Session List    | /api/session         | GET    |
| Playback Status | /api/playback/status | POST   |
| Playback Seek   | /api/playback/seek   | POST   |
