A Python code for the graphical simulation of the propagation of and impact of mitigation measures for Covid-19
This code simulates the propagation of Covid-19 through a graphical representation of a sample population with random motion.
The model used in the code incorporates a number of key assumptions and probabilities which are to be carefully noted. While the purpose of the code is for illustration only, its output should not be used unless specific assistance is sought from experts in the field of epidemiology. Any part of the code may be used provided reference is made to the present code.
Given a random sample of people comprising young people, elderly and those in Care Home, the code uses random motion to simulate the progagation of the disease given an initial number of infected persons. Through close contact, the desease is spread throughout the sample. Detection of infected people can be evoked and those detected sent to Quarantine/Hospital where they have to spend 14 days. Depending on the extent of detection, some infected people will remain in the sample. From hospital, those infected can either recover and go back to the main sample, or be sent to an Intensive Care Unit (ICU), where some may pass away. Those who recovered are assumed to be immuned.
First, the effect on the propagation, of a specified proportion of the sample wearing Personal Protection Equipmemt (PPE), such as face mask; and
In each case, the period during which these measures can be specified. In this way easing of a lockdown can be modelled.
The detailed required inputs are illustrated further below through a built-in GUI. Essentially, the sample size, the composision of the sample in terms of yound and old people, including those residing in Care Homes, the number of people initially infected, the extent of testing available, and the effectiveness of PPE and Social Distancing.
The main output is an Animated Graphical Illustration of the random motion of then sample population which also dispalys the propagation of the disease to those who are not infected. The graphical display includes a main area for the randomised motion and also two other designated areas for the Quarantin/Hospital, and ICU respectively. The model persons change colour depending on their status of health.
A 'live' plot shows the daily rate of infection as well as data pertaining to those who are moved to quarantine and the ICU.
Convergence is achieved when there are no new infection for 14 consecutive days and there are no infected persons in the sample. If these conditions are not met, the code should be terminated manually.
In the final output, graphical data over the specified number of days regarding the following can be obtained:
AT CONVERGENCE:
DAYS TO CONVERGE*: 123
:
People sample Size: 902
Number of Elderly: 180
Number of young: 722
Number in Elderly in Care Home: 9
****:
Total Number of Infected: 551
Total Number of Non-Infected Young People: 270
Total Number of Non-Infected Elderly People: 77
Total Number of Non-Infected Care Home patients: 4
*****:
Cummulative Number of people admitted to Qua/Hospital: 546
Number of Elderly in Qua/Hospital on convergence day: 2
Number of Young in Qua/Hospital on convergence day: 1
******:
Cummulative Number who Recovered: 480
Number of Young who recovered: 404
Number of Elderly who recovered: 76
*******:
Cummulative Number in ICU patients on convergence day: 68
Number of Young in ICU: 22
Number of elderly in ICU: 45
Number of Care Home patient in ICU: 1
********:
Total Number of Deaths: 37