OSHA Establishments
Core schema, browse surfaces, aggregate functions, and research-oriented querying patterns for the OSHA dataset.
The OSHA dataset is designed for business research on establishment safety and compliance history, not just raw inspection reporting.
The serving layer is built around four main objects:
osha_inspections: lean inspection-level recordsosha_violations: citation and penalty detailsosha_related_activities: lightweight links between related inspectionsosha_establishment_master: the main entity-centric browse table
For most product and API use cases, osha_establishment_master should be the default table.
Source
| Property | Value |
|---|---|
| Source | U.S. Department of Labor OSHA Data Catalog |
| Total source rows profiled | ~32.8 million across 7 source exports |
| V1 serving focus | inspections + violations + related activities |
| Refresh strategy | batch reload followed by serving-layer refresh |
Why This Dataset Exists
This dataset is meant to support workflows like:
- finding establishments in a target NAICS segment
- screening companies by geography and OSHA history
- researching high-penalty or high-violation businesses
- building city, state, and industry browse pages
- supporting diligence and prospecting workflows on NewBizBot
Main Browse Table: osha_establishment_master
This is the main public-serving table because OSHA source data is inspection-centric, while business research is establishment-centric.
Core Columns
| Column | Type | Description |
|---|---|---|
establishment_key | text | Stable derived identifier for a normalized establishment |
estab_name_display | text | Best display name for the establishment |
site_address | text | Site street address |
site_city | text | Site city |
site_state | text | Site state |
site_zip | text | Site ZIP |
mail_street | text | Mailing street |
mail_city | text | Mailing city |
mail_state | text | Mailing state |
mail_zip | text | Mailing ZIP |
owner_type | text | Ownership/business type code from OSHA |
naics_code | text | Primary industry code for research filtering |
sic_code | text | Legacy industry code for additional segmentation |
nr_in_estab_latest | integer | Latest establishment-size proxy from OSHA |
latest_open_date | date | Latest inspection open date |
latest_close_case_date | date | Latest case close date |
inspection_count | bigint | Count of inspections tied to the establishment |
violation_count | bigint | Count of citations across inspections |
serious_violation_count | bigint | Count of serious violations |
repeat_violation_count | bigint | Count of repeat violations |
willful_violation_count | bigint | Count of willful violations |
total_initial_penalty | numeric | Sum of initial penalties |
total_current_penalty | numeric | Sum of current penalties |
latest_citation_date | date | Latest citation issuance date |
has_related_activity | boolean | Whether related inspection activity exists |
Search
| Column | Type | Description |
|---|---|---|
estab_name_search | tsvector | Full-text search vector built from establishment and address fields |
Supporting Tables
osha_inspections
Lean inspection-level records with:
- establishment name
- site and mailing addresses
- NAICS and SIC
- inspection type/scope
- employee count proxy
- core inspection dates
osha_violations
Citation-level records with:
- citation identifier
- OSHA standard
- violation type
- issuance and abatement dates
- penalty amounts
- gravity and instance counts
osha_related_activities
Links between inspections. Useful for establishing that two activities belong to the same broader enforcement chain.
Aggregate Materialized Views
These views are intended for browse pages and summary endpoints:
osha_stats_by_state_mv
Returns one row per state with:
- total establishments
- total inspections
- total violations
- serious/repeat/willful counts
- penalty totals
- latest inspection date
osha_stats_by_city_mv
Returns one row per (state, city) with:
- total establishments
- total inspections
- total violations
- serious violation counts
- total current penalty
- latest inspection date
osha_stats_by_state_industry_mv
Returns one row per (state, naics_code, sic_code) with:
- total establishments
- total inspections
- total violations
- serious violation counts
- total current penalty
- latest inspection date
osha_city_slug_lookup_mv
Maps (state, city_slug) back to the original city name for route resolution.
Fast-Lookup Columns
These columns are expected to be the main indexed filter paths:
osha_establishment_master
establishment_keysite_statesite_citynaics_codesic_codelatest_open_datelatest_close_case_datetotal_current_penaltyviolation_countinspection_countestab_name_search
osha_inspections
activity_nrreporting_idsite_statesite_citysite_zipnaics_codesic_codeopen_dateclose_case_dateestab_name_search
osha_violations
activity_nrcitation_idviol_typeissuance_dateabate_datecurrent_penaltyinitial_penaltygravity
At least one indexed filter should be present in table queries. For city lookups, pair city with state whenever possible.
Aggregate RPCs
osha_stats_by_state
Endpoint: GET /data/rpc/osha_stats_by_state
Use this for:
- state leaderboard pages
- high-level research overviews
- state summary cards
Example:
curl "https://newbizbot.ai/api/data/rpc/osha_stats_by_state?p_state=TX" \
-H "Authorization: Bearer YOUR_API_KEY"osha_stats_by_city
Endpoint: GET /data/rpc/osha_stats_by_city
Use this for:
- state-to-city drill-down
- city browse pages
Example:
curl "https://newbizbot.ai/api/data/rpc/osha_stats_by_city?p_state=TX" \
-H "Authorization: Bearer YOUR_API_KEY"osha_stats_by_industry
Endpoint: GET /data/rpc/osha_stats_by_industry
Use this for:
- state + NAICS research
- broad industry scans
- workflows like utility or contractor discovery
Example:
curl "https://newbizbot.ai/api/data/rpc/osha_stats_by_industry?p_state=TX&p_naics_prefix=237130" \
-H "Authorization: Bearer YOUR_API_KEY"osha_establishments_by_city
Endpoint: GET /data/rpc/osha_establishments_by_city
Use this for:
- paginated city browse pages
- returning a bounded list of establishments plus
total_count - deep pagination over large cities without silent offset clamping
Example:
curl "https://newbizbot.ai/api/data/rpc/osha_establishments_by_city?p_state=TX&p_city=HOUSTON&p_limit=25&p_offset=0" \
-H "Authorization: Bearer YOUR_API_KEY"osha_establishments_by_state_industry
Endpoint: GET /data/rpc/osha_establishments_by_state_industry
Use this for:
- paginated state + NAICS browse pages
- workflows like "powerline maintenance companies across Texas"
- deep pagination over broad 2-digit and 3-digit NAICS prefixes
Example:
curl "https://newbizbot.ai/api/data/rpc/osha_establishments_by_state_industry?p_state=TX&p_naics_prefix=237130&p_limit=25&p_offset=0" \
-H "Authorization: Bearer YOUR_API_KEY"Suggested Query Patterns
Pagination Notes
p_limitis clamped to1..1000- negative offsets are treated as
0 - if
p_offset >= total_count, the RPC returns an empty array - empty pages do not include a synthetic row carrying
total_count; callers should treat[]as an empty page
Find establishments in a state and NAICS prefix
curl "https://newbizbot.ai/api/data/osha_establishment_master?site_state=eq.TX&naics_code=like.237130*&order=total_current_penalty.desc&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"Search for an establishment name in a state
curl "https://newbizbot.ai/api/data/osha_establishment_master?site_state=eq.CA&estab_name_search=fts.utility&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"Find inspections for a specific state and NAICS
curl "https://newbizbot.ai/api/data/osha_inspections?site_state=eq.FL&naics_code=like.238210*&order=open_date.desc&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"Find violations for a known activity number
curl "https://newbizbot.ai/api/data/osha_violations?activity_nr=eq.317722197&order=issuance_date.desc" \
-H "Authorization: Bearer YOUR_API_KEY"Practical Guidance
Use osha_establishment_master when you care about:
- one row per business/location
- search and browse
- state, city, and industry segmentation
- penalty and violation rollups
Use osha_inspections and osha_violations when you care about:
- raw enforcement detail
- inspection timelines
- citation-level review
That split is intentional. It keeps the raw data available while making the main product experience much more useful for business research.