Skip to content

Vaccination

Warning

This page is out of date, as soon as possible it will be updated.

Vaccinations policies can be done with the vacciantions parameter where a list of dictionaries can be passe each containing the parameters for a vaccination policy, where starting from a predefined day (start_day), every day a number of doses (doses_per_day) is applied on a group of citizens (filter), after a citizen is vaccinated a fraction of the vaccinated (effectiveness) became immune after a fixed number of days (days_to_immunity).

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from comorbuss import community, vaccination

parameters = dict()

vaccinate_children_and_seniors = {
    "name": "Children and seniors",
    "filter: (vaccination.FILTER_CHILDRENS, "|", vaccination.FILTER_SENIORS),
    "doses_per_day": 5000,
}

parameters['vaccinations'] = [
        vaccinate_children_and_seniors, 
        (vaccination.HOSPITALS_WORKERS, {"start_day": 10, "doses_per_day": 500})
    ]

comm = community(**parameters)
comm.simulate()

In this example two vaccination policies where conducted:

  • With the vaccinate_children_and_seniors 5000 vaccine doses are applied in children and senior citizens per day.
  • With (vaccination.HOSPITALS_WORKERS, {"start_day": 10, "doses_per_day": 500}) we load the HOSPITALS_WORKERS predefined vaccination, but change the start_day to 10 (this vaccination will start on th 10th day of simulation) and doses_per_day to 500 (500 doses will be applied per day on this vaccination policy).

vaccinations parameter

List with the ordered dictionaries of parameters for vaccination policies to be used during the simulation. Default: []

Predefined vaccinations

Seealso

Predefined vaccinations uses predefined filters.

vaccination.SENIORS

Apply the deafult number of doses on senior citzens (age groups 12 to 21, 60+ years old).

SENIORS = {
    "name": "Senior citizens",
    "filter": (FILTER_SENIORS, "&", FILTER_DIAG_NO),
}
vaccination.ADULTS

Apply the deafult number of doses on adults citzens (age groups 5 to 21, 20+ years old).

ADULTS = {
    "name": "Adult citizens",
    "filter": (FILTER_ADULTS, "&", FILTER_DIAG_NO),
}
vaccination.CHILDRENS

Apply the deafult number of doses on child citzens (age groups 0 to 4, 0-19 years old).

CHILDRENS = {
    "name": "Child citizens",
    "filter": (FILTER_CHILDRENS, "&", FILTER_DIAG_NO),
}
vaccination.DIAG_NO

Apply the deafult number of doses on citzens that where not diagnosed.

DIAG_NO = {
    "name": "Not dignosed",
    "filter": FILTER_DIAG_NO,
}
vaccination.MAKETS_WORKERS

Apply the deafult number of doses on markets workers.

MAKETS_WORKERS = {
    "name": "Markets workers",
    "filter": (FILTER_MARKET_WORKERS, "&", FILTER_DIAG_NO),
}
vaccination.HOSPITALS_WORKERS

Apply the deafult number of doses on hospitals workers.

HOSPITALS_WORKERS = {
    "name": "Hospitals workers",
    "filter": (FILTER_HOSPITALS_WORKERS, "&", FILTER_DIAG_NO),
}

Custom vaccinations parameters

Parameters:

Name Type Description Default
name string

Name of the vaccination policy.

required
start_day int

Day from the start of the simulation to start the vaccination policy.

'0.'
days_to_immunity float

Number of days for vaccinated particles to became immune.

'30.0.'
effectiveness float

Fraction of vaccianted particles to became immune.

'1.0.'
filter tuple

A sequence of nested tuples of strings and values to be evaluated to select particles to vaccinate, strings can be population attributes (see particles states attributes), comparative operators, binary operators or makers (see markers bellow). Examples:

  • ("diag_states", "!=", DIAG_YES) equivalent as population.diag_states != DIAG_YES, and will select all particles with a dianostins states diferent than DIAG_YES that is a positive disgnostic.
  • ((("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)), "&", ("diag_states", "!=", DIAG_YES)) is equivalent as ((population.symptoms == SYMPT_YES) | (population.symptoms == SYMPT_SEVERE)) & (population.diag_states != DIAG_YES), and will select all sympomatic particles (severe or mild) that has a a dianostins states diferent than DIAG_YES.
  • (("diag_states", "!=", DIAG_YES), "&", ("ages", "isin", list(range(12, 22)))) is equivalent as ((population.diag_states != DIAG_YES) & (np.isin(population.ages, list(range(12, 22))))), and will select all particles with a dianostins states diferent than DIAG_YES in age groups from 12 to 21 (60+ years old).
  • ("workplace_id", "==", ("service", "Markets")) is equivalent as (population.workplace_id == services["Markets"].id), and will select all Markets workers.
  • (("workplace_id", "==", ("service", "SCHOOLS")), "&", ("worker_type", "==", ("workers", "Schools", "Teachers"))) is equivalent as (population.workplace_id == services["Schools"].id) & (population.worker_type == services["Schools"].workers_parameters["Teachers"].id), and will select all school's teachers.

Available markers for filter_in:

  • ("service", service_name) will load the id of the service with the name service_name.
  • ("workers", service_name, workers_name) will load the id of the worker type with the name workers_name of the service with the name service_name.
  • ("tracing", trace_filters, number_of_days) will select all particles that had tracable contact with particles selected by trace_filters in the last number_of_days days.
"`FILTER_DIAG_NO`\n\n**ATTENTION:** Do NOT use python's normal boolean operators (`and`, `or`, `not`, etc), all operations\n are applied on numpy boolean arrays and the apropriate operators to use are binary operators\n (`&`, `|`, `~`, etc)."
doses_per_day int

Number of available doses per day for this policy (this number will be normalized with the number of particles).

'1000.'

Predefined filters

vaccination.FILTER_DIAG_NO

Selects citzens that where not diagnosed.

FILTER_DIAG_NO = ("diag_states", "!=", DIAG_YES)
vaccination.FILTER_SENIORS

Selects senior citzens (age groups 12 to 21, 60+ years old).

``` python FILTER_SENIORS = ("ages", "isin", list(range(12, 22)))

#### vaccination.FILTER_ADULTS

Selects adults citzens (age groups 5 to 21, 20+ years old).

``` python
FILTER_ADULTS = ("ages", "isin", list(range(5, 22)))

vaccination.FILTER_CHILDRENS

Selects child citzens (age groups 0 to 4, 0-19 years old).

FILTER_CHILDRENS = ("ages", "isin", list(range(0, 5)))
vaccination.FILTER_MARKET_WORKERS

Selects markets workers.

FILTER_MARKET_WORKERS = ("workplace_id", "==", ("service", "Markets"))
vaccination.FILTER_HOSPITALS_WORKERS

Selects hospitals workers.

FILTER_HOSPITALS_WORKERS = ("workplace_id", "==", ("service", "Hospitals"))