Skip to content

Willie-Conway/PULSE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CI-CD

PULSE β€” Public Health Analytics Platform

alt text

PULSE Platform React Recharts API Integration


Overview

PULSE is a real-time public health analytics platform built with React, featuring 5 core modules and 5 live API data sources. It provides comprehensive visualization of COVID-19 trends, FDA adverse events, and CDC wastewater surveillance data.


✨ Key Features

πŸ₯ 5 Core Modules

Module Focus Data Sources Visualizations
01 β€” Dashboard Overview disease.sh, OpenFDA, CDC NWSS KPIs, area chart, bar chart, heatmap
02 β€” Pipelines ETL Simulation All sources Status cards, latency metrics, Python code
03 β€” COVID-19 Country Data disease.sh Sortable table, flag icons, export
04 β€” FDA Events Adverse Events OpenFDA Line chart, raw records table
05 β€” Wastewater CDC NWSS data.cdc.gov Scrollable bar chart, jurisdiction table

πŸ“Š 5 Live API Sources

Source Endpoint Data Update
disease.sh (Global) /v3/covid-19/all Global cumulative stats Real-time
disease.sh (Historical) /v3/covid-19/historical/all Daily cases/deaths timeline Real-time
disease.sh (Countries) /v3/covid-19/countries 200+ country-level data Real-time
disease.sh (Continents) /v3/covid-19/continents 7 continent aggregates Real-time
OpenFDA /drug/event.json?count=receivedate 24-month adverse events Daily
CDC NWSS /resource/2ew6-ywp6.json Wastewater surveillance Weekly

πŸ“ˆ Module 01: Dashboard

Real-Time KPIs πŸ“Š

KPI Source Format Color
Total Cases disease.sh Global cumulative πŸ”΄#ff4d6a
Total Deaths disease.sh Global cumulative 🟑#f5a623
Recovered disease.sh Global cumulative 🟒#00e5a0
Active Cases disease.sh Global cumulative πŸ”΅#00d4ff
FDA Events OpenFDA 24-month total 🟣#a78bfa
WW Detect Rate CDC NWSS Avg detection % 🟒#00e5a0

COVID-19 Global Trend πŸ“‰

  • Area chart with gradient fill for cases (red) and deaths (amber)
  • Date range selector: 30D, 90D, 6M, 1Y, 2Y, All Time
  • Smart X-axis shows year labels only when year changes
  • Cumulative totals with formatted numbers (e.g., 700M, 6.9M)

Cases by Continent 🌍

  • Horizontal bar chart for 7 continents
  • Responsive layout with compact continent labels
  • Color-coded with platform accent

Influenza Heatmap πŸ—ΊοΈ

  • Live updating 10Γ—5 grid (1,600ms interval)
  • 6 intensity levels: Minimal β†’ Low β†’ Moderate β†’ High β†’ Very High β†’ Widespread
  • Gradient cells from 7% to 100% opacity
  • Interactive legend with intensity labels

Wastewater Detection πŸ’§

  • Top 12 jurisdictions by detection percentage
  • Horizontal bar chart with green gradient
  • Real CDC data from National Wastewater Surveillance System

alt text


πŸ”„ Module 02: Pipelines β€” ETL Simulation

6 Data Pipelines πŸ”§

Pipeline Source Status Indicator Metrics
COVID Global Stats disease.sh 🟒 Healthy / πŸ”΄ Error Records, Latency, Last Run
COVID Historical disease.sh 🟒 Healthy / πŸ”΄ Error Records, Latency, Last Run
COVID by Country disease.sh 🟒 Healthy / πŸ”΄ Error Records, Latency, Last Run
COVID by Continent disease.sh 🟒 Healthy / πŸ”΄ Error Records, Latency, Last Run
FDA Adverse Events OpenFDA 🟒 Healthy / πŸ”΄ Error Records, Latency, Last Run
CDC Wastewater data.cdc.gov 🟒 Healthy / πŸ”΄ Error Records, Latency, Last Run

Pipeline Status Cards πŸƒ

  • Color-coded status dots:
    • 🟒 Healthy (success)
    • πŸ”΄ Error
    • πŸ”΅ Running/Fetching (pulsing)
    • βšͺ Idle
  • Progress bar for visual status (100% success, 55% fetching)
  • 4 metrics per card:
    • Records count (formatted)
    • Latency in milliseconds
    • Last run timestamp
    • Error message (if any)

Python ETL Code Viewer 🐍

  • Syntax-highlighted Python code for each pipeline
  • Color coding:
    • πŸ”΅ Keywords (def, class, import) β€” blue
    • 🟒 Strings β€” green
    • 🟣 Decorators (@app.task) β€” purple
    • βšͺ Comments β€” muted gray
  • Real ETL examples with:
    • Pydantic models
    • Async HTTP clients
    • Airflow DAGs
    • Kafka producers
    • PostgreSQL/PostGIS loading

Sample ETL Code πŸ“

# COVID Historical ETL β†’ Timeseries table (Airflow DAG)
import httpx, pandas as pd
from airflow.decorators import dag, task
import pendulum

@dag(schedule="@daily", start_date=pendulum.datetime(2024,1,1), catchup=False)
def covid_historical_etl():
    @task()
    def extract() -> dict:
        r = httpx.get(
            "https://disease.sh/v3/covid-19/historical/all?lastdays=all",
            timeout=30)
        r.raise_for_status()
        return r.json()
  
    @task()
    def transform(raw: dict) -> list[dict]:
        df = pd.DataFrame({
            "date":   pd.to_datetime(list(raw["cases"].keys())),
            "cases":  list(raw["cases"].values()),
            "deaths": list(raw["deaths"].values()),
        })
        df["delta_cases"]  = df["cases"].diff().fillna(0).astype(int)
        df["delta_deaths"] = df["deaths"].diff().fillna(0).astype(int)
        return df.to_dict(orient="records")
  
    @task()
    def load(records: list[dict]):
        import psycopg2, io
        conn = psycopg2.connect(dsn="postgresql://ph_user@pg-main/surveillance")
        # ... PostgreSQL COPY command

alt text


🦠 Module 03: COVID-19 Country Data

200+ Countries 🌐

  • Sortable columns by any metric (click column header)
  • Flag icons from disease.sh API
  • Live search (coming soon)
  • Export capabilities: CSV, JSON

Data Columns πŸ“‹

Column Format Color Sortable
Country Text with flag icon White βœ…
Cases Formatted number πŸ”΄ Red βœ…
Deaths Formatted number 🟑 Amber βœ…
Active Formatted number πŸ”΅ Blue βœ…
Critical Formatted number 🟣 Purple βœ…
Cases/1M Formatted number White βœ…
Population Formatted (K/M/B) White βœ…

Export Options πŸ“¦

  • CSV download with proper escaping
  • JSON download with formatted data
  • Headers included in both formats

alt text

alt text

πŸ’Š Module 04: FDA Adverse Events

24-Month Timeline πŸ“ˆ

  • Line chart with purple accent
  • Data points for each month
  • Tooltip with full date and count

Raw Records Table πŸ“‹

  • Date (MM/DD format)
  • Full Date (YYYYMMDD)
  • Event Count (formatted)

Export Options πŸ“¦

  • CSV download of transformed data
  • JSON download of raw API response
  • One-click refresh button

alt text


πŸ’§ Module 05: Wastewater Surveillance (CDC NWSS)

Split Layout πŸ“Š

  • Left panel: Scrollable horizontal bar chart
  • Right panel: Scrollable jurisdiction table
  • Both panels independent scrolling

Detection Rate Chart πŸ“ˆ

  • Horizontal bar chart with green accent
  • All jurisdictions displayed (height adapts to data)
  • Percentage labels with color coding:
    • πŸ”΄ >50% detection
    • 🟑 25–50% detection
    • 🟒 <25% detection

Jurisdiction Table πŸ“‹

  • Rank (#) column
  • Jurisdiction name (bold, white)
  • Sites count
  • Detection % with color coding
  • Hover highlighting on rows

Export Options πŸ“¦

  • CSV download of transformed data
  • JSON download of raw CDC data

alt text


πŸ“‚ Module 06: Datasets Hub

Built-in Datasets πŸ“Š

Dataset Source Tag Color
COVID by Country disease.sh Β· LIVE πŸ”΅#00d4ff
FDA Adverse Events OpenFDA · LIVE 🟣#a78bfa
CDC Wastewater CDC NWSS · LIVE 🟒#00e5a0

Import Capabilities ⬆️

  • Drag & drop CSV/JSON files
  • Multiple file selection
  • Error handling with toast notifications
  • Automatic parsing of CSV headers
  • Imported datasets appear as new tabs

Export Options ⬇️

  • CSV download with proper escaping
  • JSON download with pretty formatting
  • Remove imported datasets

Data Table Features πŸ“‹

  • Column headers sticky at top
  • Alternating row colors for readability
  • Hover highlighting
  • Column count and row count display
  • Tag showing data source

alt text


πŸ“ Module 07: Logs & Monitoring

Live Log Stream πŸ“‘

  • Real-time updates as API calls occur
  • 500 most recent logs retained
  • Auto-scroll toggle option

Log Filters πŸ”

  • Level filter: ALL, FETCH, INFO, WARN, ERROR, DEBUG
  • Search filter: by message or service name
  • Result count showing filtered/total

Log Format πŸ“‹

Column Width Color
Timestamp 72px Muted gray
Level 50px Color-coded
Service 130px Cyan
Message 1fr Level-specific

Log Level Colors 🎨

Level Color Hex
FETCH πŸ”΅ Cyan #00d4ff
INFO 🟒 Green #00e5a0
WARN 🟑 Amber #f5a623
ERROR πŸ”΄ Red #ff4d6a
DEBUG 🟣 Purple #a78bfa

Export Options πŸ“¦

  • CSV export with all log fields
  • TXT export as plain text
  • JSON export with full structure
  • Clear logs button

alt text


🎨 Design & Aesthetics

Modern Health Analytics Platform πŸ₯

  • Dark background (#07090f) β€” easy on the eyes for extended monitoring
  • Cyan accent (#00d4ff) for primary actions and data
  • Green (#00e5a0) for success and wastewater data
  • Amber (#f5a623) for deaths and warnings
  • Red (#ff4d6a) for cases and errors
  • Purple (#a78bfa) for FDA data
  • IBM Plex fonts for clean, professional typography

Typography ✍️

  • IBM Plex Mono β€” Code blocks, metrics, table data, logs
  • IBM Plex Sans β€” Body text, labels, headers

Visual Elements πŸ–ΌοΈ

  • Gradient KPI cards with top accent bars
  • Area charts with gradient fills
  • Animated heatmap with pulsing cells
  • Status dots with animations
  • Progress bars for pipeline status
  • Toast notifications for user feedback

Color Coding 🎨

Element Color Hex Usage
Cases Red #ff4d6a COVID case counts
Deaths Amber #f5a623 COVID death counts
Recovered Green #00e5a0 Recovery counts
Active Cyan #00d4ff Active cases
FDA Purple #a78bfa Adverse events
Wastewater Green #00e5a0 Detection rates
Healthy Green #00e5a0 Pipeline success
Error Red #ff4d6a Pipeline errors
Running Cyan #00d4ff Active fetches

πŸ› οΈ Technical Implementation

Tech Stack πŸ₯ž

  • React 18 β€” UI components and state management
  • Recharts β€” Data visualization library
  • Custom Hooks β€” useState, useEffect, useRef, useCallback, useMemo
  • CSS-in-JS β€” Styled with inline styles and theme object

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        PULSE Platform                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Data Sources Layer        β”‚   β”‚
β”‚  β”‚   β€’ disease.sh (4 endpoints) β”‚   β”‚
β”‚  β”‚   β€’ OpenFDA (1 endpoint)    β”‚   β”‚
β”‚  β”‚   β€’ data.cdc.gov (1)        β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Transformation Layer      β”‚   β”‚
β”‚  β”‚   β€’ transformFDA()          β”‚   β”‚
β”‚  β”‚   β€’ transformWastewater()   β”‚   β”‚
β”‚  β”‚   β€’ sliceHistorical()       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   State Management          β”‚   β”‚
β”‚  β”‚   β€’ data state (6 sources)  β”‚   β”‚
β”‚  β”‚   β€’ loading state (6 flags) β”‚   β”‚
β”‚  β”‚   β€’ pipeline status         β”‚   β”‚
β”‚  β”‚   β€’ logs (500 entries)      β”‚   β”‚
β”‚  β”‚   β€’ imported datasets       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   UI Components             β”‚   β”‚
β”‚  β”‚   β€’ 7 tab views            β”‚   β”‚
β”‚  β”‚   β€’ Recharts visualizationsβ”‚   β”‚
β”‚  β”‚   β€’ Export utilities       β”‚   β”‚
β”‚  β”‚   β€’ Drag & drop import     β”‚   β”‚
β”‚  β”‚   β€’ Log viewer with filtersβ”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Functions

// Data Fetching
fetchOne(key)                    // Fetch single API source
fetchAll()                        // Fetch all sources with Promise.all

// Transformations
transformFDA(raw)                 // Convert FDA API to chart format
transformWastewater(raw)           // Aggregate CDC data by state
sliceHistorical(hist, days)        // Slice time series by range

// Export Utilities
toCSV(rows)                        // Convert array to CSV string
exportCSV(rows, name)               // Trigger CSV download
exportJSON(rows, name)              // Trigger JSON download
exportLogs(logs, fmt)               // Export logs as CSV/TXT/JSON

// Import
parseCSVText(text)                  // Parse CSV to array of objects
handleFiles(files)                  // Handle drag & drop file upload

// UI Components
Dot({ s, size })                    // Status dot with animation
Tag({ c, children })                 // Color-coded tag
MiniBar({ v, max, c })               // Progress bar
Btn({ children, c, onClick })        // Themed button
Select({ value, onChange, options }) // Themed select
Spin()                               // Loading spinner
Spinner()                            // Full loading spinner

πŸ“Š Data Transformations

FDA Adverse Events πŸ’Š

const transformFDA = raw => (raw.results ?? []).map(r => ({
  date:     `${String(r.time).slice(4,6)}/${String(r.time).slice(6,8)}`,
  fullDate: String(r.time ?? ""),
  events:   r.count ?? 0,
}));

CDC Wastewater πŸ’§

const transformWastewater = raw => {
  const byState = {};
  (raw ?? []).forEach(r => {
    const state = r.wwtp_jurisdiction ?? r.state_name ?? "Unknown";
    if (!byState[state]) byState[state] = { state, sites:0, detections:0, total:0 };
    byState[state].sites++;
    const p = parseFloat(r.detect_prop_15d ?? 0);
    byState[state].detections += isNaN(p) ? 0 : p;
    byState[state].total++;
  });
  return Object.values(byState)
    .map(s => ({ ...s, detectPct: s.total > 0 ? +(s.detections / s.total * 100).toFixed(1) : 0 }))
    .sort((a, b) => b.detectPct - a.detectPct);
};

COVID Historical Range πŸ“ˆ

const sliceHistorical = (hist, days) => {
  if (!hist?.cases) return [];
  const allEntries = Object.entries(hist.cases);
  const subset = days ? allEntries.slice(-days) : allEntries;
  const step = Math.max(1, Math.floor(subset.length / 60));
  return subset.filter((_, i) => i % step === 0).map(([date, cases]) => ({
    date,
    cases,
    deaths: hist.deaths?.[date] ?? 0,
  }));
};

πŸŽ₯ Video Demo Script (60-75 seconds)

Time Module Scene Action
0:00 Header Logo Show "PULSE" with cyan accent and status
0:05 Dashboard KPIs Global: 700M cases, 6.9M deaths, 670M recovered
0:10 Dashboard COVID Trend 90-day area chart with cases/deaths
0:15 Dashboard Continent Chart Horizontal bars: Europe 250M, Asia 150M
0:20 Dashboard Heatmap Live-updating influenza grid (10Γ—5)
0:25 Pipelines Status Cards 5/6 healthy, 1 fetching β€” expand card
0:30 Pipelines Python Code Show FDA ETL with syntax highlighting
0:35 COVID-19 Country Table Sort by cases β†’ USA 103M, India 45M
0:40 COVID-19 Export Click CSV β†’ download triggers
0:45 FDA Events Chart 24-month line chart with tooltip
0:50 Wastewater Split View Scrollable bar chart + jurisdiction table
0:55 Datasets Import Drag & drop CSV β†’ new tab appears
1:00 Logs Live Stream FETCH β†’ INFO β†’ ERROR logs in real-time
1:05 Refresh Countdown Auto-refresh in 45 seconds

🚦 Performance

  • Load Time: < 3 seconds (initial API calls)
  • Memory Usage: < 80 MB
  • API Calls: 5 simultaneous on load
  • Auto-refresh: 60-second countdown

Dependencies πŸ“¦

  • React 18
  • Recharts 2.x
  • No CSS frameworks β€” Pure inline styles

πŸ›‘οΈ Security Notes

PULSE is a client-side only application:

  • βœ… No backend server
  • βœ… All API calls made directly from browser
  • βœ… No data storage or tracking
  • βœ… No authentication required (public APIs)
  • βœ… CORS handled by public endpoints

πŸ“ License

MIT License β€” see LICENSE file for details.


πŸ™ Acknowledgments

  • disease.sh β€” Open COVID-19 API
  • OpenFDA β€” Adverse event data
  • CDC NWSS β€” Wastewater surveillance data
  • Recharts β€” React charting library
  • IBM β€” Plex font family

πŸ“§ Contact


🏁 Future Enhancements

  • Add time-series forecasting with ARIMA
  • Include geographic maps (choropleth)
  • Add user authentication for saved views
  • Implement WebSocket for real-time updates
  • Add mobile-responsive layout
  • Include historical data comparison
  • Add anomaly detection algorithms
  • Export reports as PDF
  • Add data quality metrics
  • Include public health alerts

πŸ₯ PULSE β€” Public Health Analytics Platform β€” Monitor Population Health in Real-Time πŸ₯

Last updated: March 2025

About

PULSE is a comprehensive public health analytics platform that aggregates, visualizes, and analyzes data from multiple authoritative health data sources β€” including disease.sh (COVID-19 global statistics), OpenFDA (adverse drug events), and CDC NWSS (wastewater surveillance). Built with React and Recharts, PULSE provides real-time dashboards🦠πŸ₯🩺.

Topics

Resources

License

Stars

Watchers

Forks

Contributors