This project collects and processes SBB train data for Zug, Switzerland along with weather data. The goal is to create a pipeline from data ingestion to predictive modeling using Azure, ADLS, Databricks and PySpark.
-
Data Ingestion
- Retrieve SBB train data for Zug via API.
- Retrieve weather data (snow, rain, temperature, etc.).
- Store JSON files securely in Azure Data Lake Storage (ADLS).
-
Databricks Pipeline
- Load data from ADLS into Databricks.
- Apply Bronze → Silver → Gold architecture:
- Bronze: raw ingested files
- Silver: cleaned and enriched datasets
- Gold: aggregated tables for analytics and modeling
- Python: data ingestion scripts
- Azure Data Lake Storage (ADLS): secure cloud storage
- Databricks / PySpark: scalable ETL pipelines
This project was developed within a 30-day Azure Free Trial window. As a result, certain architectural decisions favored rapid prototyping over strict production standards.
If this project were to be moved to a production environment, the following changes would be prioritized:
- Current State: Logic resides primarily in Databricks Notebooks (
.ipynb) for interactive development. - Production Target: Core transformation logic would be extracted into Python modules (
.py/src/).- Why: To enable Unit Testing (pytest) and proper CI/CD pipelines, keeping Notebooks only for orchestration and visualization.
- Current State: Secrets are managed via local environment variables or excluded config files (not committed).
- Production Target: Integration with Azure Key Vault linked to Databricks Secret Scopes.
- Note: Direct integration between Key Vault and Databricks requires the Premium Tier workspace, which was outside the budget of this prototype.
- Current State: Resources created via Azure Portal (ClickOps).
- Production Target: Infrastructure (ADLS containers, Databricks Workspaces, Clusters) defined in Terraform or Azure Bicep for reproducible deployments.
- Current State: Manual triggers / Notebook execution.
- Production Target: End-to-end pipeline orchestration using Azure Data Factory (ADF) or Databricks Workflows to schedule ingestion -> bronze -> silver -> gold jobs.
├── adls_connection.py # Utility for ADLS connectivity (Mounting/Auth)
├── bronze_notebook_sbb.ipynb # Raw ingestion to Bronze Layer (Trains)
├── silver_notebook_sbb.ipynb # Cleaning & Schema enforcement (Trains)
├── bronze_notebook_weather.ipynb # Raw ingestion to Bronze Layer (Weather)
├── silver_notebook_weather.ipynb # Cleaning & Schema enforcement (Weather)
├── main.py # Local ingestion script entry point
├── requirements.txt # Project dependencies
└── README.md # Project documentationNote: This project requires an active Azure Subscription and a Databricks Workspace.
- Setup Environment
pip install -r requirements.txt-
Configure Credentials
Create asecrets/folder (gitignored) or set environment variables for:SBB_API_KEYAZURE_STORAGE_ACCOUNT_KEY
-
Run Ingestion
Execute the python script to fetch data and push to ADLS Landing zone:
python main.py- Run Pipeline
Import the notebooks into Databricks and execute in order:bronze_notebook_*.ipynbsilver_notebook_*.ipynb
