COVID-19 SEIRD Farmworkers

COVID-19 SEIRD Farmworkers preview image

1 collaborator

Default-person Lorena Morejon (Author)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 273 times • Downloaded 21 times • Run 0 times
Download the 'COVID-19 SEIRD Farmworkers' 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 area where humans are in quarantine
  hospital                 ;; The patches representing the hospital, where patients are treated
  upper-border             ;; The borders of interaction-zone
  lower-border
  num-patients             ;; Number of humans with severe disease being treated in the hospital
  count-symptomatic        ;; Cumulative number of infected humans that are symptomatic
  r0                       ;; The number of secondary infections that arise due to a single infective introduced in a wholly susceptible population
  s0                       ;; Initial population of susceptible humans
  at-capacity-patch        ;; The patch where the "AT CAPACITY" label appears
  hospital-patch           ;; The patch where the "HOSPITAL" label appears
  quarantine-patch         ;; The patch where the "QUARANTINE" label appears
  num-clusters             ;; Number of patch clusters to form the high-touch areas
]

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
 recovered?               ;; If true, the human is recovered
 deceased?                ;; If true, the human died
 protect?                 ;; If true, the human is protecting himself from infection by following measures
 exposure-from-touch?     ;; If true, the human came in contact with the virus from touching contaminated surface
 symptomatic?             ;; If true, the infected human is symptomatic
 isolated?                ;; If true, an infected human will be isolated in quarantine
 severe?                  ;; If true, an infected human will have severe infection
 hospitalized?            ;; If true, the infected, symptomatic human will be hospitalized
 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
 infectious-period        ;; The time in days that humans will be infectious and can transmit the virus to others
]

patches-own
[
  high-touch-areas       ;; Patches contain high-touch-areas
   ]

;;;
;;; SLIDERS AND SWITCHES
;;;

;;; INITIAL-POPULATION (100 – 1000): Initial number of humans
;;; INITIAL-INFECTED (1 – 10): Initial number of infected humans
;;; INITIAL-RECOVERED (0 - 5): Initial number of recovered humans
;;; SYMPTOMATIC (10 - 100): Percentage of infected humans who will be symptomatic
;;; RISK-GROUP-PROPORTION (0 - 1): Proportion of humans in risk group (ex: elderly, underlying medical condition)
;;; TRANSMISSION-RATE (0.01 – 1): Probability that an infected human will infect a susceptible human
;;; RECOVERY-TIME (7 – 30): Average time in days for humans to recover
;;; BARRIERS-TO-HEALTHCARE (0 - 1): Ability to access hospital, where 0 = complete access and 1 = no access
;;; HEALTHCARE-QUALITY (0 - 1): Quality of healthcare, from poor = 0 to excellent = 1
;;; HOSPITAL-CAPACITY (5 - 20): Maximum number of patients in the hospital simultaneously
;;; DAYS-TO-START-CONTROL-MEASURES (1 - 60): Time in days to start control measures
;;; PROTECTION-LEVEL (0 – 1): Degree of the effectiveness of control measures adopted by the population
;;; FOLLOWING-MEASURES-PROPORTION (0 - 1): Proportion of the population following control measures
;;; MOBILITY (0-1): Distance humans move, where 0 = no movement and 1 = maximum movement
;;; INFECTED-DETECTION (0.01 - 10): Daily percentage of detection and isolation of infected humans
;;; ISOLATE-INFECTED? (switch): When ‘ON’, specified percentage of infected humans will be identified and isolated in quarantine
;;; HIGH-TOUCH-AREAS? (switch): When 'ON', randomized clusters of high-touch areas (in white) will appear in the interaction-zone
;;; DISINFECT? (switch): When 'ON' the probability of infection for a human in a high-touch-area is reduced

;;;
;;; SEED PROCEDURES
;;;

;; Use a seed created by the NEW-SEED reporter

to use-new-seed
  let my-seed new-seed            ;; generate a new seed
  output-print word "Generated seed: " my-seed  ;; print it out
  random-seed my-seed             ;; use the new seed
  reset-ticks
end 

;; Use a seed entered by the user

to use-seed-from-user
  loop [
    let my-seed user-input "Enter a random seed (an integer):"
    carefully [ set my-seed read-from-string my-seed ] [ ]
    ifelse is-number? my-seed and round my-seed = my-seed [
      random-seed my-seed ;; use the new seed
      output-print word "User-entered seed: " my-seed  ;; print it out
      reset-ticks
      stop
    ] [
      user-message "Please enter an integer."
    ]
  ]
end 

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

to clear
  clear-all
end 

to setup
  clear-globals
  clear-ticks
  clear-turtles
  clear-patches
  clear-drawing
  clear-all-plots
  setup-globals
  setup-humans
  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 ]

  ;; setup patches so that they aren't present without high-touch-areas on
  set num-clusters 2

  ask n-of num-clusters patches
  [
  if high-touch-areas?
  [ ask n-of 8 patches in-radius 2  ;; cluster 8 patches in interaction zone close to each other
    [
      set pcolor white      ;; color patches white - high-touch-areas represented
    ]
  ]
  ]

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

  ;; 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 at-capacity-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-humans
  ;; creating humans and moving them to interaction-zone patches
  create-humans initial-population
  [ask humans [move-to one-of interaction-zone]
   set shape "person"
   set size 0.5
   set susceptible? true
   set exposed? false
   set infected? false
   set recovered? false
   set deceased? false
   set protect? false
   set exposure-from-touch? false
   set symptomatic? false
   set isolated? false
   set severe? false
   set hospitalized? false
   set risk-population? false
   ]

   ;; selecting initial number of infected humans
   ask n-of initial-infected humans [
    set susceptible? false
    set infected? true
    set recovered? false]

    ;; selecting initial number of recovered humans
   ask n-of initial-recovered humans [
    set susceptible? false
    set infected? false
    set recovered? true]

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

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

  ask humans [assign-color]
end 

to assign-color  ;; The colors represent the status of the human
    if susceptible? [ set color blue ]
    if exposed? [ set color yellow ]
    if infected? [ set color red ]
    if recovered? [ set color green ]
    if deceased? [ set color black ]
end 


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

to go
  ask at-capacity-patch [ set plabel "" ]
  move-humans
  if all? humans [ not exposed? and not infected? ] [stop]  ;; stopping the simulation
  ask humans [touch-surface]
  ask humans with [exposed?] [become-infectious]
  ask humans with [infected?] [infect-others develop-symptoms]
  ask humans with [symptomatic?] [check-for-hospital go-to-hospital recover-or-die]

  set num-patients count turtles-on hospital
  if num-patients >= hospital-capacity [ask at-capacity-patch [ set plabel "AT CAPACITY" ]] ;; if the hospital has more patients than it can handle, the label "AT CAPACITY" will appear

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

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

  ask humans-on hospital [if recovered? [move-to one-of interaction-zone set hospitalized? false]] ;; humans who recovered at the hospital go back to interaction-zone
  ask humans-on hospital [if deceased? [move-to one-of interaction-zone set hospitalized? false]] ;; humans who died at the hospital go back to interaction-zone

  ask humans with [deceased?] [ set shape "dot"]

  calculate-r0
  tick
end 

;; Humans move around the world, but they don't move around in quarantine and in the hospital (i.e. movement is simply due to humans entering and exiting these regions, not humans within these regions moving)

to move-humans
  ask humans-on interaction-zone

  [ ifelse protect?

  [ if ticks < days-to-control-measures  ;; if human is protect? but control measures have not been implemented yet, human will move normally
   [rt random-float 360.0
    forward 1
    assign-color]
  if ticks >= days-to-control-measures  ;; if human is protect? and control measures have been implemented, human will alter movement according to mobility
  [rt random-float 360.0
    forward mobility
    assign-color]]

    [rt random-float 360.0 ;; if human is not protect? human will move unrestricted regardless of whether control measures have been implemented
    forward 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 

;; Infection can occur to humans who touch high-touch areas and aren't protecting themselves from exposure

to touch-surface
  let touching-humans (turtles-on patch-here)
  with [ not infected? and not recovered? ]

if pcolor = white

 [  ask touching-humans

   [ ifelse protect?

    ;; if human is taking measures to protect from exposure (ex: wearing gloves, not touching uncovered face)
    [  ifelse disinfect?
       [ if random-float 100 < 1     ;; 1% chance of exposure when touching surface with disinfection
         [ set susceptible? false
           set exposed? true
           set exposure-from-touch? true
         ]
       ]
       [ if random-float 100 < 5    ;; 5% chance of exposure when touching surface with no disinfection
          [ set susceptible? false
            set exposed? true
            set exposure-from-touch? true
         ]
       ]
     ]

    ;;if human is not taking measures to protect
    [  ifelse disinfect?
       [ if random-float 100 < 5     ;; 5% chance of exposure when touching surface with disinfection
         [ set susceptible? false
           set exposed? true
           set exposure-from-touch? true
         ]
       ]
       [ if random-float 100 < 20    ;; 20% chance of exposure when touching surface with no disinfection
          [ set susceptible? false
            set exposed? true
            set exposure-from-touch? true
         ]
       ]
     ]
  ]
 ]
end 

;; A human who has been exposed the virus will become infectious after the latent period

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

;; Infected humans can infect susceptible ones

to infect-others
 ;; selecting a susceptible target in neighbor patches
 let nearby-target (humans-on neighbors)
 let nearby-host one-of (nearby-target 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 nearby-host != nobody [
  ifelse not protect? [
   if random-float 1 < transmission-rate [
    ask nearby-host [
      set susceptible? false
      set exposed? true ]
    ] ]
      [ if ticks < days-to-control-measures [
      if random-float 1 < transmission-rate [
      ask nearby-host [
      set susceptible? false
      set exposed? true ]
      ] ]
      if ticks >= days-to-control-measures [
      if random-float 1 < (transmission-rate * (1 - protection-level)) [
      ask nearby-host [
      set susceptible? false
      set exposed? true ]
      ] ]
  ] ]
end 

;; A given proportion of infected humans will become symptomatic

to develop-symptoms
  set infectious-period infectious-period + 1

  ;; considering that the first symptoms may appear 2 days after the virus latent period, incubation period will be 5 days on average
  if infectious-period = 2 [
  if random 100 < symptomatic [
    set symptomatic? true
    set count-symptomatic  count-symptomatic + 1 ]]


  ;; asymptomatic humans become recovered after recovery time
    if infectious-period = recovery-time and not symptomatic? [
      set infected? false
      set recovered? true
      set deceased? false
      ]
end 

;; Check if symptomatic humans need a hospital

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

;; If hospital is not at capacity and can travel to hospital (take into account barriers to health), go to it

to go-to-hospital
   set num-patients count turtles-on hospital
   if num-patients < hospital-capacity * (1 - barriers-to-healthcare)
    [ move-to one-of hospital
      set hospitalized? true]
end 

;; Symptomatic humans may recover from illness or die
;; This will depend on the severity of the case, whether or not the person is hospitalized, and whether or not he belongs to the risk group

to recover-or-die
  if severe?
  [
  ifelse not hospitalized?
    [
   if infectious-period >= random-poisson recovery-time * 2  ;; severe cases will take twice as long to recover
      [
     if risk-population?
        [
       ifelse random 100 < random-poisson 20 [    ;;people in the risk group with severe infection who are not hospitalized have an average 20% chance of surviving
        set infected? false
        set symptomatic? false
        set severe? false
        set recovered? true]
       [ set deceased? true ]]
     if not risk-population?
        [
       ifelse random 100 < random-poisson 60  [   ;;people not in the risk group with severe infection who are not hospitalized have an average 60% chance of surviving
        set infected? false
        set symptomatic? false
        set severe? false
        set recovered? true]
        [ set deceased? true ]]]]

  [if infectious-period >= random-poisson recovery-time * 1.5
      [
    if risk-population?
        [
       ifelse random 100 < (100 - random-poisson 7) * healthcare-quality ;; people in the risk group who are hospitalized have an average 93% chance of surviving (assuming full healthcare quality)
          [
       set infected? false
       set symptomatic? false
       set severe? false
       set recovered? true]
       [ set deceased? true ]]
    if not risk-population?
        [
       ifelse random 100 < (100 - random-poisson 1) * healthcare-quality   ;; people not in the risk group who are hospitalized have an average 99% chance of surviving (assuming full healthcare quality)
          [
       set infected? false
       set symptomatic? false
       set severe? false
       set recovered? true]
       [ set deceased? true ]]]]]

  if not severe?  ;; infected, symptomatic people who do not need a hospital will always recover from infection
  [
    if infectious-period >= random-poisson recovery-time
    [
      set infected? false
      set symptomatic? false
      set recovered? true
       ]]
end 

;; This R0 is a numerical estimate of the basic reproduction number, as proposed by Uri Wilensky (see epiDEM basic and epiDEM travel and control)

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

  if ((initial-population - 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-population - count turtles with [ susceptible? ]))
    set r0 r0 * s0 ]
end 

;;;
;;; TO REPORT PROCEDURES
;;;

to-report num-susceptible
  report (count turtles with [susceptible?])
end 

to-report num-exposed
  report (count turtles with [exposed?])
end 

to-report num-infected
  report (count turtles with [infected?])
end 

to-report num-recovered
  report (count turtles with [recovered? and not deceased?])
end 

to-report num-deceased
  report (count turtles with [deceased?])
end 

to-report total-mortality
  report ((count turtles with [deceased?]) / initial-population) * 100
end 

to-report infected-mortality
  report ((count turtles with [deceased?]) / (initial-population - count turtles with [susceptible?])) * 100
end 

to-report symptomatic-mortality
  report ((count turtles with [deceased?]) / count-symptomatic) * 100
end 

to-report infected-from-touch
  report (count turtles with [exposure-from-touch?])
end 

There is only one version of this model, created over 3 years ago by Lorena Morejon.

Attached files

File Type Description Last updated
COVID-19 SEIR-D Model Paper.pdf pdf An Agent-Based SEIR-D Model of COVID-19: Effects of Risk Factors and Control Measures Relevant to Farmworker Communities over 3 years ago, by Lorena Morejon Download
COVID-19 SEIRD Farmworkers.png preview Preview for 'COVID-19 SEIRD Farmworkers' over 3 years ago, by Lorena Morejon Download
COVID-19 SEIRD PowerPoint Presentation.pdf pdf Powerpoint Presentation over 3 years ago, by Lorena Morejon Download

This model does not have any ancestors.

This model does not have any descendants.