Agent-based Model of Hand, Foot, and Mouth Disease in a Daycare

Agent-based Model of Hand, Foot, and Mouth Disease in a Daycare preview image

3 collaborators

Default-person Bonnie Jacob (Author)
Victoria McGraw (Author)
Alexandra Eguiluz (Author)

Tags

daycare 

Tagged by Bonnie Jacob about 4 years ago

virus 

Tagged by Bonnie Jacob about 4 years ago

virus-spread 

Tagged by Bonnie Jacob about 4 years ago

virus_spread 

Tagged by Bonnie Jacob about 4 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 365 times • Downloaded 23 times • Run 0 times
Download the 'Agent-based Model of Hand, Foot, and Mouth Disease in a Daycare' modelDownload this modelEmbed this model

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


## WHAT IS IT?

This model is a part of a research study conducted at Rochester Institute of Technology named ``Agent-Based Modeling of Hand, Foot, and Mouth Disease.'' Hand, Foot, and Mouth Disease (HFMD) is a contagious viral infection caused by coxsackievirus and other viruses from the enteroviruses genus. The software shows how the contagious viral illness spreads in a childcare center. In particular, it explores the interactions made between infected and susceptible children, teachers and adults, and one type of intervention policy requiring symptomatic individuals to remain isolated from the daycare for a set time period.

## HOW IT WORKS

Setup:

In the childcare center, there are sixteen possible classrooms of three types: infant (8 weeks - 18 months), toddler (18 months - 3 years) and preschool (3 - 4 years). The top row in the view has up to four infant rooms with eight children per room. The second row from the top has up to four toddler rooms with ten children each. And the bottom two rows has up to eight rooms for preschool aged children with fourteen per room. Each classroom has two teachers that take care of the children on a daily basis. There are floaters that are randomly assigned to different rooms throughout the daycare. There are a set number of randomly generated sibling pairs among the children in the daycare as well. Additionally, if there is more than one room of any type, then there is a random assignment of links between children of different rooms to designate children who are dropped off early and wait in a combined room until more children arrive. Three link breeds are used to define the links of siblings, and then two links for the two schedules of the weekdays that teachers and floaters rotate room assignments with.

People:

Children, teachers and floaters who are susceptible (colored black) have a possibility of catching HFMD and can either get sick or stay healthy. Infected people go into a latent period (colored red) that last 3-7 days. Infected people colored blue are symptomatic (show symptoms) while people who are colored green are asymptomatic (no symptoms). Purple-colored people have become recovered and are considered immune. There is a portion of the adult population in the daycare that are already immune.

Virus Spread:

Each day, all possible contacts by which HFMD can spread generates a probability that the virus spreads or not. This varies based on the day of the week. Then the sickness is advanced for each individual, and, if the intervention policy is enforced, any symptomatic individuals are removed from the daycare for a set number of days. Each time step (tick) represents a day.

## HOW TO USE IT

The system created is a NETWORK that shows are everyone in the daycare is linked and have a possibility of catching the contagious illness.

To Define the Settings of the Virus Spreading

The slider NUMBER-OF-IN-LATENT-PERIOD gives the user the option to choose how many people (from the ten available) in the childcare center should be infected with HFMD at first.

The slider VIRUS-SPREAD-CHANCE enables the user to determine how high or low the possibility of HFMD spreading in the childcare center.

The slider PERCENT-IMMUNE sets a percentage of the adult population (teachers and floaters) as immune previous to the virus spreading.

The slider MEAN-SYMPTOM-RECOVERY-TIME allows a range of days to define probable mean symptomatic recovery time of symptomatic individuals.

The slider MAX-ASYMPTOMATIC-TIME enables the user the ability to assign the length of days for the lingering infectious chance in asymptomatic individuals.

The switch REMOVE-SYMPTOMATIC-INDIVIDUAL? enforces an intervention policy in which symptomatic infected individuals and their siblings are removed from the daycare for a set number of days.

The slider DAYS-IN-ISOLATION is the number of days an individual must remain away from the daycare when the intervention policy is enforced and includes the weekend in the number of days.

To Define the Settings of the Daycare

The slider NUMBER-OF-INFANT-ROOMS defines the number of rooms in the daycare for infants.

The slider NUMBER-OF-TODDLER-ROOMS defines the number of rooms in the daycare for toddlers.

The slider NUMBER-OF-PRESCHOOL-ROOMS defines the number of rooms in the daycare for preschoolers.

The slider SIB-PAIRS enables the user to define how many sibling pairs are in the daycare.

The slider NUMBER-OF-FLOATERS gives flexibility to designate the number of floaters working in the daycare.

The slider MAX-ROOMS-PER-FLOATERS provides the user the ability to designate how many rooms a floater works between during a day.

Other Features

The switch SEE-LINKS? turns the links visible to see the defined connections between individuals in the daycare.

The monitors inform users of the total number of individuals and children in the daycare based on the chosen daycare settings.

The NETWORK plot enables users to observe the % OF NODES (children, teachers and student workers) infected or not with HFMD over time.

After Sliders and Switches are Selected

Select the SETUP button to set all the connections and infected individuals, then select the GO button to run the simulation.

## THINGS TO NOTICE

Estimations and Probability Distributions Used

There is a lack of information surrounding the transmissibility and other properties of HFMD. Many sources detail that a regression analysis of many infectious diseases fits a Poisson distribution, so that is the distribution used to determine the spread of infection in the virus-spread, virus-spread-off-schedule, and virus-spread-on-weekend procedures (Chen),(Wang).

The advance-sickness process goes through the range of days of incubation from 3 to 8 and generates a random probability with a lognormal distribution as to whether or not the turtle will leave the latent period with a mean of 4.4 days as it is an estimated amount of time and best fit probability distribution for children in kindergarten (Yang). Since most sources believe the average latent period is 3 to 7 days, the code forces all turtles who have not left the latent stage after 8 days to leave it (Chen).

The randomly generated number to decide whether a turtle becomes symptomatic or asymptomatic infected is determined as the percentage of people infected being symptomatic (Koh). There has also been found that a gamma distribution fits the probability that an individual will recover from being symptomatic within a week (Yang).

During the Simulation

Once the illness has stopped spreading, there may be some people (colored black) who remain. This means that they did not catch HFMD and remained susceptible all throughout.

What is the percentage of susceptible (black) to recovered and immune (purple)?

When the intervention policy is applied, is there a noticeable difference in the spread of the virus?

How does changing the daycare structure (number of rooms or floaters) affect the virus spread?

## THINGS TO TRY

Set the NUMBER-OF-IN-LATENT-PERIOD slider to one and run the program. How many people were infected and recovered over time? Try repeating the same procedure but with different number of people in the latent period and see how many people stay susceptible and how many recovered and immune. What happens when the other sliders for the virus spread are adjusted?

Set the NUMBER-OF-FLOATERS and the MAX-ROOMS-PER-FLOATERS sliders to different combinations and run the program. The floaters can be the connecters between room types. How do these factors affect the virus spreading?

Trying turning the switch REMOVE-SYMPTOMATIC-INDIVIDUAL? off. How does the intervention policy affect the virus spread?

## EXTENDING THE MODEL

The model only takes into account students, teachers and student workers. What if more people were to be added such as cooks, administrators, or parents? Would the illness be even more prevalent in childcare centers than it already is with students, teachers and student workers? What if possible weekend connections between children were included? Are there other closing policies that a daycare could implement? When better estimations and distributions become available, does changing those factors impact the current model estimations? What is the impact of vacations on the virus spread?

## NETLOGO FEATURES

The link breed feature is used to define links based on schedules for the daycare workers and siblings. The use of variables based on links and people are also used to define what connections to spread the virus over as well as what rooms and stage for the virus any particular individual is in.

The random Poisson number generator is limited to generating the x-value of the distribution whereas with the structure of this model, the probability was needed. At the end of the code, a Poisson distribution function was defined to be able to generate the probabilities with, and, since the random-number generator is constricted within a certain number of probabilities possible to be generated, the thresholds were set to the amounts within the range of the probabilities that would give the estimated ratios of the spread between the ages and stages of the turtles within the daycare. A lognormal distribution was also needed and constructed at the end of the code. The last work around was where to put all the rooms in the daycare for better visibility, so the locations had to be predesignated much like rooms in a daycare, so each room has its own place and cannot be moved around.

## RELATED MODELS

- Virus on a Network

- Virus

- Spread of Disease

## HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

McGraw, V, Eguiluz, A, and Jacob, B (2020). NetLogo Modeling of Daycare HFMD Spread.

Please cite the NetLogo software as:

Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

## CREDITS AND REFERENCES

Backhausz, A. and Bognar, E. (Feb 2020). “Virus Spread and Voter Model on Random Graphs with Multiple Type Nodes.”

Chadsuthi, S. and Wichapeng, S. (June 2018). “The Modelling of Hand, Foot, and Mouth Disease in Contaminated Environments in Bangkok, Thailand.”

Chen, Y., et al. (Oct 2018). “The Effect of School Closure on Hand, Foot, and Mouth Disease Transmission in Singapore: A Modeling Approach.” The American Journal of Tropical Medicine and Hygiene. 99(6): 1625-1632.

Esposito, S. and Principi, N. (2018). “Hand, foot, and mouth disease current knowledge on clinical manifestations, epidemiology, aetiology and prevention.” European Journal of Clinical Microbiology and Infectious Diseases. 37, 391-398.

Koh, W., et al. (Oct 2016). “The Epidemiology of Hand, Foot and Mouth Disease in Asia.” Pediatric Infectious Disease Journal. 35(10): 285-300.

Wang, Y., et al. (Nov 2012). “Hand, Foot and Mouth Disease in China: Patterns of Spread and Transmissibility during 2008-2009.” Epidemiology.

Wilensky, U. & Stroup, W. (1999). HubNet. http://ccl.northwestern.edu/netlogo/hubnet.html. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.

Yang, Z, et al. (Nov 2017). “Estimating the incubation period of hand, foot and mouth disease for children in different age groups.” Scientific Reports.

Comments and Questions

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

Click to Run Model

;; Hand, Foot, and Mouth Disease will be represented throughout the code as "HFMD"

turtles-own [

  in-latent-period?    		 ; high spread chance while infected
  infected-symptomatic?    ; infected and showing symptoms of HFMD
  infected-asymptomatic?   ; infected and not showing symptoms of HFMD
  immune?									 ; immune to HFMD
  adult?                   ; includes teachers and student workers

  early-drop-off?					 ; designates the children who are in a combined room
  group-id								 ; id number to designate which room each turtle is in
  latent-period-time			 ; time for each of the states of HFMD
  infected-symptomatic-time
  infected-asymptomatic-time
  self-isolation-time			 ; time that a symptomatic turtle spends with links not active
]

;Group-Ids go from left to right in the view
;Infant Rooms have Group-Ids 0-3 (Top Row)
;Toddler Rooms have Group-Ids 4-7 (Second Row from Top)
;Preschool Rooms have Group-Ids 8-15 (Bottom Two Rows)

links-own [
  active?					; allows for isolation policy, spreading only occurs on active links
]

globals [
  group-list			; Variable of group-ids for the floaters to choose from
  infant-list			; Variable of group-ids for each of the room types
  toddler-list		
  preschool-list	
  total-people		; Calculates the total number of people in the daycare
  total-kids			; Calculates the total number of kids in the daycare
  day-of-week			; Variable that keeps track of the weekday
]

;The link-breeds define particular connections
undirected-link-breed [siblings sibling]				 ; Connects siblings
undirected-link-breed [friendships friendship]	 ; Connects each room group and floaters with their Monday, Wednesday, and Friday (MWF) scheduled rooms
undirected-link-breed [floatfriends floatfriend] ; Connects floaters with the Tuesday and Thursday (TR) scheduled rooms

breed [teachers teacher]
breed [floaters floater]

to setup
  clear-all
  ask patches [set pcolor white]
  set-default-shape turtles "person"
  set-default-shape teachers "circle"
  set-default-shape floaters "star"

  ; Set up the infant rooms
  let i 0
  while [ i < number-of-infant-rooms ] [
    create-turtles 8 [set group-id i]
    ask turtles with [group-id = i] [
      create-friendships-with turtles with [group-id = i and self != myself] ]
    create-teachers 2 [set group-id i]
    ask teachers with [group-id = i] [
      create-friendships-with turtles with [group-id = i and self != myself] ]
    set i (i + 1)
  ]
  layout-circle turtles with [group-id < 4] (3)
   ask turtles with [group-id = 0] [
    setxy xcor - 12 ycor + 12]
   ask turtles with [group-id = 1] [
    setxy xcor - 4 ycor + 12]
   ask turtles with [group-id = 2] [
    setxy xcor + 4 ycor + 12]
   ask turtles with [group-id = 3] [
    setxy xcor + 12 ycor + 12]

  ; Set up the toddler rooms
  let j 0
  while [ j < number-of-toddler-rooms ] [
    create-turtles 10 [set group-id (j + 4)]
    ask turtles with [group-id = (j + 4)] [
      create-friendships-with turtles with [group-id = (j + 4) and self != myself]]
    create-teachers 2 [set group-id (j + 4)]
    ask teachers with [group-id = (j + 4)] [
      create-friendships-with turtles with [group-id = (j + 4) and self != myself]]
    set j (j + 1)
  ]
  layout-circle turtles with [group-id > 3] (3)
   ask turtles with [group-id = 4] [
    setxy xcor - 12 ycor + 4]
   ask turtles with [group-id = 5] [
    setxy xcor - 4 ycor + 4]
   ask turtles with [group-id = 6] [
    setxy xcor + 4 ycor + 4]
   ask turtles with [group-id = 7] [
    setxy xcor + 12 ycor + 4]

  ; Set up the pre-schooler rooms
  let k 0
  while [ k < number-of-preschool-rooms ] [
    create-turtles 14 [set group-id (k + 8)]
    ask turtles with [group-id = (k + 8)] [
      create-friendships-with turtles with [group-id = (k + 8) and self != myself]]
    create-teachers 2 [set group-id (k + 8)]
    ask teachers with [group-id = (k + 8)] [
      create-friendships-with turtles with [group-id = (k + 8) and self != myself]]
    set k (k + 1)
  ]
  layout-circle turtles with [group-id > 7] (3)
   ask turtles with [group-id = 8] [
    setxy xcor - 12 ycor - 4]
   ask turtles with [group-id = 9] [
    setxy xcor - 4 ycor - 4]
   ask turtles with [group-id = 10] [
    setxy xcor + 4 ycor - 4]
   ask turtles with [group-id = 11] [
    setxy xcor + 12 ycor - 4]
   ask turtles with [group-id = 12] [
    setxy xcor - 12 ycor - 12]
   ask turtles with [group-id = 13] [
    setxy xcor - 4 ycor - 12]
   ask turtles with [group-id = 14] [
    setxy xcor + 4 ycor - 12]
   ask turtles with [group-id = 15] [
    setxy xcor + 12 ycor - 12]
	
  ; Differentiate kids and adults and set all turtles not in the early drop off group
  ask turtles [set adult? false]
  ask teachers [set adult? true]
  ask turtles [set early-drop-off? false]

  ; Create the sibling pairs
  ask n-of sib-pairs turtles with [(not adult?)] [
    create-siblings-with n-of 1 turtles with [(not adult?) and self != myself]]
	ask turtles [
    ask sibling-neighbors [
      create-siblings-with other [sibling-neighbors] of myself]
  ]

  ; Create the floaters and their links for the two schedules: MWF and TR
  ; First, define what rooms are being used
  set group-list [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
  if (number-of-preschool-rooms < 8) [
    set group-list remove-item 15 group-list]
  if (number-of-preschool-rooms < 7) [
    set group-list remove-item 14 group-list]
  if (number-of-preschool-rooms < 6) [
    set group-list remove-item 13 group-list]
  if (number-of-preschool-rooms < 5) [
    set group-list remove-item 12 group-list]
  if (number-of-preschool-rooms < 4) [
    set group-list remove-item 11 group-list]
  if (number-of-preschool-rooms < 3) [
    set group-list remove-item 10 group-list]
  if (number-of-preschool-rooms < 2) [
    set group-list remove-item 9 group-list]
  if (number-of-preschool-rooms < 1) [
    set group-list remove-item 8 group-list]
  if (number-of-toddler-rooms < 4) [
    set group-list remove-item 7 group-list]
  if (number-of-toddler-rooms < 3) [
    set group-list remove-item 6 group-list]
  if (number-of-toddler-rooms < 2) [
    set group-list remove-item 5 group-list]
  if (number-of-toddler-rooms < 1) [
    set group-list remove-item 4 group-list]
  if (number-of-infant-rooms < 4) [
    set group-list remove-item 3 group-list]
  if (number-of-infant-rooms < 3) [
    set group-list remove-item 2 group-list]
  if (number-of-infant-rooms < 2) [
    set group-list remove-item 1 group-list]
  if (number-of-infant-rooms < 1) [
    set group-list remove-item 0 group-list]

  ; Second, create floaters and their MWF and TR rooms by link breeds
  create-floaters number-of-floaters
  ask floaters [
    set adult? true
    set early-drop-off? false]
  repeat max-rooms-per-floater [
  ask floaters [set group-id one-of group-list]
  ask floaters [
    create-friendships-with turtles with [group-id = [group-id] of myself and (not adult?)]]]
  repeat max-rooms-per-floater [
  ask floaters [set group-id one-of group-list]
  ask floaters [
    create-floatfriends-with turtles with [group-id = [group-id] of myself and (not adult?)]]]
  ask floaters [setxy random-xcor mod 10  random-ycor mod 10 ]
  ask floaters [move-to one-of turtles with [group-id = [group-id] of myself]]
  ask floaters [fd 3] ; Offset floater location, so they are close to one of the group they are linked to

  ; Now to create links of those in the combined room
  ; First, define the rooms being used for each type
  set infant-list [0 1 2 3]
  if (number-of-infant-rooms < 4) [
    set infant-list remove-item 3 infant-list]
  if (number-of-infant-rooms < 3) [
    set infant-list remove-item 2 infant-list]
  if (number-of-infant-rooms < 2) [
    set infant-list remove-item 1 infant-list]
  if (number-of-infant-rooms < 1) [
    set infant-list remove-item 0 infant-list]

  set toddler-list [4 5 6 7]
  if (number-of-toddler-rooms < 4) [
    set toddler-list remove-item 3 toddler-list]
  if (number-of-toddler-rooms < 3) [
    set toddler-list remove-item 2 toddler-list]
  if (number-of-toddler-rooms < 2) [
    set toddler-list remove-item 1 toddler-list]
  if (number-of-toddler-rooms < 1) [
    set toddler-list remove-item 0 toddler-list]

  set preschool-list [8 9 10 11 12 13 14 15]
  if (number-of-preschool-rooms < 8) [
    set preschool-list remove-item 7 preschool-list]
  if (number-of-preschool-rooms < 7) [
    set preschool-list remove-item 6 preschool-list]
  if (number-of-preschool-rooms < 6) [
    set preschool-list remove-item 5 preschool-list]
  if (number-of-preschool-rooms < 5) [
    set preschool-list remove-item 4 preschool-list]
  if (number-of-preschool-rooms < 4) [
    set preschool-list remove-item 3 preschool-list]
  if (number-of-preschool-rooms < 3) [
    set preschool-list remove-item 2 preschool-list]
  if (number-of-preschool-rooms < 2) [
    set preschool-list remove-item 1 preschool-list]
  if (number-of-preschool-rooms < 1) [
    set preschool-list remove-item 0 preschool-list]

  ; Second, combine children and then schedule two sets of teachers (one pair for MWF and one pair for TTh)
  if (number-of-infant-rooms > 1)[
    let a one-of infant-list
    let b one-of infant-list
    ask n-of (random 8) turtles with [(group-id = 0) or (group-id = 1) or (group-id = 2) or (group-id = 3) and (not adult?)] [
      set early-drop-off? true]
    ask turtles with [(group-id = 0) or (group-id = 1) or (group-id = 2) or (group-id = 3) and early-drop-off?] [
      create-friendships-with turtles with [(group-id = 0) or (group-id = 1) or (group-id = 2) or (group-id = 3) and early-drop-off? and self != myself and group-id != [group-id] of myself]
      if (group-id != a) [
        create-friendships-with teachers with [group-id = a] ]
      if (group-id != b) [
        create-floatfriends-with teachers with [group-id = b] ]
    ]
  ]
  if (number-of-toddler-rooms > 1) [
    let c one-of toddler-list
    let d one-of toddler-list
    ask n-of (random 10) turtles with [(group-id = 4) or (group-id = 5) or (group-id = 6) or (group-id = 7) and (not adult?)] [
      set early-drop-off? true]
    ask turtles with [(group-id = 4) or (group-id = 5) or (group-id = 6) or (group-id = 7) and early-drop-off?] [
    create-friendships-with turtles with [(group-id = 4) or (group-id = 5) or (group-id = 6) or (group-id = 7) and early-drop-off? and self != myself and group-id != [group-id] of myself]
      if (group-id != c) [
        create-friendships-with teachers with [group-id = c] ]
      if (group-id != d) [
        create-floatfriends-with teachers with [group-id = d] ]
    ]
  ]
  if (number-of-preschool-rooms > 1) [
    let f one-of preschool-list
    let g one-of preschool-list
    ask n-of (random 14) turtles with [(group-id > 7) and (not adult?)] [
      set early-drop-off? true]
    ask turtles with [(group-id > 7) and early-drop-off?] [
      create-friendships-with turtles with [(group-id > 7) and early-drop-off? and self != myself and group-id != [group-id] of myself]
       if (group-id != f) [
        create-friendships-with teachers with [group-id = f] ]
      if (group-id != g) [
        create-floatfriends-with teachers with [group-id = g] ]
    ]
  ]
  ; Assumes that at most the combined kids fill one room so only random turtles up to maximum room amount selected
  ; Two pairs of teachers selected to rotate MWF and TR

  ; Calculate the total number of people and children in the daycare
  set total-people (count turtles)
  set total-kids (count turtles - (number-of-floaters + (2 * (number-of-infant-rooms + number-of-toddler-rooms + number-of-preschool-rooms))))

  ; Set the links either hidden or shown
  ask turtles [ask my-links [hide-link]]
  if see-links? [
  ask turtles [
    ask my-links [show-link]
  ]]

  ; Set the number of individuals that are susceptible, immune, or in-latent-period
  ask turtles [ask my-links [set active? true] ]		                   ; Initialize all links to be active
  ask turtles [become-susceptible]                                     ; If a turtle is susceptible there is a possibility that they can get HFMD
  ask n-of (floor ((percent-immune / 100) * (count turtles with [adult?]))) (turtles with [adult?]) [
      become-immune ]								                                   ; If a turtles is immune there is no possibility that they can get HFMD
  ask n-of number-of-in-latent-period turtles with [(not immune?)] [
    	become-in-latent-period ]
  ask turtles [
    set latent-period-time 0
    set self-isolation-time 0 ]

  set day-of-week random 7   ; Initialize day-of-week
  reset-ticks
end 


;Define the 5 possible states an individual can be in

to become-in-latent-period
  set in-latent-period? true         ; In order for a turtle to go in-latent-period, then the other 3 states must be false
  set infected-symptomatic? false
  set infected-asymptomatic? false
  set immune? false
  set color red
end 

to become-infected-symptomatic
  set in-latent-period? false
  set infected-symptomatic? true         ; In order for a turtle to become-infected-symptomatic, then the other 3 states must be false
  set infected-asymptomatic? false
  set immune? false
  set color blue
end 

to become-infected-asymptomatic
  set in-latent-period? false
  set infected-symptomatic? false
  set infected-asymptomatic? true        ; In order for a turtle to become-infected-asymptomatic, then the other 3 states must be false
  set immune? false
  set color green
end 

to become-immune
  set in-latent-period? false
  set infected-symptomatic? false
  set infected-asymptomatic? false
  set immune? true											; In order for a turtle to become-immune, the other 3 states must be false
  set color violet
end 

to become-susceptible                    ; In order for a turtle to become-susceptible, then the other 4 states must be false
  set in-latent-period? false
  set infected-symptomatic? false
  set infected-asymptomatic? false
  set immune? false
  set color black
end 

to go
  ifelse
    day-of-week = (6 mod 7) or day-of-week = (0 mod 7)    ; 6 represents Saturday, 0 represents Sunday, and 7 represents the seven days in a week
    [spread-virus-on-weekend]                             ; Since students in a childcare center do not go on the weekends to the daycare, that affects the spread of HFMD
    [ifelse
      day-of-week = (2 mod 7) or day-of-week = (4 mod 7)  ; On Tuesday (2) and Thursday (4) the schedules change and different links are used, so use a different process to spread HMFD
      [spread-virus-off-schedule]
      [spread-virus]]

  advance-sickness

  set day-of-week remainder (day-of-week + 1) 7			; Move to next day
tick
  if ticks >= 4500 [stop]   ; Stops program from going on indefinitely but allows virus to run its course
end 

to spread-virus ; MWF Schedule
  let poissmu (virus-spread-chance)

  ; Adults with HFMD and Symptomatic
  ask turtles with [ infected-symptomatic? and adult? ]
  [ask my-friendships [
    if active? [          ; Only asks turtles with active links and not isolating from childcare center
      ask myself [
   	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]   ; "link-neighbors" must be susceptible
    	[ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
    	[ if  poissdist poissmu > .2
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Adults with HFMD and Asymptomatic
  ask turtles with [ infected-asymptomatic? and adult? ]
  [ask my-friendships [
    if active? [
      ask myself [
    ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .37
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .3
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Children with HFMD and Symptomatic
 	ask turtles with [ infected-symptomatic? and (not adult?) ]
  [ask my-friendships [
    if active? [
      ask myself [
    ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .05
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Children with HFMD and Asymptomatic
  ask turtles with [ infected-asymptomatic? and (not adult?) ]
  [ask my-friendships [
    if active? [
      ask myself [
    ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .1
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Siblings with HFMD and Symptomatic
 	ask turtles with [ infected-symptomatic? and (not adult?) ]
  [
    ask sibling-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) ]
      [ if poissdist poissmu > .05
            [ become-in-latent-period ] ]
  ]

  ; Siblings with HFMD and Asymptomatic
  ask turtles with [ infected-asymptomatic? and (not adult?) ]
  [
   ask sibling-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) ]
      [ if  poissdist poissmu > .05
            [ become-in-latent-period ] ]
  ]
end 

to spread-virus-off-schedule ; TR schedule
  let poissmu (virus-spread-chance)

  ; Teachers with HFMD and Symptomatic
  ask teachers with [ infected-symptomatic? and adult? ]
  [ask my-friendships [
    if active? [
      ask myself [
   	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .2
      	[ become-in-latent-period  ] ]
    ask floatfriend-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .2
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Teachers with HFMD and Asymptomatic
  ask teachers with [ infected-asymptomatic? and adult? ]
  [ask my-friendships [
    if active? [
      ask myself [
    ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .3
      	[ become-in-latent-period  ] ]
    ask floatfriend-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if poissdist poissmu > .3
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Floaters with HFMD and Symptomatic
  ask floaters with [ infected-symptomatic? and adult? ]
  [ask my-floatfriends [
    if active? [
      ask myself [
   	ask floatfriend-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
      [ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
    ask floatfriend-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[if poissdist poissmu > .2
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Floaters with HFMD and Asymptomatic
  ask floaters with [ infected-asymptomatic? and adult? ]
  [ask my-floatfriends [
    if active? [
      ask myself [
    ask floatfriend-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .37
      	[ become-in-latent-period ] ]
    ask floatfriend-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .3
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Children with HFMD and Symptomatic
 	ask turtles with [ infected-symptomatic? and (not adult?) ]
  [ask my-friendships [
    if active? [
      ask myself [
    ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .05
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Children with HFMD and Asymptomatic
  ask turtles with [ infected-asymptomatic? and (not adult?) ]
  [ask my-friendships [
    if active? [
      ask myself [
    ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (adult?) ]
    	[ if  poissdist poissmu > .36
      	[ become-in-latent-period ] ]
  	ask friendship-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) and (not adult?) ]
  		[ if  poissdist poissmu > .1
      	[ become-in-latent-period  ] ]
  ]]]]

  ; Siblings with HFMD and Symptomatic
 	ask turtles with [ infected-symptomatic? and (not adult?) ]
  [
    ask sibling-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) ]
      [ if poissdist poissmu > .05
            [ become-in-latent-period ] ]
  ]

  ; Siblings with HFMD and Asymptomatic
  ask turtles with [ infected-asymptomatic? and (not adult?) ]
  [
   ask sibling-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) ]
      [ if  poissdist poissmu > .05
            [ become-in-latent-period ] ]
  ]
end 

to spread-virus-on-weekend
  let poissmu (virus-spread-chance)

  ; Siblings with HFMD and Symptomatic
 	ask turtles with [ infected-symptomatic? and (not adult?) ]
  [
    ask sibling-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) ]
      [ if poissdist poissmu > .05
            [ become-in-latent-period ] ]
  ]

  ; Siblings with HFMD and Asymptomatic
  ask turtles with [ infected-asymptomatic? and (not adult?) ]
  [
   ask sibling-neighbors with [ (not immune?) and (not in-latent-period?) and (not infected-symptomatic?) and (not infected-asymptomatic?) ]
      [ if  poissdist poissmu > .05
            [ become-in-latent-period ] ]
  ]
end 

to advance-sickness  ; Latent-period-time lasts a total of 3 to 8 days

  ; Self Isolation Policy
  ; Asks any symptomatic individuals to remove themselves and their siblings from the daycare by deactivating links for a certain time period
  if remove-symptomatic-individual? [
    ask turtles with [infected-symptomatic?][ 						; Ask symptomatic individuals and siblings to deactivate links
      ask my-friendships [
        if active? [set active? false]]
      ask my-floatfriends [
        if active? [set active? false]]
      ask sibling-neighbors [
        ask my-friendships [set active? false]
        ask my-floatfriends [set active? false]] ]
    ask turtles with [infected-symptomatic? or infected-asymptomatic?] [ 			; If in isolation, add to timer to count days in isolation
      ask my-friendships [
      	if (not active?) [ ask myself [
          set self-isolation-time (self-isolation-time + 1)
    ]]]]
    ask turtles with [self-isolation-time = days-in-isolation] [							; If been in isolation for the designated time, set links active
      ask my-friendships [set active? true]
      ask my-floatfriends [set active? true] ]
  ]

  ; Now go through the probabilities of becoming infected from latent period
  ; Adults with incubation period of 3 days
  ask turtles with [adult?]
  	[if latent-period-time = 3
  	[if lognormal 4.4 2 < 3
  	[ifelse random-float 100 < 9.8
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Children with incubation period of 3 days
  ask turtles with [not adult?]
  	[if latent-period-time = 3
  	[if lognormal 4.4 2 < 3
  	[ifelse random-float 100 < 71.4
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Adults with incubation period of 4 days
  ask turtles with [adult?]
  	[if latent-period-time = 4
  	[if lognormal 4.4 2 < 4
    [ifelse random-float 100 < 9.8
      [ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Children with incubation period of 4 days
  ask turtles with [not adult?]
 		[if latent-period-time = 4
  	[if lognormal 4.4 2 < 4
    [ifelse random-float 100 < 71.4
      [ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Adults with incubation period of 5 days
  ask turtles with [adult?]
  	[if latent-period-time = 5
  	[if lognormal 4.4 2 < 5
    [ifelse random-float 100 < 9.8
      [ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Children with incubation period of 5 days
  ask turtles with [not adult?]
  	[if latent-period-time = 5
  	[if lognormal 4.4 2 < 5
    [ifelse random-float 100 < 71.4
      [ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Adults with incubation period of 6 days
  ask turtles with [adult?]
  	[if latent-period-time = 6
  	[if lognormal 4.4 2 < 6
    [ifelse random-float 100 < 9.8
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Children with incubation period of 6 days
  ask turtles with [not adult?]
 		[if latent-period-time = 6
  	[if lognormal 4.4 2 < 6
    [ifelse random-float 100 < 71.4
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Adults with incubation period of 7 days
  ask turtles with [adult?]
  	[if latent-period-time = 7
  	[if lognormal 4.4 2 < 7
    [ifelse random-float 100 < 9.8
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Children with incubation period of 7 days
  ask turtles with [not adult?]
 		[if latent-period-time = 7
  	[if lognormal 4.4 2 < 7
    [ifelse random-float 100 < 71.4
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]]

  ; Adults with incubation period of 8 days
  ask turtles with [adult?]
  	[if latent-period-time = 8
  	[ifelse random-float 100 < 9.8
    	[ become-infected-symptomatic ]
      [ become-infected-asymptomatic ]
      set latent-period-time 0 ] ]

  ; Children with incubation period of 8 days
  ask turtles with [not adult?]
  	[if latent-period-time = 8
  	[ifelse random-float 100 < 71.4
    	[ become-infected-symptomatic ]
    	[ become-infected-asymptomatic ]
        set latent-period-time 0 ] ]

  ; Ask Sympotmatic Individuals if Recovery Time < 7 days
  ; If the generated recovery time is less than the number of days spent symptomatic, they become asymptomatic-infected
  ask turtles [
    if ((infected-symptomatic-time > 0) and (infected-symptomatic-time < 7))
    [if random-gamma mean-symptom-recovery-time 1 < infected-symptomatic-time
      [become-infected-asymptomatic
        set infected-symptomatic-time 0] ] ]

  ; Move times and applicable stages forward
  ask turtles [
  	if infected-symptomatic-time > 7
  		[ become-infected-asymptomatic
    		set infected-symptomatic-time 0 ]
  	if infected-asymptomatic-time > max-asymptomatic-time
  		[ become-immune
    		set infected-asymptomatic-time 0 ]
  	if in-latent-period?
    	[ set latent-period-time latent-period-time + 1 ]               ; + 1 adds a day to the counter
  	if infected-symptomatic?
    	[ set infected-symptomatic-time infected-symptomatic-time + 1 ]
  	if infected-asymptomatic?
    	[ set infected-asymptomatic-time infected-asymptomatic-time + 1 ]
  ]
end 

; Lognormal distribution, generates a number of days in incubation

to-report lognormal [mu sigma]
  let beta (ln( 1 + ((sigma ^ 2) / (mu ^ 2))))
  let m (ln(mu) - (beta / 2))
  let x (exp( random-normal m (sqrt beta) ) )
  report x
end 

; Poisson Distribution, generates a random probability

to-report poissdist [poissmu]
  ifelse poissmu = 0
  [report 0]
  [let k random 100
  let kfact (factorial k)
  let p ((exp (- poissmu)) * ( (poissmu ^ k) / (kfact) ) )
    report p]
end 

; Factorial Calculation for Poisson Distribution

to-report factorial [a]
  ifelse (a = 0)
  [report 1]
  [report a * factorial (a - 1)]
end 

There are 3 versions of this model.

Uploaded by When Description Download
Bonnie Jacob about 4 years ago Attempting to fix "Info" tab error. Download this version
Bonnie Jacob about 4 years ago Attempting to fix error loading the "Info" tab. Download this version
Bonnie Jacob about 4 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Agent-based Model of Hand, Foot, and Mouth Disease in a Daycare.png preview Preview for 'Agent-based Model of Hand, Foot, and Mouth Disease in a Daycare' about 4 years ago, by Bonnie Jacob Download

This model does not have any ancestors.

This model does not have any descendants.