API Reference
Classes
Core classes
- warm_up.Model
-
Discrete-event simulation model for ambulance responses.
- warm_up.UtilisationCalculator
-
Compute time-weighted ambulance utilisation from an event log.
- warm_up.WarmUpAuditor
-
Warm-up auditor - records cumulative mean results at intervals.
- dispatcher.Patient
-
Represents a patient who has called 999.
- dispatcher.Dispatcher
-
Allocate ambulances and permits to waiting patients.
- model.CapacitySchedule
-
Apply a repeating availability schedule to one resource pool.
- model.Dispatcher
-
Allocate ambulances and permits to waiting patients.
- model.Patient
-
Represents a patient who has called 999.
- model.Model
-
Discrete-event simulation model for ambulance responses.
- runner.Model
-
Discrete-event simulation model for ambulance responses.
- runner.Results
-
Simulation output for a single model run.
- runner.Runner
-
Run the simulation for one or more replications.
- patient.Patient
-
Represents a patient who has called 999.
- capacity.CapacitySchedule
-
Apply a repeating availability schedule to one resource pool.
- results.UtilisationCalculator
-
Compute time-weighted ambulance utilisation from an event log.
- results.Results
-
Simulation output for a single model run.
- input_times.FitDist
-
Fit distributions using sim-tools and compare samples to real data.
- empirical.Model
-
Discrete-event simulation model for ambulance responses.
- empirical.Results
-
Simulation output for a single model run.
- empirical.Runner
-
Run the simulation for one or more replications.
- empirical.EmpiricalRunner
-
Run replications using empirical process time distributions.
model.CapacitySchedule Methods
Methods for the model.CapacitySchedule class
- model.CapacitySchedule.validate_schedule()
-
Validate the capacity schedule.
- model.CapacitySchedule.run()
-
Apply the capacity schedule repeatedly.
- model.CapacitySchedule.apply_target()
-
Try to reach capacity target until the specified deadline.
- model.CapacitySchedule.return_units()
-
Return units to the resource pool.
- model.CapacitySchedule.remove_units()
-
Remove available units until the target or deadline is reached.
- model.CapacitySchedule.record_change()
-
Record a single change in capacity.
- model.CapacitySchedule.assert_resource_invariants()
-
Check that resource counting is consistent.
capacity.CapacitySchedule Methods
Methods for the capacity.CapacitySchedule class
- capacity.CapacitySchedule.validate_schedule()
-
Validate the capacity schedule.
- capacity.CapacitySchedule.run()
-
Apply the capacity schedule repeatedly.
- capacity.CapacitySchedule.apply_target()
-
Try to reach capacity target until the specified deadline.
- capacity.CapacitySchedule.return_units()
-
Return units to the resource pool.
- capacity.CapacitySchedule.remove_units()
-
Remove available units until the target or deadline is reached.
- capacity.CapacitySchedule.record_change()
-
Record a single change in capacity.
- capacity.CapacitySchedule.assert_resource_invariants()
-
Check that resource counting is consistent.
Dataclasses
Data-holding classes
- dispatcher.DispatchRequest
-
A patient waiting for ambulance resources.
Functions
Public functions
- warm_up.run_single_audit()
-
Run warm-up audit for a single replication.
- warm_up.run_warm_up_audit()
-
Run warm-up audit for one or more replications (can run in parallel).
- warm_up.plot_warm_up()
-
Plot warm-up trajectories for one metric and response category.
- input_multiresource.mean_job_time()
-
Find the mean ambulance job time by response category.
- input_multiresource.estimate_extra_amb_time()
-
Estimate the time spent by extra ambulances on scene.
- input_multiresource.estimate_multiresource_reduction()
-
Estimate the reduction for the model.
- input_data.map_labels()
-
Map labels, rejecting missing and unexpected values by default.
- input_data.map_icb()
-
Map ICB names.
- input_data.map_categories()
-
Map response categories.
- input_data.prepare_time_data()
-
Import and clean time data.
- input_data.prepare_resources_per_incident()
-
Import and clean data on resources per incident.
- input_data.prepare_shifts()
-
Load shifts and calculate their start and end minutes within a week.
- input_data.prepare_resources()
-
Load resources and convert hourly resource use to vehicle counts.
- runner.combine_run_results()
-
Combine per-run results into patient, run, and overall DataFrames.
- input_shifts.create_weekly_schedule()
-
Convert shifts into a repeating weekly vehicle count schedule.
- input_shifts.create_availability_schedule()
-
Calculate mean vehicle counts by minute of week and event type.
- input_shifts.subtract_unavailability()
-
Subtract one event’s vehicle counts from a schedule.
- input_shifts.create_schedules()
-
Create the four schedule variants.
- input_shifts.plot_schedule()
-
Plot vehicle counts over the week.
- input_shifts.save_schedule()
-
Convert schedule to a dictionary and save as json file.
- input_shifts.plot_and_save_schedules()
-
Plot and save schedules for an area.
- results.plot_capacity_vs_util()
-
Plot capacity v.s., utilisation during the model run.
- results.combine_run_results()
-
Combine per-run results into patient, run, and overall DataFrames.
- input_times.get_dist_params()
-
Compute sim-tools parameter dict for a given distribution.
- input_times.snap_bins_to_seconds()
-
Compute bin edges so bin width is a whole number of seconds.
- input_times.plot_observed_fitted()
-
Plot overlaid comparison of observed vs fitted data.
- input_times.fit_dist()
-
Generate the required parameters for the chosen distribution.
- input_times.fit_config()
-
Fit distributions for each metric and category from raw time data.
- input_times.plot_metric_kde()
-
Plot KDE curve by category (C1-C4).
- input_arrivals.get_mean_arrivals()
-
Mean counts by weekday, category, outcome, and optionally by hour.
- input_arrivals.build_arrival_config()
-
Determine arrival parameters and create config dict.
- input_arrivals.plot_simulated_arrivals()
-
Simulate repeated weeks and plot arrival counts by weekday (+ hour).
- empirical.build_empirical_config()
-
Build registry configuration for empirical time distributions.
Constants
Module-level constants and data
- input_data.AREA_NAME_MAP
- input_data.DAY_MINUTES
- input_data.EVENT_TYPES_MAP
- input_data.WEEK_MINUTES
- input_data.YEAR
- input_data.CATEGORIES
- input_data.WEEKDAYS
- input_data.TIME_COLUMNS
- input_shifts.EVENT_TYPES
- input_shifts.WEEK_MINUTES
- input_times.DISTRIBUTIONS
- input_times.CONVEY_COL
- input_times.CONVEY_LABELS
- input_times.CAT_COLORS
- input_times.DIST_CLASSES