● DOCS · v0.3 LAST UPDATED · 2026-05

Docs, parameters,
references.

Everything you need to reason about what EpiChat will and won't do — architecture, parameters, disease defaults, and the seven-phase data roadmap.

Architecture

EpiChat is a six-layer pipeline. The LLM handles language; templates handle the simulation. Free-form code is never executed.

User NL query (any language · text · URL · report · web search)
     │
     ▼
Layer 0  Input Enricher           (Claude Haiku + web_search — extracts OutbreakContext)
     │   Structured facts: disease, location, cases, R₀, interventions
     ▼
Layer 1  LLM Parameter Parser     (Claude API + extraction prompt)
     │   SimParams JSON · resolver pulls UN WPP, WHO GHO, World Bank
     │   β recalibrated for age-structured networks after demographics applied
     ▼
Layer 1b Fact-Checker             (disease_parameters.json — no LLM call)
     │   ⚠ warns if R₀, dur_inf, or dur_exp outside literature ranges
     ▼
Layer 2  Code generator           (Jinja2 → Starsim Python)
     │   Python script
     ▼
Layer 3  Execution engine         (subprocess sandbox, 90s timeout)
     │   Stats JSON + plot file
     ▼
Layer 4  Results narrator         (Claude API + narration prompt, in user's language)
     │   Plain-language summary
     ▼
User: epidemic curve + interpretation

Disease models

Six compartmental models, each specified directly or inferred from a disease name.

ModelCompartmentsUse caseRequired extras
SIRS → I → RStandard acute (flu, COVID acute)
SEIRS → E → I → RLatent period (measles, SARS)dur_exp
SISS → I → SNo lasting immunity (gonorrhea)
SIRSS → I → R → SWaning immunity (COVID endemic)dur_immune
SEIRSS → E → I → R → SLatent + waning (COVID full)dur_exp, dur_immune
SEIARS → E → I|A → RAsymptomatic transmission (flu, COVID)dur_exp, p_asymp, rel_trans_asymp

Built-in disease defaults

Name a disease without full parameters and EpiChat fills these in.

DiseaseModeldur_infdur_expn_contactsp_deathNotes
Generic SIRSIR10 d40.0R₀ = 2.5
COVID (acute)SIR8 d60.01
COVID (endemic)SIRS8 d60.005immune = 180 d
COVID (full)SEIRS8 d5 d60.005immune = 180 d
InfluenzaSIR5 d60.001
MeaslesSEIR8 d12 d100.001R₀ ≈ 15
SARS-likeSEIR10 d5 d50.05
EbolaSIR10 d30.5
GonorrheaSIS90 d20.0R₀ ≈ 2

Parameters

Every parameter is validated by a Pydantic schema before the template layer sees it.

ParameterTypeDefaultDescription
disease_typestringsirsir · seir · sis · sirs · seirs · seiar
n_agentsint10,000Population size · 10 → 1,000,000
betafloatcomputedβ = R₀ × 365 / (n_contacts × dur_inf) for random networks. For age-structured networks β is back-solved from the POLYMOD spectral radius so approx_R₀() matches the intended value.
init_prevfloat0.01Seed fraction infected
dur_inffloat10.0Infectious period (days)
dur_expfloat?nullLatent period · required for SEIR/SEIRS/SEIAR
dur_immunefloat?nullImmunity days before waning · SIRS/SEIRS
p_deathfloat0.0Infection fatality rate
p_asympfloat0.3Asymptomatic fraction · SEIAR only
sim_dur_yearsfloat1.0Simulation horizon
network_typestringrandomrandom · age_structured
n_contactsint4Avg daily contacts
network_betafloat1.0Transmission multiplier per contact

Interventions

Up to three intervention types can combine in a single simulation.

Vaccine

Removes a fraction of agents from the susceptible pool. start_day=0 = pre-existing immunity; >0 = ongoing campaign starting that day.

Treatment

Reduces infectious duration or mortality for a fraction of infected agents. Optional daily capacity cap.

Seasonality

Modulates transmission rate sinusoidally over the year — scale is variation strength, shift is phase (0.0 = winter peak, 0.5 = summer peak).

NL query tips

EpiChat's parser understands a wide range of phrasing. A few useful patterns:

You sayEpiChat does
"R0 = 2.5"Converts to β via R₀ × 365 / (n_contacts × dur_inf)
"COVID", "flu", "measles"Applies built-in disease defaults
"80% vaccinated"Vaccine intervention, start_day=0
"campaign starting month 3"Vaccine intervention, start_day=90
"winter peak" / "seasonal"Seasonality · scale=0.3, shift=0.0
"endemic" / "long-run"Enables demographics
"age-structured" / "school-age"network_type=age_structured
"masks" / "50% mask uptake"network_beta ≈ 0.75
"seed 42" / "reproducible"rand_seed=42
Query in French, Spanish, Arabic, Chinese…Language auto-detected; narration and summaries respond in kind
Paste a WHO situation report or bulletinEnricher extracts structured facts (cases, CFR, R₀, interventions) before simulation
"https://..." URL to an articlePage fetched client-side; facts extracted from full text
"Search for recent Mpox news in West Africa"Built-in web search retrieves context before parameter extraction

Disease parameter database

EpiChat ships a literature-backed JSON database (epichat/data/disease_parameters.json) covering 8 diseases. When a named disease is detected, the fact-checker compares R₀, infectious period, and incubation period against published ranges and shows a ⚠ warning if any value is out of range. The database is student-extensible: adding a disease requires only editing the JSON file — no Python changes needed.

DiseaseR₀ rangeIncubation (days)Infectious (days)Source
Measles12–186–214–12PubMed 28757186 · PMC5930806
Mumps10–1214–257–25PMC557899 · PMC5930806
Rubella2–513–247–21PMC8893344 · PMC5930806
Varicella8–1010–214–10PMC8954496 · PMC5930806
Pertussis12–173–714–28PMC11679829 · PMC5930806
Influenza (seasonal)1.2–1.41–41–10PMC4169819 · PMC5930806
Meningococcal1.0–1.91–101–7ScienceDirect S1567134820301X · PMC5930806
Hepatitis A2.1–2.820–12514–28PMC6152969 · PMC5930806

The database is being expanded to cover COVID-19, Ebola, dengue, RSV, cholera, TB, polio, and Mpox (Phase 9 in the roadmap). Additional parameters per disease — IFR (p_death), contact rate (n_contacts), immunity duration (dur_immune) — will be added as literature data is collected.

Roadmap

Seven phases remaining, in priority order. Phases 4 (country demographics) and 7 (multilingual support) are complete as of v0.3. Complexity is implementation effort; impact is how much it moves the scientific needle.

#PhaseData / NotesComplexityImpact
1Disease parameter DB extensionMore diseases (COVID, Ebola, dengue…) + more params per disease (p_death, n_contacts…)Low (data) / Low–Med (Python)High
2Country contact matricesPrem et al. 2021 (177 countries) · SOCRATES · CoMixMediumHigh
3Age-specific severityO'Driscoll 2021 · CDC COVID-NET · FluViewMediumHigh
4HouseholdNetDHS · IPUMS · UN household data · ACSHighMedium
5Calibration vs surveillanceOWID · CDC Tracker · WHO FluNet · TychoHighVery High
6STI networksDHS sexual module · NATSAL · CDC NHBSVery HighMedium
7Geospatial metapopulationWorldPop · OAG · OSMVery HighHigh

Risks · mitigations

RiskMitigation
Invalid Starsim codeTemplate-based generation — no free-form LLM code
Parameter hallucinationPydantic validation; literature-range fact-checking via disease_parameters.json; ⚠ warning shown in chat and CLI when values are outside known ranges
Wrong R₀ on age-structured networkβ back-solved from POLYMOD spectral radius after demographics applied; recalibrated on every R₀ / dur_inf modification mid-conversation
Execution failure3-attempt recovery loop with LLM re-parameterization
Timeout90-second subprocess limit
API instabilityStarsim version pinned in requirements.txt