Skip to content

Repository files navigation

🍽️ Restaurant Analytics Platform on Azure Databricks

Databricks PySpark Delta Lake Unity Catalog Lakeflow Azure Event Hub Python

A production-style end-to-end Restaurant Analytics Platform built on Azure Databricks using the Medallion Architecture, Delta Lake, Unity Catalog, Lakeflow Declarative Pipelines, and Azure Event Hub for real-time data ingestion.


πŸ“– Project Overview

Modern restaurants generate enormous volumes of operational data every dayβ€”from customer orders and menu selections to restaurant reviews and customer interactions.

Simply storing this data is not enough.

Businesses need an intelligent analytics platform capable of:

  • Processing streaming and batch data
  • Maintaining high-quality datasets
  • Performing scalable transformations
  • Building analytical data models
  • Delivering business-ready insights

This project demonstrates how these challenges can be solved using the modern Databricks Lakehouse Platform.

The pipeline ingests raw restaurant data, validates it, transforms it through the Bronze, Silver, and Gold layers, and produces curated datasets that power business dashboards and analytical reporting.


πŸŽ₯ Project Demo

Want to see the project in action?

▢️ Refer to the demo video below to understand the complete Restaurant Analytics Platform, including the data pipeline, transformations, and analytics flow.

πŸ“Ί Watch the Demo

▢️ Restaurant Analytics Platform β€” Project Demo

🎬 Click here to watch the Project Demo on YouTube


πŸš€ Key Features

βœ… End-to-End Lakehouse Architecture

βœ… Medallion Architecture (Bronze β†’ Silver β†’ Gold)

βœ… Unity Catalog Governance

βœ… Lakeflow Declarative Pipelines

βœ… Delta Lake Storage

βœ… Structured Streaming

βœ… Azure Event Hub Integration

βœ… Data Quality Expectations

βœ… Real-Time Order Processing

βœ… Customer 360 Analytics

βœ… Restaurant Performance Analytics

βœ… Sales Summary Aggregations


πŸ—οΈ Architecture

The platform follows the industry-standard Medallion Architecture, where data progressively becomes cleaner, richer, and more business-friendly.

                        Azure Event Hub
                              β”‚
                              β–Ό
                    Lakeflow Pipeline
                              β”‚
                Bronze (Raw Ingestion)
                              β”‚
                              β–Ό
              Silver (Validated & Cleaned)
                              β”‚
                              β–Ό
          Gold (Business Ready Data Models)
                              β”‚
                              β–Ό
                   Dashboards & Analytics

πŸ“‚ Repository Structure

Databricks-RestaurantAnalyticsPlatform

β”‚
β”œβ”€β”€ Data
β”‚   β”œβ”€β”€ customers.csv
β”‚   β”œβ”€β”€ restaurants.csv
β”‚   β”œβ”€β”€ menu_items.csv
β”‚   β”œβ”€β”€ customer_reviews.csv
β”‚   β”œβ”€β”€ historical_orders.csv
β”‚
β”œβ”€β”€ Data Ingestion
β”‚   β”œβ”€β”€ Ingestion_to_Bronze.ipynb
β”‚   └── Ingestion_to_Silver.ipynb
β”‚
β”œβ”€β”€ EventHubDataIngestion
β”‚   β”œβ”€β”€ transformations
β”‚   └── explorations
β”‚
β”œβ”€β”€ Silver_Level_Transformations
β”‚   β”œβ”€β”€ transformations
β”‚   └── explorations
β”‚
β”œβ”€β”€ Gold_Level_Transformations
β”‚   β”œβ”€β”€ transformations
β”‚   └── explorations
β”‚
β”œβ”€β”€ Dashboard Images
β”‚
β”œβ”€β”€ project_architecture.png
β”‚
└── README.md

πŸ› οΈ Technology Stack

Layer Technology
Cloud Platform Azure
Data Platform Databricks
Storage Delta Lake
Data Processing PySpark
Streaming Structured Streaming
Messaging Azure Event Hub
Governance Unity Catalog
Pipeline Lakeflow Declarative Pipelines
Language Python
SQL Engine Spark SQL

πŸ“₯ Data Sources

The project processes both historical and streaming datasets.

Batch Data

  • Customers
  • Restaurants
  • Menu Items
  • Customer Reviews
  • Historical Orders

Streaming Data

Restaurant Orders are streamed through Azure Event Hub, simulating a real-world online ordering system.


πŸ₯‰ Bronze Layer

The Bronze layer serves as the raw landing zone.

Responsibilities

  • Ingest streaming events
  • Preserve original data
  • Minimal transformations
  • Schema enforcement
  • Store immutable raw records

Streaming ingestion is implemented using:

  • Azure Event Hub
  • Kafka API
  • Structured Streaming
  • Lakeflow Declarative Pipelines

Example Bronze table:

01_bronze.orders

πŸ₯ˆ Silver Layer

The Silver layer performs data cleansing, enrichment, and validation.

Implemented transformations include:

  • Timestamp conversion
  • Date extraction
  • Weekend identification
  • Hour extraction
  • JSON parsing
  • Item count calculation
  • Business rule validation

Data quality expectations ensure records with invalid values are automatically removed.

Examples include:

  • Null Order IDs
  • Invalid Order Status
  • Invalid Payment Method
  • Negative Revenue
  • Missing Customer IDs

Example Silver tables

02_silver.fact_orders

02_silver.fact_order_items

02_silver.fact_reviews

πŸ₯‡ Gold Layer

The Gold layer contains business-ready datasets designed for reporting and dashboarding.

Current Gold models include:

πŸ“Š Sales Summary

Daily KPIs including

  • Total Revenue
  • Average Order Value
  • Total Orders
  • Delivery Orders
  • Dine-In Orders
  • Takeaway Orders
  • Active Restaurants
  • Unique Customers

πŸ‘₯ Customer 360

Customer-centric analytical dataset including

  • Customer Profile
  • Lifetime Spend
  • Ordering Behaviour
  • Customer Segmentation

⭐ Restaurant Reviews

Aggregated review metrics including

  • Average Rating
  • Total Reviews
  • Restaurant Performance

⚑ Lakeflow Declarative Pipelines

The project uses Lakeflow Declarative Pipelines to define scalable data pipelines.

Benefits include:

  • Simplified ETL
  • Automatic dependency management
  • Incremental processing
  • Built-in monitoring
  • Streaming support
  • Declarative transformations

πŸ“ˆ Data Quality

Data quality is enforced directly inside the pipeline using expectations.

Examples include validating:

  • Order IDs
  • Customer IDs
  • Restaurant IDs
  • Order Status
  • Payment Method
  • Positive Revenue
  • Valid Item Count

Invalid records are automatically dropped before reaching downstream layers.


πŸ“Š Business Insights

The platform enables several analytical use cases.

Sales Analytics

  • Daily Revenue
  • Revenue Trend
  • Average Basket Size
  • Peak Ordering Hours

Customer Analytics

  • Customer Lifetime Value
  • Repeat Customers
  • Customer Behaviour
  • Spending Patterns

Restaurant Analytics

  • Restaurant Ratings
  • Order Volume
  • Revenue Contribution
  • Restaurant Performance

πŸ“Έ Dashboards

The repository includes sample dashboards demonstrating:

  • Restaurant Analytics
  • Customer Analytics
  • Customer Reviews
  • Sales Performance

Dashboard assets are available under:

Dashboard Images/

▢️ Running the Project

  1. Create an Azure Databricks Workspace

  2. Configure Unity Catalog

  3. Create Catalogs and Schemas

  4. Upload source datasets

  5. Configure Azure Event Hub

  6. Deploy Lakeflow Pipelines

  7. Execute Bronze Layer

  8. Execute Silver Layer

  9. Execute Gold Layer

  10. Connect Power BI or Databricks Dashboards


πŸ“š Learning Outcomes

Through this project, I gained practical experience with:

  • Azure Databricks
  • Unity Catalog
  • Lakehouse Architecture
  • Delta Lake
  • Structured Streaming
  • Azure Event Hub
  • Data Quality Expectations
  • Lakeflow Declarative Pipelines
  • PySpark Transformations
  • Real-time Analytics

πŸš€ Future Improvements

  • CI/CD using Azure DevOps
  • Infrastructure as Code with Terraform
  • Workflow orchestration
  • Data lineage visualization
  • Machine Learning for demand forecasting
  • Customer recommendation engine
  • Real-time alerting
  • Data observability
  • Cost optimization dashboards

πŸ™ Acknowledgements

This project was built by following and learning from the excellent End-to-End Databricks Project by Afaq Ahmed.

The implementation has been recreated, explored, and documented as a hands-on learning project to deepen my understanding of modern Azure Data Engineering concepts and Databricks best practices.

Special thanks to Afaq Ahmed for creating practical and industry-oriented learning content.


πŸ‘¨β€πŸ’» Author

Chethan Prabhas

Azure Data Engineer | Databricks | PySpark | Azure Data Factory | SQL

If you found this repository useful, consider giving it a ⭐ to support the project.

About

End-to-end Restaurant Analytics Platform built on Azure Databricks using Medallion Architecture, Delta Lake, Unity Catalog, Lakeflow Declarative Pipelines, PySpark, and Azure Event Hub for batch and real-time analytics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages