Generate good-looking infographics from Formula 1 statistics.
Features | Installation | Getting started | Development
- 🏁 Query Formula 1 data with SQL
- ⚙️ Process data with Typescript
- 📊 Generate infographics
- 🌎 Country icons support
- 🎨 Team colors support
- 👨💻 For developers: Strongly typed & linted
-
Download the latest F1DB from the releases page. Choose the
f1db-sqlite.zipasset and extract thef1db.dbfile from the zipped folder into the root directory. -
Make sure you have Bun installed on your system.
-
Install the generator dependencies.
cd generator
bun install- To generate an infographic, create your generation script, which would roughly look like this:
import { Database } from 'bun:sqlite'
import generate from './generator'
import { TableTemplate } from './generator/templates'
// connect to DB
const db = new Database('f1db.db')
// query data
const table = db.query("SELECT * FROM driver WHERE country_id = 'germany'").all()
// configure template
const template = TableTemplate({ table })
// generate image
generate(template)
// close FB connection
db.close()- When done, run the script.
bun run generate.tsFor a more interactive example, a generate.ts script can be found in the root directory. It shows how an overview of the current seasons F1 drivers can queried, processed and rendered to a nice table. It features plenty of helpful comments and hightlights the different configuration options.
The project consists of two moving parts: the sql and generator subdirectories. They need to be set up separately.
In VS Code the project can be opened as separate workspaces by opening the file .vscode/f1-statistics.code-workspace and clicking on Open Workspace.
The generator should already be setup from the initial project Installation.
pip install sqlfluffVS Code is configured to lint and format files on save; .sql files with SQLFluff and (.ts(x) / .json) files with Biome.
To lint files manually, open the respective subfolder (sql or generator) and run the respective commands.
sqlfluff lint my-file.sqlandsqlfluff fix my-file.sqlto lint and format SQL filesbun checkandbun lintto typecheck and format TypeScript files