A professional, enterprise-grade data engineering project for collecting, processing, and analyzing weather data across USA and India. This project demonstrates modern data engineering practices using Azure Cloud services, Databricks, and Apache Spark.
This project implements a complete data pipeline that:
- Ingests weather data from live APIs and static files
- Processes data for countries, states, and major cities
- Tracks multiple metrics: temperature, humidity, wind, air quality, and more
- Implements Medallion Architecture (Bronze β Silver β Gold layers)
- Manages original and archive tables with monthly/weekly archival
- Uses Azure Data Factory for orchestration
- Processes data with Apache Spark & PySpark
- Implements enterprise-grade logging, monitoring, error handling, and data quality
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA SOURCES β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ€
β Weather APIs β CSV/JSON Files β
β (USA & India) β (Historical Data) β
ββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AZURE DATA FACTORY (Orchestration) β
β - Copy Activities (API β Staging) β
β - Lookup Activities (Aggregations) β
β - Error Handling & Retry Logic β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AZURE DATA LAKE STORAGE (ADLS) β
ββββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββ¬βββββββββββββββββ€
β Staging β Bronze β Silver β Gold β
β (Raw) β (Raw Data) β (Cleaned) β (Insights) β
ββββββββββββββββ΄βββββββββββββββββ΄ββββββββββββββ΄βββββββββββββββββ
β β β β
β βΌ βΌ βΌ
β ββββββββββββ ββββββββββββ ββββββββββββ
β β Original β β Original β β Original β
β β Table β β Table β β Table β
β ββββββββββββ ββββββββββββ ββββββββββββ
β β β β
ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββ
β Archive Tables (Append Mode) β
β - Historical Data β
β - Monthly/Weekly Archival β
ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATABRICKS (Processing & Analytics) β
β - PySpark Transformations β
β - Data Quality Validation β
β - State/City-level Aggregations β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
BRONZE LAYER (Raw Data)
βββ Original Table: Current week/month raw data
βββ Archive Table: All historical raw data
SILVER LAYER (Cleaned & Validated)
βββ Original Table: Current cleaned data
βββ Archive Table: Historical cleaned data
GOLD LAYER (Business Ready Insights)
βββ Original Table: Current insights & aggregations
βββ Archive Table: Historical trends & patterns
βββ Country-level aggregations
βββ State-level aggregations
βββ City-level aggregations
data-engineering-weather/
βββ src/
β βββ api/
β β βββ __init__.py
β β βββ weather_client.py # Weather API client
β β βββ api_config.py # API configuration
β βββ ingestion/
β β βββ __init__.py
β β βββ file_ingestion.py # Read CSV/JSON files
β β βββ api_ingestion.py # Fetch from APIs
β βββ transformations/
β β βββ __init__.py
β β βββ bronze_transformations.py # Raw β Bronze
β β βββ silver_transformations.py # Bronze β Silver
β β βββ gold_transformations.py # Silver β Gold
β βββ validation/
β β βββ __init__.py
β β βββ data_quality.py # Quality checks
β β βββ schema_validator.py # Schema validation
β β βββ anomaly_detection.py # Data anomalies
β βββ logging/
β β βββ __init__.py
β β βββ logger.py # Structured logging
β βββ config/
β β βββ __init__.py
β β βββ config.py # Configuration management
β β βββ constants.py # Constants
β βββ utils/
β β βββ __init__.py
β β βββ spark_utils.py # Spark helpers
β β βββ adls_utils.py # ADLS operations
β β βββ retry_logic.py # Retry & backoff
β βββ archive/
β βββ __init__.py
β βββ archive_manager.py # Archive operations
βββ terraform/
β βββ main.tf # Main resources
β βββ variables.tf # Variables & placeholders
β βββ outputs.tf # Output values
β βββ storage.tf # ADLS configuration
β βββ databricks.tf # Databricks setup
β βββ data_factory.tf # ADF setup
β βββ keyvault.tf # Key Vault
β βββ terraform.tfvars.example # Example variables
βββ adf-pipelines/
β βββ pipeline-ingest-api.json # ADF pipeline for API ingestion
β βββ pipeline-ingest-files.json # ADF pipeline for file ingestion
β βββ pipeline-archive.json # ADF pipeline for archival
β βββ pipeline-master.json # Master orchestration pipeline
β βββ linked-services-template.json # Linked service templates
βββ docs/
β βββ ARCHITECTURE.md # Detailed architecture
β βββ SETUP_GUIDE.md # Setup instructions
β βββ RUNBOOK.md # Operations runbook
β βββ DATA_DICTIONARY.md # Data schema documentation
β βββ API_DOCUMENTATION.md # API details
β βββ TROUBLESHOOTING.md # Troubleshooting guide
βββ config/
β βββ dev-config.yaml # Development environment
β βββ staging-config.yaml # Staging environment
β βββ prod-config.yaml # Production environment
βββ tests/
β βββ __init__.py
β βββ test_api_client.py # API client tests
β βββ test_transformations.py # Transformation tests
β βββ test_validation.py # Validation tests
βββ .env.example # Environment template
βββ .gitignore # Git ignore rules
βββ requirements.txt # Python dependencies
βββ setup.py # Package setup
βββ README.md # This file
- Python 3.8+
- Azure subscription (optional for local development)
- Databricks workspace (optional for local development)
- Git
- pip package manager
-
Clone the repository
git clone https://github.com/yourusername/data-engineering-weather.git cd data-engineering-weather -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment
cp .env.example .env # Edit .env with your actual values (API keys, Azure credentials, etc.) -
Run tests
pytest tests/ -v
All configuration is managed via:
.envfile - Secrets and credentials (DO NOT commit)config/folder - Environment-specific configs- Terraform variables - Infrastructure parameters
See .env.example for all available configuration options.
Key variables:
AZURE_SUBSCRIPTION_ID- Azure subscriptionADLS_ACCOUNT_NAME- ADLS account nameDATABRICKS_TOKEN- Databricks API tokenWEATHER_API_KEY- Weather service API keyENVIRONMENT- Current environment (development/staging/production)
-
Ingestion Phase
- ADF Copy Activity: Fetch API data β Staging
- ADF Copy Activity: Read file data β Staging
-
Bronze Layer
- Raw data from staging
- Minimal transformations
- Schema validation
-
Silver Layer
- Data cleaning & deduplication
- Null handling
- Type conversions
- Quality checks
-
Gold Layer
- Business-ready aggregations
- Country-level metrics
- State-level insights
- City-level analysis
- Trend calculations
-
Copy to Archive
- Original table β Archive table (APPEND)
- Maintains full history
-
Clear Original
- DELETE old data from Original table
- INSERT new processed data
- Fresh snapshot each period
Implemented quality checks:
- β Schema validation (Avro/JSON)
- β Row count monitoring
- β Duplicate detection
- β Null value checks
- β Data freshness monitoring
- β Anomaly detection
- β Incremental load validation
- Structured Logging: JSON format for easy parsing
- Azure Application Insights: Real-time monitoring
- SLA Tracking: Data freshness and latency metrics
- Error Alerting: Automatic notifications on failures
- Audit Logs: Track all data modifications
- β
No credentials in code (uses
.env& Key Vault) - β Encryption at rest (ADLS, databases)
- β Encryption in transit (TLS)
- β Access control (RBAC)
- β Audit logging
- Incremental loading (only process new data)
- Auto-scaling Databricks clusters
- Archive to cheaper storage tiers
- Optimized query patterns
- Partitioned data for faster access
- Create a feature branch
- Make changes and add tests
- Run
pytest tests/to verify - Submit a pull request
- Cloud: Azure (ADLS, Databricks, Data Factory, Key Vault, SQL Database)
- Processing: Apache Spark, PySpark, Python 3.8+
- Orchestration: Azure Data Factory
- IaC: Terraform
- Monitoring: Application Insights
- Testing: pytest
- Version Control: Git, GitHub
- Data freshness: Time from ingestion to availability
- Pipeline latency: End-to-end processing time
- Data quality score: % of records passing validation
- Archive success rate: % of archives completing successfully
- API uptime: % of successful API calls
For issues and questions:
- Check Troubleshooting Guide
- Review logs in Azure Application Insights
- Submit an issue on GitHub
This project is licensed under the MIT License - see LICENSE file for details.
Created as a professional data engineering portfolio project.
Last Updated: 2026-05-13