In a lot of teams, recurring weekly numbers live in three different places: a Python script that exports charts, a spreadsheet someone cleans up by hand on Friday afternoon, and an internal HTML page whose totals never quite match the other two.
I wrote Automatic Report Generator (reportgen) so one YAML, TOML, or JSON file could load the raw data once, run the calculations once, and write PDF, HTML, and Excel outputs from the same in-memory tables.
report:
title: "Quarterly Regional Revenue"
source:
kind: postgres
query_file: queries/revenue.sql
outputs:
- format: pdf
- format: html
- format: xlsx
Keeping ingestion separate from layout
To make sure the three files never disagree, the pipeline runs in four strict steps:
- Read-only data loaders: CSV and TSV with delimiter detection, multi-sheet
.xlsxfiles, nested JSON or JSONL viarecord_path, and parameterized read-only queries against SQLite and PostgreSQL. - Single validation and aggregation pass: column type checks, null rules, group-bys, and derived totals run once before any output formatter starts.
- Shared chart rendering: charts render from the same aggregated series so the numbers in the PDF match the HTML page and the
.xlsxworkbook sheet for sheet. - Offline execution: everything runs locally in Python 3.11+ without browser daemons or external APIs, matching the local-only setup in Smart File Organizer and Riftmap.
Checking the YAML config into Git next to the SQL query also means anyone can re-run one command six months later and get the exact same report.