A minimal KPI computation system that computes 8 key performance indicators from SQLite data.
# Install dependencies make install # Seed database with synthetic data make seed # Run KPI job make run- total_orders - Count of orders created on the date
- total_revenue_dollars - Sum of paid/captured orders
- avg_order_value_dollars - Average order value
- refunds_count - Count of refunded/chargeback orders
- new_users - Count of users who signed up on the date
- active_users - Count of unique users with orders on the date
- net_revenue_dollars - Total revenue minus refunds
- repeat_users - Count of repeat users
# Basic usage python -m kpi_job.main --date 2025-07-18 # With options python -m kpi_job.main --date 2025-07-18 --verbose --dry-run # Using the installed CLI kpi --date 2025-07-18 --verbosepython-kpi/ ├── kpi_job/ │ ├── __init__.py # Package init │ ├── main.py # Main CLI │ ├── models.py # Data models │ └── seed.py # Data seeding ├── data/ # SQLite database ├── artifacts/ # Generated KPI CSV files ├── pyproject.toml # Project configuration ├── Makefile # Development commands └── README.md # This file # Install in development mode make install # Test installation make test # Clean up make cleandate,kpi_name,kpi_value,unit,computed_at 2025-07-18,active_users,11.0,count,2025-09-16T08:33:42.795407+00:00 2025-07-18,avg_order_value_dollars,103.8,dollars,2025-09-16T08:33:42.795407+00:00 2025-07-18,net_revenue_dollars,-1287.35,dollars,2025-09-16T08:33:42.795407+00:00 2025-07-18,new_users,11.0,count,2025-09-16T08:33:42.795407+00:00 2025-07-18,refunds_count,23.0,count,2025-09-16T08:33:42.795407+00:00 2025-07-18,repeat_users,0.0,count,2025-09-16T08:33:42.795407+00:00 2025-07-18,total_orders,40.0,count,2025-09-16T08:33:42.795407+00:00 2025-07-18,total_revenue_dollars,4151.94,dollars,2025-09-16T08:33:42.795407+00:00 - ✅ Click CLI - Easy command-line interface
- ✅ Pandas Processing - Efficient data manipulation
- ✅ SQLite Storage - Lightweight database
- ✅ CSV Output - Standard artifact format
- ✅ Dollar Calculations - Revenue in dollars
- ✅ Synthetic Data - Built-in test data generation
- Prototyping KPI systems
- Learning data processing with Python
- Quick deployments where simplicity matters
- Proof of concepts and demos
- Educational purposes