Alberto Baldovino Enrico Girotti Mila Mattio

Simulation models for economics

Project work on

"What health?"

 

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.


Here you can find an introduction to the What health? application.


powered by NetLogo

view/download model file: what_health.nlogo

WHAT IS IT?

The model try to evaluate the health mobility in Piemonte. More in details, the simulation analyses the movements of cancer patients to the different hospitals that are located in the territory.

HOW IT WORKS

The agents, characterized with different ages, move to the different locations according to a certain probability. The hospitalisation period is used as a reference to see wether patients move or not.

HOW TO USE IT

The setup botton creates the setting with the main cities and the hospitals.
Immediately the first patients are created in the different hospitals (bigger ones will have a greater number of patients).
The go botton allow for movements, that are made more evident with the use of links.

The monitors show the patient flow, in general and then considering each pole separately.
The plots show the evolution over time of the general occupation rate and the occupation rate after having reduced the bed seats by 90%.
The swicher is used to analyse the patients’ movements to hospitals outside the territory.

THINGS TO NOTICE

The use of links enable the user to understand immediately the main dynamics of the patients’ movements. The same thing is also showed by the monitors.
Both plots use the dynamics of pole1 as a benchmarck.

THINGS TO TRY

Activating the switcher it is possibile to have a look also at the dynamics outside the territory. Again the use of links make everything straightforward.

EXTENDING THE MODEL

The model can be extended in different directions : a) the agents could be characterised also with reference of their sex b) it is possibile to imagine to reduce differently the number of bed seats c) to analyse more in details the patients’ movements outside the territory it is possible to create different hospitals each representing the differents regions.

NETLOGO FEATURES

The main fetures of the model are :

-The probabilities used for the patients’ movements to the different poles are organised in a matrix;
-The hospitalisation period is organised using a Poisson distribution.

CREDITS AND REFERENCES

(a reference to the model’s URL on the web if it has one, as well as any other necessary credits, citations, and links)

CODE

breed [cities city]
breed [hospitals hospital]
breed [patients patient]
breed [regions region]
hospitals-own [seats weekly_recoveries pole]
patients-own [age hospitalization nowPole nowHospital]
links-own [movingPatient]
globals [probabilities cancerseats1 cancerseats2 cancerseats3 cancerseats4 cancerseats5 cancerseats6 cancerseats7 cancerseats8]



to setup 
 
  clear-all

  
  create-cities 8

  ask city 0
  [set color red set label "Asti" set shape "circle" set size 3 setxy 60.3025 45.2625]

  ask city 1
  [set color red set label "Biella" set shape "circle" set size 2 setxy 53.007 78.4195]

  ask city 2
  [set color red set label "Cuneo" set shape "circle" set size 4 setxy 27.1205 19.5065]
  
  ask city 3
  [set color red set label "Novara" set shape "circle" set size 4  setxy 81.125 72.609]
  
  ask city 4
  [set color red set label "Torino" set shape "circle 2" set size 6 setxy 34.2055 53.288]
  
  ask city 5
  [set color red set label "Verbania" set shape "circle" set size 2 setxy 77.7965 96.477]
  
  ask city 6
  [set color red set label "Vercelli" set shape "circle" set size 3 setxy 70.9555 66.1655]
  
  ask city 7
  [set color red set label "Alessandria" set shape "circle" set size 2 setxy 80 45]

  create-hospitals 40
  
  
  ;; CTO
    ask hospital 8
    
    [set color green set weekly_recoveries 28 set seats 419 set shape "building institution" set size 1 setxy 33 51 ask patch-here [sprout-patients 28 [set nowHospital 8]] set pole 1]
   
   ;;mauriziano 
   
    ask hospital 9
    [set color green set weekly_recoveries 83 set seats 448 set shape "building institution" set size 1 setxy 33 52 ask patch-here  [sprout-patients 83 [set nowHospital 9]] set pole 1]
  
  
   ;;Regina Margherita
    ask hospital 10
    
    [set color green set weekly_recoveries 72 set seats 748 set shape "building institution" set size 1 setxy 33 51 ask patch-here  [sprout-patients 72 [set nowHospital 10]] set pole 1]
  
   ;; San Giovanni Battista Molinette
    ask hospital 11
    
    [set color green set weekly_recoveries 256 set seats 1175 set shape "building institution" set size 1 setxy 33 52 ask patch-here  [sprout-patients 256 [set nowHospital 11]] set pole 1]
    
    
    ;; San Luigi Orbassano
    
    ask hospital 12
  
  [set color green set weekly_recoveries 71 set seats 398 set shape "building institution" set size 1 setxy 27 51 ask patch-here  [sprout-patients 71 [set nowHospital 12]] set pole 7]
 
 ;; Candiolo
  
  ask hospital 13
 
  [set color green set weekly_recoveries 64 set seats 120 set shape "building institution" set size 1 setxy 28 48 ask patch-here  [sprout-patients 64 [set nowHospital 13]] set pole 7]

 ;; Koelliker Torino 1
 
  ask hospital 14
    
    [set color green set weekly_recoveries 51 set seats 202 set shape "building institution" set size 1 setxy 32 52 ask patch-here  [sprout-patients 51 [set nowHospital 14]] set pole 1]
    
    ;; Valdese Torino 1
   
    ask hospital 15
   
    [ set color green set weekly_recoveries 51 set seats 202 set shape "building institution" set size 1 setxy 34 52 ask patch-here  [sprout-patients 51 [set nowHospital 15]] set pole 1]
    
    ;; Torino 2 Gradenigo
    
    ask hospital 16
    
    [set color green set weekly_recoveries 83 set seats 392 set shape "building institution" set size 1 setxy 35 53 ask patch-here  [sprout-patients 83 [set nowHospital 16]] set pole 1]
    
    ;; Torino2 Cottolengo
    
    ask hospital 17
    
    [ set color green set weekly_recoveries 83 set seats 392 set shape "building institution" set size 1 setxy 34 54 ask patch-here  [sprout-patients 83 [set nowHospital 17]] set pole 1]
    
    ;; Torino3 Rivoli
    
    ask hospital 18
    
    [ set color green set weekly_recoveries 19 set seats 210 set shape "building institution"  set size 1 setxy 26 53 ask patch-here  [sprout-patients 19 [set nowHospital 18]] set pole 7]
    
    ;; Torino3 Susa
    
    ask hospital 19
    
    
    [ set color green set weekly_recoveries 19 set seats 210 set shape "building institution"  set size 1 setxy 2 58 ask patch-here  [sprout-patients 19 [set nowHospital 19]] set pole 7]
    
    ;; Torino3 Pinerolo
    
    ask hospital 20
    
    
     [ set color green set weekly_recoveries 19 set seats 210 set shape "building institution" set size 1 setxy 16 44 ask patch-here  [sprout-patients 19 [set nowHospital 20]] set pole 7]
  
    ;; Torino4 Lanzo
   
   
    ask hospital 21
    
    [ set color green set weekly_recoveries 34 set seats 352 set shape "building institution" set size 1 setxy 24 64 ask patch-here  [sprout-patients 34 [set nowHospital 21]] set pole 8]
    
    ;; Torino4 Ivrea
    
    ask hospital 22
    
    [ set color green set weekly_recoveries 34 set seats 352 set shape "building institution" set size 1 setxy 43 73 ask patch-here  [sprout-patients 34 [set nowHospital 22]] set pole 8]
    
    ;; Torino4 San Carlo Canavese
    ask hospital 23
    
    [ set color green set weekly_recoveries 34 set seats 352 set shape "building institution" set size 1 setxy 30 62 ask patch-here  [sprout-patients 34 [set nowHospital 23]] set pole 8]
    
    ;;Torino5 Chieri
    
    ask hospital 24
    
    [ set color green set weekly_recoveries 17 set seats 142 set shape "building institution" set size 1 setxy 41 50 ask patch-here  [sprout-patients 17 [set nowHospital 24]] set pole 7]
    
    ;; Torino5 Carmagnola
    
    ask hospital 25
    
    [ set color green set weekly_recoveries 17 set seats 142 set shape "building institution" set size 1 setxy 35 42 ask patch-here  [sprout-patients 17 [set nowHospital 25]] set pole 7]
    
    ;; Torino5 Moncalieri
    
    ask hospital 26
    
    
    [ set color green set weekly_recoveries 17 set seats 142 set shape "building institution" set size 1 setxy 34 50 ask patch-here  [sprout-patients 17 [set nowHospital 26]] set pole 7]
    
    ;; Vco Domodossola
    
    ask hospital 27
    
    [ set color green set weekly_recoveries 16 set seats 175 set shape "building institution" set size 1 setxy 64 97 ask patch-here  [sprout-patients 16 [set nowHospital 27]] set pole 4
    ]
    
    ;; Vco Verbania
    
    ask hospital 28
    
    [ set color green set weekly_recoveries 16 set seats 175 set shape "building institution" set size 1 setxy 78 96 ask patch-here  [sprout-patients 16 [set nowHospital 28]] set pole 4]
    
    ;; Vco Omegna
    
    ask hospital 29
    
    [ set color green set weekly_recoveries 16 set seats 175 set shape "building institution" set size 1 setxy 70 94 ask patch-here  [sprout-patients 16 [set nowHospital 29]] set pole 4]
    
    ;; Vercelli
    
    ask hospital 30
    
    [ set color green set weekly_recoveries 33 set seats 209 set shape "building institution" set size 1 setxy 70 66 ask patch-here  [sprout-patients 33 [set nowHospital 30]] set pole 5]
      
    ;; Vercelli-Borgosesia
    
    ask hospital 31
    
    [ set color green set weekly_recoveries 33 set seats 209 set shape "building institution" set size 1 setxy 64 85 ask patch-here  [sprout-patients 33 [set nowHospital 31]] set pole 5]

    ;; Alessandria-Casale
     
     ask hospital 32
     
     [ set color green set weekly_recoveries 28 set seats 169 set shape "building institution" set size 1 setxy 80 45 ask patch-here  [sprout-patients 28 [set nowHospital 32]] set pole 3]

    ;; Alessandria-Novi Ligure
    
    ask hospital 33
    
    [ set color green set weekly_recoveries 28 set seats 169 set shape "building institution" set size 1 setxy 82 38 ask patch-here  [sprout-patients 28 [set nowHospital 33]] set pole 3]
    
     ;; Alessandria-Acqui Terme
    
    ask hospital 34
    
        [ set color green set weekly_recoveries 28 set seats 169 set shape "building institution" set size 1 setxy 73 33 ask patch-here  [sprout-patients 28 [set nowHospital 34]] set pole 3]
    
     ;; Alessandria-Ovada
     
     ask hospital 35
     
     [ set color green set weekly_recoveries 28 set seats 169 set shape "building institution" set size 1 setxy 82 31 ask patch-here  [sprout-patients 28 [set nowHospital 35]] set pole 3]
     
     ;; Asti
     
     ask hospital 36
     
     [ set color green set weekly_recoveries 56 set seats 432 set shape "building institution" set size 1 setxy 95 45 ask patch-here  [sprout-patients 56 [set nowHospital 36]] set pole 6]
    
      ;; Biella
      
       ask hospital 37
     
     [ set color green set weekly_recoveries 57 set seats 421 set shape "building institution" set size 1 setxy 53 78 ask patch-here  [sprout-patients 57 [set nowHospital 37]] set pole 5]


      ;; Cuneo1-Mondovì
      
       ask hospital 38
     
     [ set color green set weekly_recoveries 19 set seats 244 set shape "building institution" set size 1 setxy 41 19 ask patch-here  [sprout-patients 19 [set nowHospital 38]] set pole 2]

     
     ;; Cuneo1-Savigliano
     
      ask hospital 39
     
     [ set color green set weekly_recoveries 19 set seats 244 set shape "building institution" set size 1 setxy 33 32 ask patch-here  [sprout-patients 19 [set nowHospital 39]] set pole 2]
     
     
      ;; Cuneo1-Ceva
     
      ask hospital 40
     
     [ set color green set weekly_recoveries 19 set seats 244 set shape "building institution" set size 1 setxy 51 19 ask patch-here  [sprout-patients 19 [set nowHospital 40]] set pole 2]
     
     
      ;; Cuneo2-Alba
     
      ask hospital 41
     
     [ set color green set weekly_recoveries 26 set seats 289 set shape "building institution" set size 1 setxy 51 35 ask patch-here  [sprout-patients 26 [set nowHospital 41]] set pole 2]


       ;; Cuneo2-Bra
     
      ask hospital 42
     
     [ set color green set weekly_recoveries 26 set seats 289 set shape "building institution" set size 1 setxy 42 34 ask patch-here  [sprout-patients 26 [set nowHospital 42]] set pole 2]
     
      ;; Novara-Arona
     
      ask hospital 43
     
     [ set color green set weekly_recoveries 15 set seats 172 set shape "building institution" set size 1 setxy 77 88 ask patch-here  [sprout-patients 15 [set nowHospital 43]] set pole 4]

     ;; Novara-Borgomanero
     
      ask hospital 44
     
     [ set color green set weekly_recoveries 15 set seats 172 set shape "building institution" set size 1 setxy 73 85 ask patch-here  [sprout-patients 15 [set nowHospital 44]] set pole 4]

    ;; A U S Antonio Biagio e C. Arrigo
    
       
      ask hospital 45
     
     [ set color green set weekly_recoveries 91 set seats 678 set shape "building institution" set size 1 setxy 81 45 ask patch-here  [sprout-patients 91 [set nowHospital 45]] set pole 3]

     ;; A O U Maggiore della CaritĂ  Novara
     
      ask hospital 46
     
     [ set color green set weekly_recoveries 140 set seats 765 set shape "building institution" set size 1 setxy 81 72 ask patch-here  [sprout-patients 140 [set nowHospital 46]] set pole 4]

     ;; Santa Croce e Carle Cuneo
     
      ask hospital 47
     
     [ set color green set weekly_recoveries 80 set seats 667 set shape "building institution" set size 1 setxy 62 19 ask patch-here  [sprout-patients 80 [set nowHospital 47]] set pole 2]

;; Other Regions
  
create-regions 1

ask regions

[ set color blue set shape "building institution" set size 5 setxy 11 96] 


set cancerseats1 sum [seats] of hospitals with [ pole = 1] * 0.1 

set cancerseats2 sum [seats] of hospitals with [ pole = 2] * 0.1 

set cancerseats3 sum [seats] of hospitals with [ pole = 3] * 0.1 

set cancerseats4 sum [seats] of hospitals with [ pole = 4] * 0.1 

set cancerseats5 sum [seats] of hospitals with [ pole = 5] * 0.1 

set cancerseats6 sum [seats] of hospitals with [ pole = 6] * 0.1 

set cancerseats7 sum [seats] of hospitals with [ pole = 7] * 0.1 

set cancerseats8 sum [seats] of hospitals with [ pole = 8] * 0.1 


setup-patients
  
set probabilities [ [ 0 0.008 0.01 0.013 0.014 0.016 0.102 0.112 ] [ 0.098 0.098 0.101 0.102 0.102 0.108 0.141 0.141 ] [ 0.048 0.049 0.049 0.052 0.06 0.067 0.074 0.075 ]
                    [ 0.016 0.018 0.021 0.021 0.037 0.037 0.041 0.041 ] [0.074 0.076 0.089 0.159 0.159 0.16 0.169 0.177 ] [ 0.144 0.169 0.29 0.294 0.296 0.296 0.341 0.374]
                    [0.457 0.477 0.479 0.481 0.481 0.483 0.483 0.488 ] [ 0.543 0.546 0.558 0.564 0.577 0.578 0.653 0.653 ] ]


reset-ticks
end

to setup-patients
  ask patients with [nowPole != -1]
  [
    let r random-float 1 
    if r <= 0.0416 [set age 1] 
    if 0.0416 < r and r <= 0.36 [set age 2]
    if   0.36 < r and r <= 0.86  [set age 3]
    if 0.86 < r and r <= 1  [set age 4]
    set shape "person"
    set nowPole [pole] of hospital nowHospital 
    set hospitalization (random-poisson 7.9)
    set xcor ( xcor + random-float 2 - 1)
    set ycor ( ycor + random-float 2 - 1)
  ]
end

to check-patients
  ask patients [
    if ticks > 0  [set hospitalization hospitalization - 1 ]
    if hospitalization <= 0 [
      
      if not link-persistency? [
        let whoLink who
        ask links with [movingPatient = whoLink] [die]
      ]
      
      die
    ]
  ]
  
  if (remainder ticks  7 = 0) and (ticks != 0) [ 
    ask hospitals [ 
      let NewPatients weekly_recoveries
      let place who
      ask patch-here [
        sprout-patients NewPatients [set nowHospital place]
      ]
    ]
    setup-patients
  ]
end
  

to go
  move-patients
  check-patients
  if ticks = 365[stop]
  tick
end


to move-patients

  ask hospitals [
    let hosp self
    let hospWho who 
    let prob item (pole - 1) probabilities 
    
    
   ask (patients with [ nowHospital = hospWho and hospitalization >= 5 and ( (age = 1 and random-float 1 < 0.5 ) or (age = 2 and random-float 1 < 0.28) or
         (age = 3 and random-float 1 < 0.17) or (age = 4 and random-float 1 < 0.05) )]) [

         if not (external-mobility external-mobility? who hosp) [
           let oddsMax last prob
           let odds random-float oddsMax 
           let poledestination 1
           
           let patientID who  
           foreach prob [
             if odds > ? [ set poledestination poledestination + 1 ]
           ]
           let hospitaldest (one-of hospitals with [ pole = poledestination ] )
           set nowHospital [who] of hospitaldest
           
           set nowPole poledestination
           ask hospitaldest [create-link-from hosp [ set movingPatient patientID]]
           move-to hospitaldest
         ]
         ]
  ]




end
 
 
to-report external-mobility [theyMove? patientID provenience]
    let probextMob random-float 1
    
    ifelse (probextMob <= 0.0862 and theyMove?) [
      let regionDest one-of regions
      set nowHospital ["Outside"]
      set nowPole -1
      ask regionDest [create-link-from provenience [set movingPatient patientID]]
      move-to regionDest
      report true
    ]
    [report false]
   
end