Skip to content

Latest commit

ย 

History

131 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” Tech Layoff Tracker

ๅ…จ็ƒ็ง‘ๆŠ€่กŒไธš่ฃๅ‘˜ๅ…จๆ™ฏๆดžๅฏŸ ยท 2025โ€“2026

Python BeautifulSoup Pandas ECharts Docker GitHub Actions License: MIT


An automated data pipeline that scrapes, processes, and visualizes global tech industry layoff data.

ไธ€ไธช่‡ชๅŠจๅŒ–ๆ•ฐๆฎ็ฎก้“๏ผŒ็ˆฌๅ–ใ€ๅค„็†ๅนถๅฏ่ง†ๅŒ–ๅ…จ็ƒ็ง‘ๆŠ€่กŒไธš่ฃๅ‘˜ๆ•ฐๆฎใ€‚

Quick Start ยท Features ยท Architecture ยท Data Sources


๐Ÿ“ธ Dashboard Preview

๐Ÿ‡บ๐Ÿ‡ธ English Mode (Default)

Dashboard - English

Dashboard - Charts

๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ๆจกๅผ

Dashboard - Chinese

๐Ÿ’ก Supports EN / ไธญๆ–‡ language toggle โ€” switch instantly without page reload.


โœจ Features

Feature Description
๐Ÿ•ท๏ธ Web Scraper Multi-strategy scraper with live Airtable shared-view extraction, CSV mirror fallback, and offline sample data
๐Ÿงน Data Processing Pandas-based pipeline that cleans, normalizes, and aggregates raw data into analysis-ready JSON
๐Ÿ“Š Interactive Dashboard Glassmorphism-styled ECharts dashboard with animated gradients, responsive layout, dynamic date-range subtitles, and homepage-first analysis modules
๐Ÿงญ SEO Trend Report Static trend-report.html page with indexable analysis text, chart-backed findings, methodology notes, FAQ, and structured data
๐Ÿ—‚๏ธ Reports Archive /reports/ archive entry designed for daily, weekly, monthly, and quarterly layoff trend reports
๐Ÿค– GEO / AI-Readable Summary llms.txt and ai-summary.json expose canonical facts, data range, methodology, and source files for AI answer engines
๐Ÿงญ SEO Discovery Files Generated sitemap.xml and robots.txt expose the dashboard, reports, and AI-readable files to crawlers
๐Ÿš€ One-Command Pipeline python main.py runs the complete scrape โ†’ process โ†’ visualize workflow
๐Ÿณ Docker Ready Multi-stage Dockerfile + Compose โ€” docker compose up for instant deployment
๐Ÿ”„ Offline-Capable Built-in curated dataset ensures the project works even without network access

๐Ÿš€ Quick Start

Option A: Docker (Recommended) ๐Ÿณ

# Clone & start โ€” one command!
git clone https://github.com/frankwang0909/tech-layoff-tracker.git
cd tech-layoff-tracker

Open http://localhost:8080/ in your browser. Done! ๐ŸŽ‰

Option B: Local Python

# Clone the repository
git clone https://github.com/frankwang0909/tech-layoff-tracker.git
cd tech-layoff-tracker

# Create virtual environment
python -m venv venv
source venv/bin/activate  # macOS/Linux

# Install dependencies
pip install -r requirements.txt

# Run the full pipeline
python main.py

# Serve the dashboard locally

Open http://localhost:8080/ or directly open index.html.

CLI Options

python main.py                  # Full pipeline: Scrape โ†’ Process โ†’ Chart
python main.py --skip-scrape    # Skip scraping, use existing data
python main.py --verbose        # Debug output
python server.py --port 3000    # Serve on custom port

โš™๏ธ CI/CD: GitHub Pages Deploy

This project uses GitHub Actions to deploy the generated static site to GitHub Pages:

Setting Value
๐Ÿ”„ Trigger Push to main and manual dispatch
๐Ÿ“ฆ Artifact Entire repository root (including index.html and visualization/)
๐ŸŒ Deploy GitHub Pages with optional custom domain
๐Ÿงญ Entry Point Root index.html serves the dashboard homepage directly

Setup Instructions

  1. Push this repo to GitHub
  2. Go to Settings โ†’ Pages โ†’ Source and select GitHub Actions
  3. Push a commit to main or run Actions โ†’ Deploy Static Redirects โ†’ Run workflow
  4. Your dashboard will be live at:
    https://frankwang0909.github.io/tech-layoff-tracker/ 
    
    If you configure a custom domain, the root path should render the dashboard directly.

๐Ÿ—๏ธ Architecture

tech-layoff-tracker/
โ”‚
โ”œโ”€โ”€ index.html                       # ๐ŸŒ Generated homepage dashboard
โ”œโ”€โ”€ trend-report.html                # ๐Ÿงญ Generated SEO trend report
โ”œโ”€โ”€ llms.txt                         # ๐Ÿค– LLM guidance and canonical facts
โ”œโ”€โ”€ ai-summary.json                  # ๐Ÿค– Machine-readable answer summary
โ”œโ”€โ”€ sitemap.xml                      # ๐Ÿงญ Generated sitemap index
โ”œโ”€โ”€ sitemap-main.xml                 # ๐Ÿงญ Generated main-page sitemap
โ”œโ”€โ”€ sitemap-reports.xml              # ๐Ÿงญ Generated reports sitemap
โ”œโ”€โ”€ sitemap-topics.xml               # ๐Ÿงญ Generated industry/country sitemap
โ”œโ”€โ”€ robots.txt                       # ๐Ÿงญ Generated crawler directives
โ”œโ”€โ”€ layoff_chart.html                # โ†ช Root-level legacy redirect
โ”œโ”€โ”€ main.py                          # ๐Ÿš€ One-command entry point
โ”œโ”€โ”€ requirements.txt                 # Python dependencies
โ”œโ”€โ”€ .gitignore
โ”‚
โ”œโ”€โ”€ scraper/                         # ๐Ÿ•ท๏ธ Data Collection
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ config.py                    # Scraper configuration
โ”‚   โ””โ”€โ”€ layoffs_fyi_scraper.py       # Multi-strategy web scraper
โ”‚
โ”œโ”€โ”€ analysis/                        # ๐Ÿ”ง Data Processing
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ data_processor.py            # Clean, aggregate, export JSON
โ”‚
โ”œโ”€โ”€ visualization/                   # ๐Ÿ“Š Chart Generation
โ”‚   โ”œโ”€โ”€ generate_charts.py           # Jinja2 template โ†’ HTML dashboard
โ”‚   โ””โ”€โ”€ layoff_chart.html            # Legacy redirect kept for old links
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ raw/                         # Raw scraped CSV
โ”‚   โ””โ”€โ”€ processed/                   # Aggregated JSON files
โ”‚       โ”œโ”€โ”€ industry_pages.json      # ๐Ÿงฉ Topic data for industry pages
โ”‚       โ””โ”€โ”€ country_pages.json       # ๐Ÿงฉ Topic data for country pages
โ”‚
โ”œโ”€โ”€ industries/                      # ๐Ÿงฉ Generated industry topic pages
โ”œโ”€โ”€ countries/                       # ๐Ÿงฉ Generated country/region topic pages
โ”‚
โ””โ”€โ”€ reports/
    โ”œโ”€โ”€ index.html                   # ๐Ÿ—‚ Generated reports archive
    โ”œโ”€โ”€ daily/                       # ๐Ÿ—“ Generated significant daily report pages (noindex)
    โ”œโ”€โ”€ weekly/                      # ๐Ÿ—“ Generated recent weekly report pages
    โ”œโ”€โ”€ monthly/                     # ๐Ÿ—“ Generated monthly report pages
    โ”œโ”€โ”€ quarterly/                   # ๐Ÿ—“ Generated quarterly report pages
    โ”œโ”€โ”€ yearly/                      # ๐Ÿ—“ Generated yearly report pages
    โ””โ”€โ”€ layoff_report_2025_2026.md   # Detailed analysis report (ไธญๆ–‡)

Pipeline Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   SCRAPE     โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   PROCESS    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  VISUALIZE   โ”‚
โ”‚              โ”‚     โ”‚              โ”‚     โ”‚              โ”‚
โ”‚ layoffs.fyi  โ”‚     โ”‚  pandas      โ”‚     โ”‚  Jinja2 +    โ”‚
โ”‚ Airtable API โ”‚     โ”‚  aggregation โ”‚     โ”‚  ECharts     โ”‚
โ”‚ + fallbacks  โ”‚     โ”‚  โ†’ JSON      โ”‚     โ”‚  โ†’ HTML      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ•ท๏ธ Scraper Design

The scraper uses a 3-tier strategy for maximum reliability:

Priority Strategy Description
1๏ธโƒฃ Live Airtable Shared View Discover the current Airtable iframe from layoffs.fyi, then read the shared-view payload exposed to public visitors
2๏ธโƒฃ GitHub CSV Mirror Fallback snapshot from a community-maintained CSV mirror
3๏ธโƒฃ Offline Dataset Curated sample data from verified public reports (always works)

Ethical scraping practices:

  • Polite request delays (REQUEST_DELAY = 1.0s)
  • Proper User-Agent header
  • Configurable retry with backoff
  • Only targets publicly available data
  • Preserves current embed rotations by discovering the Airtable URL from the live page first
  • Normalizes Airtable UTC timestamps before applying the configured date filter

๐Ÿ“Š Dataset Notes

  • The dashboard subtitle is generated from data/processed/stats.json, so the displayed range tracks the latest processed snapshot instead of a hard-coded month.
  • When the live Airtable source is reachable, python main.py now captures current layoffs.fyi records, including post-March 2026 entries.
  • If the live source fails or returns an unusable filtered result, the pipeline falls back to the CSV mirror and then to the bundled offline sample dataset.
  • The current snapshot metrics can always be read from data/processed/stats.json.

๐Ÿ“ˆ Homepage Analytics

The homepage dashboard now combines overview KPIs with additional analysis slices generated from data/processed/:

  • monthly_comparison.json powers a side-by-side 2025 vs 2026 monthly comparison chart
  • stage_size_heatmap.json powers a Stage ร— Layoff Size event heatmap
  • layoff_pct_distribution.json powers the Layoff % Distribution chart
  • recent_layoffs.json powers the latest layoff events table shown on the homepage

๐Ÿงญ SEO Trend Reports

The pipeline also generates static, crawlable report pages:

  • trend-report.html provides an indexable trend report with executive summary, key findings, chart-backed sections, methodology, FAQ, and JSON-LD structured data.
  • reports/index.html is the archive entry for the planned daily, weekly, monthly, and quarterly report system.
  • reports/weekly/*.html includes the most recent weekly reports and is included in sitemap.xml.
  • reports/monthly/*.html and reports/quarterly/*.html are generated from period report JSON for long-tail SEO.
  • reports/yearly/*.html provides annual and year-to-date summary pages for evergreen SEO.
  • reports/daily/*.html is generated only for significant daily reports and uses noindex, follow to avoid thin-content indexing.
  • industries/*.html and countries/*.html provide focused topic pages for long-tail SEO and AI answer discovery.
  • llms.txt and ai-summary.json provide GEO-friendly canonical facts for AI answer engines and chatbots.
  • sitemap.xml is a sitemap index pointing to sitemap-main.xml, sitemap-reports.xml, and sitemap-topics.xml.

These pages reuse the existing processed JSON data so they stay aligned with the dashboard after every python main.py run.


๐Ÿ“ Data Sources

  • layoffs.fyi โ€” Primary tech layoff tracker
  • RationalFX Annual Reports
  • Major tech press: Reuters, Bloomberg, CNBC, The Verge, TechCrunch
  • Company press releases and SEC filings

๐Ÿ› ๏ธ Tech Stack

  • Scraping: requests, BeautifulSoup4, lxml
  • Processing: pandas
  • Templating: Jinja2
  • Visualization: ECharts 5.x (client-side)
  • Language: Python 3.10+

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


If you found this project useful, please consider giving it a โญ!

About

๐Ÿ” Tech Layoff Tracker โ€” Interactive dashboard tracking global tech layoffs (2025-2026). Python scraper + Pandas + ECharts. Auto-updated daily via GitHub Actions.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages