class_hems_availability.HEMSAvailability
class_hems_availability.HEMSAvailability(
env,
sim_start_date,
sim_duration,
utility,
servicing_overlap_allowed=False,
servicing_buffer_weeks=4,
servicing_preferred_month=1,
print_debug_messages=False,
master_seed=SeedSequence(42),
)The HEMS Availability class
This class is a filter store which can provide HEMS resources based on the time of day and servicing schedule
Methods
| Name | Description |
|---|---|
| add_hems | Future function to allow for adding HEMS resources. |
| allocate_regular_resource | Attempt to allocate a resource from the preferred group (REG jobs). |
| allocate_resource | Attempt to allocate a resource from the preferred group. |
| current_store_status | Debugging function to return current state of store |
| daily_servicing_check | Function to iterate through the store and trigger the service check |
| do_ranges_overlap | Function to determine whether two sets of datetimes overlap |
| find_next_service_date | Function to determine the next service date for a resource. The date is determine by |
| is_during_school_holidays | Function to calculate whether given start and end date time period falls within |
| is_other_resource_being_serviced | Function to determine whether any resource is being services between a |
| populate_store | Function to populate the filestore with HEMS class objects |
| preferred_regular_group_available | Determine the most suitable HEMS (Helicopter Emergency Medical Service) unit |
| preferred_resource_available | Determine the best available HEMS resource for an EC/CC case based on the |
| prep_HEMS_resources | This function ingests HEMS resource data from a user-supplied CSV file |
| return_resource | Class to return HEMS class object back to the filestore. |
| years_between | Function to return a list of years between given start and end date |
add_hems
class_hems_availability.HEMSAvailability.add_hems()Future function to allow for adding HEMS resources. We might not use this (we could just amend the HEMS_ROTA dataframe, for example) but might be useful for ‘what if’ simulations
allocate_regular_resource
class_hems_availability.HEMSAvailability.allocate_regular_resource(pt)Attempt to allocate a resource from the preferred group (REG jobs).
allocate_resource
class_hems_availability.HEMSAvailability.allocate_resource(pt)Attempt to allocate a resource from the preferred group.
current_store_status
class_hems_availability.HEMSAvailability.current_store_status(
hour,
month,
store='resource',
)Debugging function to return current state of store
daily_servicing_check
class_hems_availability.HEMSAvailability.daily_servicing_check(
current_dt,
hour,
month,
)Function to iterate through the store and trigger the service check function in the HEMS class
do_ranges_overlap
class_hems_availability.HEMSAvailability.do_ranges_overlap(
start1,
end1,
start2,
end2,
)Function to determine whether two sets of datetimes overlap
find_next_service_date
class_hems_availability.HEMSAvailability.find_next_service_date(
last_service_date,
interval_months,
service_dates,
service_duration,
)Function to determine the next service date for a resource. The date is determine by the servicing schedule for the resource, the preferred month of servicing, and to avoid dates that fall in either school holidays or when other resources are being serviced.
is_during_school_holidays
class_hems_availability.HEMSAvailability.is_during_school_holidays(
start_date,
end_date,
)Function to calculate whether given start and end date time period falls within a school holiday
is_other_resource_being_serviced
class_hems_availability.HEMSAvailability.is_other_resource_being_serviced(
start_date,
end_date,
service_dates,
)Function to determine whether any resource is being services between a given start and end date period.
populate_store
class_hems_availability.HEMSAvailability.populate_store()Function to populate the filestore with HEMS class objects contained in a class list
preferred_regular_group_available
class_hems_availability.HEMSAvailability.preferred_regular_group_available(pt)Determine the most suitable HEMS (Helicopter Emergency Medical Service) unit for a REG (regular) job, ensuring that two units from the same crew/callsign group are not simultaneously active. This method prioritizes matching the patient’s preferences and helicopter benefit where applicable.
Returns: A list containing: - The selected HEMS unit (or None if none available) - A lookup code describing the allocation reason
preferred_resource_available
class_hems_availability.HEMSAvailability.preferred_resource_available(pt)Determine the best available HEMS resource for an EC/CC case based on the patient’s preferred care category (EC = Enhanced Care, CC = Critical Care), vehicle type, and ad-hoc availability. Returns the chosen HEMS unit and the reason for its selection.
Returns: A list containing: - The selected HEMS unit (or None if none available) - A lookup code describing the allocation reason
prep_HEMS_resources
class_hems_availability.HEMSAvailability.prep_HEMS_resources()This function ingests HEMS resource data from a user-supplied CSV file and populates a list of HEMS class objects. The key activity here is the calculation of service schedules for each HEMS object, taking into account a user-specified preferred month of servicing, service duration, and a buffer period following a service to allow for over-runs and school holidays
return_resource
class_hems_availability.HEMSAvailability.return_resource(
resource,
secondary_resource,
)Class to return HEMS class object back to the filestore.
years_between
class_hems_availability.HEMSAvailability.years_between(start_date, end_date)Function to return a list of years between given start and end date