Skip to content

Rush-Quality-Analytics/SupplyDemand

Repository files navigation

#SupplyDemand

Description

Source code and data for an application (https://rush-covid19.herokuapp.com/) to aid US hospitals in planning their response to the ongoing COVID-19 pandemic. The application forecasts hospital visits, admits, discharges, and needs for hospital beds, ventilators, and personal protective equipment by coupling COVID-19 predictions to models of time lags, patient carry-over, and length-of-stay. Users can choose from seven COVID-19 models, customize 23 parameters, examine trends in testing and hospitalization, and download forecast data. The application accurately predicts the spread of COVID-19 across states and territories and its hospital-level forecasts are in continuous use by our home institution. The application is versatile, easy-to-use, and can help hospitals plan their response to the changing dynamics of COVID-19, while providing a platform for deeper study.

Requirements

  • Python 3.6 or greater
  • dash==1.0.0
  • gunicorn>=19.9.0
  • numpy>=1.16.2
  • pandas>=0.24.2
  • datetime==4.3
  • pathlib==1.0.1
  • scipy>=1.4.0
  • flask>=1.1.1
  • plotly==4.5.2

How to run this app

Create a virtual environment for running this app with Python 3. Clone this repository and open your terminal/command prompt in the root folder.

python3 -m virtualenv venv

In Unix system:

source venv/bin/activate

In Windows:

venv\Scripts\activate

Install all required packages by running:

pip install -r requirements.txt

Run this app locally with:

python app.py

Directories & Files

DataUpdate
A directory containing python scripts for updating data used by the application. To update data run the following scripts in the following order via your terminal window:

  1. get_dataframe_dailyreports.py ...downloads and formats state-level cumulative COVID-19 case data from the John's Hopkins CSSE github repository.
  2. get_US_dailyreports_JH_testing.py ...downloads and formats state-level COVID-19 testing data from the John's Hopkins CSSE github repository.
  3. TestingData.py ...downloads and formats state-level COVID-19 testing data from The Atlantic's COVID-19 Tracking Project.
  4. SEIR-SD_States_Update.py ...Generates updated predictions for the SEIR-SD model for each US state and select territory

DataUpdate/data
A directory containing data files used by the application's app_fxns.py file. The data files are:

  1. SEIR-SD_States_Update.txt ...Latest updated version of SEIR-SD model predictions
  2. Testing_Dataframe_Most_Recent_Day.pkl ...Latest updated version of state-level COVID-19 testing results for the most recent day on record.
  3. Testing_Dataframe.pkl ...Latest updated version of state-level COVID-19 testing results for all days on record.
  4. COVID-TESTING-DF ...An intermediate file generated by get_US_dailyreports_JH_testing.py and used by TestingData.py to create the .pkl data files listed above.

ForManuscript:
A directory containing files and other directories needed to recreate figures in the associated manuscript. The files are directories are:

  1. model_fxns.py ...a script containing functions specific to the applications models
  2. ModelFxns_Figs.py ...a script to generate the general predicted forms of each model; associated with Figure 1 of the associated manuscript.
  3. results_dataframe.py ...a script to generate results data for each model's predictive accuracy across time and US states and terroritories. The resulting file model_results_dataframe.pkl is located in the ForManuscript/data directory.
  4. ModelPerformance_Figs.py ...a script to generate results figures for each model; associated with Figure 1 of the associated manuscript; uses the model_results_dataframe.pkl file.

app.py
The application's main source code.

app_fxns.py
A python script containing functions needed by app.py.

model_fxns.py
A python script containing functions specific to the applications models

The following are files and directories that are necessary components of the plotly dash application structure

  1. venv & env -- a directory containing files and directories specific to the application environment and virtual environment
  2. flask -- a directory specific to enabling flask app functionality
  3. assets -- a directory of images used by the main application
  4. requirements.txt -- software requirements of the app
  5. runtime.txt -- python version required or best suited for running the app
  6. Procfile -- text file specific to gunicorn; contains a single line (web: gunicorn app:server )

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages