Skip to main content

areaFluForecast

DOI PyPI tests

areaFluForecast is an open-source Python package that gives public health departments 1–4 week influenza forecasts for their neighborhoods, ZIP codes or districts. You bring weekly flu rates and area boundaries. It trains three models, checks each against persistence ("next week looks like this week") on your own past seasons, and gives forecasts with calibrated uncertainty bands and a trust label for each model.

In Boston, the graph model's error was 18–28% below persistence on seasons it never saw. In Columbus it was 12–23% below on average, but not clearly. The backtest tells you which kind of city yours is.


Documentation

Documentation: areafluforecast.readthedocs.io

PyPI: areaFluForecast

Data sources and credits: Data and credits


Install

pip install areaFluForecast             # everything except plots
pip install "areaFluForecast[plot]"     # + forecast plots
pip install "areaFluForecast[geo]"      # + messy boundary files (shapely)

Requires Python 3.10 or later. Runs on a laptop CPU; no GPU needed.


A tour

import areafluforecast as af

# Your data: weekly rates per area, plus a boundary file
city = af.City.from_files("rates.csv", areas="areas.geojson", id_col="NAME")
city.fetch_weather()                 # optional; Open-Meteo, no API key
print(city.summary())

# Would the models have worked here? Score past seasons against persistence
bt = af.backtest(city)
bt.report()

# Forecast the next 1-4 weeks, with a trust label from that backtest
fc = af.forecast(city)
fc.to_csv("forecast.csv")            # median, 95% band, 23 FluSight quantiles
fc.plot("gnn_st")

# Short history? Start from the bundled Boston models
weights = af.pretrained("boston")
fc = af.forecast(city, init_from=weights, zero_shot=True)

Or from the shell:

areaflu check    --rates rates.csv --areas areas.geojson --id-col NAME
areaflu backtest --rates rates.csv --areas areas.geojson --id-col NAME --weather
areaflu forecast --rates rates.csv --areas areas.geojson --id-col NAME --weather
areaflu backtest --sample boston --seasons 1 --quick      # try it on bundled data

What's in it

Model What it is
gnn_st Graph neural network over bordering areas and correlated curves; the model from the accompanying paper
lstm Multivariate LSTM: every area's series, no map
colagnn Cola-GNN (Deng et al. 2020), reimplemented from the paper
arima Seasonal ARIMA per area (annual cycle as harmonic regressors), the paper's statistical baseline
persistence, seasonal_naive Baselines every model is compared with
af.pretrained("boston") Transferable graph models trained on Boston, one per horizon
Bundled data Coverage
Boston sample 14 neighborhoods, weekly, 2017–2026, with weather
Chicago sample 58 ZIP codes, weekly activity level (1–10), 2019–2026, with weather

Modules

City and data

City.from_files, City.from_frames, load_sample, load_city, save_city, rates_from_counts, read_rates_csv

Backtest and forecast

backtest, BacktestResult, latest_backtest, combine, forecast, ForecastResult

Every forecast carries a trust label per model and horizon, such as "better than persistence" or "not backtested". Anything short of "better" raises a TrustWarning.

Models and settings

GNNConfig, LSTMConfig, ColaGNNConfig, BaselineConfig, PRESETS, resolve, Checkpoint, pretrained

Scores, timing, maps, weather

af.scoring (WIS, interval score, PIT, Diebold-Mariano), af.timing (weeks behind the curve, peak offsets), af.adjacency (borders from GeoJSON), af.weather (Open-Meteo)


Limits

  • Forecasts run late. Like persistence, every model runs about h weeks behind the curve at h weeks ahead. The models win on the size of the epidemic, not on its timing. The backtest report measures this on your data.
  • Reporting delays aren't simulated. If your data arrives L weeks late, treat an h-week forecast as an (h + L)-week one.
  • The backtest sees final data. Revised counts make past accuracy look better than real time will be.

More in Limits to know.


Examples

Five notebooks, saved with their outputs, are in examples/: a Boston quickstart, bringing your own files, a city with two years of data, reading the results, and a real city (Chicago) from public open data.

Reproducing the paper

scripts/parity/ reruns the paper's Boston backtest with this package. tests/test_research_parity.py checks that the package matches the research code bit for bit. See Reproducing the paper.


Citing

Cite the version you used: 10.5281/zenodo.23327109 always resolves to the latest version. Details are in CITATION.cff, or use GitHub's Cite this repository button.

References

The package implements methods from published work. The core ones:

The full list, with what each paper is used for, is in References.

Found a bug or want a feature? Open an issue.

Credits

Supported by the Boston Public Health Commission, Columbus Public Health, the PEAK Trailblazer fellowship, Prof. Ariel Hamlin, Prof. Deahan Yu, and Prof. Rajagopal Venkatesaramani (Northeastern University). Weather data by Open-Meteo.com (CC BY 4.0). Your data stays with you: the only network call is the optional weather fetch.

Contact

Mateo Biggs (biggs.m@northeastern.edu) or Atharva Nilapwar (nilapwar.a@northeastern.edu).

Metadata

Release files for areaFluForecast 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for areaFluForecast 1.2.0
File Size Uploaded
areafluforecast-1.2.0.tar.gz 2.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for areaFluForecast 1.2.0
File Interpreter ABI Platform
areafluforecast-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.8 MB

Release files / areafluforecast-1.2.0.tar.gz

Download URL areafluforecast-1.2.0.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
eed79401fe4b12fccf0cc0dd407a956884f28cd9ec40659a62c5cda18f39a45d
BLAKE2b-256 checksum
How to use checksums
d3163af488e34fa1498e6f3ff0099ddaa2e7a0cf3bc74fbac6321d9557202a74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / areafluforecast-1.2.0-py3-none-any.whl

Download URL areafluforecast-1.2.0-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2815d2915c751283c9ce01c71028d278436e2f9aaf79c70d95b4d9f2f12643a0
BLAKE2b-256 checksum
How to use checksums
71777e97f33a9ebfc14734ad769b37a1be8002d1ccb8cb837faa5ca07402ccef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page