communications · CompSci_Studies · download · Health · medicine

Epidemiological models (SIR) in nCov and Other Epidemics

Reading Time: 4 minutes

Epidemic is an incident, in time, where typically a large proportion of a population gets ill.

Corona-virus pandemic of 2019 is causing an epidemic. Originally detected somewhere in December 2019, we are still (March 20th 2020) in midst of the rising tide of infection cases. The causing virus is called specifically ‘Severe acute respiratory syndrome coronavirus 2″, or SARS-CoV-2 for short. Another alias for the exact same virus is nCov. The disease that results from this virus is called COVID-19.

The virus – cause of the epidemic

A virus — photo by CDC on Unsplash

The biological root of an epidemic is called an antigen. With the novel Corona-virus pandemic, it’s a virus in the “corona family”.

There have been corona viruses in the wild before this 2019-2020 epidemic.

Viruses are small, lifeless objects per se, who carry either a DNA or RNA code, and can drift to hijack a working cell’s production mechanism, so that the cells start producing replicants of the virus. Thus normal functioning of the cells are interrupted and the virus population starts to grow.

Corona (nCOV) leading to the disease COVID-19 is a RNA-virus. Thus the replication message carried is in the form of ribonucleic acid. See Wikipedia: RNA-virus.

As one virus can reproduce many other viruses, the growth curve of the mass of viruses is exponential in shape. It’s similar to the mechanism of nuclear fission – the mechanism of nuclear weapons. Many biological processes are exponential.

The growth often also has a natural limiting factor, thus there’s resistance. In human bodies, resistance may come in the form of immunity fighting back the spread of the virus. A virus may also simply exhaust the host or exhausting a critical matter that is needed to replicate; leading to either sustained levels of viral presence, or decay of the level.

The antigen causes the symptoms and capability to transmit the disease to another person. The branch of medicine and science that deals with epidemics is called epidemiology.

Mathematical models for viral epidemics

There are lot of mathematics which is useful in modeling these epidemics. Some of maths is actually quite simple, and can be understood perhaps better with computer simulation.

There’s a few “main ideas” of viral outbreak simulations:

  • differential equations (called DE, or ‘ODE’)
  • agent-based simulation
  • AI models, such as using autoencoders [Wikipedia: autoencoder]

The simplest epidemic models choose variables that predict the amounts of people in various stages of the disease. People move (permanently) from one compartment towards the final compartment, which is ‘Recovered’. A recovered person means one who has either gotten immune (healthy), or died.

People always thus essentially end up in the Recovered state. This means also that these kind of models assume the epidemic goes through 100% of the people; for an individual, thus, the question wouldn’t be “whether I will get infected”, but “when (is it) I will get infected”.

In real life, there’s actually only a few things that potentially can prevent an infection from ever happening. One of those is that during the epidemic, a vaccine is found. Thus this would “freeze” the situation (number of population allocated into each compartments), given that the nations have funds to provide vaccination and given that everyone is willing to get vaccinated.

Thus an epidemic has a few interesting elements to it:

  • properties of the virus
  • sociology of a population, among which the virus is spreading
  • remedies available to stop the virus spreading
  • effectiveness of communicating the correct information and situational awareness to target population
  • availability and cost of the cure, if a person has gotten Infected
Photo by CDC on Unsplash

One of the most famous model, a set of differential equations, is called SIR model. SIR is a “compartmental model”: it places people into exactly one compartment at any given time. In SIR, for example, people can be:

  • Susceptible
  • Infected
  • Resolved

Actual, recognizable individuals (single people) are not “tracked” in these models – rather; the numbers of people in each compartment are calculated as function of time. So the model itself doesn’t identify individuals who are infected, but the use of the model is fed with real numbers. The statistics of infected (tested) people gives epidemiologists, citizens and any stakeholders during the management and containment a lot of important information.

Population models produce numeric results that can be plotted as curves.

Contained population: sum S+I+R

There’s one particular limitation set in SIR model, by design: the sum of compartmentalized populations is constant, and equal to initial population of the study:

  • in SIR model, summing S+I+R is always constant => equal to the initial population
  • thus in SIR model, births are not allowed
  • “R” includes both cured (immune) and deaths

These models were largely formulated in 1927.

Recipe for using SIR epidemiologic model

  • initialize all 3 compartments to values (populations)
  • define 4 parameters for the differential equations
  • there will be 3 differential equations, one for each population
  • in SIR, the populations are S=susceptible (healthy), I = infected, R = recovered
  • run a ODE solver algorithm, usually provided as part of your programming language of choice
  • for example, R language has “deSolve” libary and a ode() function, for example
  • for R language, there’s also ready-made code libraries for the particular SIR model; for example, one called EpiDynamics
  • ode() or the appropriate modeling function returns as result the values of each function (corresponding to one function per compartment)
  • you can plot the functions, all on a same diagram (axes t for time, and autoscaling Y axis as per quantity) to get an overall image of how the epidemic turns out

Some suggested reading

Btw. Getting R for experimenting with math modeling – it’s a snap! It took me less than 15 minutes to install both free RStudio and the underlying R programming environment. Definitely recommended!

CompSci_Studies · webdevelopment

Non-functional items in Branding through software

Reading Time: 2 minutes“How the perception of quality of software is affected
by other merits than core technical features and the code”


– sales techniques
– initial approach and product presentation
– management of customer expectations
– matching the sales process and its promises with operations
– simple and effective communications in presenting solutions

Software in-line documents: comments lines

Some of the g2g communication is within source code comment lines.

– comments being to the point: don’t blabber
– aim your comments covering 2-10% of total line count (SLOCs)
– comment contents should be useful for developer or other stakeholder (designers, users involved in customizing)
– positive points: score by checking your commentary is not bloated, repetitive, unnecessary

Quality of the payload code

linted with appropriate tool
– advanced: metrics with SonarQube or other dashboarding tools
– make sure there’s really an active process to make sure code stays well maintained / “hygienic”
– don’t fall to the “just letting metrics be”, do TAKE ACTION. Let my experience speak: technical debt never goes down automatically.
– scanning using programmatic methods
– human perception of the code: ask your colleague for code review
– self-explanatory, or perceived throught architectural documentation?

– in open-source projects, code quality comes in 2 senses:
– the actual code (payload)
– comments
– other possible artefacts that are in the repository

Do code Commit patterns matter?

– commit pattern means the temporal distribution of developer’s effort
– a commit means “uploading” to the central repository part of new code
(or fix) from a developer’s computer
– does the client see and care about something in when and by whom the
‘git commits’ are done?
– there may not yet be actually any hard science on the research of commit
patterns and how they affect code quality
– different software corporations and/or teams might have conventions on this

CompSci_Studies · Uncategorized

BSc thesis memo

Reading Time: < 1 minuteWhy Software Security matters?

We’re entering a world where software makes a great deal of our daily lives. Software is a critical part of both “actually useful” as well as the trivial and fun stuff in our lives.
Nevertheless, in both cases we’d like to be assured of certain things: that a life-saving thing like the brakes of our car, or the control unit of an elevator, or the software used by air traffic controllers (ATC personnel).

What on earth is this?

Continue reading “BSc thesis memo”