This repo is just a place to store some links, notes, code and other resources related to c19 hospital impact modeling.
In Oct of 2021, this article appeared in MIT Technology Review:
I love this quote from above article:
He envisions research results that come not only with exhortations that “People should do this!” but also with accessible software allowing others to tinker with the tools. But for the most part, he says, epidemiologists do research, not development: “We write software, and it’s usually pretty bad, but it gets the job done. And then we write the paper, and then it's up to somebody else—some imagined other person—to make it useful in the broader context. And then that never happens. We’ve seen these failures in the context of the pandemic.”
The article above is based partially on this recent paper arguing for the need to better account for various flavors of uncertainty (stochastic, parameter and model) when doing pandemic modeling and analysis - Jon Zelner, Julien Riou, Ruth Etzioni, and Andrew Gelman.
This site has numerous teams submitting long term (3-6 months) forecasts that are them combined to create an ensemble forecast. Anyone can join. Since longer term forecasts are more susceptible to changes in policy and behavior (both virus and human), this site takes a scenario approach. Often four distinct scenarios are proposed and the modelers submit forecasts for each. The scenarios might involve things like vaccine uptake and NPI use.
This is another forecast aggregation site but with a focus on short term forecasts of cases, deaths and hospitalizations across the US. Numerous infectious modeling teams participate.
Some of the work in this repo is based on the CHIME project at UPenn. This project does not appear to be active anymore, though the online hospital impact simulator is still running.
Jump to:
sim_chime_scenario_runner
to model relative contact rates that change over time as social distancing policies change.sim_chime_scenario_runner
- CHIME wrapper (Python) that can be used from command line or as importable librarySimulating SD models in Python - https://pysd.readthedocs.io/en/master/
Can read Vensim .mdl files. They are just text files.
Mesa - https://github.com/projectmesa/mesa and https://mesa.readthedocs.io/en/master/index.html
Added ability to specify multiple mitigation dates and associated relative contact rate values. See demo notebook for details. This should be useful for projecting impact of various changes in social distancing policies.
WARNING - NEEDS TESTING AND VALIDATION - IDEA SEEMS REASONABLE - USE AT YOUR OWN RISK
I wanted to see how sensitive the CHIME projections are to values of the key input variables. Using my sim_chime_scenario_runner tool, I ran 560 scenarios based on the following ranges for each input factor:
mitigation-date
: 2020-03-21 through 2020-03-27relative-contact-rate
: 0.05 to 0.80 in 0.05 incrementsinfectious-days
: 8, 9, 10, 11 and 12 daysR based analysis knitted to pdf
Created: 2020-04-02
The goal for this notebook is to try to help people better understand the modeling principles, math and code behind the resource modeling in CHIME. It walks through how admits and census are computed for hospitalizations, ICU beds and vents. It also discusses some basic modeling issues related to using CHIME for assessing resource impacts of covid-19.
In part 2, I developed a queueing model based approximation for the census distribution over time. This will allow us to include census distribution bands instead of just a deterministic point estimate of mean census.
Updated 2020-04-08 for consistency with penn-chime v1.1.3
NOTE - Input parameter file for CHIME has a few changes. See https://github.com/misken/sim_chime_scenario_runner.
A simple Python module for working with the penn_chime model from the command line or as importable functions.
Has its own repo now: https://github.com/misken/sim_chime_scenario_runner
A Jupyter notebook demo showing its use: using_sim_chime_scenario_runner.ipynb
assumes that you've pip installed penn_chime
per these instructions
[OPTIONAL] You can do a pip install .
of sim_chime_scenario_runner
from the directory containing setup.py if you want to install into a virtual environment
allows running simulations from command line (like cli.py in penn_chime)
is importable so can also run simulations via function call
includes a few additional command line (or passable) arguments, including:
after a simulation scenario is run, a results dictionary is created that contains:
writes out the results
(WIP) runs multiple scenarios corresponding to user specified ranges for one or more input variables.
Based on CHIME model as of 2020-03-30
I took our actual admits (from 2020-02-20 to a 2020-03-25) and just fit an exponential growth model, got the implied growth rate and implied doubling time. Plotted actual admits vs predicted (just using simple exp growth model) and got very nice fit. Then used implied doubling time of 3.61 in CHIME model and got spot on match with the exponential fit to admits and thus, to the actual admits. Super happy to see this!
You can see the results in this notebook: model_calibration_validation.ipynb
Downloads latest time series data from https://github.com/nytimes/covid-19-data
https://github.com/misken/c19/blob/master/get_c19_data_nytimes.ipynb
Had idea for adjusting census and admission during early stages of virus spread to deal with census at time 0 problem.
Basic idea is that underlying epidemic has its dynamics that will play out almost independent of resources. But for capacity constrained resources it seems like there are a few phases during the early growth stage and then later stages of the virus. See my modeling notes README page.
The docs for CHIME are great. I created this to help folks with limited exposure to this kind of stuff get CHIME installed in either Windows or Linux. The hospital based analysts we are trying to help with this work are all on Windows.
https://github.com/misken/c19/tree/master/mychime/docs
NOTE: This was based on a very early version of the CHIME model. Nevertheless, the comments might still be useful to someone trying to understand the basic logic of the model. It should NOT be used for actual work.
I've added tons of code comments and other descriptive text throughout the notebook to help others understand exactly how this works and how we might adapt it for our use.
https://github.com/misken/c19/blob/master/mychime/archive/chime_earlyversion_annotated.ipynb