This notebook automates the process of extracting Formula 1 (F1) race data from the OpenF1 API and uploading it to Azure Blob Storage for further analysis or storage.
- Microsoft Fabric environment with access to Azure services
- Azure Key Vault with the following secrets:
storageKey: Connection string for Azure Blob Storagecontainer: Name of the blob container
- Required Python packages:
requests,pandas,azure-storage-blob
- Install Dependencies: Install necessary Python packages using pip.
- Import Libraries: Load required libraries for API calls, data manipulation, and Azure Blob Storage interaction.
- Retrieve Secrets: Fetch Azure Blob Storage connection string and container name from Azure Key Vault.
- Connect to Blob Storage: Establish connection to Azure Blob Storage and ensure the container exists.
- Fetch F1 Data: Retrieve the latest F1 session data including drivers, laps, and race results from the OpenF1 API.
- Upload Data: Save the fetched data as CSV files (with .parquet extension in filename) and upload them to the specified Azure Blob container.
- OpenF1 API: Public API providing real-time and historical F1 data (https://api.openf1.org/v1/)
The notebook generates and uploads the following files to Azure Blob Storage:
drivers_[timestamp].parquet(actually CSV format)laps_[timestamp].parquet(actually CSV format)race_results_[timestamp].parquet(actually CSV format)
- Open the notebook in Microsoft Fabric.
- Ensure the Azure Key Vault secrets are properly configured.
- Run the cells in order to execute the data extraction and upload process.
- Check the Azure Blob Storage container for the uploaded files.
- The notebook fetches data for the "latest" session key from the OpenF1 API.
- Files are timestamped to avoid overwrites.
- Error handling is minimal; check console output for any API or upload issues.