惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
博客园 - 叶小钗
F
Fortinet All Blogs
GbyAI
GbyAI
Martin Fowler
Martin Fowler
博客园 - 聂微东
I
InfoQ
B
Blog
IT之家
IT之家
美团技术团队
L
LangChain Blog
小众软件
小众软件
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
Last Week in AI
Last Week in AI
A
About on SuperTechFans
博客园 - Franky
P
Proofpoint News Feed
罗磊的独立博客
月光博客
月光博客
V
Visual Studio Blog
MyScale Blog
MyScale Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Fentanyl Poverty: Building a Big Data Pipeline to Map Ame...
StiiWann · 2026-05-20 · via DEV Community

StiiWann

The United States is in the grip of an opioid crisis. Between 2019 and 2023,
fentanyl-related overdose deaths skyrocketed — but the impact is not uniform
across the country. Are the hardest-hit states also the poorest? We built a
full Big Data pipeline to answer that question.

The Data

We combined two official U.S. government sources:

  • CDC VSRR (Vital Statistics Rapid Release) — state-level fentanyl overdose deaths per 12-month rolling period, from 2015 to 2023
  • U.S. Census Bureau ACS 5-Year — median household income, poverty rate, and unemployment rate for all 50 states + D.C.

The Architecture

CDC API ──┐
├── Apache Spark ── Elasticsearch ── Kibana Dashboard
Census ───┘ │
└── scikit-learn (ML)

Step 1 — Ingestion

Python scripts fetch both datasets via REST APIs and land them in a raw
datalake (data/raw/), with UTC timestamps for traceability.

Step 2 — Spark Processing

Apache Spark formats and combines both sources:

  • Filters for fentanyl-specific death indicators
  • Joins CDC deaths with Census socioeconomic data by state and year
  • Computes a risk score: 40% poverty + 30% unemployment + 30% inverse income
  • Outputs Parquet files via PyArrow (Windows-compatible, no winutils needed) ### Step 3 — Machine Learning Two scikit-learn models add predictive power: Linear Regression — predicts deaths from socioeconomic features. Result: R²=0.066, showing that poverty alone doesn't explain deaths linearly. K-Means Clustering (k=3) — groups states into risk profiles: | Cluster | States | Avg Deaths/Year | |---------|--------|----------------| | LOW_RISK | 21 states | ~415 | | MEDIUM_RISK | 17 states | ~1,200 | | HIGH_RISK | 11 states | ~3,800+ | Ohio, Pennsylvania, West Virginia and California consistently appear in the HIGH_RISK cluster — driven by both high absolute populations and deep socioeconomic distress. ### Step 4 — Elasticsearch + Kibana All 637 documents (3 indices) are indexed on Elastic Cloud Serverless, with geo_point coordinates for each state enabling map visualizations. The Kibana dashboard includes:
  • 🗺️ Map — deaths per state with bubble sizing
  • 📈 Timeline — the 2019-2021 explosion visible at a glance
  • 💰 Scatter plot — income vs. deaths (weak but visible inverse trend)
  • 🏷️ Risk table — all 51 states ranked by risk score and cluster ## Key Finding The correlation between poverty and fentanyl deaths is positive but weak (Pearson r ≈ 0.04 for poverty rate, r ≈ 0.36 for unemployment). This suggests the epidemic crosses socioeconomic lines — but unemployment is a stronger signal than raw poverty. The K-Means clustering is more revealing: states with combined economic distress AND large populations form the HIGH_RISK cluster. ## The Stack | Component | Tool | |-----------|------| | Ingestion | Python + Requests | | Processing | Apache Spark 3.5 + PyArrow | | ML | scikit-learn (LinearRegression, KMeans) | | Storage | Parquet (datalake) + Elasticsearch 8.13 | | Visualization | Kibana on Elastic Cloud | | Orchestration | Apache Airflow (daily DAG) | | Version control | GitHub | ## Try It Yourself The full pipeline is open source: 👉 github.com/tristandaniel8/fentanyl-poverty-epidemic

bash
git clone https://github.com/tristandaniel8/fentanyl-poverty-epidemic
pip install -r requirements.txt
python pipeline.py

Enter fullscreen mode Exit fullscreen mode