Skip to content

Diagnostics

One or more diagnostics to be applied on the population can be configured with the diagnostics parameter. Diagnostics data are stored on the attributes diag_state, diag_type, diag_false and diag_waiting atributes of the population class and can be used by other intervention mechanics like decisions and quarantines.

diagnostics parameter

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

Predefined diagnostics

diagnostics.SEROLOGICAL

All symptomatic particles be tested with sensitivity of 86%.

SEROLOGICAL = {
    "name": "Serological",
    "sensitivity": 0.86,
    "specificity": 0.90,
}
diagnostics.PCR

All symptomatic particles be tested with sensitivity of 90% and a 2 days delay for results.

PCR = {
    "name": "PCR",
    "result_delay": 2.0,
    "sensitivity": 0.90,
    "specificity": 1.0,
}

Custom diagnostic parameters

Parameters:

Name Type Description Default
name string

Name of the diagnostic.

required
filter_particles tuple

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

  • ("symptoms", "==", SYMPT_YES) equivalent as population.symptoms == SYMPT_YES
  • ((("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)), "&", ("states", "==", STATE_I)) is equivalent as ((population.symptoms == SYMPT_YES) | (population.symptoms == SYMPT_SEVERE)) & (population.states == STATE_I)

Available markers for filter_particles:

  • ("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.
  • ("service", service_name) will be replaced with the id of the service with service_name.
  • ("workers", service_name, workers_name) will be replaced with the id of the workers with workers_name type on service with service_name.

ATTENTION: Do NOT use python's normal boolean operators (and, or, not, etc), all operations are applied on numpy boolean arrays and the apropriate operators to use are binary operators (&, |, ~, etc).

'`("symptoms", "==", SYMPT_YES), "|", ("symptoms", "==", SYMPT_SEVERE)`'
number_per_day int

Number of tests to be applied in the selected population, particles selected with filter_particles will be selected ramdomly to test if there isn't enough tests. If set to -1 will test all particles selected with filter_particles.

'-1'
sensitifity float

Sensitivity value for the test in the [0., 1.] interval.

'0.85'
specificity float

Specificity value for the test in the [0., 1.] interval.

'0.96'
test_delay float

Time in days between a particle is selected to be tested and the test is made.

'0.0'
result_delay float

Time in days between a particle is tested and the result is available.

'0.0'
allow_retest str

Allow particles to retest the test, available settings:

  • "yes": All particles can retest.
  • "no": retests are not allowed.
  • "negative": Particles with negative results can retest.
'"no"'
retest_delay float

Time since last result for a particle to be alloed retest.

'2.0'
start_day int

Days from the start of the simulation to start using this diagnostic.

'0'
end_day int

Days from the start of the simulation to stop using this diagnostic. If set to -1 this diagnostic will be used up to the end of the simulation.

'-1'