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 at 10%, 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,000 hours worked, whereas UK RIDDOR and EU metrics normalize per 100,000 hours; 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.

  1. Hard-blocking Permit-to-Work validator: POST /api/permits/validate enforces deterministic thresholds across HOT_WORK (OSHA 29 CFR 1910.252 / NFPA 51B / UK HSG168), CONFINED_SPACE (OSHA 1910.146 / AS 2865), and LOTO (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 (O2 in [19.5, 23.5]%, LEL < 10.0%, H2S < 10.0 ppm, CO < 25.0 ppm). Any failure forces status: "BLOCKED" with structured blockers, and issuance requires explicit EHS Officer sign-off (HTTP 409 HUMAN_SIGNOFF_REQUIRED otherwise).
  2. Dual-base TRIR/DART/RIDDOR engine: GET /api/metrics/trir computes deterministic OSHA 200,000-hour and RIDDOR/EU 100,000-hour incidence rates (for example, normalizing 9 recordables and 4 DART cases across 1,480,000 worked hours against sector benchmarks) alongside overdue training matrices and severity distributions.
  3. Evidence-gated CAPA closure and ephemeral photo wipe: POST /api/incidents/log captures recordable injuries, near-misses, and hazard observations while purging uploaded witness photos after 3600s (retaining SHA-256 metadata) and running OfflineDeterministicAdapter by default. Closing any CAPA at POST /api/capa/{id}/close returns HTTP 409 EHS_MANAGER_SIGNOFF_REQUIRED unless 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.
  4. Tamper-evident audit binder exports: Every permit issuance and CAPA closure appends to a SHA-256 hash-chained audit_logs ledger verifiable for chain integrity and exports via GET /api/metrics/audit.csv as 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.

Review your multi-site EHS permit and CAPA workflow

Book a free 30-minute workflow check. Bring your Permit-to-Work checklist, training matrix, or incident reporting structure and leave with one concrete recommendation within one business day.