Skip to main content
The F1 Stats Archive collects comprehensive Formula 1 statistics from the Ergast API using a suite of Python scripts. Each script is responsible for fetching a specific type of data and storing it in a structured format.

Data Collection Workflow

The data collection process follows a specific order:
  1. Events - Fetch race calendars for each season
  2. Race Results - Collect finishing positions and race outcomes
  3. Qualifying Results - Gather qualifying session data
  4. Standings - Calculate driver and constructor championship points
  5. Lap Times - Retrieve detailed lap-by-lap timing data
  6. Pitstops - Collect pit stop information (2011 onwards)
  7. Sprint Races - Fetch sprint race results (2021 onwards)

Directory Structure

Data is organized in a hierarchical structure:

API Base URL

All scripts use the Ergast API via Jolpi:

Rate Limiting Strategy

The Ergast API enforces strict rate limits that all scripts must respect:
  • Burst limit: 4 requests per second
  • Sustained limit: 500 requests per hour
All scripts implement rate limiting using one of these approaches:

Time-based Delay

Adaptive Rate Limiting

Common Utilities

Race Name Slugification

All scripts convert race names to folder names consistently:

Directory Creation

Logging

Most scripts use Python’s logging module for tracking progress:
Each script writes logs to both a file and the console, making it easy to monitor progress and debug issues.

Data Availability

Different types of data are available for different time periods:

Next Steps

Events

Learn how to fetch race calendars

Race Results

Collect race finishing positions

Qualifying

Gather qualifying session data

Standings

Calculate championship points