Fix OSHA query: column insp_scope does not exist

Resolved 💬 2 comments Opened Apr 13, 2026 by mhanauer Closed Apr 17, 2026

Bug

The Big Book OSHA data source fetch fails with a SQL error:

column i.insp_scope does not exist
HINT: Perhaps you meant to reference the column "i.insp_type".

The query in backend/app/tasks/big_book.py (around line 1150) references i.insp_scope in the SELECT clause, but the osha_inspection table does not have an insp_scope column.

Steps to Reproduce

Run any Big Book generation — the OSHA data source will fail with ProgrammingError.

Fix

Remove i.insp_scope from the SELECT statement in the OSHA query, or replace it with the correct column name if the data is needed.

Impact

Low — OSHA data source is skipped on failure, doesn't block Big Book generation. But it means we're missing OSHA violation data for all subjects.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗