Architecture Note · Security & Compliance
Deterministic Permit-to-Work Gates, TRIR/RIDDOR Calculators, and CAPA Audit Trails
Why conversational AI wrappers cannot enforce hazardous-work preconditions or regulatory incidence reporting—and how deterministic gas/training hard-blocks, dual-denominator KPIs, and EHS sign-off gates protect plants.
The Problem: Hazardous Permit Bypass and Fragmented Safety Registers
Global manufacturing, chemical, and cold-chain logistics sites operate under parallel regulatory frameworks—OSHA 29 CFR 1904 in the US, UK RIDDOR, Safe Work Australia, EU Directive 89/391/EEC, and ISO 45001. When incident logs live in spreadsheets and Permit-to-Work (Hot Work, Confined Space, Lockout/Tagout) checklists are verified on paper, an uncalibrated 4-gas detector or expired medical fit-test can slip past shift handoff, while overdue Corrective and Preventive Actions (CAPAs) close without verified engineering controls.
Why Naive AI Safety Wrappers Fail
Handing safety classification, permit approvals, or regulatory KPI reporting to an unconstrained LLM breaks plant safety invariants:
- Probabilistic threshold checks on life-safety telemetry: An LLM summarizing atmospheric readings may overlook a marginal oxygen drop below
19.5%, an LEL reading at10%, or an expired bump-test calibration date—turning a hard safety stop into polite advisory prose. - Conflated regulatory denominators: US OSHA calculates TRIR and DART per
200,000hours worked, whereas UK RIDDOR and EU metrics normalize per100,000hours; ungrounded models routinely mix bases across multi-country registers. - Premature CAPA closure without evidence: Automated ticket workflows that mark high-severity interlock or guarding CAPAs closed without 5-Why root-cause documentation and EHS Manager verification fail external ISO 45001 and OSHA audits.
- Uncontrolled witness media retention: Keeping raw incident photos on disk indefinitely or triggering outbound calls/SMS violates site privacy and channel policies.
The Deterministic Architecture That Fixes It
A production EHS platform separates deterministic safety interlocks and mathematical incidence formulas in FastAPI and SQLite WAL from optional advisory hazard checklists.
- Hard-blocking Permit-to-Work validator:
POST /api/permits/validateenforces deterministic thresholds acrossHOT_WORK(OSHA 29 CFR 1910.252 / NFPA 51B / UK HSG168),CONFINED_SPACE(OSHA 1910.146 / AS 2865), andLOTO(OSHA 1910.147 / EU Directive 2009/104/EC) permits: validating non-expired worker credentials (oshaNebosh,confinedSpace,lotoAuthorized,hotWorkFireWatch,medicalFitTest), mandatory hazard sign-offs such as active ventilation and posted attendants, 4-gas detector bump-test and calibration currency, and atmospheric bounds (O2in[19.5, 23.5]%,LEL < 10.0%,H2S < 10.0 ppm,CO < 25.0 ppm). Any failure forcesstatus: "BLOCKED"with structured blockers, and issuance requires explicit EHS Officer sign-off (HTTP 409 HUMAN_SIGNOFF_REQUIREDotherwise). - Dual-base TRIR/DART/RIDDOR engine:
GET /api/metrics/trircomputes deterministic OSHA200,000-hourand RIDDOR/EU100,000-hourincidence rates (for example, normalizing9recordables and4DART cases across1,480,000worked hours against sector benchmarks) alongside overdue training matrices and severity distributions. - Evidence-gated CAPA closure and ephemeral photo wipe:
POST /api/incidents/logcaptures recordable injuries, near-misses, and hazard observations while purging uploaded witness photos after3600s(retaining SHA-256 metadata) and runningOfflineDeterministicAdapterby default. Closing any CAPA atPOST /api/capa/{id}/closereturnsHTTP 409 EHS_MANAGER_SIGNOFF_REQUIREDunless 5-Why root-cause analysis, corrective/preventive actions, verification evidence, and EHS Manager sign-off are supplied, while any external worker notifications enforce inbound-only voice and Official WhatsApp Business Cloud API compliance. - Tamper-evident audit binder exports: Every permit issuance and CAPA closure appends to a SHA-256 hash-chained
audit_logsledger verifiable for chain integrity and exports viaGET /api/metrics/audit.csvas OWASP formula-neutralized RFC 4180 CSV alongside multi-area floor inspection checklists (PPE, machine guarding, emergency egress, chemical storage, LOTO, and ventilation) with one-click CAPA draft creation.
Operational Takeaway
Safety controls must fail closed. Combining deterministic 4-gas and training hard-blocks with dual-base OSHA/RIDDOR reporting and explicit EHS Officer and Manager sign-off gates ensures no high-hazard work proceeds—and no CAPA closes—on unverified assumptions or incomplete root-cause evidence.