Small open-source analytics starter kit for customer KPIs, revenue concentration, segmentation and short executive summaries.
The repo is built notebook-first.
- synthetic ecommerce order data
- customer level KPI calculation
- customer revenue deciles
- pareto / top customer concentration
- simple customer segmentation
- short executive summary text
- tests, becuase code without tests is basically hope in a hoodie
git clone https://github.com/uioreanu/analytics-decision-kit.git
cd analytics-decision-kit
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -e ".[dev]"
python examples/01_customer_concentration.py
pytestfrom analytics_decision_kit.sample_data import create_demo_orders
from analytics_decision_kit.customer_analysis import run_customer_analysis
orders = create_demo_orders(n_customers=5000, n_orders=18000, seed=42)
results = run_customer_analysis(orders)
print(results["summary_text"])
print(results["decile_summary"])from analytics_decision_kit.data_loader import (
DEFAULT_SUPERSTORE_GITHUB_URL,
get_transactional_data,
)
# No URL -> synthetic data
synthetic_orders = get_transactional_data()
# GitHub/raw CSV URL -> public dataset normalized to the same schema
public_orders = get_transactional_data(DEFAULT_SUPERSTORE_GITHUB_URL)The output schema is the same in both cases:
order_id, customer_id, order_date, revenue, category, manufacturer
The input dataframe should have:
| column | meaning |
|---|---|
| customer_id | customer id |
| order_id | order id |
| order_date | date of the order |
| revenue | revenue amount |
| category | optional |
| manufacturer | optional |
Use synthetic or public data only. Alternatively using a public available dataset like "Sample Superstore CSV"
The first version is deliberately small:
- create demo data
- calculate customer metrics
- split customers into revenue deciles
- calculate top customer revenue concentration
- assign basic segments
- write a short summary