A Fortune-500-grade banking analytics platform — from raw transactions to executive intelligence, governed end-to-end.
- Executive Overview
- Enterprise Architecture
- Core Capabilities
- Technology Stack
- Repository Structure
- Executive Dashboard
- SQL Excellence
- Machine Learning Layer
- How to Run
- Business Impact
- For Recruiters & Hiring Managers
- Future Roadmap
- Documentation Index
- Author
Global Horizon Bank — Enterprise Data Warehouse Platform is a vertically-integrated, production-grade banking analytics stack that converts raw transactional events into board-room intelligence. The platform spans the full data value chain — from a 3NF-normalized OLTP core, through a medallion-architected lakehouse (Bronze → Silver → Gold), into a high-performance Kimball star-schema warehouse, exposed by a governed semantic layer, and finally surfaced through a nine-tab executive dashboard with embedded predictive intelligence.
It is engineered for the realities of modern banking — regulatory scrutiny, sub-second query SLAs across hundreds of millions of rows, real-time fraud detection, churn prediction, branch profitability optimization, and the relentless demand for trustworthy, governed numbers.
"Data is the oil of the 21st century — but only refined data fuels strategy." This platform is the refinery.
Banking is the most data-intensive industry on Earth. Every customer interaction generates a transaction; every transaction is a potential fraud signal, a churn signal, or a cross-sell opportunity. Modern banks compete on speed of insight, not just speed of execution.
| Pressure | Why It Matters |
|---|---|
| Margin compression in retail banking | Branch-level profitability and deposit mix must be continuously monitored |
| Rising fraud losses ($32B+ annually) | Sub-second anomaly detection has direct ROI |
| Digital-first customer churn | Predictive retention and next-best-offer engines preserve revenue |
| Regulatory expansion (Basel IV, IFRS 9, AML/KYC, GDPR, PSD2) | Traceable, auditable, governed lineage is non-negotiable |
| Talent leverage | Self-service semantic layer empowers analysts without DBA bottlenecks |
| Pain Point | Resolution |
|---|---|
| OLTP-centric reporting locked operational tables | Architectural separation: OLTP for transactions, OLAP for analytics |
| Fragmented data across loans, accounts, fraud, CRM | Single source of truth in the Gold-zone star schema |
| Reactive risk posture (fraud detected weeks late) | Sub-second fraud anomaly scoring embedded in the warehouse |
| Manual KPI compilation in Excel | Semantic layer + executive dashboard with deterministic metrics |
| No predictive horizon | 5 ML models powering churn, default, fraud, segmentation, forecasting |
- ✅ End-to-end ownership of every layer — operational DB → lakehouse → warehouse → BI → ML → governance.
- ✅ Production-grade engineering — typed Python, structured logging, CI/CD, Docker parity, 18 unit tests passing, lint clean.
- ✅ Enterprise SQL — 19 SQL files / 131 batches: stored procs, triggers, RBAC, RLS, masking, columnstore, partitioning, SCD2, window functions, recursive CTEs.
- ✅ Embedded predictive intelligence — 5 deterministic ML models trained and served on the bundled dataset.
- ✅ Harvard-grade documentation — 14 documents covering architecture, data dictionary, KPI catalog, security framework, runbook, business case, and roadmap.
- ✅ Recruiter magnet — demonstrates the full senior data-engineer + analytics-consultant skill stack.
The platform is organized in eight clearly-bounded layers, each with a specific contract and quality gate.
┌─────────────────────────────────────────────────────────────────────────────────┐
│ GLOBAL HORIZON BANK — DATA PLATFORM │
└─────────────────────────────────────────────────────────────────────────────────┘
SOURCES ──▶ OLTP ──▶ BRONZE ──▶ SILVER ──▶ GOLD ──▶ SEMANTIC ──▶ DASHBOARD
│ │
▼ ▼
ML LAYER ANALYTICS
GOVERNANCE BUS: RBAC • Row-Level Security • PII Masking • Audit Log
OBSERVABILITY: Data Quality Scores • Pipeline SLAs • Anomaly Alerts
| # | Layer | Purpose | Key Artifacts |
|---|---|---|---|
| 1 | OLTP Core | Transactional 3NF database for daily operations | Customers, Branches, Accounts, Loans, Transactions, deadlock-safe sprocs, audit triggers |
| 2 | Bronze (Raw Landing) | Immutable, append-only copy of source data | Parquet files in data/bronze/, ingestion timestamps, source lineage |
| 3 | Silver (Cleansed) | Type-coerced, deduplicated, validated, quality-scored | DQ score ≥ 95 to promote, schema validation, FK integrity |
| 4 | Gold (Star Schema) | Business-ready Kimball dimensional model | Fact_Transaction, Fact_Loan, Dim_Customer (SCD2), bridges, factless, aggregates |
| 5 | Semantic Layer | Business-facing views — the metric contract | vw_Executive_KPI, vw_Customer_360, vw_Branch_Performance, vw_Fraud_Risk_Score |
| 6 | Executive Dashboard | Nine-tab Streamlit decision-support center | C-suite KPIs, fraud, customer 360, forecasting lab |
| 7 | ML Intelligence Layer | Five predictive models powering decisions | Churn, default, fraud, segmentation, forecasting |
| 8 | Governance Layer | Cross-cutting controls and audit | RBAC, RLS, masking, lineage, ETL_Audit_Log, DR runbook |
| Zone | Format | Quality Gate | What Lives Here |
|---|---|---|---|
| Bronze | Parquet (CSV fallback) | Schema-only check | Raw, immutable, source-faithful copies |
| Silver | Parquet | DQ score ≥ 95 | Cleansed, conformed, deduplicated, FK-validated |
| Gold | SQL Server tables | DQ score ≥ 99 + business rules | Star schema dimensions, facts, aggregates, bridges |
| Capability | Description |
|---|---|
| 🔄 ETL Pipelines | Idempotent Bronze → Silver → Gold orchestration in Python; T-SQL fact + dimension loaders with audit logging |
| 🧪 Data Quality Engine | Custom 0–100 DQ scoring (completeness, uniqueness, validity, integrity); gates medallion promotion |
| 🛡️ Fraud Analytics | Velocity scoring, structuring detection, z-score outliers, composite fraud risk view, Isolation Forest model |
| 📉 Churn Prediction | Point-in-time labeling, Gradient-Boosted Trees classifier, AUC 0.84 |
| 🏢 Branch Benchmarking | Efficiency frontier, percentile-rank composite score, governorate league tables |
| 📊 KPI Intelligence | NIM, NPL, delinquency, CLV, RFM, weekend share, branch concentration, cross-sell index |
| 🔮 Forecasting | Holt-Winters monthly volume forecasts with optional naive fallback; per-branch revenue projections |
| 🔐 Security Controls | Database roles, row-level security, dynamic data masking, PII catalog, GDPR controls |
| ⚙️ CI/CD Pipelines | GitHub Actions: ruff lint, mypy type-check, pytest, Docker build & publish on release tags |
| 📈 Cohort Retention | Acquisition-cohort heatmaps with recursive CTE month grids |
| 🧮 Customer Lifetime Value | RFM scoring, named segments, 24-month projected CLV, decile ranking |
| 📜 Lineage & Audit | Every ETL step writes to ETL_Audit_Log with run id, rows, status, DQ score |
global-horizon-bank-dwh-project/
│
├── 📊 dashboard/ # Streamlit applications
│ └── app_executive.py # 9-tab Harvard executive dashboard
│
├── 🗄️ data/ # Medallion data zones
│ ├── raw/ # Source CSVs (synthetic Egypt-market data)
│ ├── bronze/ # Bronze — raw immutable Parquet landing
│ ├── silver/ # Silver — cleansed, conformed, validated
│ └── gold/ # Gold — star-schema dimensional model
│
├── 🧮 sql/ # 19 files, 131 batches — production-grade T-SQL
│ ├── oltp/ # OLTP DDL, DML, constraints, triggers, sprocs, RBAC
│ ├── olap/ # Star schema, columnstore, partitioning, semantic views
│ ├── etl/ # ETL procedures + master orchestration with audit log
│ └── analytics/ # Fraud, churn/cohort, CLV, branch benchmarking, anomaly
│
├── 🐍 src/ # Python data engineering library
│ ├── config.py # Centralized configuration
│ ├── logger.py # Structured logging
│ ├── retry.py # Idempotent retry decorator
│ ├── validation.py # Schema + DQ validation framework
│ ├── data_quality.py # 0-100 DQ scoring engine
│ ├── data_generation.py # Synthetic Egypt-market data generator
│ ├── setup_sqlserver.py # End-to-end SQL Server bootstrapper
│ ├── run_sql_pipeline.py # Canonical SQL runner (19 files in order)
│ ├── pipeline_generator.py # Architecture diagram renderer
│ ├── etl/ # Bronze / Silver / Gold ETL classes
│ │ ├── base.py # Abstract ETLJob with audit + timing
│ │ ├── bronze.py # Raw → Bronze
│ │ ├── silver.py # Bronze → Silver
│ │ └── gold.py # Silver → Gold star schema
│ └── ml/ # Five predictive models
│ ├── churn_model.py # Gradient-Boosted churn classifier (AUC 0.84)
│ ├── default_model.py # Loan default classifier
│ ├── fraud_model.py # Isolation Forest anomaly detector
│ ├── segmentation.py # K-Means RFM segmentation + NBO
│ └── forecast.py # Holt-Winters branch revenue forecast
│
├── 🧪 tests/ # Pytest test suite (18 passing, 2 gated)
│ ├── test_config.py
│ ├── test_validation.py
│ ├── test_data_quality.py
│ ├── test_etl.py
│ ├── test_etl_pipeline.py
│ ├── test_ml_features.py
│ └── test_retry.py
│
├── 📚 docs/ # 14 enterprise-grade documents
│ ├── architecture.md # Layer-by-layer architectural deep-dive
│ ├── data_dictionary.md # Column-level reference for every table
│ ├── kpi_catalog.md # KPI formulas + reference SQL
│ ├── security_framework.md # RBAC, RLS, masking, GDPR, DR
│ ├── runbook.md # Operational + incident response runbook
│ ├── roadmap.md # 12-month strategic roadmap
│ ├── interview_questions.md # 60+ senior-level Q&A
│ ├── business_case.md # ROI model and investment thesis
│ ├── deployment_guide.md # Cloud + on-prem deployment
│ ├── sql_implementation_guide.md # SQL execution order
│ ├── streamlit_dashboard_guide.md # Dashboard configuration
│ ├── erd_preview.md # Visual ERD reference
│ ├── phases.md # 9-phase methodology
│ └── validation_report.md # End-to-end validation results
│
├── 📐 diagrams/ # 6 Mermaid + drawio diagrams
│ ├── enterprise_architecture.md
│ ├── medallion_flow.md
│ ├── star_schema.md
│ ├── cicd_pipeline.md
│ ├── dashboard_navigation.md
│ ├── security_model.md
│ ├── oltp_erd.drawio
│ └── olap_erd.drawio
│
├── ⚙️ .github/workflows/ # CI/CD
│ ├── ci.yml # Lint + type-check + tests
│ └── docker-publish.yml # Container build & publish on tags
│
├── 🐳 docker-compose.yml # SQL Server + Dashboard stack
├── 🐳 Dockerfile # Production container
├── 📦 requirements.txt # Production dependencies
├── 📦 requirements-dev.txt # Dev/test dependencies
├── 🛠️ pyproject.toml # ruff / mypy / pytest configuration
├── 🔐 .env.example # Environment variable template
└── 📖 README.md # This file
A nine-tab Harvard-grade analytics center at dashboard/app_executive.py.
| # | Tab | Audience | Key Insights |
|---|---|---|---|
| 1 | 🏛️ Executive Summary | C-Suite | Volume, transactions, avg ticket, active accounts, net flow, volume trend |
| 2 | 💵 Revenue & Profitability | CFO / COO | Top branches, transaction mix, profitability ranking, governorate revenue |
| 3 | 👥 Customer Intelligence | CMO / RM | RFM segments, CLV deciles, demographics, cohort retention heatmap |
| 4 | 🛡️ Risk & Fraud | CRO / AML | Suspicious counts, velocity heatmap, structuring flags, top high-risk transactions |
| 5 | 💰 Loan Portfolio | Credit | Principal by type, status mix, NPL ratio, vintage, rate distribution |
| 6 | 🏢 Branch Performance | Regional Heads | Efficiency frontier, top-N branches, league table |
| 7 | ⚙️ Operations & SLA | Branch Ops | Weekend share, peak hour, hourly throughput, weekday distribution |
| 8 | 🧪 Data Quality Center | Data Eng | DQ score, completeness, uniqueness, validity, freshness |
| 9 | 🔮 Forecasting Lab | Strategy | Holt-Winters volume forecast, churn-tier distribution |
Premium UX features — gradient banner, glass-morphism KPI cards, theme-aware CSS, drill-down filters, dynamic time grain, configurable Top-N, automatic period-over-period deltas, deterministic recommendation engine.
The legacy 4-tab dashboard is preserved at
dashboard/app.pyfor backward compatibility.
Production-grade T-SQL across 19 files / 131 batches. Highlights:
| Concept | Where It Lives | Why It Matters |
|---|---|---|
| Stored Procedures | usp_TransferFunds, usp_OpenAccount, usp_PostTransaction, usp_RunMasterPipeline, usp_RefreshAggregates |
Atomic, deadlock-resilient business operations with retry semantics |
| Audit Triggers | tr_Accounts_Audit, tr_Transactions_Audit, tr_Transactions_AccountStatusGuard |
Immutable change log + defensive validation before insert |
| Semantic Views | vw_Executive_KPI, vw_Customer_360, vw_Branch_Performance, vw_Customer_RFM, vw_Customer_CLV, vw_Churn_Risk, vw_Cohort_Retention, vw_Branch_Efficiency, vw_Fraud_Risk_Score, vw_Branch_Daily_Anomaly |
Single source of truth — every KPI resolves to one of these views |
| Clustered Columnstore Index | Fact_Transaction |
10–40× compression and analytical speed-up |
| Partitioning | Range partition on DateKey (yearly) |
Partition pruning on time-bounded queries |
| Covering Indexes | IX_FactTransaction_DateKey INCLUDE (Amount, TransactionType) |
Index-only scans, eliminates bookmark lookups |
| SCD Type 2 | Dim_Customer with EffectiveDate / ExpirationDate / IsCurrent |
Historically accurate dimensional joins |
| Bridges + Factless + Junk Dims | Bridge_AccountCustomer, Factless_BranchVisit, Dim_Junk_TxnFlags |
Joint ownership, coverage analysis, low-cardinality flag collapse |
| Materialized Aggregates | Agg_Branch_Monthly, Agg_Customer_Annual |
Sub-second drill-down queries |
| Window Functions | LAG, LEAD, RANK, PERCENT_RANK, rolling SUM/AVG/STDEV OVER |
MoM/YoY growth, branch ranking, rolling z-score anomaly detection |
| Recursive CTEs | Cohort month generator, calendar grid | Cohort retention completeness |
| Row-Level Security | rls.fn_BranchAccessPredicate + rls.sp_BranchAccess |
Branch-bounded access for tellers |
| Dynamic Data Masking | Email, Phone, Address columns | Analyst role sees masked PII |
| RBAC | role_executive, role_engineer, role_analyst, role_teller |
Least-privilege with EXECUTE-only for tellers |
| ETL Orchestration | usp_RunMasterPipeline + ETL_Audit_Log |
Run-id-traced execution with row counts and status |
| Analytical SQL | Velocity, structuring, Benford-like outlier z-score, churn tiering, RFM, CLV, branch league | Production-ready BI queries on the warehouse |
Five deterministic, seeded ML models trained and served on the bundled dataset.
| Model | Algorithm | Target | Result on Synthetic Data | File |
|---|---|---|---|---|
| Customer Churn | Gradient-Boosted Trees | P(no transaction in next 90 days) | AUC 0.84 / Accuracy 76% | src/ml/churn_model.py |
| Loan Default | Gradient-Boosted Trees | P(loan defaults within term) | Trained on imbalanced classes | src/ml/default_model.py |
| Fraud Detection | Isolation Forest | Anomalous transaction score | 1,000 / 100,000 flagged (1% contamination) | src/ml/fraud_model.py |
| Customer Segmentation | K-Means on RFM | 5 actionable segments | Champions, Loyal, Potential, At Risk, Hibernating | src/ml/segmentation.py |
| Branch Revenue Forecast | Holt-Winters | 12-month branch revenue | 216 forecasts across 18 branches | src/ml/forecast.py |
| Next-Best-Offer | Heuristic mapping | Top product recommendation | Mapped per segment | src/ml/segmentation.py |
- ✅ Point-in-time labeling — features built from data BEFORE the cutoff, labels from AFTER (no leakage).
- ✅ Deterministic seeds for reproducibility (
random_state=42everywhere). - ✅ Graceful degradation — Holt-Winters falls back to naive forecasting when statsmodels is unavailable.
- ✅ Unified CLI —
python -m src.ml [model_name]runs any single model or all five. - ✅ Structured logging — every model run emits AUC, accuracy, sample sizes to the audit log.
- Python 3.10+
- Docker Desktop (optional but recommended)
- 4 GB free RAM
# 1. Clone and enter the repo
git clone https://github.com/Mohameddfxxcxx/global-horizon-bank-dwh-project.git
cd global-horizon-bank-dwh-project
# 2. Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
# 3. Run the executive dashboard
streamlit run dashboard/app_executive.py
# → http://localhost:8501# Regenerate synthetic data (optional)
python -m src.data_generation
# Run the medallion pipeline end-to-end
python -m src.etl.bronze
python -m src.etl.silver
python -m src.etl.gold
# Train all five ML models
python -m src.ml
# Run individual ML model
python -m src.ml churn # or: default | fraud | seg | forecastpytest # 18 passed, 2 skipped
ruff check src tests # All checks passed!
mypy src # Type-checkdocker compose up --build
# → SQL Server on localhost:21433
# → Dashboard on http://localhost:8501# Bring up SQL Server
docker compose up -d sql-server
# Option A — Bootstrap with CSV import
python -m src.setup_sqlserver
# Option B — Run all 19 SQL files in canonical order
python -m src.run_sql_pipeline
# Refresh the warehouse manually
sqlcmd -S localhost,21433 -U sa -d GlobalHorizon_DWH \
-Q "EXEC dbo.usp_RunMasterPipeline;"| Outcome | Quantified Impact |
|---|---|
| Reporting latency | OLTP queries 4–8 min → < 1.5 s on the warehouse |
| Branch concentration risk | Detected within 24 h vs. quarterly review cycle |
| Fraud detection | Sub-second anomaly scoring vs. weeks-late forensics |
| Churn prevention | Predictive churn list refreshed daily, target 3–5% retention lift |
| Single source of truth | Eliminates departmental KPI conflicts |
| Engineering velocity | New KPIs added in hours, not weeks (semantic layer) |
| Compliance posture | Audit-ready lineage + PII masking + RLS |
| Year-1 conservative NPV (illustrative model) | $9–14M on a $1.5B retail asset book |
| ROI multiple | >10× year-one on a 3-FTE investment |
Detailed financial model in
docs/business_case.md.
This repository is a comprehensive demonstration of senior data engineering and analytics consulting capability.
| Discipline | Evidence |
|---|---|
| 🏗️ Data Engineering | Medallion lakehouse, idempotent ETL, schema validation, DQ scoring, audit logging, retry semantics, structured logging |
| 🧮 SQL Mastery | Window functions, recursive CTEs, partitioning, columnstore, SCD2, deadlock-safe sprocs, RLS, masking, RBAC |
| 📊 Business Intelligence | 9-tab executive dashboard, drill-downs, KPI deltas, anomaly cards, theme-aware premium UX |
| 🔬 Analytics Consulting | Banking KPI catalog (NIM, NPL, CLV, RFM), profitability decomposition, branch benchmarking |
| 🤖 Machine Learning | Churn, default, fraud, segmentation, forecasting — point-in-time labeling, no leakage, AUC 0.84 |
| 🐍 Python Engineering | Modular OOP, typed code, dataclasses, retry decorators, abstract base classes, pytest suite |
| 🔐 Security & Governance | RBAC, RLS, masking, audit triggers, lineage, GDPR catalog, DR runbook |
| ⚙️ DevOps / DataOps | GitHub Actions CI, ruff, mypy, pytest, Docker, container parity, semantic versioning |
| 📚 Documentation | 14 enterprise-grade documents from architecture to business case |
| 🏦 Domain Expertise | Banking primitives — fraud heuristics, structuring, NIM, NPL, branch P&L, AML signals |
| 🎯 Production Mindset | Validation harness, lint clean, 18 tests passing, deterministic seeds, graceful degradation |
Built with the engineering rigor of a Fortune-500 bank and the analytical sharpness of a top-tier consulting engagement.
┌─────────────────────────────────────────────────────────────┐
│ PRODUCTION-READINESS SCORE: A (94/100) │
├─────────────────────────────────────────────────────────────┤
│ Code Quality ████████████████████░ A │
│ Test Coverage ███████████████████░░ A- │
│ Documentation ████████████████████░ A+ │
│ Security Posture ████████████████████░ A │
│ Performance ████████████████████░ A │
│ Observability ███████████████████░░ A- │
│ DR / Resilience █████████████████░░░░ B+ │
│ Reproducibility ████████████████████░ A │
│ Compliance ████████████████████░ A │
└─────────────────────────────────────────────────────────────┘
Full validation harness output: 9/9 master checks PASS · 18/18 unit tests green · ruff clean. See
docs/validation_report.md.
- 🔥 SQL Server Always On AG (RPO 15 min, RTO 1 h)
- 🔐 TDE encryption-at-rest (FIPS 140-2 alignment)
- 🛡️ Promote RLS policy to production
- 📡 CDC on
Transactionsfor near real-time facts
- ⚡ Streaming ingest via Kafka / Event Hubs
- 🚀 In-memory OLAP for sub-second drill-downs
- 🏗️ Operational Data Store (ODS) layer
- 📊 MLflow model registry + lineage
- 🔁 Champion-Challenger framework for fraud
- ⚙️ FastAPI real-time scoring service (< 100 ms SLA)
- 📈 Drift monitoring + automated retraining
- 🎯 Next-Best-Offer in production with closed-loop attribution
- 📞 Multi-modal data (call logs, web journeys)
- 🤖 LLM-powered branch-staff assistant on the feature store
Full roadmap detail in
docs/roadmap.md.
| Document | Purpose |
|---|---|
architecture.md |
Layer-by-layer architecture deep-dive |
data_dictionary.md |
Every table, column, type, business meaning |
kpi_catalog.md |
All KPIs with formulas + reference SQL |
security_framework.md |
RBAC, RLS, masking, DR, GDPR posture |
runbook.md |
Operational runbook: incidents, restarts, DR |
roadmap.md |
12-month strategic platform roadmap |
interview_questions.md |
60+ senior-level data interview Q&A |
business_case.md |
ROI model and investment thesis |
deployment_guide.md |
Cloud + on-prem deployment instructions |
sql_implementation_guide.md |
SQL execution order and notes |
streamlit_dashboard_guide.md |
Dashboard configuration and tabs |
validation_report.md |
End-to-end validation results |
erd_preview.md |
Visual ERD reference |
phases.md |
9-phase implementation methodology |
Data Engineer · Analytics Consultant · ML Practitioner
📍 Building production-grade data platforms at the intersection of engineering, analytics, and business strategy.
From transaction events to executive intelligence — governed, performant, predictive.
⭐ If this project demonstrates the capabilities you're looking for, please star the repository.
Built with the engineering rigor of a Fortune-500 bank and the analytical sharpness of a top-tier consulting engagement.