NewBizBot
|Docs
Data APIDatasets

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 records
  • osha_violations: citation and penalty details
  • osha_related_activities: lightweight links between related inspections
  • osha_establishment_master: the main entity-centric browse table

For most product and API use cases, osha_establishment_master should be the default table.

Source

PropertyValue
SourceU.S. Department of Labor OSHA Data Catalog
Total source rows profiled~32.8 million across 7 source exports
V1 serving focusinspections + violations + related activities
Refresh strategybatch 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

ColumnTypeDescription
establishment_keytextStable derived identifier for a normalized establishment
estab_name_displaytextBest display name for the establishment
site_addresstextSite street address
site_citytextSite city
site_statetextSite state
site_ziptextSite ZIP
mail_streettextMailing street
mail_citytextMailing city
mail_statetextMailing state
mail_ziptextMailing ZIP
owner_typetextOwnership/business type code from OSHA
naics_codetextPrimary industry code for research filtering
sic_codetextLegacy industry code for additional segmentation
nr_in_estab_latestintegerLatest establishment-size proxy from OSHA
latest_open_datedateLatest inspection open date
latest_close_case_datedateLatest case close date
inspection_countbigintCount of inspections tied to the establishment
violation_countbigintCount of citations across inspections
serious_violation_countbigintCount of serious violations
repeat_violation_countbigintCount of repeat violations
willful_violation_countbigintCount of willful violations
total_initial_penaltynumericSum of initial penalties
total_current_penaltynumericSum of current penalties
latest_citation_datedateLatest citation issuance date
has_related_activitybooleanWhether related inspection activity exists
ColumnTypeDescription
estab_name_searchtsvectorFull-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

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_key
  • site_state
  • site_city
  • naics_code
  • sic_code
  • latest_open_date
  • latest_close_case_date
  • total_current_penalty
  • violation_count
  • inspection_count
  • estab_name_search

osha_inspections

  • activity_nr
  • reporting_id
  • site_state
  • site_city
  • site_zip
  • naics_code
  • sic_code
  • open_date
  • close_case_date
  • estab_name_search

osha_violations

  • activity_nr
  • citation_id
  • viol_type
  • issuance_date
  • abate_date
  • current_penalty
  • initial_penalty
  • gravity

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_limit is clamped to 1..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.

On this page