- Visibility into productivity – Quantifies how many hours are worked each week relative to the contractual 40‑hour target.
- Data‑driven compensation – Provides the numbers needed for the existing comp‑time package and for any future payroll reconciliation.
- Trend analysis – Moving‑average and month‑by‑month summaries highlight whether the team is consistently ahead, behind, or on‑track, enabling proactive workload adjustments.
- Self‑service reporting – With a single
make statscommand developers can generate a notebook with plots, reducing manual spreadsheet work and eliminating ad‑hoc analyses.
| ID | Requirement | Description |
|---|---|---|
| R1 | Historical data generation | Ability to (re)run hack/since_the_start.sh to produce history/YYYY_MM_history.csv files for every month. |
| R2 | Data ingestion | Python script must read all CSVs, parse Duration (HH:MM:SS) into hours, and associate each row with the correct month. |
| R3 | Weekly aggregation | Compute total hours per ISO week (Mon‑Fri) and calculate the deviation hours – 40. |
| R4 | Monthly aggregation | Compute total hours per month and the mean ratio X/40 where X is the weekly total for that month. |
| R5 | Moving average | Provide a configurable window (default 4 weeks) of the weekly deviation. |
| R6 | Visualization | Jupyter notebook that displays: |
| • Line chart of weekly deviation with moving‑average overlay | ||
| • Bar chart of monthly total hours and mean X/40 ratio | ||
| • Scatter / cumulative chart of deviation over time | ||
| • Optional heat‑map calendar view | ||
| R7 | CLI integration | Add a make stats target that runs the analysis script, prints a short textual summary, and launches the notebook. |
| R8 | Documentation | Update README.md (or a new docs/STATISTICS.md) with usage instructions, prerequisites, and interpretation of the results. |
| R9 | Export summary CSV | Optional summary.csv containing per‑month totals, mean ratios, and moving‑average values for downstream tools. |
analysis/stats.py– Core Python module implementing data loading, weekly/monthly aggregation, deviation calculations, and moving‑average logic.analysis/stats.ipynb– Jupyter notebook that importsstats.pyand creates the required visualizations.- Makefile entry –
statstarget that runs the script and opens the notebook. - Documentation – Updated
README.md(ordocs/STATISTICS.md) with clear step‑by‑step instructions and explanation of the business insights. - Optional
analysis/weekly_summary.csv&analysis/monthly_summary.csv– Machine‑readable summaries for other tooling.
- Generate CSV history – Run
hack/since_the_start.shto ensure thehistory/folder is populated. - Create
analysis/package – Add__init__.py,stats.py(using the skeleton provided earlier), and a minimal test script. - Add statistical functions – Implement
parse_duration,load_history,add_week_info,weekly_stats,monthly_stats, andmoving_average. - Write Jupyter notebook – Populate cells for data loading, table display, and the four visualizations.
- Extend Makefile – Add a
statstarget that runs the script and launches the notebook. - Document the workflow – Explain prerequisites (
python3,pandas,matplotlib,jupyter), how to regenerate data, run analysis, and interpret the charts. - (Optional) Export summary CSV – Include a flag in
stats.pyto writesummary.csvfor downstream consumption.
All tasks are reflected in the existing todo list. Once the plan file is committed, we can start implementing the code.