DEV Community

Aurelix Solutions
Aurelix Solutions

Posted on

WARN Act layoff notices from nine US states in Python

Under the federal WARN Act, employers with 100 or more workers must give 60 days' notice before a plant closing or mass layoff, and the state labor agencies publish the notices they receive. That makes WARN lists one of the earliest public signals of a layoff: weeks before it happens, with the employer, the site and the number of people affected.

Each state publishes them differently: an Excel report in California, a dataset in Texas, HTML tables in Maryland, Wisconsin and Alabama, a paged list in Oregon. This post reads nine of them into Python in one schema and turns them into a daily feed that returns only notices not returned before.

Disclosure: I'm Aurelix, and I built WARN Layoff Notices, the tool used here. It's a paid tool (prices below).

What each row holds

  • state, company, location (site address or city), county.
  • employees_affected.
  • notice_date (received or posted by the state), effective_date (first layoff or closure date) and effective_date_text as published.
  • notice_type (closure, layoff, mass layoff, relocation) and industry where the state gives them.
  • agency and url: the state page, file or dataset the notice came from.

Only employers are returned; state contact persons are never read.

Last 30 days, three states

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
import os

from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("aurelix/warn-layoff-notices").call(
    run_input={"states": ["CA", "MD", "WI"], "daysBack": 30}
)
for n in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(n["state"], n["notice_date"], n["company"], n["employees_affected"], n["effective_date_text"])
Enter fullscreen mode Exit fullscreen mode

Large layoffs only

run = client.actor("aurelix/warn-layoff-notices").call(
    run_input={"states": ["CA", "TX", "MD", "TN", "AL", "UT", "NE", "WI", "OR"], "daysBack": 90, "minEmployees": 100}
)
rows = sorted(client.dataset(run["defaultDatasetId"]).iterate_items(), key=lambda n: -(n["employees_affected"] or 0))
for n in rows[:20]:
    print(f"{n['employees_affected']:>6}  {n['state']}  {n['company']}  {n['location'] or ''}")
Enter fullscreen mode Exit fullscreen mode

Only new notices, every day

run_input = {
    "states": ["CA", "TX", "MD", "TN", "AL", "UT", "NE", "WI", "OR"],
    "daysBack": 14,
    "incremental": True,
    "stateKey": "warn-daily",
    "slackWebhookUrl": "https://hooks.slack.com/services/...",
}
Enter fullscreen mode Exit fullscreen mode

The first run returns everything in the window and remembers it; each later run with the same stateKey returns only notices it has not returned before. Schedule it daily in the Apify Console: Slack gets a short digest with links, and nothing is sent when nothing is new.

Limits

  • Nine states. Others were left out because their pages refuse automated access, publish only scanned letters, or need form submissions.
  • Columns differ by state: Utah and Nebraska give no layoff date or industry.
  • California's report covers the current state fiscal year, Wisconsin's page the current year, and Texas publishes its dataset months late.

Cost

$4.00 per 1,000 notices on Apify's free plan, $3.00 on paid plans, plus a $0.005 start fee per run. A state with nothing to return costs $0.0003, except the first three in each run, so a daily nine-state run costs a few cents. Current prices are on the Store page; Apify's free plan includes $5 of credit a month.

Use it from an AI assistant

Through Apify's hosted MCP server, Claude, ChatGPT or Cursor can run it from a request like "which companies filed WARN notices in California this month affecting more than 100 people?". Server URL: https://mcp.apify.com/?tools=aurelix/warn-layoff-notices.

Links

Top comments (0)