Technology Stack: PySpark, Delta Lake, Azure Data Lake, Databricks
This project implements a scalable data pipeline using the Medallion Architecture to transform raw data into business-ready insights.
The pipeline is designed to ensure:
- Data reliability
- Scalability
- Auditability
- Clear separation of concerns
The data pipeline follows a Medallion Architecture:
- Bronze Layer β Raw ingestion from source
- Silver Layer β Data cleaning & standardization
- Gold Layer β Business-ready data (DIM, FACT, KPIs)
Source (Azure Blob Storage)
β
Bronze Layer (Raw Data)
β
Silver Layer (Cleaned & Standardized Data)
β
Gold Layer (Dimensional Model + KPIs + Business Logic)
bronze/ingest_bronze.ipynb
To ingest raw data from source systems without any transformation.
- Dynamically reads all tables from source catalog:
tables = [t.name for t in spark.catalog.listTables("azure_blob_storage")]- Adds ingestion timestamp:
df = df.withColumn("ingestion_ts", current_timestamp())- Stores as Delta tables:
workspace.bronze.bronze_<table_name>
- Source data schema is consistent
- Data may contain errors, nulls, or duplicates
- No transformations are applied
- All tables are ingested as-is without transformation
- No filtering, no validation at this stage
- No validation performed
- Raw data preserved for traceability
- Schema drift allowed
- Ingestion timestamp ensures auditability
To clean, validate, and standardize data before business use.
- Convert string dates to proper format:
to_date(col("order_date"), "dd-MM-yyyy")-
Remove or filter records with null values in:
order_idcustomer_idproduct_idorder_statuscustomer_emailcustomer_name
- Remove duplicate records using primary keys
- Is_valid column for checking valid records
- Is_invalid_status to check if status is valid and present
- Data inconsistencies exist in raw layer
- All transformations must be handled in Silver layer
- Silver acts as a trusted data source
- Data may contain null vaues, incorrect formats, duplicates, orphan records
- No nulls in primary keys
- Dates must be correctly parsed
- No duplicate records
- Valid currency mappings
- Invalid records are filtered
To provide analytics-ready datasets using dimensional modeling.
dim_customerdim_productdim_datedim_country
fact_orders
All revenue is converted to USD:
revenue_usd = quantity Γ price Γ rate_to_usd
- Ensures global consistency
- Applied at fact table level
All order statuses are preserved:
-
Pending -
Completed -
Shipped -
Cancelled -
No filtering in fact layer
-
Enables flexible KPI calculations
Revenue is attributed using:
orders.country
- Represents actual transaction location
- Used for regional performance analysis
- Silver data is clean and reliable
- Exchange rates are accurate
- Fact table contains all transactional data
- Business logic is applied only here
- Revenue must be greater than 0
- Foreign keys must be valid
- No nulls in critical fields
- Valid joins across tables
- Exchange rates must exist
To derive business insights from the Gold layer.
- Total Revenue (USD)
- Revenue by Country
- Revenue by Channel
β Only completed orders are considered
- Customer Acquisition (monthly)
- Active Customers
Based on first purchase date
- Completed Order Rate
- Average Order Value (AOV)
- Top Performing Products
Defined as:
Data Quality Score = Valid Records / Total Records
Valid records must:
- Have no null keys
- Contain valid revenue
- Pass all integrity checks
Ensures scalability and modularity
- Bronze β Raw
- Silver β Clean
- Gold β Business
- Avoids repeated calculations
- Ensures consistency across KPIs
- No filtering
- Maintains auditability
- Flexible business rules
- Easy to modify
This pipeline provides:
- Scalable data processing
- Clean and reliable datasets
- Accurate business metrics
- Strong data governance
The design follows industry best practices and is suitable for real-world analytics and reporting systems.
- Incremental data processing
- Slowly Changing Dimensions (SCD Type 2)
- Data validation frameworks
- Real-time streaming pipelines
- Dashboard integration (Power BI / Tableau)