APProjects commited on
Commit
de96f3c
·
verified ·
1 Parent(s): e3625c0

daily largest-events refresh

Browse files
README.md CHANGED
@@ -33,10 +33,10 @@ configs:
33
 
34
  # The 1,000 largest US layoff events on record under the WARN Act, 1988-2026
35
 
36
- **Rebuilt 2026-09-12. Largest on file: United Airlines, 2020-07-01 to 2020-10-01 — 45,360
37
  workers across 25 notices in 14 state(s). The table's floor is
38
- 835 workers; 558 of the 1,000 events span more than one notice and
39
- 380 span more than one state.**
40
 
41
  A state WARN portal lists one row per site per notice. "What was the biggest layoff?" is an
42
  employer-level question, and answering it takes three steps no portal performs: 48 agencies'
@@ -124,39 +124,3 @@ employers.
124
 
125
  *Automated publisher (APProjects). Not affiliated with any government agency. Verify critical
126
  figures against the state source linked from each notice.*
127
-
128
- <!-- warn-feed:offer:start -->
129
- ## Use it, or keep watching it
130
-
131
- This dataset is one cut of a single daily rebuild: **61,304 US WARN Act
132
- layoff notices from 48 state agencies, 1988 to today**, one schema, no
133
- login, no delay, CC BY 4.0. Snapshot as of **2026-09-13**; the files above are
134
- rebuilt every day, so the live count is the truth.
135
-
136
- **Look something up right now — free, no signup, nothing to install.**
137
- [Check any employer or state against the last 180 days
138
- →](https://approjects-warn-act-notices.static.hf.space/watch-now.html) It runs in your browser against these same files.
139
-
140
- **Building something with it?** The same files are a free HTTP API — JSON and
141
- CSV, no key, no signup, `access-control-allow-origin: *` so `fetch()` works from
142
- a browser: [endpoints, schema and curl examples →](https://approjects-warn-act-notices.static.hf.space/api.html)
143
-
144
- **Or have it watch a list for you.** Coming back to look is the part a CSV cannot
145
- do. **WARN Watch — $49 for a year**, one payment, nothing auto-renews, 14-day
146
- refund, no login: up to 500 employer names plus whole states, matched on every
147
- daily refresh, delivered to a private alert page + calendar (.ics) + RSS +
148
- an optional Slack / Discord / Teams webhook. Every alert carries that employer's
149
- whole filing history from the archive, which a keyword rule on an RSS feed cannot
150
- see. There is no built-in email — we do not claim one.
151
-
152
- - [See a real alert page before paying](https://approjects-warn-act-notices.static.hf.space/watch-sample.html) · [what you get](https://approjects-warn-act-notices.static.hf.space/watch.html)
153
- - [Try it free for 30 days, no card](https://approj.gumroad.com/l/warn-free-watch) · [Buy — $49/year](https://approj.gumroad.com/l/warn-watch)
154
-
155
- **Reaching a human.** WARN Feed is published by APProjects, an automated data
156
- publisher — that is stated plainly rather than dressed up. Corrections, coverage
157
- gaps, schema questions and refund requests all go here and are read:
158
- [open an issue](https://github.com/APVentureEngine/warn-act-notices/issues/new/choose). Payments are handled by Gumroad as merchant of
159
- record, so an invoice can carry your company name.
160
-
161
- [Source, scrapers and methodology](https://github.com/APVentureEngine/warn-act-notices) · [the 48-state site](https://approjects-warn-act-notices.static.hf.space/)
162
- <!-- warn-feed:offer:end -->
 
33
 
34
  # The 1,000 largest US layoff events on record under the WARN Act, 1988-2026
35
 
36
+ **Rebuilt 2026-09-13. Largest on file: United Airlines, 2020-07-01 to 2020-10-01 — 45,360
37
  workers across 25 notices in 14 state(s). The table's floor is
38
+ 844 workers; 560 of the 1,000 events span more than one notice and
39
+ 381 span more than one state.**
40
 
41
  A state WARN portal lists one row per site per notice. "What was the biggest layoff?" is an
42
  employer-level question, and answering it takes three steps no portal performs: 48 agencies'
 
124
 
125
  *Automated publisher (APProjects). Not affiliated with any government agency. Verify critical
126
  figures against the state source linked from each notice.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/largest_layoff_events.csv CHANGED
The diff for this file is too large to render. See raw diff
 
hf_largest_events.py CHANGED
@@ -353,6 +353,79 @@ def render(res):
353
  return card, svg
354
 
355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
  README_ANCHOR = "<!--largest-events-readme-->"
357
  README_PATH = os.path.join(HERE, "repo", "README.md")
358
  HF_URL = f"https://huggingface.co/datasets/APProjects/{DATASET_NAME}"
@@ -365,7 +438,7 @@ def inject_readme(res, readme_path=README_PATH):
365
  return False
366
  top = res["rows"][0]
367
  line = (f"{README_ANCHOR} \U0001F3ED **[The {st['rows']:,} largest US layoff events since "
368
- f"{min(st['years'])}](data/largest_layoff_events.csv)** — notices clustered per resolved "
369
  f"employer (rolling programmes = one event); #1 {top['employer']} {top['year']}, "
370
  f"{top['workers_reported']:,} workers over {top['notices']} notices. "
371
  f"[Card on Hugging Face]({HF_URL}).")
@@ -482,6 +555,10 @@ def selftest():
482
  assert not left, f"unformatted placeholder: {left}"
483
  assert "<svg" in svg and "| 1 | Employer" in card and "45 days" in card
484
  import tempfile
 
 
 
 
485
  tmp = tempfile.NamedTemporaryFile("w", suffix=".md", delete=False, encoding="utf-8")
486
  tmp.write("# T\n\n<!--metro-readme--> metro line\n<!--state-rates-readme--> rates line\n\n## Next\n")
487
  tmp.close()
@@ -500,6 +577,7 @@ def main():
500
  write_csv(OUT_CSV, res["rows"])
501
  write_csv(REPO_CSV, res["rows"])
502
  try:
 
503
  inject_readme(res)
504
  except Exception as e: # noqa: BLE001 — a README line must never block the upload
505
  print(f"hf_largest_events: WARN README injection failed ({e})")
 
353
  return card, svg
354
 
355
 
356
+ MD_PATH = os.path.join(HERE, "repo", "LARGEST-LAYOFF-EVENTS.md")
357
+ MD_TOP = 100
358
+
359
+ MD = """# The {rows:,} largest US layoff events on record (WARN Act, {y0}-{y1})
360
+
361
+ *Rebuilt {asof} from the daily-normalized archive of 48 state WARN portals. Full table:
362
+ [`data/largest_layoff_events.csv`](data/largest_layoff_events.csv) ({rows:,} rows, CC BY 4.0) ·
363
+ [Hugging Face card]({hf}) · [how the numbers are made](#how-an-event-is-built).*
364
+
365
+ **Largest on file: {top_employer}, {top_start} to {top_end} — {top_workers:,} workers across
366
+ {top_notices} notices in {top_states} state(s).** {multi_notice:,} of the {rows:,} events span more
367
+ than one notice; {multi_state:,} span more than one state; the table's floor is {min_workers:,}
368
+ workers.
369
+
370
+ A state portal lists one row per site per notice. "What was the biggest layoff?" is an
371
+ employer-level question, and it takes three steps no portal performs: one schema across 48
372
+ agencies, an employer's spellings resolved to one name (Boeing files under 22), and rolling
373
+ per-site notices clustered into one event.
374
+
375
+ ## Top {mdtop}
376
+
377
+ | # | employer | period | workers reported | notices | sites | states |
378
+ |---|---|---|---|---|---|---|
379
+ {table}
380
+
381
+ ## How an event is built
382
+
383
+ * **Event** = one alias-merged employer's notices with no gap over {gap} days between consecutive
384
+ notice dates and no more than {maxdays} days end to end. A rolling programme is one event; a
385
+ later round is a separate one.
386
+ * **`workers reported`** sums `employees_affected` after dropping exact duplicate portal rows.
387
+ Successive notices for the same site are summed (a portal does not say whether the second is
388
+ cumulative), so a rolling programme can be overstated; `sites` is the conservative figure.
389
+ * **Coverage is uneven before ~2020** — most state portals begin between 2010 and 2023, so an
390
+ early-year rank is a rank among the states we hold. The CSV's `states_covered_in_year` column
391
+ says how many.
392
+ * Single-filing events are only as reliable as that one portal row (`single_notice` in the CSV);
393
+ verify at the state source before repeating a number.
394
+ * Employer resolution: [`product/alias_merge.py`](product/alias_merge.py). It merges spellings,
395
+ not corporate parents.
396
+
397
+ Get told the day an employer on your list files, in any of the 48 states: [free 30-day
398
+ watch]({free_watch}) (no card) or [WARN Watch, $49/year]({watch}) for a list of up to 500
399
+ employers. Automated publisher (APProjects); not affiliated with any government agency.
400
+ """
401
+
402
+
403
+ def write_md(res, path=MD_PATH):
404
+ """GitHub-channel twin (c327 reasoning: the repo is the most human surface; site pages
405
+ carry a host-injected canonical header). Same in-memory result as the card and CSV."""
406
+ rows, st = res["rows"], res["stats"]
407
+ if st["rows"] < MIN_EVENTS:
408
+ raise SystemExit(f"hf_largest_events: only {st['rows']} events; refusing to write md")
409
+ top = rows[0]
410
+ table = "\n".join(
411
+ f"| {e['rank']} | {('[' + e['employer'] + '](' + e['employer_page'] + ')') if e['employer_page'] else e['employer']} | "
412
+ f"{e['event_start']} to {e['event_end']} | {e['workers_reported']:,} | {e['notices']} | "
413
+ f"{e['sites']} | {e['states'].replace(';', ' ')} |"
414
+ for e in rows[:MD_TOP])
415
+ md = MD.format(rows=st["rows"], y0=min(st["years"]), y1=max(st["years"]), asof=st["asof"],
416
+ hf=HF_URL, top_employer=top["employer"], top_start=top["event_start"],
417
+ top_end=top["event_end"], top_workers=top["workers_reported"],
418
+ top_notices=top["notices"], top_states=top["states_count"],
419
+ multi_notice=st["multi_notice_rows"], multi_state=st["multi_state_rows"],
420
+ min_workers=st["min_workers_in_table"], mdtop=min(MD_TOP, st["rows"]),
421
+ table=table, gap=st["gap_days"], maxdays=MAX_EVENT_DAYS,
422
+ free_watch=FREE_WATCH, watch=WATCH)
423
+ assert not re.findall(r"\{[a-z_0-9]+\}", md)
424
+ open(path, "w", encoding="utf-8").write(md)
425
+ print(f"hf_largest_events: wrote {os.path.basename(path)} ({len(md):,} chars)")
426
+ return md
427
+
428
+
429
  README_ANCHOR = "<!--largest-events-readme-->"
430
  README_PATH = os.path.join(HERE, "repo", "README.md")
431
  HF_URL = f"https://huggingface.co/datasets/APProjects/{DATASET_NAME}"
 
438
  return False
439
  top = res["rows"][0]
440
  line = (f"{README_ANCHOR} \U0001F3ED **[The {st['rows']:,} largest US layoff events since "
441
+ f"{min(st['years'])}](LARGEST-LAYOFF-EVENTS.md)** — notices clustered per resolved "
442
  f"employer (rolling programmes = one event); #1 {top['employer']} {top['year']}, "
443
  f"{top['workers_reported']:,} workers over {top['notices']} notices. "
444
  f"[Card on Hugging Face]({HF_URL}).")
 
555
  assert not left, f"unformatted placeholder: {left}"
556
  assert "<svg" in svg and "| 1 | Employer" in card and "45 days" in card
557
  import tempfile
558
+ mdtmp = tempfile.NamedTemporaryFile("w", suffix=".md", delete=False, encoding="utf-8"); mdtmp.close()
559
+ md = write_md(res2, mdtmp.name)
560
+ assert "| 1 | Employer" in md and md.count("\n| ") >= MD_TOP + 1, "md top table missing"
561
+ os.unlink(mdtmp.name)
562
  tmp = tempfile.NamedTemporaryFile("w", suffix=".md", delete=False, encoding="utf-8")
563
  tmp.write("# T\n\n<!--metro-readme--> metro line\n<!--state-rates-readme--> rates line\n\n## Next\n")
564
  tmp.close()
 
577
  write_csv(OUT_CSV, res["rows"])
578
  write_csv(REPO_CSV, res["rows"])
579
  try:
580
+ write_md(res)
581
  inject_readme(res)
582
  except Exception as e: # noqa: BLE001 — a README line must never block the upload
583
  print(f"hf_largest_events: WARN README injection failed ({e})")