Skip to main content

Case Study

Emergency Department Queue (ED-Q) System

Real-time Patient Flow Aggregation from 26 Hospitals

A centralized data engineering solution that scrapes and normalizes live patient queue data from 26 different hospital emergency departments. Provides real-time visibility into patient flow for the Regional Command Center, enabling load balancing and transfer coordination.

6/1/2025Updated 12/1/202510 min read
Node.js
Puppeteer
TypeScript
WebSocket
PostgreSQL

Project Overview

The Challenge

The Regional Command Center needed real-time visibility into patient queue data across 26 emergency departments. Each hospital used different legacy queue management software with no standardized API access, inconsistent data formats, and varying field naming conventions. The government required centralized monitoring to coordinate patient transfers and balance loads across the healthcare network.

The Solution

I designed and built the ED-Q System end-to-end - a centralized patient flow aggregation platform using real-time web scraping. The system uses Puppeteer to extract live queue data from 26 different hospital interfaces, normalizes the heterogeneous data into a unified schema, and pushes updates via WebSocket to the RCC dashboard for operator visibility.

Impact

  • Centralized patient flow visibility across all 26 emergency departments
  • 99.9% data accuracy from legacy systems with no API access
  • Real-time queue monitoring for regional load balancing decisions
  • Automated error recovery and alerting for scraping failures
  • End-to-end ownership from architecture to deployment
  • Critical data source for Ministry decision-making

Key Metrics

26

Hospitals Scraped

Real-time data extraction

99.9%

Data Accuracy

With validation pipelines

~1 min

Update Frequency

Near real-time

100%

System Coverage

All ED queues monitored

Technical Implementation

Architecture

The ED-Q System uses a distributed scraping architecture with Node.js worker pools for parallel data extraction. Each hospital has a dedicated schema mapping configuration to normalize its unique data format. Puppeteer with stealth plugins handles JavaScript-rendered queue interfaces. Data flows through validation pipelines before being pushed via WebSocket to the RCC dashboard. The system includes automatic retry logic, session management, and comprehensive error alerting.

Technology Stack

Frontend

React (RCC Dashboard)WebSocket ClientReal-time Updates

Backend

Node.jsPuppeteerTypeScriptExpress

Database

PostgreSQLRedis CacheData Normalization

Infrastructure

DockerPM2Cron SchedulerHealth Checks

Tools

Puppeteer StealthSchema MappingsError Alerting

Key Features

  • Parallel web scraping of 26 hospital queue interfaces
  • Per-hospital schema mappings for data normalization
  • Puppeteer with stealth plugins for JavaScript-rendered pages
  • Automatic retry logic with exponential backoff
  • Session management for authenticated hospital portals
  • WebSocket push to RCC dashboard for real-time updates
  • Comprehensive error alerting and monitoring
  • Validation pipelines ensuring data accuracy

Challenges and Solutions

Challenge

Scraping 26 different hospital queue systems with unique interfaces

Solution

Created a flexible schema mapping system allowing per-hospital configuration of field extractors, selectors, and data transformations. Each hospital's unique interface is handled by its configuration file while sharing the core scraping engine.

Challenge

Maintaining data accuracy without standardized API access

Solution

Implemented multi-stage validation pipelines checking data types, value ranges, and consistency. Added automated health checks comparing current vs. historical patterns to detect anomalies and scraping failures.

Challenge

Handling rate limiting and avoiding detection

Solution

Used Puppeteer stealth plugins, randomized delays, and request throttling to avoid triggering anti-bot measures. Implemented intelligent scheduling to distribute load and maintain sustainable scraping rates.

Related Projects

Live-Stream Guardian QA

UNFCCC - Automation Engineer. Chrome extension with Node.js and Puppeteer that replaced manual stream monitoring with automated quality checks and fast alerts.

Chrome ExtensionsNode.jsPuppeteer
View Project