class_simulation_trial_results.TrialResults
class_simulation_trial_results.TrialResults(
simulation_inputs,
run_results,
daily_availability_data,
historical_data=None,
)Manages results from a model trial
Methods
| Name | Description |
|---|---|
| PLOT_SIMULATION_utilisation_summary | Creates a bar plot to summarize the average resource utilization |
| PLOT_hourly_call_counts | Produces an interactive plot showing the number of calls that were received per hour in |
| calculate_available_hours | Version of a function to calculate the number of hours a resource is available for use |
| compute_average_calls | Computes the average calls received per day of the week for each month. |
| count_weekdays_in_month | Returns a dictionary with the count of each weekday in a given month. |
| display_UNTATTENDED_calls_per_run | Alternative to get_perc_unattended_string(), using a different approach, allowing for |
| display_resource_use_exploration | Displays the resource use exploration section including dataframes and plots. |
| display_vehicle_utilisation_metric | Displays the utilisation metrics for a given vehicle in a specified Streamlit column. |
| get_AVERAGE_UNATTENDED_calls_per_run | Returns a count of the calls per run, averaged across all runs |
| get_AVERAGE_calls_per_run | Returns a count of the calls per run, averaged across all runs |
| get_UNATTENDED_calls_per_run | Returns a count of the unattended calls per run |
| get_calls_per_run | Returns a series of the calls per simulation run |
| get_perc_unattended_string | Alternative to display_UNTATTENDED_calls_per_run |
| get_perc_unattended_string_normalised | Alternative to display_UNTATTENDED_calls_per_run |
| make_SIMULATION_utilisation_headline_figure | Options: |
| make_SIMULATION_utilisation_variation_plot | Creates a box plot to visualize the variation in resource utilization |
| make_job_count_df | Given the event log produced by running the model, create a dataframe with one row per |
PLOT_SIMULATION_utilisation_summary
class_simulation_trial_results.TrialResults.PLOT_SIMULATION_utilisation_summary(
historical_results_obj,
car_colour='blue',
helicopter_colour='red',
use_poppins=False,
)Creates a bar plot to summarize the average resource utilization across all simulation runs.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| historical_results_obj | required |
Returns
| Name | Type | Description |
|---|---|---|
| plotly.graph_objects.Figure | A Plotly bar plot showing the average utilization percentage for each resource, grouped by vehicle type. |
Notes
- The
vehicle_typecolumn values are capitalized for consistency. - The y-axis values are formatted as percentages with no decimal places.
- A custom color scheme is applied based on vehicle type:
- “Car” is mapped to
COLORSCHEME["blue"]. - “Helicopter” is mapped to
COLORSCHEME["red"].
Example
fig = make_SIMULATION_utilisation_summary_plot(utilisation_df) fig.show()
PLOT_hourly_call_counts
class_simulation_trial_results.TrialResults.PLOT_hourly_call_counts(
box_plot=False,
average_per_month=False,
bar_colour='teal',
title='Calls Per Hour',
use_poppins=False,
error_bar_colour='charcoal',
show_error_bars_bar=True,
show_historical=True,
)Produces an interactive plot showing the number of calls that were received per hour in the simulation
This can be compared with the processed historical data used to inform the simulation
calculate_available_hours
class_simulation_trial_results.TrialResults.calculate_available_hours(
summer_start,
summer_end,
)Version of a function to calculate the number of hours a resource is available for use across the duration of the simulation, based on the rota used during the period, accounting for time during the simulation that uses the summer rota and time that uses the winter rota.
Servicing is also taken into account.
Warm up duration is taken into account.
compute_average_calls
class_simulation_trial_results.TrialResults.compute_average_calls(df)Computes the average calls received per day of the week for each month.
count_weekdays_in_month
class_simulation_trial_results.TrialResults.count_weekdays_in_month(year, month)Returns a dictionary with the count of each weekday in a given month.
display_UNTATTENDED_calls_per_run
class_simulation_trial_results.TrialResults.display_UNTATTENDED_calls_per_run()Alternative to get_perc_unattended_string(), using a different approach, allowing for robustness testing
Here, this is done by looking for any instances where no callsign was assigned, indicating that no resource was sent
display_resource_use_exploration
class_simulation_trial_results.TrialResults.display_resource_use_exploration()Displays the resource use exploration section including dataframes and plots.
display_vehicle_utilisation_metric
class_simulation_trial_results.TrialResults.display_vehicle_utilisation_metric(
historical_data_class,
st_column,
callsign_to_display,
vehicle_type_label,
icon_unicode,
current_quarto_string,
)Displays the utilisation metrics for a given vehicle in a specified Streamlit column. Returns the updated quarto_string.
get_AVERAGE_UNATTENDED_calls_per_run
class_simulation_trial_results.TrialResults.get_AVERAGE_UNATTENDED_calls_per_run(
)Returns a count of the calls per run, averaged across all runs
This is done by looking for any instances where no callsign was assigned, indicating that no resource was sent
get_AVERAGE_calls_per_run
class_simulation_trial_results.TrialResults.get_AVERAGE_calls_per_run()Returns a count of the calls per run, averaged across all runs
get_UNATTENDED_calls_per_run
class_simulation_trial_results.TrialResults.get_UNATTENDED_calls_per_run()Returns a count of the unattended calls per run
This is done by looking for any instances where no callsign was assigned, indicating that no resource was sent
get_calls_per_run
class_simulation_trial_results.TrialResults.get_calls_per_run()Returns a series of the calls per simulation run
get_perc_unattended_string
class_simulation_trial_results.TrialResults.get_perc_unattended_string()Alternative to display_UNTATTENDED_calls_per_run
This approach looks at instances where the resource_request_outcome was ‘no resource available’
get_perc_unattended_string_normalised
class_simulation_trial_results.TrialResults.get_perc_unattended_string_normalised(
)Alternative to display_UNTATTENDED_calls_per_run
This approach looks at instances where the resource_request_outcome was ‘no resource available’
make_SIMULATION_utilisation_headline_figure
class_simulation_trial_results.TrialResults.make_SIMULATION_utilisation_headline_figure(
vehicle_type,
)Options: - helicopter - solo car - helicopter backup car
make_SIMULATION_utilisation_variation_plot
class_simulation_trial_results.TrialResults.make_SIMULATION_utilisation_variation_plot(
historical_results_obj,
car_colour='blue',
helicopter_colour='red',
use_poppins=False,
)Creates a box plot to visualize the variation in resource utilization across all simulation runs, with historical mean and range indicators.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| historical_results_obj | required |
Returns
| Name | Type | Description |
|---|---|---|
| plotly.graph_objects.Figure | A Plotly box plot. |
make_job_count_df
class_simulation_trial_results.TrialResults.make_job_count_df()Given the event log produced by running the model, create a dataframe with one row per patient, but all pertinent information about each call added to that row if it would not usually be present until a later entry in the log