Code for "COVID-19 and the Drug Overdose Crisis: Uncovering the Deadliest Months in the United States, January-July 2020"
Paper:
Friedman, J. & Akre, S. COVID-19 and the Drug Overdose Crisis: Uncovering the Deadliest Months in the United States, January‒July 2020. Am J Public Health e1–e8 (2021). doi:10.2105/ajph.2021.306256
Updated 07-17-2021
- Overdose data by state for analysis purposes in:
Useable_Overdose_Data_Through_Oct_2020.csv
- src/: Contains python scripts used in analysis
- defilter_data.py: Disaggregates rolling sum data
- estimate_error.py: Calculates error in disaggregation process from historical data
- load_data.py: Cleans and preprocesses input datasets
- tests/: Unit tests to ensure desired functions work as intended
- input/: Input datafiles used for analysis
- output/: Generated intermediate files
- visuals/: Generated figures and tables
- state_timeseries_2021-05-16.pdf: State by state data
- CDC_overdose_monthly_recovery.ipynb: Python notebook used to disaggregate CDC overdose death data and calculate errors in that process
- CDC_monthly_imputation.R: Imputes missing data from monthly "ground truth" overdose data
- CDC_monthly_recovery_analysis.R: Run analysis and visualizations of monthly overdose data. Used to generate figures in manuscript.
- Useable_Overdose_Data_Through_Sep_2020.csv: Cleaned monthly overdose death data by state. Intended for use by others.
Python 3.7.6
- pandas==1.2.0
- numpy==1.19.4
- scipy==1.5.4
- matplotlib==3.3.3
- seaborn==0.11.1
- jupyterlab==3.0.0 .
R 4.0.3
- Set up R and python environments
- Create an empty folder
output
andvisuals
inside of repository- Intermediate files and manuscript figures will be placed here
- Run
CDC_monthly_imputation.R
- Make sure to change
root
variable to point to location of this repository on your local system
- Make sure to change
- Run the full
CDC_overdose_monthly_recovery.ipynb
python notebook - Run
CDC_monthly_recovery_analysis.R
- Make sure to change
root
variable to point to location of this repository on your local system
- Make sure to change