API Reference

Classes

Core classes

CapacitySchedule

Apply a repeating availability schedule to one resource pool.

WarmUpAuditor

Warm-up auditor - records cumulative mean results at intervals.

SimConfig

Configuration for a simulation run.

Dispatcher

Allocate ambulances and permits to waiting patients.

EmpiricalRunner

Run replications using empirical process time distributions.

FitDist

Fit distributions using sim-tools and compare samples to real data.

Model

Discrete-event simulation model for ambulance responses.

Patient

Represents a patient who has called 999.

Results

Simulation output for a single model run.

UtilisationCalculator

Compute time-weighted ambulance utilisation from an event log.

Runner

Run the simulation for one or more replications.

CapacitySchedule Methods

Methods for the CapacitySchedule class

CapacitySchedule.validate_schedule()

Validate the capacity schedule.

CapacitySchedule.run()

Apply the capacity schedule repeatedly.

CapacitySchedule.apply_target()

Try to reach capacity target until the specified deadline.

CapacitySchedule.return_units()

Return units to the resource pool.

CapacitySchedule.remove_units()

Remove available units until the target or deadline is reached.

CapacitySchedule.record_change()

Record a single change in capacity.

CapacitySchedule.assert_resource_invariants()

Check that resource counting is consistent.

Dataclasses

Data-holding classes

DispatchRequest

A patient waiting for ambulance resources.

Functions

Public functions

plot_warm_up()

Plot warm-up trajectories for one metric and response category.

run_warm_up_audit()

Run warm-up audit for one or more replications (can run in parallel).

convert_keys_to_int()

Convert dictionary keys to int.

convert_resource_hours_to_ambulances()

Convert resource hours per week to a fixed number of ambulances.

resolve_dict()

Return a dictionary unchanged, or load one from a JSON file path.

build_empirical_config()

Build registry configuration for empirical time distributions.

build_arrival_config()

Determine arrival parameters and create config dict.

fit_config()

Fit distributions for each metric and category from raw time data.

get_dist_params()

Compute sim-tools parameter dict for a given distribution.

plot_metric_kde()

Plot KDE curve by category (C1-C4).

plot_observed_fitted()

Plot overlaid comparison of observed vs fitted data.

plot_capacity_vs_util()

Plot capacity v.s., utilisation during the model run.

Constants

Module-level constants and data

DISTRIBUTIONS