This project implements a dimensional Data Lakehouse using PySpark and Delta Lake based on the Titanic dataset. The solution demonstrates batch and streaming data integration using multiple source systems and follows the Bronze/Silver/Gold data engineering architecture discussed in class and Lab 6.
The project models Titanic passenger survival events as the business process being analyzed.
- PySpark
- Delta Lake
- MySQL
- MongoDB Atlas
- Pandas
- Jupyter Notebook
This project integrates data from multiple source systems as required by the assignment.
Used as the primary OLTP source system.
Tables created in MySQL:
- dim_date source data
- passenger dimension source data
- embarkation dimension source data
- ticket dimension source data
- survival fact source data
Embarkation dimension data is exported from MySQL as JSON and uploaded into MongoDB Atlas before being read into PySpark.
Flow: MySQL → JSON → MongoDB Atlas → PySpark
Ticket dimension data is exported from MySQL as CSV and read from local disk into Spark.
Flow: MySQL → CSV → Local File System → PySpark
Fact survival event data is exported from MySQL into 3 separate JSON files to simulate streaming mini-batches.
Flow: MySQL → 3 JSON Files → PySpark Structured Streaming
The project implements the Bronze/Silver/Gold architecture.
Raw streaming JSON survival event data is ingested into Delta tables.
Bronze data is cleaned and integrated with dimension tables using joins.
Business analytics and aggregated reporting queries are generated.
Examples:
- Survival rate by passenger class
- Survival rate by gender
- Survival statistics by embarkation location
- dim_date
- dim_passenger
- dim_ticket
- dim_embarkation
- fact_survival_event
DS2002_Titanic_Capstone_LOCAL_Project/
├── DS2002_Project2_Titanic_Capstone_LOCAL_PySpark.ipynb
├── README.md
├── titanic_capstone/
│ ├── source/
│ ├── batch/
│ ├── streaming/
│ ├── bronze/
│ ├── silver/
│ └── gold/
└── spark-warehouse/