This page was automatically generated by NetLogo 5.0.3.

The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.


In order for this to work, this file, your model file (EpidemicExplorer.nlogo), and the files NetLogoLite.jar and NetLogoLite.jar.pack.gz must all be in the same directory. (You can copy NetLogoLite.jar and NetLogoLite.jar.pack.gz from the directory where you installed NetLogo.)

On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.

You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.

If the NetLogoLite files and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of the NetLogoLite files in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)

powered by NetLogo

view/download model file: EpidemicExplorer.nlogo

WHAT IS IT?

Here is a village somewhere in the world sometime near the end of the 1800’s. Epidemics break out, and scientists like Charles Louis Alphonse Laveran, Ronald Ross, Carlos Finlay, and Walter Reed are trying to determine their cause. In this model, the disease may be spread

(1) By direct contact with infected humans.
(2) By drinking infected water.
(3) By eating tainted food.
(4) By being bitten by flying insects like mosquitos.

For simplicity, we have omitted the possible vectors of breathing airborne infectious agents, being bitten by crawling insects like ticks, and living in an unsanitary situation.

Enter a 5-digit numerical key. Set up and run the simulation repeatedly varying whether or not you reduce the mosquito population, supplement the villagers’ food supply with sterile meals, or supplement the villagers’ water supply with sterile water. Can you determine which of the 4 possible sources are responsible for the epidemic associated with that numerical key.

HOW IT WORKS

In the simulation, the human inhabitants of the village sleep for 8 hours in their houses, after which they make their way to the river for water, eat 3 times a day (food not shown), and wander about doing their daily activities. All the while, black mosquitos are flying around, including in and out of the houses.

Something infects an uninfected individual, but they don’t become symptomatic for 24 hours, on average. When they do become symptomatic, they head for the hospital. The hospital houses the symptomatic until they recover 72 hours, on average, after becoming symptomatic.

The plot counts ONLY those who are in the hospital – others may be ill and simply have not yet gone to the hospital.

HOW TO USE IT

  1. Enter a 5 digit number (and hit the enter key after doing so). This will generate an epidemic with one of the 7 sources above (and same epidemic for each 5 digit key).
  2. Press the SETUP button.
  3. Press the GO button to begin the simulation.
  4. You can turn on an intervention.

    i) REDUCE MOSQUITOS reduces the mosquito population.

ii) PROVIDE STERILIZED MEALS provides some – but not all! – of the villagers with sterile food.
iii) PROVIDE BOTTLED WATER provides some – but not all! – of the villagers with sterile water.
YOU WILL NEED TO SETUP AGAIN AFTER ENACTING AN INTERVENTION!
5. The HOSPITAL COUNTS plot shows the number of patients (symptomatic individuals who have wandered into the hospital). Once they recover, they leave the hospital.

THINGS TO NOTICE

There are many subtle differences between the hospital plots for the four possible vectors. One key difference is the peak number in the hospital, and it is this peak that is most affected by the 3 different interventions.

THINGS TO TRY

The simulation should be setup and run repeatedly, thus creating a data set of peaks that can be analyzed used a statistical inference on a hypothesis of a particular disease vector.

CODE

breed [ foodsources foodsource ]
breed [ people person ]
breed [ hospitals hospital ]
breed [ houses house ]
breed [ mosquitos mosquito ]


globals
[
  InfectionSource    ;; selector for how infection is spread
  RecoveredCount
  TicksPerHour  ;; Slow down the sim
  ; ProbabilityOfInfection   ;;   TicksPerHour based probability
  HospitalizedDuringHour ;;
  RecoveredDuringHour ;;
  IsolatedDuringHour 
  TotalTreated ;;
  numskeeters ;; 
  MealsProb ;;
  WaterProb ;;
  Duration
  Provide_Meals
  Provide_Water
]

people-own
[
  Infected?      ;; true if ill
  Symptomatic?
  InHospital?
  InIsolation? 
  Recovered?
  SickTime    
]

to SetUp
  reset-ticks
  clear-turtles
  clear-patches
  clear-drawing
  clear-all-plots
  clear-output
  set-default-shape people "person"
  set-default-shape mosquitos "mosquito"
  set-default-shape hospitals "redcross"
  set-default-shape houses "house"

  set Provide_Meals false
  set Provide_Water false

  set RecoveredCount 0
  set Duration 0
  set TicksPerHour 1 
  set TotalTreated 0 
  ; set ProbabilityOfInfection ( 35 / TicksPerHour )
  ifelse( Epidemic_Vector = "Human" )
     [ set InfectionSource  0 ]
     [ set InfectionSource  1 ];
    
  ask patches [
     ifelse (pycor = min-pycor) 
       [ set pcolor blue ]
       [ set pcolor green ]
   ]
  create-houses 5 
    [ set size 3 
      set color brown
    ] 
    
  ask house 0 [ setxy min-pxcor + 1      max-pycor - 1 ]
  ask house 1 [ setxy min-pxcor / 2 + 1  max-pycor - 1 ]
  ask house 2 [ setxy 0                  max-pycor - 1 ]
  ask house 3 [ setxy max-pxcor / 2 - 1  max-pycor - 1 ]
  ask house 4 [ setxy max-pxcor - 1      max-pycor - 1 ] 
  
  create-hospitals 1
    [ setxy 0 0
      set size 8
      set label-color black
      set label "Hospital" 
    ]
   create-people 500
    [ set color pink + 3 
      set Infected? false
      set Symptomatic? false
      set InHospital? false
      set InIsolation? false
      set Recovered? false
      setxy random-xcor random-ycor ]
  ifelse ( Reduce_Mosquitos ) 
     [ set numskeeters 40 ]
     [ set numskeeters 100 ]
   create-mosquitos numskeeters
    [ set color black
      set size 0.25  
      setxy random-xcor random-ycor ]
   make-infection      
   ifelse( Provide_Meals) 
         [ set MealsProb ProbabilityOfInfection * 0.35 ] 
         [ set MealsProb ProbabilityOfInfection * 0.4 ]
         
   ifelse( Provide_Water) 
         [ set WaterProb ProbabilityOfInfection * 0.7 ] 
         [ set WaterProb ProbabilityOfInfection ]
         
end;


to go
 move-all;
 update-Sicktime;
 update-infection;
 manage-data; 
 if( TicksPerHour * 25 * 10 < ticks ) [ stop ]
end;


to make-infection
  if (InfectionSource mod 4 = 0) ;; human 
    [ ask people ;; to be infected 
       [ if (who < 10) 
         [  set Infected? true
            set Symptomatic? false ;; have to incubate 
            set SickTime 0 ;; Already Symptomatic
         ]
       ] 
    ]

end;

to move-all
  tick
  ask mosquitos 
    [ st 
         rt random 100
         lt random 100
         fd 1 
    ]
  ask people 
    [ if(not InHospital?) ;; if asleep and not in hospital, then into huts!
       [ ifelse( ticks mod ( 24 * TicksPerHour ) < 8 * TicksPerHour ) 
          [ if(who < 100  )             
              [ setxy  min-pxcor + 1   max-pycor - 1    
                facexy min-pxcor + 1   0 
              ] 
            if(who >  99 and who < 200) 
              [ setxy  min-pxcor / 2 + 1  max-pycor - 1 
                facexy min-pxcor / 2 + 1  0
              ]
            if(who > 199 and who < 300) 
              [ setxy 0                  max-pycor - 1 
                facexy 0                 0
              ]
            if(who > 299 and who < 400) 
              [ setxy  max-pxcor / 2 - 1  max-pycor - 1
                facexy max-pxcor / 2 - 1  0
              ]
            if(who > 399)               
              [ setxy  max-pxcor - 1      max-pycor - 1 
                facexy max-pxcor - 1      0
              ]
          ] 
          [ if(ycor <= min-pycor) 
             [ set ycor min-pycor + 1 
               facexy xcor 0
             ]
            if(ycor >= max-pycor) 
             [ set ycor max-pycor - 1 
               facexy xcor 0
             ]
            if(Symptomatic? and SickTime > 0 ) 
             [facexy 0 0 ]
            rt random 50
            lt random 50
            fd random 10 
          ]
      ]
   ]
end

to Update-Sicktime
  ask people with [Infected?]
    [ ifelse(Symptomatic?)
       [ if(SickTime > 0) 
          [ set SickTime SickTime - 1 
            if( abs(xcor) < 2 and abs(ycor) < 2 )
              [ setxy 0 0
                set InHospital? true
              ]
            if(SickTime = 0 ) 
              [ set color blue + 2 
                set TotalTreated TotalTreated + 1
                set Recovered? true  
                set Duration ticks
                set InHospital? false ]
          ] 
       ]
       [ ifelse(SickTime > 0)  
          [ set SickTime SickTime - 1]
          [ set Symptomatic? true
            set color red 
            set SickTime floor ( random-normal ( 72 * TicksPerHour ) ( 8 * TicksPerHour ) )  ;; 4 day infection 
          ]
       ]
    ]  
end; 

to update-infection
   if(InfectionSource mod 4 = 0 ) ;; human
     [ ;; random interactions with others
       ask people with [ Symptomatic? and SickTime > 0 and not InHospital? ]  
        [ ask other people-here with [ not  Infected?  ]
          [ if (random-float 100) < ProbabilityOfInfection
              [ set Infected? true ;
                set SickTime ( random-normal floor ( 24 * TicksPerHour ) ( 4 * TicksPerHour ) )  ;
              ]
          ]
        ]
      ]
    if (InfectionSource mod 4 = 1) ;; mosquito
      [  ;; random chance of infection upon mosquito on same patch
         ask mosquitos with [ ( who mod 30 ) = 0 ] 
           [ ask people-here with [ not ( Infected? or InIsolation?) ]
                [ if ( random-float 1.0 < ProbabilityOfInfection )
                  [ set Infected? true ;
                    set color pink ;
                    set SickTime ( random-normal floor ( 24 * TicksPerHour ) ( 4 * TicksPerHour ) ) ;
                  ]
                ]
          ]
      ]
    if(    ticks mod ( 24 * TicksPerHour ) =  8 * TicksPerHour 
        or ticks mod ( 24 * TicksPerHour ) = 14 * TicksPerHour
        or ticks mod ( 24 * TicksPerHour ) = 20 * TicksPerHour ) 
      [ ask people 
            [ if(InfectionSource mod 4 = 2 and not Infected? and not InIsolation?) ;; food
                [ if ( random-float 100 < MealsProb )
                  [ set Infected? true ;
                    set SickTime floor ( random-normal ( 24 * TicksPerHour ) ( 4 * TicksPerHour ) ) ;
                  ]
                ]
             ]
      ]
     ask people with [ pycor <= min-pycor ]
        [ if(InfectionSource mod 4 = 3 and not Infected?) ;; water
               [ if (random-float 100 < WaterProb )
                  [ set Infected? true ;
                    set SickTime floor ( random-normal ( 24 * TicksPerHour ) ( 4 * TicksPerHour ) ) ;
                  ]
               ]
        ]
end;

to manage-data
  set HospitalizedDuringHour ( HospitalizedDuringHour + count people with [InHospital? and not InIsolation? ])
  set RecoveredDuringHour    ( RecoveredDuringHour + RecoveredCount ) ; 
  set IsolatedDuringHour     ( IsolatedDuringHour + count people with [InIsolation?] );
  if ( ( ticks - 1 ) mod TicksPerHour = 0 )
   [
     set-current-plot "S (gray), I (red), and R"
     set-current-plot-pen "Susceptibles"
     plot ( 500 - ( count ( people with [Infected?] ) ) );
     set-current-plot-pen "Infecteds"
     plot ( count ( ( people with [Infected? and not  Recovered? ] ) ) );
     set-current-plot-pen "Recovered"
     plot count people with [ Recovered? ]
      
     set HospitalizedDuringHour 0
     set RecoveredDuringHour    0 
     set IsolatedDuringHour     0
  ]
end;