Skip to content

About

Luizza's Research project on Analyzing Online Discourse on Reddit about the H5N1, considering sentiment and external signals to predict online engagement on the H5N1 outbreak.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reddit H5N1 Infoveillance Project

DOI License

Code for a research project analyzing online discussion of avian flu (H5N1). It collects Reddit comments and Google News articles about bird flu, runs an NLP analysis of that discussion (sentiment, toxicity, topic modeling, n-grams), and models weekly Reddit comment volume over time against external signals such as news activity, egg prices, and animal-case data.

Associated publication

This repository contains the code accompanying:

Dalla Pria, L., Nelson, A. L., Koebel, K. J., & Ivanek, R. (2026). Mammalian spillover events predict the volume and emotion of online discourse during the US H5N1 outbreak. Manuscript submitted to Nature Communications.

Zenodo DOI 10.5281/zenodo.23070435

Repository structure

Reddit-NLP-ARIMAX-Project/
├── README.md
├── LICENSE
├── .gitignore
├── requirements.txt           # All dependencies (collection + analysis)
├── src/                       # Data collection scripts
│   ├── reddit_collection.py
│   ├── google_news_collection.py
│   └── .env.example
├── notebooks/                 # Analysis and modeling
│   ├── Luizza_Reddit_NLP_Data_Analysis_2026.ipynb
│   └── Luizza_ARIMAX_Modeling_2026.ipynb
└──

Setup

pip install -r requirements.txt
python -m nltk.downloader stopwords punkt punkt_tab wordnet vader_lexicon

1. Collect the data (src/)

Pulls the raw data from the Reddit and Google News (SerpApi) APIs. You need your own API keys:

Copy src/.env.example to src/.env and fill in your keys, then run:

python src/reddit_collection.py        # -> df_birdflu.csv, df_h5n1.csv, df_birdflupreps.csv
python src/google_news_collection.py   # -> serpapi_birdflu_news.csv

Collection can take a while and may pause for API rate limits — this is normal.

2. Run the analysis (notebooks/)

Open the notebooks in VS Code or Jupyter:

  • Luizza_Reddit_NLP_Data_Analysis_2026.ipynb — data cleaning, EDA, n-grams, sentiment, toxicity, and topic modeling.
  • Luizza_ARIMAX_Modeling_2026.ipynb — ARIMA / ARIMAX time-series modeling of weekly comment volume.

Data files

The notebooks read CSVs produced by the collection scripts plus a few external sources (egg prices, poultry / cattle / mammal / wild-bird cases). Place these files where the notebooks expect them (paths are set near the top of each notebook). Because Reddit and Google News API results change over time (deleted posts, updated indexing), re-running the collection scripts will produce a dataset that differs from the one analyzed in the paper. Exact numerical reproduction of the published findings is therefore not possible from raw collection alone; the code and methodology are provided so that the analysis can be re-executed on newly collected data or on comparable datasets.

Notes

  • API keys are loaded from a local .env file and are never committed.
  • .gitignore excludes .env, data files (*.csv), and Python caches.

Citation

If you use this code, please cite:

Dalla Pria, L. et al. (2026). Mammalian spillover events predict the volume and emotion of online discourse during the US H5N1 outbreak. Manuscript submitted to Nature Communications. Code: https://doi.org/10.5281/zenodo.23070435

License

This project is licensed under the terms of the LICENSE file in this repository.

Contact

For questions, contact Luizza Dalla Pria (ln326@cornell.edu).

About

Luizza's Research project on Analyzing Online Discourse on Reddit about the H5N1, considering sentiment and external signals to predict online engagement on the H5N1 outbreak.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages