Análisis Vacunación Ecuador

Análisis Vacunación Ecuador preview image

1 collaborator

Captura Adrian Lara (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.1 • Viewed 79 times • Downloaded 6 times • Run 0 times
Download the 'Análisis Vacunación Ecuador' 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

extensions [csv]
turtles-own[
  sexo
  edad
  nom_vacuna
]

to setup
  ca
  ask patches [set pcolor white set plabel-color 102]
  create-turtles-from-data
;  crt 14800[
;    set size 6
;    set shape "person"
;    setxy random-xcor random-ycor
;    set sexo one-of (list "Mujer" "Hombre")
;  ]
  let die-t (count turtles * 0.9)
  ;show die-t
  ask n-of die-t turtles[die]
  reset-ticks
end 

to go
  ask turtles[move]
  ;if simulacion [start-simulation]
  tick
end 

to simular
  contagiar
  ask turtles [move]
  tick
end 

to create-turtles-from-data
  ;;let file user-file
  file-close-all
  file-open "data_netlogo_encoded.csv"
  while [ not file-at-end? ] [
    ; here the CSV extension grabs a single line and puts the read data in a list
    let f csv:from-row file-read-line
    let n-turtles 0
    if dosis = "Primera" [set n-turtles item 4 f]
    if dosis = "Segunda" [set n-turtles item 5 f]
    ; now we can use that list to create a turtle with the data and target info
    create-turtles n-turtles[
      setxy random-xcor random-ycor
      set heading random-float 360
      set size 7
      set shape "person"
      set sexo item 1 f
      set nom_vacuna item 3 f
      if item 2 f = 0 [set edad 12 + random 5]
      if item 2 f = 1 [set edad 18 + random 6]
      if item 2 f = 2 [set edad 25 + random 24]
      if item 2 f = 3 [set edad 50 + random 9]
      if item 2 f = 4 [set edad 60 + random 9]
      if item 2 f = 5 [set edad 70 + random 9]
      if item 2 f = 6 [set edad 80 + random 20]
    ]
  ]
  file-close ; make sure to close the file
end 

to group-by-gender
  ask patches [set pcolor white set plabel " "]
  let r-male count turtles with [sexo = "Hombre"]
  let r-female count turtles with [sexo = "Mujer"]
  ask patch 175 9 [
    ask other patches in-radius (r-male / 5) [set pcolor blue]
  ]
  ask patch -175 9 [
    ask other patches in-radius (r-female / 5) [set pcolor 15]
  ]
  ask turtles[
    ifelse sexo = "Hombre"
    [set color yellow move-to one-of patches with[pcolor = blue ]]
    [set color 65 move-to one-of patches with[pcolor = 15 ]]
  ]
  ask patch -290 -140[set plabel "Mujeres" set pcolor 65 ask other patches in-radius 5 [set pcolor 65]]
  ask patch -290 -155[set plabel "Hombres" set pcolor yellow ask other patches in-radius 5 [set pcolor yellow]]
end 

to group-by-edad
  ask patches [set pcolor white set plabel " "]

  ;Radio por edad
  let r-12-17 count turtles with [edad <= 17]
  let r-18-24 count turtles with [edad >= 18 and edad <= 24]
  let r-25-49 count turtles with [edad >= 25 and edad <= 49]
  let r-50-59 count turtles with [edad >= 50 and edad <= 59]
  let r-60-69 count turtles with [edad >= 60 and edad <= 69]
  let r-70-79 count turtles with [edad >= 70 and edad <= 79]
  let r-80 count turtles with [edad >= 80]

  ask patch -300 148 [
    if r-12-17 > 50 [set r-12-17 r-12-17 / 5]
    ask other patches in-radius r-12-17[set pcolor 19]
  ]

   ask patch -300 0 [
    if r-18-24 > 50 [set r-18-24 r-18-24 / 5]
    ask other patches in-radius r-18-24[set pcolor 39]
  ]
  ask patch -100 0 [
    if r-25-49 > 50 [set r-25-49 r-25-49 / 5]
    ask other patches in-radius r-25-49[set pcolor 102]
  ]
  ask patch 100 100 [
    if r-50-59 > 50 [set r-50-59 r-50-59 / 5]
    ask other patches in-radius r-50-59[set pcolor 69]
  ]
  ask patch 250 30 [
    if r-60-69 > 50 [set r-60-69 r-60-69 / 5]
    ask other patches in-radius r-60-69[set pcolor 89]
  ]
  ask patch 98 -77 [
    if r-70-79 > 50 [set r-70-79 r-70-79 / 5]
    ask other patches in-radius r-70-79[set pcolor 119]
  ]
  ask patch 300 -100 [
    if r-80 > 50 [set r-80 r-80 / 5]
    ask other patches in-radius r-80[set pcolor 9]
  ]

  ask turtles with[ edad <= 17][set color 1 move-to one-of patches with[pcolor = 19 ]]
  ask turtles with[ edad >= 18 and edad <= 24][set color 24 move-to one-of patches with[pcolor = 39 ]]
  ask turtles with[ edad >= 25 and edad <= 49][set color 45 move-to one-of patches with[pcolor = 102 ]]
  ask turtles with[ edad >= 50 and edad <= 59][set color 64 move-to one-of patches with[pcolor = 69 ]]
  ask turtles with[ edad >= 60 and edad <= 69][set color 84 move-to one-of patches with[pcolor = 89 ]]
  ask turtles with[ edad >= 70 and edad <= 79][set color 114 move-to one-of patches with[pcolor = 119 ]]
  ask turtles with[ edad >= 80][set color 4 move-to one-of patches with[pcolor = 9 ]]

  ask patch -290 -65[set plabel "12 - 17 años" set pcolor 1 ask other patches in-radius 5 [set pcolor 1]]
  ask patch -290 -80[set plabel "18 - 24 años" set pcolor 24 ask other patches in-radius 5 [set pcolor 24]]
  ask patch -290 -95[set plabel "25 - 49 años" set pcolor 45 ask other patches in-radius 5 [set pcolor 45]]
  ask patch -290 -110[set plabel "50 - 59 años" set pcolor 64 ask other patches in-radius 5 [set pcolor 64]]
  ask patch -290 -125[set plabel "60 - 69 años" set pcolor 84 ask other patches in-radius 5 [set pcolor 84]]
  ask patch -290 -140[set plabel "70 - 79 años" set pcolor 114 ask other patches in-radius 5 [set pcolor 114]]
  ask patch -290 -155[set plabel "80 años y más" set pcolor 4 ask other patches in-radius 5 [set pcolor 4]]
end 

to group-by-vaccine
  ask patches [set pcolor white set plabel " "]
  let r-pfizer count turtles with [ nom_vacuna = 0]
  let r-astraz count turtles with [nom_vacuna = 1]
  let r-sinovac count turtles with [nom_vacuna = 2]

  ask patch 0 0 [
    ask other patches in-radius (r-pfizer / 5) [set pcolor 63]
  ]
  ask patch 260 60 [
    ask other patches in-radius (r-astraz / 5) [set pcolor 83]
  ]
  ask patch -220 80 [
    ask other patches in-radius (r-sinovac / 5) [set pcolor 123]
  ]

  ask turtles[
    if nom_vacuna = 0 [set color 67 move-to one-of patches with[pcolor = 63 ]]
    if nom_vacuna = 1 [set color 88 move-to one-of patches with[pcolor = 83 ]]
    if nom_vacuna = 2 [set color 127 move-to one-of patches with[pcolor = 123]]
  ]
  ask patch -270 -50[set plabel "Pfizer" set pcolor 63 ask other patches in-radius 5 [set pcolor 63]]
  ask patch -270 -65[set plabel "Astrazeneca" set pcolor 83 ask other patches in-radius 5 [set pcolor 83]]
  ask patch -270 -80[set plabel "Sinovac" set pcolor 123 ask other patches in-radius 5 [set pcolor 123]]
end 

to start-simulation
  ask patches [set pcolor white set plabel " "]
  ask turtles [
    set color 105
    setxy random-xcor random-ycor
  ]
  let contagiados count turtles * 0.01
  ask n-of contagiados turtles [set color red]
end 

to contagiar
  let umbral 0
  ifelse vacuna?
  [
    set umbral 2
    ask turtles with [color = red][ask other turtles in-radius umbral [set color red]]
  ]
  [
    set umbral 10
    ask turtles with [color = red][ask other turtles in-radius umbral [set color red]]
  ]
end 

to move
  fd 2
  rt 30
  fd 2
  lt 45
end 

There is only one version of this model, created almost 3 years ago by Adrian Lara.

Attached files

File Type Description Last updated
Análisis Vacunación Ecuador.png preview Preview for 'Análisis Vacunación Ecuador' almost 3 years ago, by Adrian Lara Download
data_netlogo_encoded.csv data Ejemplo de archivo para ejecutar el modelo almost 3 years ago, by Adrian Lara Download

This model does not have any ancestors.

This model does not have any descendants.