contact_tracing#

class contact_tracing(trace_probs=None, trace_time=None, start_day=0, end_day=None, presumptive=False, quar_period=None, capacity=None, **kwargs)[source]#

Bases: Intervention

Contact tracing of people who are diagnosed. When a person is diagnosed positive (by either test_num() or test_prob(); this intervention has no effect if there is not also a testing intervention active), a certain proportion of the index case’s contacts (defined by trace_prob) are contacted after a certain number of days (defined by trace_time). After they are contacted, they are placed into quarantine (with effectiveness quar_factor, a simulation parameter) for a certain period (defined by quar_period, another simulation parameter). They may also change their testing probability, if test_prob() is defined.

Parameters:
  • trace_probs (float/dict) – probability of tracing, per layer (default: 100%, i.e. everyone is traced)

  • trace_time (float/dict) – days required to trace, per layer (default: 0, i.e. no delay)

  • start_day (int) – intervention start day (default: 0, i.e. the start of the simulation)

  • end_day (int) – intervention end day (default: no end)

  • presumptive (bool) – whether or not to begin isolation and contact tracing on the presumption of a positive diagnosis (default: no)

  • capacity (int) – optionally specify a maximum number of newly diagnosed people to trace each day

  • quar_period (int) – number of days to quarantine when notified as a known contact. Default value is pars['quar_period']

  • kwargs (dict) – passed to Intervention()

Example:

tp = cv.test_prob(symp_prob=0.1, asymp_prob=0.01)
ct = cv.contact_tracing(trace_probs=0.5, trace_time=2)
sim = cv.Sim(interventions=[tp, ct]) # Note that without testing, contact tracing has no effect

Methods

initialize(sim)[source]#

Process the dates and dictionaries

apply(sim)[source]#

Trace and notify contacts

Tracing involves three steps that can independently be overloaded or extended by derived classes

  • Select which confirmed cases get interviewed by contact tracers

  • Identify the contacts of the confirmed case

  • Notify those contacts that they have been exposed and need to take some action

select_cases(sim)[source]#

Return people to be traced at this time step

identify_contacts(sim, trace_inds)[source]#

Return contacts to notify by trace time

In the base class, the trace time is the same per-layer, but derived classes might provide different functionality e.g. sampling the trace time from a distribution. The return value of this method is a dict keyed by trace time so that the Person object can be easily updated in contact_tracing.notify_contacts

Parameters:
  • sim – Simulation object

  • trace_inds – Indices of people to trace

Returns: {trace_time: np.array(inds)} dictionary storing which people to notify

notify_contacts(sim, contacts)[source]#

Notify contacts

This method represents notifying people that they have had contact with a confirmed case. In this base class, that involves

  • Setting the ‘known_contact’ flag and recording the ‘date_known_contact’

  • Scheduling quarantine

Parameters:
  • sim – Simulation object

  • contacts – {trace_time: np.array(inds)} dictionary storing which people to notify