Skip to content

denniemok/seirs-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ  Interactive SEIRS Model

This interactive simulator demonstrates how infectious diseases spread through populations using a deterministic, mean-field SEIRS compartmental model. It features real-time parameter adjustments and elegant visualizations to help understand epidemic dynamics, including vaccination, immunity waning, and disease-induced mortality.



โœจ Features

๐ŸŽฎ Interactive Controls

  • Real-time parameter adjustments
  • Intuitive slider controls
  • Instant visualization updates
  • Reset to defaults anytime

๐Ÿ“Š Flexible Visualization

  • Linear & logarithmic Y-axis
  • Adjustable time horizons (3000 days)
  • Color-coded compartments (S, E, I, R)
  • Responsive plot design

๐Ÿ”ฌ Epidemiological Parameters

  • Basic reproduction number (Rโ‚€)
  • Incubation & infectious periods
  • Immunity duration
  • Vaccination rates
  • Disease-induced mortality

๐ŸŽ“ Educational Content

  • Built-in mathematical equations
  • Parameter explanations
  • Helpful tooltips
  • Clean, modern interface
  • Zero dependencies required


๐Ÿš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, or Edge)
  • No installation or build process required!

Quick Start

  1. Get the code

    git clone https://github.com/denniemok/seirs-demo.git

    Or download ZIP directly.

  2. Open in browser

    Double-click index.html to open directly in your browser, or use a local web server for full functionality:

    cd seirs-demo
    
    # Python 3
    python -m http.server 8000
    
    # Node.js
    npx http-server

    Then open http://localhost:8000 in your browser.


๐Ÿ“ Technical Details

Framework

The model divides the population into four compartments:

Compartment Description
S (Susceptible) ๐ŸŸฆ Individuals who can contract the disease
E (Exposed) ๐ŸŸฉ Individuals who are infected but not yet infectious
I (Infectious) ๐ŸŸง Individuals who can transmit the disease
R (Recovered) ๐ŸŸจ Individuals who have immunity (temporary or permanent)

Mathematics

The dynamics are governed by these differential equations:

dS/dt = -ฮฒSI + ฯ‰R - ฮผS + ฮผ(1-p)
dE/dt = ฮฒSI - ฯƒE - ฮผE
dI/dt = ฯƒE - ฮณI - (ฮผ+ฮฑ)I
dR/dt = ฮณI - ฯ‰R - ฮผR + ฮผp
Symbol Description
ฮฒ Transmission rate
ฯƒ Progression rate (1 / incubation period)
ฮณ Recovery rate (1 / infectious period)
ฯ‰ Immunity waning rate (1 / immunity duration)
ฮผ Natural mortality rate (1 / life expectancy)
ฮฑ Disease-induced mortality rate (1 / infection-to-death period)
p Vaccination rate

Implementation

Feature Technology
Numerical solver 4th-order Runge-Kutta (RK4)
Data structures Float64Array for performance
Visualization D3.js v3.5.17 (SVG)
Documentation JSDoc + inline comments

๐Ÿ“ Project Structure

seirs-demo/
โ”œโ”€โ”€ ๐Ÿ“„ index.html          # Main HTML page with structure and equations
โ”œโ”€โ”€ ๐Ÿ“œ seirs.js            # Core SEIRS model implementation and plotting logic
โ”œโ”€โ”€ โš™๏ธ  params.js           # Parameter definitions and UI control values
โ”œโ”€โ”€ ๐ŸŽจ seirs.css           # Styling and responsive design
โ””โ”€โ”€ ๐Ÿ“Š d3.min.js           # D3.js library for visualization

๐ŸŽจ Customisation

Modify Parameters

Edit params.js to change parameter ranges and defaults:

// Example: Extend Rโ‚€ range from 1-5 to 1-10
R0: generateParams(1, 10, 0.1, 3.0)

Change Styling

Modify seirs.css to customize the appearance. CSS variables make theming easy:

:root {
    --color-susceptible: #2c3e50;  /* Dark blue */
    --color-exposed: #27ae60;      /* Green */
    --color-infectious: #e67e22;   /* Orange */
    --color-recovered: #3498db;    /* Light blue */
}

๐Ÿ™ Acknowledgments

This project is built upon and inspired by:



This model is intended for educational purposes to understand epidemiological dynamics. For public health decisions, please consult epidemiological experts and use validated, peer-reviewed models.

This project, including D3.js v3.5.17, is distributed under the BSD 3-Clause License.




Made with โค๏ธ for epidemiology education

โฌ† Back to Top

About

An interactive web-based visualization of the SEIRS epidemiological model for understanding disease spread dynamics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published