Library/Builder Teardown

Teardown: A Regulatory Report Generator for Energy Operators

Automating OSHA, EPA, and state filings without automating the accountability: the validate-early pipeline, report templates as versioned code, and the unit-conversion trap that makes automated reports wrong in the most confident way possible. Public excerpt; the full teardown lives in the Builder library.

The system, in four principles

A compliance report generator is an unusual automation: the output goes to a regulator, so the design goal isn't removing humans — it's removing assembly while keeping accountability exactly where it was. Four principles carry the build.

Principle 1 — Validate when data lands, not when reports are due. The pipeline pulls from historians, safety systems, and back-office platforms continuously, and runs validation at ingestion: gaps, outliers, unit anomalies, missing sites. The entire point is moving the discovery of a data problem from the night before the deadline — where it's a crisis — to weeks earlier, where it's a ticket.

Principle 2 — Templates are versioned code. Every filing is a template: the required schema, the data mappings that fill it, the transformations between. Templates live in version control with effective dates, because requirements change — and when a regulator updates a form, you want a dated diff, not a hunt through one engineer's memory of what changed. The template history is your institutional memory of the requirement.

Principle 3 — Assemble, flag, stage — never submit. The system generates the filing, attaches its anomaly flags ("Site 4's flare data is 3σ above trailing average — verified?"), and stages it for a qualified reviewer. Submission is a human act, always. This is a hard design line, not a caution: an unreviewed auto-filed regulatory report is a liability generator, and we decline to build them.

Principle 4 — The calendar lives in the system. Every obligation, jurisdiction, and deadline is data, with escalating reminders as review windows shrink. The failure mode this kills is mundane and common: the filing that was late because the person who always remembered was on rotation.

Where the first version broke

Right numbers, wrong units, perfect formatting. One source system recorded a quantity in different units than the report schema expected — same field name, plausible magnitudes, no error anywhere. The generated report was internally consistent and wrong. The fix made units first-class: every mapping declares source and target units explicitly, conversions are centralized and tested, and any unit-ambiguous source field blocks generation until resolved. Automated wrongness is worse than manual wrongness because it arrives with confidence.

A requirement changed and only the reviewer noticed. A state form added a field; the template didn't know; the staged report sailed through generation with the field absent. The reviewer caught it — proving Principle 3 — but the lesson stuck: template versioning gained effective-date checks against filing dates, and every review now opens with a diff against the agency's current form, not just last cycle's output.


The full teardown — the ingestion-validation rule set, the template versioning structure, the reviewer staging checklist, and the obligation-calendar data model — lives in the Builder library.

The Full Teardown Is in the Builder Library

Implementation detail, checklists, and the parts we'd rather not have public — for members.

Unlock with Builder