Skip to main content

NEISS-AI

Tests PyPI DOI Open In Colab

AI-assisted national injury estimates from US emergency department narratives.

NEISS-AI turns the US Consumer Product Safety Commission's NEISS data into consistent national estimates for e-bikes, e-scooters, bicycles and other micromobility devices, with survey-correct 95% confidence intervals.

Live web app: https://subash28kumar.github.io/neiss-ai/

The web app has four parts, all free and running in the browser:

  • Overview: headline numbers and trends for e-bikes, e-scooters and kick scooters.
  • Ask a question: type a question in plain English (for example, "How many teenagers broke a bone on an e-scooter in 2025?") and get a national estimate with a 95% confidence interval, a trend chart and an "Understood as" line showing how the question was read.
  • Explore the data: filter by device, years, age, sex, injury, body part, outcome and circumstance; download the results as CSV; share a link to any view.
  • Search injury stories: search the hospital narratives (for example battery, hit by car) to see national estimates by year and real example stories.

The site refreshes itself: a GitHub Actions workflow (.github/workflows/refresh.yml) checks monthly for a new year of NEISS data, reruns the tool and republishes the site. It never publishes fewer years than the site already shows.

Why it exists

In January 2024, CPSC gave e-bikes their own product code (5045). Before then, e-bikes shared code 3215 ("mopeds or power-assisted cycles") with gas mopeds. Counts based on codes alone therefore jump at 2024 and cannot show a true trend.

NEISS-AI reads the short injury story in each record:

  1. Rules. Product codes and whole-word keywords label each injury (e-bike, e-scooter, bicycle, kick scooter, hoverboard, skateboard or moped). Whole-word matching matters: "the bike" is not an "e bike".
  2. Text classifier. For code-3215 records whose story is unclear, a classifier trained on 2024-2025 records (where 5045 and 5046 are separate) decides e-bike vs moped. It is TF-IDF + logistic regression, stored as plain JSON and run with numpy only. Five-fold cross-validated AUC: 0.995.
  3. National estimates. NEISS is a stratified sample of hospitals. Estimates use the survey weights and Taylor-linearized standard errors (hospitals as clusters within strata), and are flagged "unstable" by CPSC's rule (fewer than 20 records, an estimate below 1,200, or a coefficient of variation above 33%).

Validation: e-bike estimates for 2022-2024 are within 5% of CPSC's published figures (28,000 vs 26,800; 37,900 vs 37,600; 59,300 vs 59,200).

Install

pip install neissai

NEISS-AI is on PyPI: https://pypi.org/project/neissai/. Requires Python 3.9+, pandas and numpy. (scikit-learn is needed only to retrain the classifier: pip install "neissai[train]". For the latest development version: pip install git+https://github.com/subash28kumar/neiss-ai.)

Try it in Google Colab (no install)

Open the quickstart notebook and click Runtime → Run all. In a few minutes it downloads the public NEISS files, labels each injury, and reproduces the national estimates by year and device (with 95% confidence intervals), a trend chart and hospital-stay shares. The notebook is also in this repository at notebooks/NEISS-AI_Quickstart.ipynb.

Use from the command line

Download the annual NEISS files (for example neiss2019.tsv ... neiss2025.tsv) from the CPSC NEISS page into a folder called data, or try neissai download --years 2019-2025 --data-dir data. Then:

neissai micromobility --years 2019-2025 --data-dir data --out-dir results

This prints a table of national estimates and saves:

File Contents
estimates_by_year_device.csv national ED visits by year and device, 95% CI, CV, records, unstable flag
estimates_by_year_device_age.csv the same by age group (0-17, 18-64, 65+)
shares_by_device.csv weighted shares hospitalized, head/face injury, motor vehicle involved, no helmet stated, alcohol
micromobility_records.csv every labelled record, with device, label source and classifier probability

Check a single story:

neissai classify "14YOM FELL OFF HIS ELECTRIC BIKE GOING 20MPH"

Use from Python

import neissai

df = neissai.read_neiss("data", years="2019-2025")
df = neissai.add_outcomes(neissai.label_devices(df))
mm = df["device"].isin(neissai.DEVICES)

# Pass the full table plus a filter, so the variance uses the whole sample design
by_year = neissai.national_estimates(df, by=["year", "device"], where=mm)
kids = neissai.national_estimates(df, by=["year"], where=(df["device"] == "E-bike") & (df["age_group"] == "0-17"))
hosp = neissai.shares(df, "hospitalized", by=["device", "age_group"], where=mm)

# Regular e-bike, likely e-moto (e.g. Sur-Ron, Talaria, rider speed over 28 mph) or unclear
df = neissai.add_ebike_type(df)
etype = neissai.national_estimates(df, by=["year", "ebike_type"], where=df["device"] == "E-bike")

The e-bike vs e-moto rule and its check are described in validation/EBIKE_TYPE.md.

Rebuild the website data

python scripts/update_site.py --data-dir data --years 2019-2025

Retrain the classifier

python scripts/train_classifier.py --data-dir data --years 2024-2025

Limits

NEISS counts emergency department visits, not riders or miles, so results are counts, not risk rates. Injuries treated elsewhere and deaths at the scene are not included. Helmet use is only what the story mentions. Early e-bike estimates (2019-2021) rest on small samples. The powered-scooter code may include some seated, moped-style scooters.

Cite

If you use NEISS-AI, please cite the software (see CITATION.cff or "Cite this repository" on GitHub):

Kumar S. NEISS-AI: AI-assisted national injury estimates from NEISS emergency department narratives. Version 1.4.0 [software]. Zenodo; 2026. https://doi.org/10.5281/zenodo.23550272

To cite all versions, use https://doi.org/10.5281/zenodo.23306744 (always resolves to the latest version).

and the method paper:

Kumar S. E-bike injuries among US children surged in 2025: national estimates from emergency department reports, 2019-2025, using machine learning to read injury narratives [preprint]. Zenodo; 2026. https://doi.org/10.5281/zenodo.23354066

and the labeled dataset:

Kumar S. NEISS-AI device labels for US micromobility injuries, 2019–2025 [dataset]. Version 1.1. Zenodo; 2026. https://doi.org/10.5281/zenodo.23550382

Data come from the US Consumer Product Safety Commission. CPSC does not endorse this tool.

Licence

MIT. Built by Subash Kumar (ORCID 0009-0003-6661-3424).

Metadata

Release files for neissai 1.5.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 neissai 1.5.0
File Size Uploaded Provenance Actions
neissai-1.5.0.tar.gz 105.4 kB With provenance Details for neissai-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for neissai 1.5.0
File Interpreter ABI Platform Actions
neissai-1.5.0-py3-none-any.whl Python 3 none any Details for neissai-1.5.0-py3-none-any.whl

Total release size: 208.2 kB

Release files / neissai-1.5.0.tar.gz

Download URL neissai-1.5.0.tar.gz
Size 105.4 kB
Tags Source
SHA-256 checksum
How to use checksums
66b1b0784397a252084cfb397dfde1949814521e36c7ac827b03a15089bb5ec1
BLAKE2b-256 checksum
How to use checksums
e6c1fda5387d69d4f9857ac3fd86eafe82ec2225de44d1bfc5fad656434f74e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Release files / neissai-1.5.0-py3-none-any.whl

Download URL neissai-1.5.0-py3-none-any.whl
Size 102.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af75d09ef69ca680ffaa5c779ab9993f9b2ee041e9ba265248fd830645a25ed9
BLAKE2b-256 checksum
How to use checksums
9ee9592210e47e6eb7582b9cad407065e14a212e2c92dc3d7b12433b3d002aeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 29, 2026.

Transparency log

Security for neissai 1.5.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for neissai-1.5.0.tar.gz

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 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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