Covid-19 and Health System Capacity

Covid-19 and Health System Capacity preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Tags

covid-19 

Tagged by Antônio Ralph Medeiros de Sousa over 4 years ago

sars-cov-2 

Tagged by Antônio Ralph Medeiros de Sousa over 4 years ago

virus_spread 

Tagged by Antônio Ralph Medeiros de Sousa over 4 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.0 • Viewed 788 times • Downloaded 35 times • Run 0 times
Download the 'Covid-19 and Health System Capacity' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  interaction-zone         ;; The patches representing the area of social interactions in the world
  quarantine               ;; The patches representing the humans are in quarantine
  hospital                 ;; The patches representing the hospital with severe cases of the disease
  upper-border             ;; The borders of interaction-zone
  lower-border
  crowded-patch            ;; The patch where the "CROWDED" label appears
  patients                 ;; Infected people being trated in the hospital
  count-infected           ;; Cumulative number of infected people
  count-symptomatic        ;; Cumulative number of infected and symptomatic people
  r0                       ;; The number of secondary infections that arise due to a single infective introduced in a wholly susceptible population
  s0                       ;; Initial population of susceptible people
  hospital-patch           ;; The patch where the "HOSPITAL" label appears
  quarantine-patch         ;; The patch where the "QUARANTINE" label appears
]

breed [humans human]

humans-own
[susceptible?             ;; If true, the human is susceptible.
 exposed?                 ;; If true, the human is infected but in latent period
 infected?                ;; If true, the human is infected and infectious
 immune?                  ;; If true, the human is immune
 symptomatic?             ;; If true, the infected human is symptomatic
 hospitalized?            ;; If true, the infected and symptomatic human will be hospitalized
 protect?                 ;; If true, the human is protecting himself from infection
 need-hospital?           ;; If true, an infected and symptomatic human will need a hospital
 isolated?                ;; If true, an infected human will be isolated in quarantine
 risk-population?         ;; The proportion of the population at risk of severe disease (i.e. old people, pre-existing chronic disease)
 latent-period            ;; The latent period of the virus
 viremic-time             ;; The time in days that individuals will be infectious and can transmit the virus to others
 ]


;;;;;
;;; SETUP PROCEDURES
;;;;;

to setup
  clear-all
  setup-globals
  setup-host
  reset-ticks
end 

to setup-globals
  ;; creating interaction-zone patches
  set interaction-zone patches with [(pxcor >= min-pxcor and pycor < int (max-pycor - (max-pycor / 2)) and pycor > min-pycor)]
  ask interaction-zone [ set pcolor gray ]

  ;; creating quarantine patches
  set quarantine patches with [(pxcor > (0.5 * min-pxcor) and pycor > int (max-pycor - (max-pycor / 2)) )]
  ask quarantine [set pcolor green ]

  ;; creating hospital patches
  set hospital patches with [(pxcor >= min-pxcor and pxcor <= (0.5 * min-pxcor) and pycor > int (max-pycor - (max-pycor / 2)))]
  ask hospital [set pcolor pink ]

  ;; creating border patches
  set upper-border patches with [(pycor = int (max-pycor - (max-pycor / 2)))]
  ask upper-border [ set pcolor gray ]
  set lower-border patches with [(pycor = min-pycor)]
  ask lower-border [ set pcolor gray ]

  ;; selecting patches where labels will appear
  ask patch (0.7 * min-pxcor) ( 0.8 * max-pycor) [
    set crowded-patch self
    set plabel-color black]
  ask patch (0.7 * min-pxcor) ( 0.95 * max-pycor) [
    set hospital-patch self
    set plabel "HOSPITAL"
    set plabel-color black]
  ask patch (0.3 * max-pxcor) ( 0.95 * max-pycor) [
    set quarantine-patch self
    set plabel "QUARANTINE"
    set plabel-color black]
end 

to setup-host
  ;; creating people and moving them to interaction-zone patches
  create-humans initial-people
  [ask humans [move-to one-of interaction-zone]
   set shape "person"
   set size 0.5
   set infected? false
   set immune? false
   set susceptible? true
   set exposed? false
   set risk-population? false
   set symptomatic? false
   set hospitalized? false
   set protect? false
   set need-hospital? false
   set isolated? false
   ]

   ;; selecting initial number of infected people
   ask n-of initial-infected humans [
    set susceptible? false
    set infected? true]
  ;; selecting people who will be less exposed to infection due to individual protection measures
  ask n-of (initial-people * proportion-of-population) humans [set protect? true]

  ;; selecting people who will belong to the risk group
  ask n-of (initial-people * risk-group) humans [set risk-population? true]

  ask humans [assign-color]
end 

to assign-color  ;; The colors for represent the virus circulation and individual status
    if susceptible? [ set color white ]
    if exposed? [ set color yellow ]
    if infected? [ set color red ]
    if immune? [ set color blue ]
end 

;;;;;
;;; GO PROCEDURES
;;;;;

to go
  ask crowded-patch [ set plabel "" ]
  move-humans
  if all? humans [ not exposed? and not infected? ] [stop]  ;; stopping the simulation

  ask humans with [exposed?] [become-viremic]
  ask humans with [infected?] [infect-others symptom]
  ask humans with [symptomatic?] [recovery-or-die]
  ask humans [if hospitalized? and immune? [move-to one-of interaction-zone]] ;; people who recovered at the hospital go back to interaction-zone
  ask humans with [symptomatic?] [check-for-hospital go-to-hospital]

  set patients count turtles-on hospital
  if patients > hospital-capacity [ask crowded-patch [ set plabel "CROWDED" ]] ;; If the hospital have more patients than it can handle, the label "CROWDED" will appear

  ;;Infected people who are detected will be quarantined (but only after the start of control measures).
  if isolate-infected? [ask humans with [infected? and not hospitalized?]
    [if ticks >= days-to-start-control-measures [
      if random 100 < infected-detection [
      move-to one-of quarantine
      set isolated? true]]]]

  ask humans-on quarantine [if immune? [move-to one-of interaction-zone set isolated? false]] ;; people who recovered in the quarantine go back to interaction-zone

  calculate-r0
  tick
end 

;; People move around the world randomly, but they don't move around in the quarantine and in the hospital patches.

to move-humans
    ask humans-on interaction-zone
    [rt random-float 360.0
    forward random-float 1
    assign-color]
    ask humans-on upper-border [
    move-to patch-at-heading-and-distance 180 1
    assign-color]
    ask humans-on lower-border [
    move-to patch-at-heading-and-distance 180 -1
    assign-color]
    ask humans-on hospital[
     assign-color ]
    ask humans-on quarantine [
      assign-color]
end 

;; Infected people can infect susceptible ones

to infect-others
 ;; selecting a susceptible target in neighbor patches
 let target-h (humans-on neighbors)
 let hosth one-of (target-h with [susceptible?])

  ;; The chance of a susceptible person becoming infected will depend on the transmission rate and whether or not he is protecting himself from the transmission.
  if hosth != nobody [
  ifelse not protect? [
   if random-float 1 < transmission-rate [
    ask hosth [
      set susceptible? false
      set exposed? true
      set count-infected count-infected + 1
    ] ] ]
      [ if ticks < days-to-start-control-measures [
      if random-float 1 < transmission-rate [
      ask hosth [
      set susceptible? false
      set exposed? true
      set count-infected count-infected + 1
      ] ] ]
      if ticks >= days-to-start-control-measures [
      if random-float 1 < (transmission-rate * (1 - protection-level)) [
      ask hosth [
      set susceptible? false
      set exposed? true
      set count-infected count-infected + 1
      ] ] ]
  ] ]
end 

;; A human who has been infected with the virus will become infectious after the latency period

to become-viremic
  set latent-period latent-period + 1
  if latent-period > random-poisson 3 [  ;; An average latency period of 3 days was considered here
     set infected? true
     set exposed? false
     ]
end 

;; A given proportion of infected people will become symptomatic

to symptom
  set viremic-time viremic-time + 1

  ;;It was considered that the first symptoms may appear in 2 days after the virus latency period, which means an incubation period of 5 days on average.
  if viremic-time = 2 [
  if random 100 < symptomatic-proportion [
    set symptomatic? true
    set count-symptomatic  count-symptomatic + 1
  ]]

  ;; asymptomatic people become immune after recovery time
    if viremic-time = recovery-time and not symptomatic? [
      set infected? false
      set immune? true
      ]
end 

;; Check if infected-symptomatic people need a hospital

to check-for-hospital
 ifelse risk-population? [
    if random 100 < 20 [  ;; For the people of the risk group, a 20% chance of needing a hospital was considered
      set need-hospital? true]]
   [if random 100 < 5 [   ;; For people who are not of risk group, a 5% chance of needing a hospital was considered
    set need-hospital? true ]]
end 

;; If the Hospital is not crowded, go to it.

to go-to-hospital
  set patients count turtles-on hospital
  if need-hospital? [
   if patients < hospital-capacity + 1 [
      move-to one-of hospital
      set hospitalized? true]]
end 

;; After a few days, infected symptomatic people may recover from illness or die
;; This will depend on the severity of the case (need-hospital?), whether or not the person is hospitalized, and whether or not he belongs to the risk group.

to recovery-or-die
  if need-hospital?
  [
  ifelse not hospitalized?
    [
   if viremic-time >= random-poisson recovery-time * 1.5  ;; severe cases will take 50% more time to recover
      [
     if risk-population?
        [
       ifelse random 100 < random-poisson 20 [    ;;people in the risk group who need a hospital and are not hospitalized have an average 20% chance of surviving
        set infected? false
        set symptomatic? false
        set immune? true
        set need-hospital? false]
       [ die ]]
     if not risk-population?
        [
       ifelse random 100 < random-poisson 60      ;;people who are not in the risk group who need a hospital and are not hospitalized have an average 60% chance of surviving
          [
        set infected? false
        set symptomatic? false
        set immune? true
        set need-hospital? false]
        [ die ]]]]

  [if viremic-time >= random-poisson recovery-time * 1.5
      [
    if risk-population?
        [
       ifelse random 100 < (100 - random-poisson 7)  ;; people who are the risk group and who are hospitalized have an average 93% chance of surviving
          [
       set infected? false
       set symptomatic? false
       set immune? true
       set need-hospital? false]
       [ die ]]
    if not risk-population?
        [
       ifelse random 100 < (100 - random-poisson 1)    ;; people who are not in the risk group and who are hospitalized have an average 99% chance of surviving
          [
       set infected? false
       set symptomatic? false
       set immune? true
       set need-hospital? false]
       [ die ]]]]]

  if not need-hospital?  ;; Infected-symptomatic people who do not need a hospital will always recover from infection
  [
    if viremic-time >= random-poisson recovery-time
    [
      set infected? false
      set symptomatic? false
      set immune? true
       ]]
end 


;; This R0 is a numerical estimate of the basic reproduction number, as proposed by Uri Wilensky.
;; For more information on how this R0 equation was obtained, see the models 'epiDEM basic' and 'epiDEM travel and control'.

to calculate-r0
  set s0 initial-people - initial-infected

  if ((initial-people - count turtles with [ susceptible? ]) != 0 and (count turtles with [ susceptible? ] != 0))   ;; Prevent from dividing by 0
  [
    set r0 (ln (s0 / count turtles with [ susceptible? ]) / (initial-people - count turtles with [ susceptible? ]))
    set r0 r0 * s0 ]
end 

There is only one version of this model, created over 4 years ago by Antônio Ralph Medeiros de Sousa.

Attached files

File Type Description Last updated
Covid-19 and Health System Capacity.png preview Preview for 'Covid-19 and Health System Capacity' over 4 years ago, by Antônio Ralph Medeiros de Sousa Download

This model does not have any ancestors.

This model does not have any descendants.