# Production KPI (OEE) dashboard — sample project

A small, complete analysis project: from raw production records to a one-page dashboard.
**All data is synthetic** (random numbers with a fixed seed). No real company or person is involved.

## The question
Which production line loses the most output, why, and is it getting better or worse?

## What is in this folder
| Path | What it is |
| --- | --- |
| `data/production_log.csv` | One row per line per day: planned minutes, downtime, units, scrap |
| `data/downtime_events.csv` | Every stoppage with its reason and length |
| `sql/monthly_oee.sql` | The SQL that calculates monthly Availability, Performance, Quality and OEE |
| `src/generate_data.py` | Creates the synthetic data (repeatable) |
| `src/oee_analysis.py` | Runs the SQL, cross-checks it in pandas, builds the dashboard |
| `output/dashboard.svg` | The finished dashboard picture |
| `output/kpi_monthly.csv`, `output/metrics.json` | The results behind the dashboard |

## How OEE is calculated
Availability = operating time / planned time · Performance = (units × ideal cycle time) / operating time ·
Quality = good units / total units · **OEE = Availability × Performance × Quality**

## Run it
```bash
pip install pandas
python src/generate_data.py
python src/oee_analysis.py
```

The same logic can drive a Power BI report: load the two CSV files, add the measures above and rebuild the visuals.
