# PHMSA Enforcement Case Metadata (`vixendata/phmsa-enforcement-case-metadata`) Actor

Official pipeline enforcement case snapshot, normalized dates and penalties with source-preserved case states.

- **URL**: https://apify.com/vixendata/phmsa-enforcement-case-metadata.md
- **Developed by:** [Vixendata](https://apify.com/vixendata) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 enforcement-case records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## PHMSA Enforcement Case Metadata

Private, read-only Actor. Downloads the official PHMSA TSV snapshot once and emits typed case metadata. No Apify Console edits or publication.

### Run

`pip install -r requirements.txt` then `python main.py`. Apify SDK reads INPUT and writes default dataset plus RUN_REPORT. Run offline tests with `python -m unittest discover -s tests -v` from this folder. Docker uses Apify Python 3.12.

### Scope and correctness

Exact source: https://primis.phmsa.dot.gov/enforcement-documents/PHMSA%20Pipeline%20Enforcement%20Raw%20Data.txt . No arbitrary URLs, document downloads, personal contact fields, browser, proxies, retries or redirects. Standard urllib environment transport. Robots checked first; minimum 2 seconds or greater robots crawl delay, 25-second request timeout, 90-second request-launch/post-response budget (socket timeout is not a total deadline; a slow active response can overrun before the post-read check), 2 requests, 10 MB export, 250 KB robots, 20,000 parsed rows and 10,000 emitted cases maximum. Windows-1252 and proper quoted TSV parsing. Missing values remain null; raw date/amount strings retained. Case ID is stable; contentHash excludes observation time. Filter arrays use exact source values, operator uses name substring or exact ID, openedSince uses ISO date. Order follows official export; no sort or complete-history guarantee.

Notices, allegations, proposed penalties and final orders remain distinct. Records are not findings of liability or legal advice. Check the official current source before decisions. dataAsOfText is preserved verbatim because source time zone is unspecified.

### Rights and demand

Attribution: U.S. DOT, PHMSA. Official Data.gov catalog https://catalog-old.data.gov/dataset/pipeline-enforcement-transparency-portal lists https://www.usa.gov/government-works . Only government-produced metadata, no operator submissions.
Kondwit https://kondwit.com/ explicitly integrates PHMSA enforcement for pipeline professionals; https://noxara.ai/resources/regulatory-intelligence discusses PHMSA inspection/enforcement trends. These demonstrate professional consumption, not revenue or willingness-to-pay proof.
Store searches on 2026-10-06 for PHMSA, phmsa.dot.gov and pipeline enforcement found no dedicated typed case-export Actor. Generic regulatory intelligence and web crawlers are alternatives; absence is a bounded search finding, not proof.

### Evidence

Portable fixtures captured from official source 2026-10-06 are included in tests/fixtures, without absolute-path dependencies. Tests cover real 5,089-case export, quoted TSV, nulls, dates, amount parsing, limits, filters, robots and URL safety. verification contains actual local SDK live-run evidence; this is not an Apify-hosted production test.

# Actor input Schema

## `maxItems` (type: `integer`):

Maximum matching case records to emit from the single official snapshot.

## `operator` (type: `string`):

Case-insensitive operator-name substring or exact operator ID; empty includes all.

## `openedSince` (type: `string`):

Inclusive YYYY-MM-DD filter on opened date. Empty disables; unknown dates excluded when enabled.

## `regions` (type: `array`):

Case-insensitive exact source values; empty includes all. Up to 20 values.

## `caseStatuses` (type: `array`):

Case-insensitive exact source values; empty includes all. Up to 20 values.

## `caseTypes` (type: `array`):

Case-insensitive exact source values; empty includes all. Up to 20 values.

## Actor input object example

```json
{
  "maxItems": 100,
  "operator": "",
  "openedSince": "",
  "regions": [],
  "caseStatuses": [],
  "caseTypes": []
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("vixendata/phmsa-enforcement-case-metadata").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("vixendata/phmsa-enforcement-case-metadata").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call vixendata/phmsa-enforcement-case-metadata --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vixendata/phmsa-enforcement-case-metadata"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/GFcxXfVNetOcJNZyV/builds/ZgjVJ8Qw9wFpuqbEP/openapi.json
