How bitsbybhargav/customer-transaction-analytics- works
1. What this repo is
- This is a customer transaction analytics / BI project, not an application service.
- The main deliverable is an analytics workflow: SQL for KPI and segmentation logic, Python for exploratory analysis, and a Power BI model for reporting.
2. Primary data layer
- The repository includes five sanitized CSV exports that form the core relational dataset:
- customers_export.csv
- orders_export.csv
- order_items_export.csv
- payments_export.csv
- products_export.csv
- These files represent the base fact/dimension tables used across the SQL, notebook, and Power BI artifacts.
3. SQL analytics subsystem
- The SQL work is split across multiple root-level files:
- CTA_Analytics_Suite.sql
- CTA_queries.sql
- Business_Intelligence_Queries.sql
- foundationalqueries.sql
- Technical_Evaluation_Suite.sql
- RetailSales Practice Queries.sql
- Architecturally, these appear to represent progressive query sets: foundational extraction, intermediate aggregations, and advanced analytical queries.
- The README indicates the final suite covers RFM segmentation, payment leakage analysis, retention/cohort analysis, YoY growth, and AOV benchmarks.
4. Analytical boundaries in SQL
- The SQL layer is the main business logic engine.
- It likely performs:
- multi-table joins across customers/orders/items/payments/products
- time-based aggregations
- window-function-based ranking and segmentation
- customer value classification
- failed/pending payment reconciliation
- This is the layer where business definitions are encoded and reused for downstream reporting.
5. Python EDA layer
- analysis.ipynb is the exploratory analysis and visualization notebook.
- According to the README, it recreates the 5-table schema in pandas and generates charts for:
- monthly revenue trend
- payment gateway success/failure comparison
- city-wise transaction distribution
- This is a read/transform/visualize layer, not the source of truth for core business rules.
6. Export and connection utilities
- test_connection.py suggests a small utility for validating database connectivity before extraction.
- export_data.py likely pulls data from the source database into the CSV exports.
- Together, these form the ingestion boundary between the operational data source and the repository’s offline analytics artifacts.
7. BI / dashboard layer
- Model_VIew_CTA.pbix is the Power BI semantic/reporting artifact.
- It likely consumes the exported tables and/or modeled relationships to create interactive dashboards.
- dashboard images/ contains static visual outputs, probably screenshots or presentation assets derived from the PBIX/reporting layer.
8. End-to-end data flow
- The implied flow is:
- source database → test_connection.py validation
- source database → export_data.py → CSV extracts
- CSV extracts → SQL analysis suites
- CSV extracts → analysis.ipynb for EDA
- CSV extracts/modelled tables → Model_VIew_CTA.pbix for dashboards
- So the repo is organized around one dataset feeding three consumption paths: SQL intelligence, notebook exploration, and BI reporting.
9. Important architectural emphasis
- The project is logic-heavy and analytics-centric: the “application” is the business interpretation of transactions.
- The core outputs are not APIs or services, but:
- customer segments
- leakage/recovery estimates
- retention metrics
- revenue trend analysis
- gateway performance insights
10. Repo structure note
- The README describes a more folderized layout, but the actual tree is flattened at the repo root.
- For diagramming, it’s still best to treat the repo as three layers:
- data extraction/export
- SQL analytics engine
- Python/Power BI presentation and exploration
Main entry points: export_data.py Export Data · foundationalqueries.sql Foundations · Model_VIew_CTA.pbix Power BI · analysis.ipynb EDA Notebook
Components 16
Ingestion
Database validation and CSV export utilities.
- Test Conn · Validates source database access before extraction.
test_connection.py - Export Data · Pulls source data into flat CSV exports.
export_data.py
Analytics
SQL logic and notebook exploration over the exported customer transaction data.
- Customers · Customer dimension export.
customers_export.csv - Orders · Order transaction export.
orders_export.csv - Order Items · Line-item level order export.
order_items_export.csv - Payments · Payment transaction export.
payments_export.csv - Products · Product catalog export.
products_export.csv - Foundations · Core extraction and baseline query logic.
foundationalqueries.sql - CTA Queries · Intermediate analytical queries and joins.
CTA_queries.sql - Analytics Suite · Main KPI, segmentation, and cohort logic.
CTA_Analytics_Suite.sql - Eval Suite · Technical evaluation and deeper analytical checks.
Technical_Evaluation_Suite.sql - BI Queries · Business intelligence query set for reporting metrics.
Business_Intelligence_Queries.sql - Practice SQL · Practice-oriented retail sales analysis queries.
RetailSales Practice Queries.sql - EDA Notebook · Pandas exploration and visualization of the transaction dataset.
analysis.ipynb
Reporting
Power BI model and derived dashboard visuals.
- Power BI · Semantic model and interactive reporting artifact.
Model_VIew_CTA.pbix - Dashboards · Static dashboard screenshots or presentation images.
dashboard images
Connections 27
- Test Conn → Export Data: validate · Connection check precedes extraction.
- Export Data → Customers: writes · Exports customer data to CSV.
- Export Data → Orders: writes · Exports order data to CSV.
- Export Data → Order Items: writes · Exports line-item data to CSV.
- Export Data → Payments: writes · Exports payment data to CSV.
- Export Data → Products: writes · Exports product data to CSV.
- Customers → Foundations: feeds · Customer records support base SQL analysis.
- Orders → Foundations: feeds · Order records support base SQL analysis.
- Order Items → Foundations: feeds · Item-level records support base SQL analysis.
- Payments → Foundations: feeds · Payment records support base SQL analysis.
- Products → Foundations: feeds · Product records support base SQL analysis.
- Foundations → CTA Queries: builds · Foundational logic is refined into intermediate query sets.
- CTA Queries → Analytics Suite: extends · Intermediate logic rolls into the main analytics suite.
- Analytics Suite → Eval Suite: informs · Core KPI logic supports evaluation-oriented queries.
- Analytics Suite → BI Queries: reused by · Analytical definitions feed BI reporting queries.
- BI Queries → Practice SQL: complements · Reporting logic sits alongside practice-oriented SQL.
- Customers → EDA Notebook: loads · Notebook reconstructs the customer table in pandas.
- Orders → EDA Notebook: loads · Notebook reconstructs the order table in pandas.
- Order Items → EDA Notebook: loads · Notebook reconstructs the line-item table in pandas.
- Payments → EDA Notebook: loads · Notebook reconstructs the payment table in pandas.
- Products → EDA Notebook: loads · Notebook reconstructs the product table in pandas.
- Customers → Power BI: models · Customer data is consumed by the BI model.
- Orders → Power BI: models · Order data is consumed by the BI model.
- Order Items → Power BI: models · Item-level data is consumed by the BI model.
- Payments → Power BI: models · Payment data is consumed by the BI model.
- Products → Power BI: models · Product data is consumed by the BI model.
- Power BI → Dashboards: renders · PBIX produces dashboard visuals and screenshots.