You Be Walter Reed and/or Carlos Finlay

powered by NetLogo

view/download model file: YouBeWalterReed.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. As 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.
(5) By breathing airborne infectious agents.
(6) By being bitten by crawling insects like ticks.
(7) By living in unsanitary housing.

Enter a 5-digit numerical key. By running the simulation and intervening by spraying for mosquitos, passing out sterile meals, passing out bottled water, and putting healthy individuals into isolation, can you determine which of the 7 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 (food not shown), and wander about doing their daily activities. All the while, black mosquitos are flying around, including in and out of the hospital and houses. There are also orange crawling bugs, which due to their limited range do not move at all in this simulation.

Something infects an uninfected individual, but they don't become symptomatic for 24 hours. When they do become symptomatic, they head for the hospital. The hospital houses the symptomatic until they recover 96 hours after becoming symptomatic. The hospital may also house a collection of uninfected in isolation from the rest of the population. The hospital keeps the infected away from the uninfected, gives everyone in the hospital clean water, sanitary living conditions free of mosquitos, and sterilized food.


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. At anytime during or before the simulation, you may employ any combination of 4 interventions.
i) ISOLATION allows you to put up to 100 individuals into isolation.
ii) SPRAY FOR MOSQUITOS eliminates mosquitos for a 48 hour period.
iii) PROVIDE STERILIZED MEALS provides 1000 sterile meals to the population.
iv) PROVIDE BOTTLED WATER provides 1000 single-servings of sterile water.
Interventions i, ii, and iii are deployable only when that particular resource is depleted. We suggest setting isolation beforehand rather than changing interactively.
5. The HOSPITAL COUNTS plot shows the number of patients (symptomatic individuals who have wandered into the hospital)(blue), the number in isolation (brown), and the number who have had the disease and are now recovered (green).
6. The INTERVENTIONS plot shows the number of hours remaining until a fumigation ceases to prevent mosquitos (black), the number of sterile meals remaining (purple), and the number of bottled waters remaining (magenta).
7. The "save data" button saves the results to a text file . The text file has a row of data for each time step (hour) of the simulation, where each row is 7 numbers separated by commas. The format of each row is as follows:

Hours Patients Isolated Recovered Fumigation Meals Water

where "Hours" is the number of hours elapsed since process began, "Patients" is number of patients in the Hospital, "Isolated" is the number of uninfected individuals in isolation, "Recovered" is the number who have had the disease and recovered, "Fumigation" is the number of hours remaining until the mosquitos return, "Meals" is the number of sterile meals remaining, and "Water" is the number of individual servings of water remaining.


THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.


THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.


EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.


NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.


RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.


CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.


PROCEDURES

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


globals
[
  InfectionSource    ;; selector for how infection is spread
  IsolationCount   ;; number in isolation
  RecoveredCount
  FileName$        ;; name of output file 
  Recording?     ;;
  Fumigation     ;; Counts down 
  ReadyMeals     ;; Counts down
  BottledWaters  ;; Counts down
]

people-own
[
  Infected?      ;; true if ill
  Symptomatic?
  InHospital?
  InIsolation? 
  SickTime    ;; initially equal to incubation time
]

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 crawlybugs "bug"
  set-default-shape hospitals "redcross"
  set-default-shape houses "house"

  set IsolationCount 0 
  set RecoveredCount 0
  set Fumigation 0 
  ifelse(Five_digit_number > 9999 )
    [ set InfectionSource Five_digit_number ] 
    [ user-message "Number is not five digits. Generating random key." 
      set InfectionSource random 9999999999
    ]
  set InfectionSource int ( ( InfectionSource * 3 + 1 ) / 11 )  ;
    
  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
      setxy random-xcor random-ycor ]
  create-mosquitos 100
    [ set color black
      set size 0.25  
      setxy random-xcor random-ycor ]
  create-crawlybugs 20 
    [ set color orange
      set size 0.4
      setxy floor ( max-pxcor  / 2 ) + random floor( max-pxcor  / 2 ) floor ( -4 +  random 8 ) 
    ]
   make-infection     
   ; MakeDataFile 
  
end;


to go
 move-all;
 Isolate-Non-Infecteds;
 update-Sicktime;
 update-infection;
 manage-data; 
 if( ticks > 24 * 10 ) [ stop ]
end;

to MakeDataFile
  set FileName$ "SciMethodData.csv" 
  file-close-all
  if(file-exists? FileName$)
     [ file-delete FileName$ ]
  file-open FileName$
  set Recording? true;
end; 

to record-data 
   ifelse(Recording?) 
   [ file-close-all 
     user-message word "Data saved to file " FileName$ 
     set Recording? false 
   ]
   [ user-message "Data Recording saved previously. Filename is SciMethodData.csv" ]
end;

to make-infection
  if (InfectionSource mod 7 = 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
  if(Fumigation > 0 ) [ set Fumigation Fumigation - 1 ]
  ask mosquitos 
    [ ifelse(Fumigation > 0 and ( ( who mod 100 ) < 50 ) ) 
       [ ht ]
       [ 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 < 8 ) 
          [ 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 Fumigate
   if(Fumigation <= 0) [  set Fumigation 48 ];
end;

to ProvideMeals
   if(ReadyMeals <= 0) [ set ReadyMeals 1000 ];
end;

to ProvideWater
   if(BottledWaters <= 0 ) [ set BottledWaters 1000 ];
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 RecoveredCount RecoveredCount + 1 
                set InHospital? false ]
          ] 
       ]
       [ ifelse(SickTime > 0)  
          [ set SickTime SickTime - 1]
          [ set Symptomatic? true
            set SickTime ( floor random-normal 72 8 )  ;; 4 day infection 
          ]
       ]
    ]  
end; 

to Isolate-Non-Infecteds 
  ask people with [not Infected? and not InIsolation? ]
     [ if( IsolationCount < Isolation )
        [ setxy 0 0 
          set InIsolation?  true 
          set InHospital?  true
          set IsolationCount IsolationCount + 1 
        ]
     ]
  ask people with [InIsolation? ]
     [ if(IsolationCount > Isolation )
         [ set InIsolation? false
           set InHospital? false
           set IsolationCount IsolationCount - 1 
         ]
     ]
end;

to update-infection
   if(InfectionSource mod 7 = 0 ) ;; human
     [ ;; random interactions with others
       ask people with [ Symptomatic? and SickTime > 0 and not InHospital? ]  
        [ ask other people-here with [ not ( Infected? or InIsolation?) ]
          [ if (random-float 100) < 65
              [ set Infected? true ;
                set SickTime ( floor random-normal 24 4 ) ;
              ]
          ]
        ]
      ]
    if (InfectionSource mod 7 = 1) ;; mosquito
      [  ;; random chance of infection upon mosquito on same patch
         ask mosquitos 
           [ if(Fumigation <=  0 )
             [ ask people-here with [ not ( Infected? or InIsolation?) ]
                [ if (random-float 100) < 65
                  [ set Infected? true ;
                    set SickTime ( floor random-normal 24 4 ) ;
                  ]
                ]
             ]
          ]
      ]
    if(ticks mod 24 = 8 or ticks mod 24 = 14 or ticks mod 24 = 20 ) 
      [ ask people 
         [ ifelse( ReadyMeals > 0 )
            [ set ReadyMeals ReadyMeals - 1 ]
            [ if(InfectionSource mod 7 = 2 and not Infected? and not InIsolation?) ;; food
                [ if (random-float 100) < 65
                  [ set Infected? true ;
                    set SickTime ( floor random-normal 24 4 ) ;
                  ]
                ]
             ]
          ]
      ]
     ask people with [ pycor <= min-pycor ]
        [ ifelse(BottledWaters > 0 )
            [ set BottledWaters BottledWaters - 1 ]
            [ if(InfectionSource mod 7 = 3 and not Infected?) ;; water
               [ if (random-float 100) < 65
                  [ set Infected? true ;
                    set SickTime ( floor random-normal 24 4 ) ;
                  ]
               ]
           ]
      ]
    if (InfectionSource mod 7 = 4) ;; airborne
      [  ;; random chance of infection no matter where you are!
        ask people with [ not Infected?  ]
           [ if (random-float 100) < 65
              [ set Infected? true ;
                set SickTime ( floor random-normal 24 4 ) ;
              ]
           ]
      ]
    if (InfectionSource mod 7 = 5) ;; crawlybugs
      [  ;; random chance of infection upon mosquito on same patch 
        ask crawlybugs 
         [ ask people-here with [ not ( Infected? or InHospital?) ]
           [ if (random-float 100) < 65
              [ set Infected? true ;
                set InIsolation? false ; 
                set SickTime ( floor random-normal 24 4 ) ;
               ]
           ]
         ]
      ]
    if (InfectionSource mod 7 = 6) ;; houses
      [  ;; random chance of infection from unknown source in home
        ask houses 
         [ ask people-here with [ not ( Infected? or InHospital?) ]
           [ if (random-float 100) < 65
              [ set Infected? true ;
                set InIsolation? false;
                set SickTime ( floor random-normal 24 4 ) ;
               ]
           ]
         ]
      ]
end;

to manage-data
  set-current-plot "Hospital Counts"
  set-current-plot-pen "In Isolation"
  plot count people with [ InIsolation? and Symptomatic? ] 
  set-current-plot-pen "Patients"
  plot count people with [InHospital? and not InIsolation? ]
  set-current-plot-pen "Recovered"
  plot RecoveredCount
  
  set-current-plot "Interventions"
  set-current-plot-pen "Fumigation Hours"
  plot Fumigation
  set-current-plot-pen "Sterile Meals"
  plot ReadyMeals
  set-current-plot-pen "Bottled Waters"
  plot BottledWaters
  
  ;file-type ticks - 1
  ;file-type ","
  ;file-type count people with [InHospital? and not InIsolation?]
  ;file-type ","
  ;file-type IsolationCount
  ;file-type ","
  ;file-type RecoveredCount
  ;file-type ","
  ;file-type Fumigation
  ;file-type ","
  ;file-type ReadyMeals
  ;file-type ","
  ;file-print BottledWaters  
end;