# Industrial Safety — OSHA Accidents & MSHA Data (`ryanclinton/industrial-safety-intel`) Actor

Analyze workplace safety risks using OSHA, MSHA, and EPA data. Generates composite risk scores with incident history, violation patterns, and safety recommendations for any company or facility.

- **URL**: https://apify.com/ryanclinton/industrial-safety-intel.md
- **Developed by:** [ryan clinton](https://apify.com/ryanclinton) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Industrial Safety Intelligence

Build comprehensive safety profiles for any U.S. company or industry by combining OSHA accident reports, OSHA workplace inspections, and MSHA mining data into a single risk-scored report. Search by company name, state, NAICS industry code, or date range and get back fatality counts, hospitalization numbers, inspection histories, mine information, violation counts, and a computed risk score from 0-100 with detailed scoring factors.

Industrial Safety Intelligence queries the Department of Labor's open data API across three datasets simultaneously: OSHA accident and injury reports, OSHA workplace inspections, and MSHA mine information with violation counts. Results are unified into a single safety profile with aggregate statistics and a risk assessment that weighs fatalities, hospitalizations, injuries, inspection volume, and mining violations into a composite score with a severity level (LOW, MODERATE, HIGH, or CRITICAL).

### What data can you extract?

| Data Point | Source | Example |
|------------|--------|---------|
| **OSHA accidents** | DOL OSHA accident dataset | Employer, event date, description, fatalities, hospitalizations, injuries |
| **OSHA inspections** | DOL OSHA inspection dataset | Establishment, open date, inspection type, NAICS code |
| **MSHA mines** | DOL MSHA mines dataset | Mine name, operator, type (Surface/Underground), status, employees |
| **MSHA violations** | DOL MSHA violations dataset | Total violation count across all mines |
| **Risk score** | Computed | 0-100 score with LOW/MODERATE/HIGH/CRITICAL level |
| **Risk factors** | Computed | Itemized breakdown of scoring factors |

### Why use Industrial Safety Intelligence?

Safety research across DOL datasets is fragmented. OSHA accidents, OSHA inspections, and MSHA mining data live in separate API endpoints with different schemas and query parameters. Cross-referencing a company's safety record requires multiple API calls, data normalization, and manual aggregation.

This actor combines all three data sources into a single query with a unified risk score. One search gives you a complete safety picture: accident severity, inspection frequency, mine operations, and violation history.

**Built on the Apify platform**, Industrial Safety Intelligence gives you:
- **Scheduling** -- monitor safety records quarterly or monthly for portfolio companies, suppliers, or clients
- **API access** -- integrate into due diligence platforms, ESG scoring tools, or supply chain monitoring systems
- **No API key management** -- the actor handles DOL API authentication with your key securely
- **Integrations** -- connect to Google Sheets, Zapier, Make, or webhooks

### Features

- **Three-source intelligence** -- combines OSHA accidents, OSHA inspections, and MSHA mining data in a single query
- **Composite risk scoring** -- 0-100 risk score computed from fatalities (up to 90 pts), hospitalizations (up to 40 pts), injuries (up to 20 pts), accident volume (up to 15 pts), inspection volume (up to 15 pts), MSHA violations (up to 25 pts), and mine count (up to 5 pts)
- **Severity levels** -- risk score mapped to CRITICAL (75+), HIGH (50-74), MODERATE (25-49), or LOW (0-24) with itemized scoring factors
- **Multi-filter search** -- search by company name, U.S. state, NAICS industry code, and date range (all filters combinable)
- **Fatalities-only mode** -- filter OSHA accidents to show only cases involving fatalities
- **Selective data sources** -- enable or disable OSHA accidents, OSHA inspections, and MSHA data independently
- **Parallel data fetching** -- all three data sources are fetched concurrently for faster results
- **Rate limit handling** -- exponential backoff with up to 4 retries on DOL API rate limits (429 responses)
- **Dry run mode** -- test without an API key to see the output format before committing to a DOL API registration

### Use cases for industrial safety data

#### ESG and responsible investing
ESG analysts evaluate companies' workplace safety records as part of environmental, social, and governance scoring. High fatality counts and OSHA violations are material ESG risk factors.

#### Supply chain due diligence
Procurement teams assess supplier safety records before awarding contracts. A supplier with a CRITICAL risk score may pose regulatory, reputational, and operational risks to the buyer.

#### Insurance underwriting
Commercial insurance underwriters evaluate workplace safety profiles when pricing workers' compensation, general liability, and commercial property policies.

#### Regulatory compliance monitoring
EHS (Environment, Health & Safety) teams monitor their own company's safety record and track how it compares to industry benchmarks. Scheduled runs flag new incidents automatically.

#### Investigative journalism
Journalists research companies with poor safety records for accountability reporting. The risk score and factor breakdown provide a structured narrative starting point.

#### Private equity due diligence
PE firms evaluate acquisition targets' safety profiles. Companies with high MSHA violation counts or OSHA fatalities carry regulatory and litigation risk that affects valuation.

### How to build safety profiles

1. **Get a DOL API key** -- Register for a free API key at [https://dataportal.dol.gov/registration](https://dataportal.dol.gov/registration). This is required for real data (or use dry run mode to test).
2. **Enter search criteria** -- Provide a company name, state, NAICS code, date range, or any combination.
3. **Configure options** -- Enable or disable individual data sources (OSHA accidents, inspections, MSHA). Set the fatalities-only filter if needed.
4. **Run the actor** -- Click "Start" to begin. The actor queries all enabled data sources in parallel and computes the risk assessment.
5. **Download results** -- Once finished, download your safety profile as JSON, CSV, or Excel from the Dataset tab.

### Input parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `apiKey` | string | No* | -- | DOL Open Data Portal API key. Register free at dataportal.dol.gov/registration. Not needed for dry run mode. |
| `dryRun` | boolean | No | `true` | When true (or when no API key is provided), runs without calling the DOL API. Set to false with an API key for real data. |
| `companyName` | string | No | -- | Search by company/establishment name (partial match, case-insensitive). |
| `state` | string | No | -- | Filter by U.S. state (2-letter code, e.g., TX, CA, WV). |
| `naicsCode` | string | No | -- | Filter by NAICS industry code (2-6 digits). Prefix matching, e.g., "21" matches all mining codes. |
| `dateFrom` | string | No | -- | Start date filter (YYYY-MM-DD). Applies to event/open dates. |
| `dateTo` | string | No | -- | End date filter (YYYY-MM-DD). Applies to event/open dates. |
| `fatalitiesOnly` | boolean | No | `false` | When true, only return OSHA accident cases involving fatalities. |
| `includeOshaAccidents` | boolean | No | `true` | Include OSHA accident and injury data in the safety profile. |
| `includeOshaInspections` | boolean | No | `true` | Include OSHA workplace inspection records in the safety profile. |
| `includeMsha` | boolean | No | `true` | Include MSHA mine information and violation counts in the safety profile. |
| `maxResults` | integer | No | `100` | Maximum number of records to return per dataset (1-5,000). |

*API key is required unless using dry run mode.

#### Input examples

**Company safety profile:**
```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "dryRun": false,
    "companyName": "TYSON",
    "maxResults": 200
}
````

**State and industry filter:**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "dryRun": false,
    "state": "WV",
    "naicsCode": "21",
    "maxResults": 500
}
```

**Fatalities only in a date range:**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "dryRun": false,
    "companyName": "AMAZON",
    "dateFrom": "2020-01-01",
    "dateTo": "2024-12-31",
    "fatalitiesOnly": true
}
```

**OSHA only (no mining data):**

```json
{
    "apiKey": "YOUR_DOL_API_KEY",
    "dryRun": false,
    "companyName": "WALMART",
    "includeMsha": false
}
```

#### Input tips

- **Register for a DOL API key first** -- It is free at [dataportal.dol.gov/registration](https://dataportal.dol.gov/registration). Without a key, the actor only runs in dry mode.
- **Use NAICS codes for industry-wide searches** -- NAICS code "21" covers all mining, "23" covers construction, "3116" covers meat processing. Use 2-digit codes for broad searches or 4-6 digit codes for specific industries.
- **Set date ranges for recent data** -- Without a date filter, the API returns all historical records. Use `dateFrom` to focus on recent years.
- **Increase maxResults for large companies** -- Major employers like Walmart or Amazon may have hundreds of OSHA records. The default of 100 may not capture the full picture.

### Output example

Each run produces a single safety profile:

```json
{
    "company": "TYSON",
    "state": null,
    "generatedAt": "2026-03-18T14:30:00.000Z",
    "oshaAccidents": {
        "totalCases": 47,
        "totalFatalities": 3,
        "totalHospitalizations": 28,
        "totalInjuries": 52,
        "cases": [
            {
                "summaryNumber": "1234567",
                "employer": "TYSON FOODS INC",
                "eventDate": "2024-03-15",
                "eventDescription": "Employee was injured when caught in a conveyor belt mechanism",
                "keyword": "Caught in/between",
                "city": "SPRINGDALE",
                "state": "AR",
                "fatalities": 0,
                "hospitalizations": 1,
                "injuries": 1
            }
        ]
    },
    "oshaInspections": {
        "totalInspections": 89,
        "inspections": [
            {
                "activityNumber": "987654321",
                "establishment": "TYSON FOODS INC",
                "openDate": "2024-06-10",
                "type": "Complaint",
                "state": "AR",
                "city": "SPRINGDALE",
                "naics": "311615"
            }
        ]
    },
    "mshaData": {
        "totalMines": 0,
        "totalViolations": 0,
        "mines": []
    },
    "riskAssessment": {
        "score": 72,
        "level": "HIGH",
        "factors": [
            "3 OSHA fatalities (+90)",
            "28 OSHA hospitalizations (+40)",
            "52 OSHA injuries (+20)",
            "47 accident reports (+15)",
            "89 inspections (+15)"
        ]
    }
}
```

### Output fields

| Field | Type | Description |
|-------|------|-------------|
| `company` | string/null | Company name from the search input |
| `state` | string/null | State filter applied (uppercase 2-letter code) |
| `generatedAt` | string | ISO timestamp of when the profile was generated |
| `oshaAccidents` | object/null | OSHA accident data (null if disabled) |
| `oshaAccidents.totalCases` | number | Total accident cases found |
| `oshaAccidents.totalFatalities` | number | Sum of fatalities across all cases |
| `oshaAccidents.totalHospitalizations` | number | Sum of hospitalizations across all cases |
| `oshaAccidents.totalInjuries` | number | Sum of injuries across all cases |
| `oshaAccidents.cases` | object\[] | Individual accident records with summaryNumber, employer, eventDate, eventDescription, keyword, city, state, fatalities, hospitalizations, injuries |
| `oshaInspections` | object/null | OSHA inspection data (null if disabled) |
| `oshaInspections.totalInspections` | number | Total inspections found |
| `oshaInspections.inspections` | object\[] | Individual inspection records with activityNumber, establishment, openDate, type, state, city, naics |
| `mshaData` | object/null | MSHA mining data (null if disabled) |
| `mshaData.totalMines` | number | Total mines found for the operator |
| `mshaData.totalViolations` | number | Total MSHA violations across all mines (up to 10 mines checked) |
| `mshaData.mines` | object\[] | Individual mine records with mineId, mineName, operator, state, type, status, employees |
| `riskAssessment.score` | number | Composite risk score from 0 (no risk indicators) to 100 (maximum risk) |
| `riskAssessment.level` | string | Risk level: LOW (0-24), MODERATE (25-49), HIGH (50-74), CRITICAL (75-100) |
| `riskAssessment.factors` | string\[] | Itemized list of scoring factors with point values |

### How much does it cost?

Industrial Safety Intelligence uses compute-based pricing on the Apify platform. The DOL API itself is free to use (with your own key).

| Scenario | Data Sources | Records | Est. Runtime | Est. Cost |
|----------|-------------|---------|--------------|-----------|
| Single company profile | All 3 | 100 | ~15 sec | ~$0.005 |
| Large company (high maxResults) | All 3 | 1,000 | ~30 sec | ~$0.01 |
| State-wide industry search | All 3 | 5,000 | ~1 min | ~$0.02 |
| OSHA only (no MSHA) | 2 | 100 | ~10 sec | ~$0.003 |

**Apify Free Tier:** New Apify accounts receive $5 of free platform credits each month.

### Build safety profiles using the API

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run = client.actor("ryanclinton/industrial-safety-intel").call(run_input={
    "apiKey": "YOUR_DOL_API_KEY",
    "dryRun": False,
    "companyName": "TYSON",
    "maxResults": 200,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    risk = item["riskAssessment"]
    print(f"{item['company']}: Risk {risk['level']} ({risk['score']}/100)")
    for factor in risk["factors"]:
        print(f"  - {factor}")
    if item.get("oshaAccidents"):
        osha = item["oshaAccidents"]
        print(f"  OSHA: {osha['totalFatalities']} fatalities, {osha['totalHospitalizations']} hospitalizations")
```

#### JavaScript

```javascript
import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: "YOUR_APIFY_API_TOKEN" });

const run = await client.actor("ryanclinton/industrial-safety-intel").call({
    apiKey: "YOUR_DOL_API_KEY",
    dryRun: false,
    companyName: "TYSON",
    maxResults: 200,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) {
    const risk = item.riskAssessment;
    console.log(`${item.company}: Risk ${risk.level} (${risk.score}/100)`);
    risk.factors.forEach(f => console.log(`  - ${f}`));
}
```

#### cURL

```bash
## Start the actor run
curl -X POST "https://api.apify.com/v2/acts/ryanclinton~industrial-safety-intel/runs?token=YOUR_APIFY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "YOUR_DOL_API_KEY",
    "dryRun": false,
    "companyName": "TYSON",
    "maxResults": 200
  }'

## Fetch results (replace DATASET_ID from the run response)
curl "https://api.apify.com/v2/datasets/DATASET_ID/items?token=YOUR_APIFY_API_TOKEN&format=json"
```

### How Industrial Safety Intelligence works

#### Step 1: Parallel data fetching

The actor queries up to three DOL API endpoints simultaneously using `Promise.all`:

- **OSHA accidents** (`/OSHA/accident`) -- filtered by establishment name, state, NAICS code, date range, and fatality flag
- **OSHA inspections** (`/OSHA/inspection`) -- filtered by establishment name, state, NAICS code, and date range
- **MSHA mines** (`/MSHA/mines`) -- filtered by operator name and state, sorted by employee count

All filters are assembled into a JSON filter object passed as a query parameter. Each API call includes timeout handling (30 seconds), exponential backoff on rate limits (429 responses), and up to 4 retries.

#### Step 2: MSHA violation count

After mine data is fetched, the actor queries the MSHA violations endpoint for the first 10 mine IDs to get an aggregate violation count. This provides a quick measure of the operator's compliance history without fetching every individual violation record.

#### Step 3: Risk assessment

The risk score is computed by summing weighted factors:

- **Fatalities**: 30 points per fatality (capped at 90)
- **Hospitalizations**: 10 points per hospitalization (capped at 40)
- **Injuries**: 3 points per injury (capped at 20)
- **Accident volume**: 15 points for 10+ accidents, 8 points for 5-9
- **Inspection volume**: 15 points for 20+ inspections, 8 points for 10-19
- **MSHA violations**: 25 points for 100+, 15 for 20-99, 5 for 1-19
- **Mine count**: 5 points for 5+ mines

The total is capped at 100 and mapped to a severity level.

#### Step 4: Output

All data is assembled into a single safety profile with aggregate statistics and the risk assessment, then pushed to the Apify dataset.

### Risk score reference

| Score Range | Level | Interpretation |
|-------------|-------|----------------|
| 0-24 | LOW | Minimal safety incidents. Few or no accidents, inspections, or violations found. |
| 25-49 | MODERATE | Some safety concerns. Multiple accidents or inspections, possible injuries. |
| 50-74 | HIGH | Significant safety issues. Fatalities, many hospitalizations, or high inspection/violation counts. |
| 75-100 | CRITICAL | Severe safety record. Multiple fatalities, extensive hospitalizations, and/or massive violation counts. |

### Limitations

- **DOL API key required** -- You must register for a free API key at dataportal.dol.gov/registration. The actor cannot fetch real data without one.
- **Company name matching is approximate** -- The DOL API uses LIKE matching on establishment/operator names. Broad searches may return unrelated companies with similar names.
- **MSHA violation count is approximate** -- Only the first 10 mines (by employee count) are checked for violations. Companies with more than 10 mines may have a higher actual violation count.
- **No violation detail** -- The actor reports total MSHA violation counts but does not fetch individual violation records with severity levels or penalty amounts.
- **Historical data only** -- The DOL API provides historical records. There is no real-time incident reporting.
- **NAICS prefix matching** -- The NAICS filter uses prefix matching. A 2-digit code like "21" matches all industries starting with 21 (all mining), which may be broader than intended.
- **Rate limits** -- The DOL API has rate limits. The actor handles 429 responses with exponential backoff, but very large searches may encounter delays.
- **Single profile per run** -- The actor produces one safety profile per run covering all matching records. It does not break out separate profiles per establishment or location.

### Integrations

- [Zapier](https://apify.com/integrations/zapier) -- Trigger workflows when safety data is updated.
- [Make](https://apify.com/integrations/make) -- Build automated ESG monitoring or supply chain safety pipelines.
- [Google Sheets](https://apify.com/integrations/google-sheets) -- Export safety profiles to Google Sheets for team review.
- [Apify API](https://docs.apify.com/api/v2) -- Call the actor from due diligence platforms, ESG scoring tools, or compliance systems.
- [Webhooks](https://docs.apify.com/platform/integrations/webhooks) -- Get notified when a safety profile is generated.

### FAQ

**Do I need to pay for the DOL API?**
No. The DOL Open Data Portal API is free. Register at [dataportal.dol.gov/registration](https://dataportal.dol.gov/registration) to get your API key.

**What is NAICS and how do I find the right code?**
NAICS (North American Industry Classification System) is a standard for classifying businesses by industry. Common codes: 21 (Mining), 23 (Construction), 31-33 (Manufacturing), 3116 (Meat Processing), 2121 (Coal Mining). Search at [naics.com](https://www.naics.com/search/) or [census.gov/naics](https://www.census.gov/naics/).

**What is the difference between OSHA and MSHA?**
OSHA (Occupational Safety and Health Administration) covers most U.S. workplaces. MSHA (Mine Safety and Health Administration) specifically covers mining operations. Companies in mining industries will have records in both datasets.

**How is the risk score calculated?**
The score sums weighted factors: fatalities (30 pts each, max 90), hospitalizations (10 pts each, max 40), injuries (3 pts each, max 20), accident volume (8-15 pts), inspection volume (8-15 pts), MSHA violations (5-25 pts), and mine count (5 pts). The total is capped at 100.

**Can I compare companies' safety records?**
Run the actor separately for each company and compare the risk scores, factor breakdowns, and aggregate statistics. The standardized scoring makes cross-company comparison straightforward.

**How far back does the data go?**
The DOL API contains historical records going back many years. The exact range varies by dataset. Use the `dateFrom` filter to limit results to a specific time period.

**What does dry run mode do?**
Dry run mode runs the actor without making any DOL API calls. It is useful for testing the input configuration and understanding the output format before registering for an API key.

### Related actors

| Actor | How to combine |
|-------|---------------|
| [Website Contact Scraper](https://apify.com/ryanclinton/website-contact-scraper) | Find safety officer and compliance team contacts at companies with safety concerns |
| [B2B Lead Gen Suite](https://apify.com/ryanclinton/b2b-lead-gen-suite) | Build comprehensive profiles combining safety data with business intelligence |
| [SEC 13F Holdings Tracker](https://apify.com/ryanclinton/sec-13f-holdings) | Research institutional exposure to companies with poor safety records |

### Support

Found a bug or have a feature request? Open an issue in the [Issues tab](https://console.apify.com/actors) on this actor's page. For custom safety intelligence solutions, reach out through the Apify platform.

# Actor input Schema

## `dryRun` (type: `boolean`):

When true (or when no API key is provided), returns realistic sample data without calling the DOL API. Set to false and provide an API key for real data.

## `apiKey` (type: `string`):

Your DOL Open Data Portal API key. Register free at https://dataportal.dol.gov/registration. Not needed for dry run mode.

## `companyName` (type: `string`):

Search by company/establishment name (partial match). Examples: 'WALMART', 'AMAZON', 'TYSON', 'US STEEL'

## `state` (type: `string`):

Filter by U.S. state (2-letter code). Examples: 'TX', 'CA', 'WV', 'PA'

## `naicsCode` (type: `string`):

Filter by NAICS code (2-6 digits). Examples: '21' (Mining), '23' (Construction), '3116' (Meat Processing), '2121' (Coal Mining)

## `dateFrom` (type: `string`):

Start date filter (YYYY-MM-DD format). Applies to event/open dates.

## `dateTo` (type: `string`):

End date filter (YYYY-MM-DD format). Applies to event/open dates.

## `fatalitiesOnly` (type: `boolean`):

When true, only return OSHA accident cases involving fatalities.

## `includeOshaAccidents` (type: `boolean`):

Include OSHA accident and injury data in the safety profile.

## `includeOshaInspections` (type: `boolean`):

Include OSHA workplace inspection records in the safety profile.

## `includeMsha` (type: `boolean`):

Include MSHA mine information and violation counts in the safety profile.

## `maxResults` (type: `integer`):

Maximum number of records to return per dataset (accidents, inspections, mines). Range: 1-5,000.

## Actor input object example

```json
{
  "dryRun": true,
  "companyName": "TYSON",
  "fatalitiesOnly": false,
  "includeOshaAccidents": true,
  "includeOshaInspections": true,
  "includeMsha": true,
  "maxResults": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "companyName": "TYSON"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ryanclinton/industrial-safety-intel").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "companyName": "TYSON" }

# Run the Actor and wait for it to finish
run = client.actor("ryanclinton/industrial-safety-intel").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "companyName": "TYSON"
}' |
apify call ryanclinton/industrial-safety-intel --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ryanclinton/industrial-safety-intel",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Industrial Safety — OSHA Accidents & MSHA Data",
        "description": "Analyze workplace safety risks using OSHA, MSHA, and EPA data. Generates composite risk scores with incident history, violation patterns, and safety recommendations for any company or facility.",
        "version": "1.0",
        "x-build-id": "hj5nf2JOje3N1VcPj"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ryanclinton~industrial-safety-intel/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ryanclinton-industrial-safety-intel",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/ryanclinton~industrial-safety-intel/runs": {
            "post": {
                "operationId": "runs-sync-ryanclinton-industrial-safety-intel",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/ryanclinton~industrial-safety-intel/run-sync": {
            "post": {
                "operationId": "run-sync-ryanclinton-industrial-safety-intel",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "dryRun": {
                        "title": "Dry Run (Sample Data)",
                        "type": "boolean",
                        "description": "When true (or when no API key is provided), returns realistic sample data without calling the DOL API. Set to false and provide an API key for real data.",
                        "default": true
                    },
                    "apiKey": {
                        "title": "DOL API Key",
                        "type": "string",
                        "description": "Your DOL Open Data Portal API key. Register free at https://dataportal.dol.gov/registration. Not needed for dry run mode."
                    },
                    "companyName": {
                        "title": "Company Name",
                        "type": "string",
                        "description": "Search by company/establishment name (partial match). Examples: 'WALMART', 'AMAZON', 'TYSON', 'US STEEL'",
                        "default": "TYSON"
                    },
                    "state": {
                        "title": "State",
                        "type": "string",
                        "description": "Filter by U.S. state (2-letter code). Examples: 'TX', 'CA', 'WV', 'PA'"
                    },
                    "naicsCode": {
                        "title": "NAICS Industry Code",
                        "type": "string",
                        "description": "Filter by NAICS code (2-6 digits). Examples: '21' (Mining), '23' (Construction), '3116' (Meat Processing), '2121' (Coal Mining)"
                    },
                    "dateFrom": {
                        "title": "Date From",
                        "type": "string",
                        "description": "Start date filter (YYYY-MM-DD format). Applies to event/open dates."
                    },
                    "dateTo": {
                        "title": "Date To",
                        "type": "string",
                        "description": "End date filter (YYYY-MM-DD format). Applies to event/open dates."
                    },
                    "fatalitiesOnly": {
                        "title": "Fatalities Only",
                        "type": "boolean",
                        "description": "When true, only return OSHA accident cases involving fatalities.",
                        "default": false
                    },
                    "includeOshaAccidents": {
                        "title": "Include OSHA Accidents",
                        "type": "boolean",
                        "description": "Include OSHA accident and injury data in the safety profile.",
                        "default": true
                    },
                    "includeOshaInspections": {
                        "title": "Include OSHA Inspections",
                        "type": "boolean",
                        "description": "Include OSHA workplace inspection records in the safety profile.",
                        "default": true
                    },
                    "includeMsha": {
                        "title": "Include MSHA Mining Data",
                        "type": "boolean",
                        "description": "Include MSHA mine information and violation counts in the safety profile.",
                        "default": true
                    },
                    "maxResults": {
                        "title": "Max Results Per Dataset",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of records to return per dataset (accidents, inspections, mines). Range: 1-5,000.",
                        "default": 100
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
