NexusMart Data Analytics & Engineering Pipeline
CodeConnect’26 · Module 02 — Data Analytics Challenge
From raw retail data to a validated SQL Server warehouse, orchestrated workflow, and business-focused analysis.
Individual project · Built by Aaisha Iqbal
Table of Contents
Project Overview
NexusMart is a retail analytics case study developed for CodeConnect’26 — Module 02: Data Analytics. The project works with nine related CSV datasets covering customers, locations, orders, order items, payments, products, returns, sellers, and shipping.
The objective was to build and document a practical analytics workflow that moves beyond one-off queries: profile the source data, clean and validate records, load a SQL Server warehouse, model the data for analysis, orchestrate key workflow checks with Apache Airflow, and use SQL to investigate the challenge's 15 business questions.
The work includes Python-based profiling and cleaning artifacts, staging tables, a dimensional warehouse model, SQL analysis scripts, a local Airflow DAG, and supporting evidence and documentation. Power BI model and DAX work was also started; a completed interactive Power BI dashboard is not part of the current submission.
Scope note: This repository reflects the implementation reached during the hackathon. Some stages are demonstrated through existing processed outputs and validation tasks rather than a fully reproducible raw-to-warehouse rebuild. Known limitations are documented explicitly rather than presented as resolved.
Project Objectives
- Profile the supplied datasets and identify quality issues before analysis.
- Preserve traceability for duplicate, invalid, missing, or unresolved records.
- Apply the challenge's business rules consistently, including PKR amounts, discount handling, returns, cancellations, shipping fees, and date interpretation.
- Build a SQL Server staging layer and dimensional model suitable for retail analysis.
- Define and validate fact-table grain, dimension keys, and key financial measures.
- Use Apache Airflow to organize and execute workflow validation tasks.
- Answer the 15 official business questions using SQL and document the evidence and caveats.
- Record implementation challenges, decisions, limitations, and future improvements.
Architecture
The diagram below represents the current implemented workflow at a high level. It intentionally does not show Power BI as a completed reporting stage.
flowchart TD
A["Nine source CSV datasets"] --> B["Python profiling and cleaning artifacts"]
B --> C["Processed and quarantined/rejected CSVs"]
C --> D["SQL Server staging tables"]
D --> E["Dimensional warehouse"]
E --> F["FactSales + five dimensions"]
F --> G["SQL business-question analysis"]
G --> H["Business Answers document and query evidence"]
I["Apache Airflow DAG"] -. "orchestrates checks / validates existing state" .-> C
I -.-> D
I -.-> E
J["Quality reports and audit CSVs"] --- B
J --- D
J --- E
classDef source fill:#EAF2FF,stroke:#4776B8,color:#172554;
classDef processing fill:#E8F6F3,stroke:#168477,color:#123C38;
classDef warehouse fill:#FFF4DF,stroke:#C78B24,color:#533A0A;
classDef evidence fill:#F1EDFF,stroke:#7C65B1,color:#30235A;
class A source;
class B,C processing;
class D,E,F warehouse;
class G,H,J evidence;
Workflow summary
- Source profiling: inspect each CSV's row counts, columns, types, duplicates, and quality issues.
- Cleaning and exception handling: produce processed data and retain rejected/quarantined records with supporting quality artifacts.
- Staging: load the processed datasets into SQL Server staging tables.
- Warehouse modelling: use a line-level fact table and conformed dimensions for analytical queries.
- Orchestration: use a local Airflow DAG to organize validation and checks across the workflow.
- Analysis and evidence: execute SQL queries for the official business questions and retain results, documentation, and schema evidence.
Important distinction: the current Airflow DAG successfully ran its seven configured tasks, but several tasks validate existing processed files or populated warehouse tables rather than rebuilding every stage from raw data. See Airflow Orchestration and Known Limitations.
Technology Stack
| Area |
Tools |
Role in the project |
| Data preparation |
Python, pandas, notebooks |
Profiling, cleaning, validation, and exception reporting |
| Source format |
CSV |
Supplied retail datasets and processed outputs |
| Database |
Microsoft SQL Server |
Staging tables, dimensional tables, fact table, and analytical SQL |
| Data modelling |
Star schema |
Organizes order-line facts around shared dimensions |
| Orchestration |
Apache Airflow, Astro CLI, Docker Desktop |
Runs the local DAG and its validation workflow |
| Analytics |
SQL |
Business metrics, comparisons, trends, and question-based analysis |
| Semantic modelling |
Power BI, DAX |
Initial model and measure development; dashboard remains future work |
| Version control |
Git, GitHub |
Source control and submission repository |
| Documentation |
Markdown, Word, screenshots |
Business answers, implementation notes, and execution evidence |
Repository Structure
The repository is organized around code, SQL, reports, documentation, and screenshots. The tree below is a guide to the main folders, not a guarantee that every optional file listed in a generic project template exists.
CodeConnect26_DataAnalytics/
├── airflow/ # Local Airflow/Astro-related project files, if included
├── dags/ # Submitted DAG source
├── data/ # Source and/or processed datasets, subject to repository contents
├── important documentations/
│ ├── Business Answers.docx
│ ├── CodeConnect26_NexusMart_Challenges_Learnings_Limitations.docx
│ └── NexusMart_DAX_Measures.docx
├── logs/ # Local execution logs; inspect before publishing
├── notebooks/ # Profiling and cleaning notebooks
├── powerbi/ # Power BI-related files, if present
├── reports/
│ ├── Star_Schema_Diagram.png # Schema evidence may also be under screenshots/
│ └── ... # Data-quality reports and audit outputs
├── screenshots/
│ ├── airflow/ # Airflow UI / DAG execution evidence
│ └── star schema/ # Star schema screenshot
├── sql/ # Staging, dimensions, fact loading, and validation scripts
├── src/ # Python profiling, cleaning, and loading utilities
├── .gitignore
└── README.md
Important files and folders
dags/ — DAG source included for review and submission.
sql/ — SQL scripts for staging, dimensions, FactSales, date dimension, relationships, and quality checks.
src/ — Python utilities related to profiling, cleaning finalization, and data loading.
notebooks/ — exploratory profiling and cleaning work.
reports/ — quality summaries, reconciliation reports, exception/audit outputs, and other supporting artifacts.
screenshots/airflow/ — evidence of the local Airflow environment and successful DAG run.
screenshots/star schema/ — visual evidence of the dimensional model.
important documentations/ — the business-question answers, engineering challenges/limitations, and DAX implementation notes.
Before publishing, review data/, logs/, and row-level audit CSVs. Include only files permitted by the challenge and useful to reviewers; never commit credentials, .env files, or local secrets.
Data Sources and Cleaning
The challenge supplied nine datasets:
| Dataset |
Analytical role |
| Customers |
Customer attributes and registration information |
| Locations |
Geographic attributes used for location analysis |
| Orders |
Order-level dates, statuses, channels, and order information |
| OrderItems |
Line-level products, quantities, and item values |
| Payments |
Payment-method information and payment records |
| Products |
Product, category, and cost/price attributes |
| Returns |
Return statuses, reasons, and refund information |
| Sellers |
Seller attributes and seller-tier analysis |
| Shipping |
Courier, shipping-fee, shipment, and delivery-date information |
The cleaning work focused on more than removing duplicates. It included profiling, type and date checks, missing and negative value review, duplicate analysis, reference validation, and retained-versus-quarantined record accounting.
Recorded data-quality findings
The project notes record the following results from the cleaning and validation work:
- Nine source datasets were profiled.
- 7,118 unique quarantined rows were reported in the recorded cleaning notes.
- Processed outputs were reported to have zero remaining exact duplicates and duplicate primary keys after the applied cleaning.
- 1,381 truly broken references and 7,937 references to quarantined parents were identified in the recorded audit notes, with 9,318 row-level exceptions reported.
- 1,731 invalid or ambiguous customer registration dates were flagged.
- 988 negative values were flagged for review.
These are recorded findings from the current project artifacts. Consult the reports and exception files for the precise definitions and row-level evidence behind each figure.
Selected row reconciliation
| Dataset |
Source rows |
Retained |
Quarantined |
Duplicate copies |
| Customers |
45,000 |
45,000 |
0 |
0 |
| Locations |
650 |
650 |
0 |
0 |
| Orders |
163,200 |
158,250 |
1,750 |
3,200 |
| OrderItems |
315,143 |
313,250 |
1,893 |
0 |
| Payments |
168,111 |
163,586 |
1,229 |
3,296 |
| Products |
3,200 |
3,200 |
0 |
0 |
| Returns |
16,048 |
15,912 |
136 |
0 |
| Sellers |
420 |
416 |
4 |
0 |
| Shipping |
151,228 |
149,122 |
2,106 |
0 |
The counts above should be read alongside the cleaning reports. Quarantined rows, duplicate copies, and retained rows describe different outcomes and should not be added together without considering how the reconciliation was defined.
Business rules considered
The analysis and warehouse work considered the challenge's specified rules, including:
- Monetary values are in PKR.
order_total represents merchandise value after discounts.
- A blank discount code means no discount.
- Shipping is paid by NexusMart; the shipping fee should be allocated once per order rather than duplicated on every order line.
- Returns marked
Rejected are not valid returns for refund calculations.
- Slash-formatted dates are intended to be interpreted as day/month/year, subject to validation.
- The allowed order-date window is 1 January 2024 through 30 June 2025.
- Orders in
In Transit status that are not cancelled still count toward NMV.
- Valid refunds, delivered lines, kept lines, cancellation rates, and margin must follow their respective definitions in the challenge brief.
Data Warehouse Design
The SQL Server warehouse uses a star-schema approach with FactSales at order-line grain and five dimensions.
Star schema

If the image does not render in the GitHub preview, open it directly from the screenshots/star schema folder.
Tables and grain