<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: q9i</title>
    <description>The latest articles on DEV Community by q9i (@quantum9innovation).</description>
    <link>https://dev.to/quantum9innovation</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F560849%2Fe05c3650-657c-4c4f-9dae-22fdbfc6678f.png</url>
      <title>DEV Community: q9i</title>
      <link>https://dev.to/quantum9innovation</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/quantum9innovation"/>
    <language>en</language>
    <item>
      <title>Disease Modeling with epispot</title>
      <dc:creator>q9i</dc:creator>
      <pubDate>Tue, 20 Apr 2021 23:06:28 +0000</pubDate>
      <link>https://dev.to/epispot/disease-modeling-with-epispot-k3c</link>
      <guid>https://dev.to/epispot/disease-modeling-with-epispot-k3c</guid>
      <description>&lt;p&gt;To get started with this post, install &lt;code&gt;epispot&lt;/code&gt;, one of the largest epidemiological modelers for Python. Fire up a command line and type one of the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;epispot &lt;span class="c"&gt;# pip&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;epispot-nightly &lt;span class="c"&gt;# pip (nightly version)&lt;/span&gt;
conda &lt;span class="nb"&gt;install &lt;/span&gt;epispot &lt;span class="c"&gt;# Anaconda&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can install epispot from the source via:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/epispot/epispot
&lt;span class="nb"&gt;cd &lt;/span&gt;epispot
git checkout master
&lt;span class="c"&gt;# git checkout nightly (nightly version)&lt;/span&gt;
python setup.py &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's get started! In this tutorial, we will be recreating the SIR model, the most basic of compartmental models in epidemiology. At its core, the SIR model consists of three "classes:"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Susceptible (not infected yet)&lt;/li&gt;
&lt;li&gt;Infected (infected and actively spreading disease)&lt;/li&gt;
&lt;li&gt;Removed (either dead or recovered --i.e. not spreading the disease)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Parameters
&lt;/h2&gt;

&lt;p&gt;Before we dive into creating the &lt;code&gt;Model&lt;/code&gt;, we need to &lt;br&gt;
establish some of the parameters that will be used to &lt;br&gt;
define our model.&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Note: if you aren't sure about which parameters are &lt;br&gt;
needed for a specific model, always consult the &lt;br&gt;
compartment docstrings using the built-in Python &lt;br&gt;
&lt;code&gt;help()&lt;/code&gt; command.&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  1. &lt;code&gt;R_0&lt;/code&gt; (basic reproductive number)
&lt;/h3&gt;

&lt;p&gt;This number represents the number of &lt;br&gt;
Susceptibles one Infected will infect, &lt;br&gt;
assuming that everyone else is Susceptible. A &lt;br&gt;
number greater than one means the disease is still &lt;br&gt;
spreading, whereas a number less than one means &lt;br&gt;
the disease is dying out. For reference, most &lt;br&gt;
epidemics have an &lt;code&gt;R_0&lt;/code&gt; value of around 2.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. &lt;code&gt;gamma&lt;/code&gt; (recovery rate)
&lt;/h3&gt;

&lt;p&gt;This variable is set to: &lt;br&gt;&lt;br&gt;
&lt;code&gt;1 / avg time to recover&lt;/code&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt;
This acts as a buffer between the time an individual &lt;br&gt;
is infected and when that individual recovers.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. &lt;code&gt;N&lt;/code&gt; (total population)
&lt;/h3&gt;

&lt;p&gt;This is, of course, the total population of the &lt;br&gt;
region in question.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. &lt;code&gt;p_recovery&lt;/code&gt; (probability of recovery)
&lt;/h3&gt;

&lt;p&gt;The probability of recovery determines an individual's &lt;br&gt;
chances of recovering after &lt;code&gt;1 / gamma&lt;/code&gt; days. This can &lt;br&gt;
be used as a proxy measure to increase or decrease &lt;br&gt;
&lt;code&gt;gamma&lt;/code&gt; or can just be left as 1.&lt;/p&gt;

&lt;p&gt;Before we finish this section, it is important to &lt;br&gt;
understand how parameters are implemented in epi-spot. &lt;br&gt;
&lt;strong&gt;All parameters are functions.&lt;/strong&gt; This is because many &lt;br&gt;
parameters change over the course of a disease. Take &lt;br&gt;
&lt;code&gt;R_0&lt;/code&gt; for example. As social distancing and &lt;br&gt;
quarantining measures are put in place, the disease &lt;br&gt;
spreads more slowly and Infecteds are only able to &lt;br&gt;
spread the disease to a fewer number of people, if at &lt;br&gt;
all. This essentially lowers &lt;code&gt;R_0&lt;/code&gt; &lt;em&gt;during the course &lt;br&gt;
of the disease&lt;/em&gt;. In order to do this in epi-spot, we &lt;br&gt;
simply change &lt;code&gt;R_0&lt;/code&gt; as time progresses, as we will be &lt;br&gt;
doing in this example.&lt;/p&gt;
&lt;h2&gt;
  
  
  Coding
&lt;/h2&gt;

&lt;p&gt;For &lt;code&gt;R_0&lt;/code&gt; we will use a simple logistic model, &lt;br&gt;
something that lowers &lt;code&gt;R_0&lt;/code&gt; as a function of time: &lt;br&gt;
slowly at the beginning, fast as the outbreak emerges, &lt;br&gt;
and then slowly as &lt;code&gt;R_0&lt;/code&gt; creeps to 0 in order to end &lt;br&gt;
the outbreak. We will use the following values:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;R_0&lt;/code&gt; start value: 2.0 &lt;br&gt;
&lt;code&gt;R_0&lt;/code&gt; end value: 0.0&lt;br&gt;
&lt;code&gt;gamma&lt;/code&gt;: 0.2&lt;br&gt;
&lt;code&gt;N&lt;/code&gt;: 100,000&lt;br&gt;
&lt;code&gt;p_recovery&lt;/code&gt;: 1.0&lt;/p&gt;

&lt;p&gt;Each function takes in a parameter &lt;code&gt;t&lt;/code&gt; representing &lt;br&gt;
the time in days from the beginning of the outbreak. &lt;br&gt;
This is implemented in lines 1-27.&lt;/p&gt;

&lt;p&gt;Next, we create an instance of each &lt;code&gt;layer&lt;/code&gt; in the &lt;br&gt;
Model. These are listed in &lt;code&gt;epispot.comps&lt;/code&gt;. Each &lt;br&gt;
layer contains a certain category of people, whether &lt;br&gt;
that be Susceptible, Infected, or Recovered. Before &lt;br&gt;
using any of them, be sure to look at which parameters &lt;br&gt;
to include depending on the next and previous layers. &lt;br&gt;
Here, we implement them as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Susceptible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;comps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Susceptible&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;R_0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Susceptible layer
&lt;/span&gt;&lt;span class="n"&gt;Infected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;comps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Infected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;R_0&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;R_0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p_recovery&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;p_recovery&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;recovery_rate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Infected layer
&lt;/span&gt;&lt;span class="n"&gt;Recovered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;comps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Recovered&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p_from_inf&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;p_recovery&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;from_inf_rate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;gamma&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Recovered layer
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we compile the Model class in &lt;code&gt;epispot.models&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;N&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
        &lt;span class="n"&gt;layers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Susceptible&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Infected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Recovered&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; 
        &lt;span class="n"&gt;layer_names&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'Susceptible'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Infected'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Recovered'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="n"&gt;layer_map&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;Infected&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Recovered&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[]])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;layer_map&lt;/code&gt; parameter here contains an array with &lt;br&gt;
an instance of the class of the next layer to each of &lt;br&gt;
the layers in the Model. It will be more useful later &lt;br&gt;
in complex models where we want to create different &lt;br&gt;
paths through each of the layers.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Lastly, we call&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;epi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plots&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plot_comp_nums&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;passing in our Model as one parameter and a time &lt;br&gt;
range that we would like to plot. This will return a &lt;br&gt;
matplotlib plot showing the values of each of those &lt;br&gt;
compartments over the timerange specified.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
There you have it! You've completed the basic tutorial &lt;br&gt;
and understand the three main modules of epi-spot &lt;br&gt;
(comps, models, and plots) and how to use them! To see the exact source code for this model, check out &lt;a href="https://www.github.com/epispot/epispot/tree/master/tests/models/basic-sir-model.py"&gt;the GitHub source&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>modeling</category>
      <category>epidemiology</category>
      <category>python</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Contributing to epispot: made easy</title>
      <dc:creator>q9i</dc:creator>
      <pubDate>Sat, 17 Apr 2021 19:27:07 +0000</pubDate>
      <link>https://dev.to/epispot/contributing-to-epispot-made-easy-26n</link>
      <guid>https://dev.to/epispot/contributing-to-epispot-made-easy-26n</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Epispot is an open-source Python package for modeling infectious&lt;br&gt;
diseases with support for compartmental models and graphing &lt;br&gt;
utilities.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Epispot started small. In fact, when epispot was first launched, it was little more than a few scraps of code. But over time, with inspiration from other demos, epispot has become one of the largest Python packages for infectious disease modeling. As epispot turns a new corner, we hope to grow our open-source community and reach more contributors. This article outlines the main ways you can help contribute to the &lt;a href="https://www.github.com/epispot/epispot"&gt;epispot/epispot&lt;/a&gt; repository on GitHub.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Fixing Bugs
&lt;/h1&gt;

&lt;p&gt;Epispot categorizes issues by priority level. On the repository, each issue, after being processed, will be tagged with either a &lt;code&gt;high-priority&lt;/code&gt; or &lt;code&gt;low-priority&lt;/code&gt; label. A great way to contribute is to try and work on as many &lt;code&gt;high-priority&lt;/code&gt; issues as possible. These issues tend to be bugs, vulnerabilities, or critical issues and your help will go a &lt;em&gt;long&lt;/em&gt; way. But you don't need to &lt;em&gt;fix&lt;/em&gt; a bug to actually help. Even adding more information about what the behavior of a certain bug is can help. However, if you do want to start working on a bugfix, run the following on a local computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/epispot/epispot
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;epispot
&lt;span class="nv"&gt;$ &lt;/span&gt;git checkout master
&lt;span class="nv"&gt;$ &lt;/span&gt;git branch patch-1
&lt;span class="nv"&gt;$ &lt;/span&gt;git checkout patch-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, once you're done fixing the bug:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Fixed #[Issue Number]"&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this you can successfully submit your PR to the main repo. After build and code quality tests run, your PR will be tagged and linked to the issue and then merged.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Documentation
&lt;/h1&gt;

&lt;p&gt;One important misconception with contributing to open-source is that you have to &lt;em&gt;code&lt;/em&gt;. However, documentation is a great way to contribute without actually &lt;em&gt;coding&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Epispot's docs are generated using &lt;a href="https://pdoc3.github.io/pdoc/doc/pdoc/"&gt;&lt;code&gt;pdoc3&lt;/code&gt;&lt;/a&gt;, which automatically creates documentation for docstrings on the &lt;code&gt;nightly&lt;/code&gt; branch. The &lt;code&gt;nightly&lt;/code&gt; branch is essentially epispot's development branch--it's where all new changes and features go to get tested (and it even has its own &lt;a href="https://www.pypi.org/project/epispot-nightly"&gt;package&lt;/a&gt;! To contribute, run the following in a git shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/epispot/epispot
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;epispot
&lt;span class="nv"&gt;$ &lt;/span&gt;git checkout nightly
&lt;span class="nv"&gt;$ &lt;/span&gt;git branch docs-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can start adding docs! Before starting, checkout &lt;code&gt;DOCUMENTATION.md&lt;/code&gt; if you're unfamiliar with pdoc3. Then go into the &lt;code&gt;epispot&lt;/code&gt; (package) directory, and edit the docstrings. To preview the docs, run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;pdoc &lt;span class="nt"&gt;--html&lt;/span&gt; &lt;span class="nt"&gt;--output-dir&lt;/span&gt; docs epispot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a &lt;code&gt;docs/epispot&lt;/code&gt; folder which will be automatically gitignored so you can preview the docs and not have to delete them before committing. When you're done, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Added Documentation on [module name]"&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can safely submit your PR and tag it with &lt;code&gt;documentation&lt;/code&gt;. Most doc PRs will be merged soon since tests don't have to run.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Localization
&lt;/h1&gt;

&lt;p&gt;One of the other &lt;em&gt;great&lt;/em&gt; ways you can contribute to epispot, without even &lt;em&gt;using&lt;/em&gt; a terminal or code editor, is through localization. Epispot uses &lt;a href="https://www.gitlocalize.com/repo/5997"&gt;gitlocalize&lt;/a&gt; to localize documentation. If you speak another language, you can add it and start working on localizing it. Then, submit a review request. This will get approved soon and a PR will be created in GitHub. Note that all localizations are pushed to the &lt;code&gt;gh-pages&lt;/code&gt; branch by default where they will be deployed instantly after merging.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Epispot hopes that through our open-source efforts we can grow our contributors. If you are interested in contributing, head on over to the &lt;a href="https://www.github.com/epispot/epispot"&gt;repo&lt;/a&gt; and check out our &lt;a href="https://www.github.com/epispot/epispot/tree/master/CONTRIBUTING.md"&gt;contributing guidelines&lt;/a&gt;! In the meanwhile, 👋&lt;/p&gt;

</description>
      <category>contributorswanted</category>
      <category>opensource</category>
      <category>epidemiology</category>
      <category>python</category>
    </item>
    <item>
      <title>The epispot Project Roadmap</title>
      <dc:creator>q9i</dc:creator>
      <pubDate>Thu, 15 Apr 2021 22:49:18 +0000</pubDate>
      <link>https://dev.to/epispot/the-epispot-project-roadmap-4ih1</link>
      <guid>https://dev.to/epispot/the-epispot-project-roadmap-4ih1</guid>
      <description>&lt;p&gt;Epispot is one of the largest and simplest epidemiological modeling tools for Python. Install via one of the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;epispot
conda &lt;span class="nb"&gt;install &lt;/span&gt;epispot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can install it from the source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/epispot/epispot
&lt;span class="nb"&gt;cd &lt;/span&gt;epispot
python setup.py &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're new to epispot, start by reading the information provided on the READMEs in PyPI or GitHub &lt;a href="https://www.github.com/epispot/epispot/README.md"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While the epispot package has had tremendous success and now has over &lt;strong&gt;15 releases&lt;/strong&gt; (just counting the &lt;code&gt;master&lt;/code&gt; package), the epispot team would like to announce a preview of what's to come. We present to you the &lt;strong&gt;epispot project roadmap:&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  In Maintenance:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In Automation: 

&lt;ul&gt;
&lt;li&gt;Automate release notes on master &amp;amp; nightly &lt;/li&gt;
&lt;li&gt;Automate documentation on master &amp;amp; nightly &lt;/li&gt;
&lt;li&gt;Dependabot automation everywhere&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;In Packaging: 

&lt;ul&gt;
&lt;li&gt;Automatic conda deployment on nightly &lt;/li&gt;
&lt;li&gt;Direct conda packaging (without conda-forge)?&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;In Issue Management: 

&lt;ul&gt;
&lt;li&gt;Automate issue labels&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;In Branch Management: 

&lt;ul&gt;
&lt;li&gt;Automatic code coverage reports on pull requests and commits &lt;/li&gt;
&lt;li&gt;Automate merge conflict resolutions for master→nightly&lt;/li&gt;
&lt;li&gt;Automate merge conflict resolutions for nightly→master&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  In Development:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In Compartments: 

&lt;ul&gt;
&lt;li&gt;Vaccinated &lt;/li&gt;
&lt;li&gt;Severe &lt;/li&gt;
&lt;li&gt;Mild &lt;/li&gt;
&lt;li&gt;Immune &lt;/li&gt;
&lt;li&gt;Asymptomatic &lt;/li&gt;
&lt;li&gt;Quarantined&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;In Model Types: 

&lt;ul&gt;
&lt;li&gt;Cluster &lt;/li&gt;
&lt;li&gt;Probabilistic &lt;/li&gt;
&lt;li&gt;Monte-Carlo Simulation &lt;/li&gt;
&lt;li&gt;Large Area Simulation&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;In Small Updates: 

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Anything?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;In Major Changes: 

&lt;ul&gt;
&lt;li&gt;Demographic modeling within compartments &lt;/li&gt;
&lt;li&gt;More information on integrate() 

&lt;ul&gt;
&lt;li&gt;inflection points &lt;/li&gt;
&lt;li&gt;extrema &lt;/li&gt;
&lt;li&gt;herd immunity markers &lt;/li&gt;
&lt;li&gt;Pre-built support for geographic modeling&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In Integrations: 

&lt;ul&gt;
&lt;li&gt;Live COVID-19 data &lt;/li&gt;
&lt;li&gt;Live national cases data &lt;/li&gt;
&lt;li&gt;Live city/county data&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  In Simulations:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Small-Scale 

&lt;ul&gt;
&lt;li&gt;Use spatial models get to accurate small-scale predictions &lt;/li&gt;
&lt;li&gt;Implement in large cities: 

&lt;ul&gt;
&lt;li&gt;San Francisco &lt;/li&gt;
&lt;li&gt;London &lt;/li&gt;
&lt;li&gt;Tokyo &lt;/li&gt;
&lt;li&gt;New York &lt;/li&gt;
&lt;li&gt;Mexico City &lt;/li&gt;
&lt;li&gt;Mumbai &lt;/li&gt;
&lt;li&gt;Add an open-source platform for more cities to be added&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Build a web dashboard&lt;/li&gt;
&lt;li&gt;Large-Scale 

&lt;ul&gt;
&lt;li&gt;Add large-scale modeling to CLI &lt;/li&gt;
&lt;li&gt;Implement a Cluster model to simulate travel across major hotspots &lt;/li&gt;
&lt;li&gt;Get a geographic model ready for world mapping&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lastly:&lt;/strong&gt; The long-awaited command line-interface (&lt;strong&gt;is here! 🎆&lt;/strong&gt;)--no, really, &lt;a href="https://www.github.com/epispot/epispot/tree/nightly/CHANGELOG.md"&gt;check it out&lt;/a&gt;&lt;/p&gt;

</description>
      <category>epidemiology</category>
      <category>datascience</category>
      <category>python</category>
      <category>pythonpackage</category>
    </item>
    <item>
      <title>Reopening Safely: A Tale of Four Cities</title>
      <dc:creator>q9i</dc:creator>
      <pubDate>Sun, 13 Dec 2020 00:42:16 +0000</pubDate>
      <link>https://dev.to/epispot/reopening-safely-a-tale-of-four-cities-26ca</link>
      <guid>https://dev.to/epispot/reopening-safely-a-tale-of-four-cities-26ca</guid>
      <description>&lt;p&gt;The follow-up to &lt;a href="https://q9i.medium.com/reopening-safely-the-data-science-approach-289fd86ef63"&gt;“Reopening Safely: The Data Science Approach.”&lt;/a&gt; We examine the use of lockdowns, social distancing and other citywide measures and their effectiveness.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TMdHd7FH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AN5RKpjHSHfyzk2lS" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TMdHd7FH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AN5RKpjHSHfyzk2lS" alt=""&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/@waldemarbrandt67w?utm_source=medium&amp;amp;utm_medium=referral"&gt;Waldemar Brandt&lt;/a&gt; on &lt;a href="https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;This article is the second in a series about using data science to analyze reopening strategies. If you haven’t already, read &lt;a href="https://q9i.medium.com/reopening-safely-the-data-science-approach-289fd86ef63"&gt;the first article&lt;/a&gt; before this one.&lt;/li&gt;
&lt;li&gt;All the code in this article has been based off of the &lt;a href="https://www.github.com/epispot/covid-19"&gt;covid-19&lt;/a&gt; repository set up by epispot to help fight the coronavirus. The complete source code for the simulations in this article can be found there.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The last article has clearly proven that doing nothing is not a strategy when it comes to reopening cities in wake of the coronavirus. The speed at which the coronavirus spreads is too fast and uncontrollable to be left up to chance. However, the secret to mitigating the spread of COVID-19 lies in its predictability. As explained in the previous article, the SIR Model, and many others, can quite accurately model how a virus spreads. In fact, there exist many free open-source libraries that can run these models and give predictions. Just like in the last article, we will be using &lt;a href="https://www.github.com/epispot/epispot"&gt;epispot&lt;/a&gt; throughout this article for modeling and analysis.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 1: Tracking Hospitalizations
&lt;/h3&gt;

&lt;p&gt;In order to compare the various reopening strategies employed across the globe, we have randomly selected 4 cities with sufficient COVID-19-related hospitalization data. The cities are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://stopcovid19.metro.tokyo.lg.jp/en/cards/number-of-hospitalized"&gt;Tokyo&lt;/a&gt;, Japan&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://data.sfgov.org/COVID-19/COVID-19-Hospitalizations/nxjg-bhem"&gt;San Francisco&lt;/a&gt;, US&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://raw.githubusercontent.com/nychealth/coronavirus-data/master/latest/now-data-by-day.csv"&gt;New York&lt;/a&gt;, US&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.england.nhs.uk/statistics/statistical-work-areas/covid-19-hospital-activity/"&gt;London&lt;/a&gt;, UK&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The associated hospitalization data has been linked along with the city names.&lt;/p&gt;

&lt;p&gt;First, let’s take a look at how hospitalizations* in each of the five cities has progressed since the start of the coronavirus:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hb6NEdSe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AtBE75xCU8pBjUYadtL0QnQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hb6NEdSe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AtBE75xCU8pBjUYadtL0QnQ.png" alt="All cities have two distinct waves of hospitalizations although San Francisco and Tokyo have much more hospitalized."&gt;&lt;/a&gt;No data for New York and London was available before their trend lines begin. Note that the y-axis is proportional to city size, recording the portion of hospitalized individuals (think percentage of people hospitalized / 100)&lt;/p&gt;

&lt;p&gt;*We examine COVID-19-related hospitalization data because this data is the most accurate of all other data sources. Other sources, like case counting, rely on testing efforts which can only reach a small portion of the population each day.&lt;/p&gt;

&lt;p&gt;Clearly, there is one trend line that completely dominates this graph — those hospitalizations are from Tokyo. Upon closer analysis, we can see that the peak begins to flatten after about the 40th day after 3/04/20, which corresponds with the date Japan &lt;a href="https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=&amp;amp;ved=2ahUKEwiSluvBv73tAhUGsZ4KHQf5AzcQFjAAegQIBxAC&amp;amp;url=https%3A%2F%2Fwww.mdpi.com%2F2227-9032%2F8%2F4%2F426%2Fpdf&amp;amp;usg=AOvVaw3by3_JuWiz2S0Wn9FOWOYX"&gt;imposed a nationwide state of emergency&lt;/a&gt;. After further lockdowns were implemented, Tokyo’s hospitalizations plummet within just 20 days, again highlighting the importance of small changes on a citywide or national level.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Even small changes made on a large-scale can have profound impacts on the change in coronavirus cases.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In order to focus on the more minute fluctuations of the hospitalizations, we zoom in on the bottom-right corner of the graph. Here are an additional two views:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ezt8CxEN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AaA5q6NTnagU21KUQDtuQOA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ezt8CxEN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AaA5q6NTnagU21KUQDtuQOA.png" alt="Sharp decrease in hospitalizations in SF &amp;amp; Tokyo indicate progress but looser restrictions create increase at end of graph"&gt;&lt;/a&gt;The second of two distinct “waves” of coronavirus hospitalizations is shown for both San Francisco and Tokyo while London and New York seem to have almost no hospitalizations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FQHNKkf1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AOHvDTEIkb4XBhWe6vWbpeQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FQHNKkf1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AOHvDTEIkb4XBhWe6vWbpeQ.png" alt="On the smaller scale, increases in New York’s and London’s hospitalizations are visible."&gt;&lt;/a&gt;San Francisco’s all-time low nearly matches London and New York’s all-time high in hospitalizations. London’s and New York’s hospitalizations barely change as San Francisco’s increases again and Tokyo’s skyrockets (not visible on this graph).&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 2: Tracking Cases
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Example: San Francisco
&lt;/h4&gt;

&lt;p&gt;Great! We have the hospitalization data, but there’s one crucial piece of information that is escaping these graphs: the confirmed cases! Without case information, it is impossible to truly understand how fast the disease will continue to spread. Thankfully, that’s not too hard to implement in &lt;a href="https://www.github.com/epispot/epispot"&gt;epispot&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For those of you who are interested in the full source code, definitely check out the &lt;a href="https://www.github.com/epispot/covid-19"&gt;covid-19 repo from epispot,&lt;/a&gt; where all the code from this article is hosted. Here’s a quick snippet of the code used to fit the model:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;If this code looks confusing to you, don’t worry! The goal here is to analyze the results, not worry about the code. Again, if you are interested in understanding this code, the &lt;a href="https://epispot.github.io/epispot"&gt;epispot documentation&lt;/a&gt; is a great place to start (all resources linked at the end of this article). Essentially, the goal of this code is to fit a model to the hospitalization data that we downloaded earlier. Then, we can use epispot to predict the number of cases:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xTwhSWD7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AUElIImufMtV6HmOh4Apy8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xTwhSWD7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AUElIImufMtV6HmOh4Apy8w.png" alt="While the hospitalization waves may look mild, the true number of cases increases at a much larger rate."&gt;&lt;/a&gt;The difference between predicted hospitalizations and actual hospitalizations is due to random noise in the data.&lt;/p&gt;

&lt;p&gt;This graph reveals two important ideas, one of which we have already discussed. That is the fact that even small changes in some parts of the model (like changes in hospitalizations) can result in huge changes in other parts of the model (like changes in cases). This massive surge in cases over San Francisco’s coronavirus “waves” tell us that the rate that the disease is spreading will continue to increase, causing an exponential increase in the number of cases.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;In other words, if the spread is controlled quickly by the use of lockdowns or other preventive measures, it won’t take long before San Francisco or any city is completely overwhelmed with coronavirus cases (and hospitalizations)&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For the second and last part of the analysis, we examine the crucial R Naught parameter, also known as the basic reproductive number. This was one of the important parameters in SIR Model because it tells us &lt;em&gt;how fast&lt;/em&gt; an outbreak is growing. In its most basic form, it measures how many people one infected infects over their entire infectious period.&lt;/p&gt;

&lt;p&gt;R Naught &amp;gt; 1: Epidemic is growing&lt;/p&gt;

&lt;p&gt;R Naught = 1: Epidemic has stopped growing&lt;/p&gt;

&lt;p&gt;R Naught &amp;lt; 1: Epidemic is ending&lt;/p&gt;

&lt;p&gt;Here is the corresponding R Naught graph for the cases in San Francisco:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ySdKLf4Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AkIwIclsa9oLG4I3saAaydQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ySdKLf4Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AkIwIclsa9oLG4I3saAaydQ.png" alt="R Naught increases in both of San Francisco’s “waves” and then decreases again."&gt;&lt;/a&gt;San Francisco’s outbreak seems to be declining for the most part (R Naught is less than 1), but as soon as reopening began, the R Naught value peaked again at a value over 1 indicating that the coronavirus is beginning to spread yet again.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Wrap-Up (Not Quite)
&lt;/h3&gt;

&lt;p&gt;Clearly, we have seen how the coronavirus has developed in many cities across the globe. We have used hospitalization data to generate case data, understand how different factors affect the growth rate of COVID-19, and seen some amazing visualizations of the spread of the coronavirus. Of course, there is still much, &lt;em&gt;much&lt;/em&gt; more to be done. To start, we have not even started with &lt;em&gt;predictions …&lt;/em&gt; and we still have not examined the hospitalization spike in Tokyo, and the slow case growth in New York and London as they begin reopening. All this &lt;em&gt;and more&lt;/em&gt; in the next article in this series …&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;This is article two of the series “Reopening Safely”&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://github.com/epispot/epispot"&gt;epispot&lt;/a&gt;: The code library on GitHub used for the predictions and analysis shown in this article&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/matplotlib/matplotlib"&gt;matplotlib&lt;/a&gt;: The amazing Python graphics library used for the stunning visualizations shown throughout this article&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.github.com/epispot/covid-19"&gt;covid-19&lt;/a&gt;: The repo where all code in this article is stored at (hosted by epispot &amp;amp; GitHub). You can find the full code, data, and sources for this article there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://q9i.medium.com/reopening-safely-the-data-science-approach-289fd86ef63"&gt;Reopening Safely Part One&lt;/a&gt;: The first article in this series (goes over epispot, the SIR Model, and basic modeling techniques)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://epispot.github.io/epispot"&gt;epispot documentation&lt;/a&gt;: For creating “Lessons Learned from Japan’s Response to the First Wave of COVID-19: A Content Analysis”models of your own! (make sure to check out the repo for instructions as well)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=&amp;amp;ved=2ahUKEwiSluvBv73tAhUGsZ4KHQf5AzcQFjAAegQIBxAC&amp;amp;url=https%3A%2F%2Fwww.mdpi.com%2F2227-9032%2F8%2F4%2F426%2Fpdf&amp;amp;usg=AOvVaw3by3_JuWiz2S0Wn9FOWOYX"&gt;“Lessons Learned from Japan’s Response to the First Wave of COVID-19: A Content Analysis”&lt;/a&gt;: A paper for more information on Tokyo and Japan’s response as a whole to the coronavirus&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>reopening</category>
      <category>coronavirus</category>
    </item>
    <item>
      <title>Reopening Safely: The Data Science Approach</title>
      <dc:creator>q9i</dc:creator>
      <pubDate>Mon, 02 Nov 2020 03:21:24 +0000</pubDate>
      <link>https://dev.to/epispot/reopening-safely-the-data-science-approach-62p</link>
      <guid>https://dev.to/epispot/reopening-safely-the-data-science-approach-62p</guid>
      <description>&lt;p&gt;The great reopening debate attacked using infectious disease modeling&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PLbL6N38--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/960/1%2Aml21-N9rNe6FeIfK5VR_jA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PLbL6N38--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/960/1%2Aml21-N9rNe6FeIfK5VR_jA.png" alt="A disease model"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the coronavirus raging through major cities all over the world, the question remains the same: when is it safe to reopen? The answer is not simple, so as usual, data science comes to the rescue. Using an SIR-based model in multiple experiments will give clues to how the reopening of the world might look, and whether it will last.&lt;/p&gt;

&lt;h3&gt;
  
  
  The SIR Model
&lt;/h3&gt;

&lt;p&gt;The SIR model is one of the most sacred disease modeling tools. Its versatility, simplicity, and effectiveness make it one of the most powerful tools in epidemiological modeling. Here is a simple breakdown of the key ideas behind the model:&lt;/p&gt;

&lt;h4&gt;
  
  
  The S, I, and R
&lt;/h4&gt;

&lt;p&gt;The first step in the SIR model is to break down the population into three possible states: Susceptible (S), Infected (I), or Recovered (R). The states themselves are quite self-explanatory. However, the last state, removed, is also commonly referred to as the “Removed” state because it can contain individuals who are recovered or dead.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Dynamics
&lt;/h4&gt;

&lt;p&gt;As with many problems involving populations, it is much easier to describe the change of a state rather than it is to describe the state itself. Essentially, this means that differential equations are necessary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--otG4HLTC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/217/1%2AeW5KD-qu4A7HDVaoDTMQhQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--otG4HLTC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/217/1%2AeW5KD-qu4A7HDVaoDTMQhQ.png" alt="dS/dt = -beta * I * S/N, dI/dt = beta * I * S/N - gamma * I, dR/dt = gamma * I"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The equations above might look intimidating at first glance, but when understood in the right context, they make perfect sense. In order to understand these equations, we need to define a few variables, notably:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Beta&lt;/em&gt; = infection rate &lt;em&gt;*&lt;/em&gt; number of individuals a person makes contact with (essentially how many people 1 infected infects)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Gamma&lt;/em&gt; = &lt;em&gt;1&lt;/em&gt; / days to recover (the recovery rate)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first equation means that the number of people exiting the susceptible compartment per timestep is beta * I * S/N. This makes sense because each infected infects beta people (see the definition of beta). The last part, S/N, represents the portion of the population that is susceptible because an infected or recovered person cannot be reinfected*.&lt;/p&gt;

&lt;p&gt;Now, since everyone who “leaves” the Susceptible compartment must go to the Infected compartment (you can’t jump to the Removed compartment without first being infected), the Infected compartment simply gets whatever population leaves the Susceptible compartment (notice the derivative of the Infected compartment is just the negated derivative of the Susceptible compartment with one other term). The extra term at the end represents the people leaving the Infected compartment after recovering (the recovery rate * the infected population). And lastly, the same number of people leaving the Infected compartment join the Recovered compartment.&lt;/p&gt;

&lt;p&gt;*The idea that someone who has recovered from an illness cannot be susceptible to it again is one of the assumptions behind the SIR model which is mostly true for COVID-19&lt;/p&gt;

&lt;h4&gt;
  
  
  Setting it Up
&lt;/h4&gt;

&lt;p&gt;Coding the SIR Model might seem quite intimidating at first, but luckily, there is a software library that can help — check out &lt;a href="https://github.com/quantum9Innovation/epispot"&gt;epispot&lt;/a&gt; on GitHub. Epispot can handle the SIR model and even more complex models (where there are exposed and hospitalized states). Coding this model in epispot will be covered in the following sections. The code itself is not that important (you can always consult the documentation), but its predictions and the reasons behind them are.&lt;/p&gt;

&lt;p&gt;If you are interested in the code, there is one other parameter that epidemiologists frequently use (and one that epispot uses). That parameter is of course R Naught. R Naught is essentially beta / gamma or the &lt;strong&gt;net&lt;/strong&gt; gain in the infected category per infected if 100% of the population is fully susceptible. Essentially, this tells epidemiologists &lt;em&gt;how infectious&lt;/em&gt; a certain disease is (e.g. for COVID-19, this number is around 2.5).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Case Study
&lt;/h3&gt;

&lt;h4&gt;
  
  
  San Francisco
&lt;/h4&gt;

&lt;p&gt;The entire code would be too much to explain for this article, but if you are interested, see the sf-case-study-covid-19.py in the &lt;a href="https://github.com/quantum9Innovation/epispot"&gt;epispot repo&lt;/a&gt;. However, the rest of the article will be mostly code snippets.&lt;/p&gt;

&lt;p&gt;After we import the epispot library and get everything configured, we load the San Francisco case data from 3/19 to 7/11 from &lt;a href="https://data.sfgov.org/stories/s/dak2-gvuj"&gt;DataSF&lt;/a&gt;. If you want to download the data yourself, this is in the epispot repo under tests/data . Here is a sample of the data:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now we set up the model. Again, the full code for this can be found on GitHub, but for the sake of simplicity, only an important snippet is shown. After the coronavirus data loads, the model is set up in just a few lines of code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Before we get the predictions, there is a little bit of setup required. The parameters used in this model ( R_0, gamma, N, delta, alpha ) have all been gathered using open data sets and a regression algorithm. This means that we have essentially &lt;em&gt;fitted&lt;/em&gt; our model to the data to get more accurate estimates. In case you are interested, the regression was performed using data from the infamous Diamond Princess cruise ship.&lt;/p&gt;

&lt;p&gt;Lastly, the model outputs the predictions (using the epi.plots.compare method), plotted on a logarithmic scale. The predictions are from 7/11 to 8/10 (1 month ahead)*. The predictions are calculated as if there is no social distancing at all (that is, San Francisco completely reopened). Finally, the question is answered:&lt;/p&gt;

&lt;p&gt;*Yes, this is not exactly happening &lt;em&gt;right now&lt;/em&gt;, but it still is useful because it gives a general idea of what &lt;em&gt;could&lt;/em&gt; happen in the future. The modeling is also still necessary because we are simulating what would happen after a &lt;em&gt;complete&lt;/em&gt; reopening, so we need to predict.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kn4QLDZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AsQNNr8HHzkMhD0El6mP_xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kn4QLDZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2AsQNNr8HHzkMhD0El6mP_xw.png" alt="The current susceptibles and infecteds grow slowly and linearly, while after reopening, they blow up, peaking at ~100k"&gt;&lt;/a&gt;The infected and hospitalized cases before and after a full theoretical reopening&lt;/p&gt;

&lt;p&gt;This graph can be a lot to take in at one time, especially since all the important details are stashed away in the right corner. Zooming in on days 120–140 yield the following graph:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N414eYZX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2A99-g-qIePF9g2gpkDFhm8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N414eYZX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1000/1%2A99-g-qIePF9g2gpkDFhm8w.png" alt="A zoom-in on the graph reveals a stretch of ~10 days where hospital capacity is surpassed."&gt;&lt;/a&gt;A zoom-in of the predicted infecteds (light blue) and predicted hospitalized (dark blue)&lt;/p&gt;

&lt;p&gt;The gigantic yellow box on top is the period where San Francisco’s maximum hospital capacity is passed (i.e. not everyone can be treated). At this point, there is a clear public health disaster — so how long did San Francisco’s pretend lockdown really last?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;7 days.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What Happened?
&lt;/h3&gt;

&lt;p&gt;Seven days is quite a surprising number. Only one week. That is the maximum duration of a complete reopening. Reopening clearly does not mean that there will be &lt;em&gt;no&lt;/em&gt; safety precautions, but in many cases it does make some sacrifices. Aside from that, there are still many reasons why this model is an exaggeration: it is from a few months ago, the parameters are all estimated, etc. However, this model does show something important:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;small changes in awareness, precautionary measures, or anything that is carried out on an&lt;/em&gt; even citywide &lt;em&gt;scale can have&lt;/em&gt; &lt;strong&gt;&lt;em&gt;major impacts.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Of course, several questions remain. For example, what would happen if there was just a &lt;em&gt;partial&lt;/em&gt; reopening, or what if this was in a suburb, or New York, or what happened it Italy? See you in the next blog post …&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;This is article one of the series “Reopening Safely”&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  While you wait …
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;See the &lt;a href="https://github.com/quantum9Innovation/epispot"&gt;epispot repo&lt;/a&gt; on GitHub&lt;/li&gt;
&lt;li&gt;See these &lt;a href="https://towardsdatascience.com/infectious-disease-modelling-part-i-understanding-sir-28d60e29fdfc"&gt;Medium posts&lt;/a&gt; on infectious disease modeling&lt;/li&gt;
&lt;li&gt;Look at the &lt;a href="https://www.google.com/search?q=san+francisco+coronavirus+cases"&gt;San Francisco case data&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Credits
&lt;/h3&gt;

&lt;p&gt;Epispot is built using numpy for managing multidimensional arrays. The plots shown in this article are using epispot’s plot feature, which relies on matplotlib for the stunning graphics and annotations.&lt;/p&gt;

</description>
      <category>sirmodel</category>
      <category>datascience</category>
      <category>modelling</category>
      <category>coronavirus</category>
    </item>
  </channel>
</rss>
