BaseCaseSurveillanceTracker#

class BaseCaseSurveillanceTracker(model, verbose=False, params=None)[source]#

Bases: BasePhase

Component for tracking detected cases in the model.

This component: 1. Simulates case detection based on a detection rate 2. Optionally tracks detected cases aggregated by geographic level 3. Uses a filter function to determine which nodes to include

Case detection is simulated using a binomial distribution. Cases can be tracked at individual node level or aggregated by geographic level. Uses a filter function to determine which nodes to include. Note that a single infection can be detected multiple times.

Parameters:
  • model – The simulation model containing nodes, states, and parameters.

  • verbose (bool) – Whether to print verbose output during simulation. Defaults to False.

  • params (BaseCaseSurveillanceParams | None) – Component-specific parameters. If None, will use default parameters.

Initialize the component.

Parameters:
  • model – The model instance this component belongs to.

  • verbose (bool) – Whether to enable verbose output. Defaults to False.

__call__(model, tick)[source]#

Process case surveillance for the current tick.

Parameters:
  • model – The simulation model.

  • tick (int) – Current time step.

Return type:

None

get_dataframe()[source]#

Get a DataFrame of reported cases over time.

Returns:

  • tick: Time step

  • patch_id: Patch/group identifier. Matches the id column of the scenario DataFrame at the requested aggregation_level.

  • cases: Number of reported cases

Return type:

DataFrame

plot(fig=None)[source]#

Create a heatmap visualization of log(cases+1) over time.

Parameters:

fig (Figure | None) – Existing figure to plot on. If None, a new figure will be created.

Yields:

The figure containing the heatmap visualization.