Every aspect of the simulation can be customised. This is handled through JSON formatted configuration files. These files must contain three elements:
Configuration files are JSON objects. The basic structure is shown below, the internal structure of each section will be described separately. There are no optional elements.
{
"patient_config" : { },
"ward_config" : [ {}, {}, ...], //one element per ward
"simulation_config" : { ... }
}
The transfer_probability
object describes the edges in a graph were nodes are wards and edges are patient transfers. The weight of each edge is the probability that a patient in the source ward will be transferred to the target ward. It must ultimately be possible for all patients to reach the (virtual) Exit ward.
resource_limits
, wait_limits
and attention_limits
have the same structure. They provide the parameters for poisson distributions (the lambda) used to generate the resource/ staff time need and stay duration required for each patient in each ward. The min and max parameters clamp the possible generated values. Importantly, the settings for the Pool and Exit wards must not be changed. The Exit ward is not described in the wait_limits
object because the limit must be set to Javascript Infinity
, which is not possible in JSON.
The batch_arrival_*
properties parameterise the poisson distrubution controlling the arrival rate at A+E. Per simulation step, this distribution is used to determine the number of new patients arriving.
transfer_probability
, resource_limits
, wait_limits
, attention_limits
and initial_ward
are entirely determined by the configuration file and cannot be changed by users. For all other settings, the configuration file sets the default but users are not restricted to your settings.
"patient_config" : {
"transfer_probability" : {
"Emergency":[
{"name":"Observation","weight":0.8},
{"name":"Medical","weight":0.15},
{"name":"Surgery","weight":0.05}
],
"Observation":[
{"name":"Medical","weight":0.3},
{"name":"Exit","weight":0.7}
],
"Medical":[
{"name":"Surgery","weight":0.2},
{"name":"Exit","weight":0.8}
],
"Surgery":[
{"name":"Recovery","weight":1}
],
"Recovery":[
{"name":"Exit","weight":1}
]
},
"resource_limits" : {
"Emergency" : {
"min" : 1,
"max" : 10,
"lambda" : 10
},
...
"Exit" : {"min":1,"max":1}, //do not change
"Pool":{"min":1,"max":1} //do not change
},
"wait_limits" : {
"Emergency" : {
"min" : 1,
"max" : 10,
"lambda" : 10
},
...
"Pool":{"min":1,"max":1} //do not change
},
"attention_limits" : {
"Emergency" : {
"min" : 1,
"max" : 10,
"lambda" : 10
},
...
"Pool":{"min":1,"max":1} //do not change
},
"max_transfers" : 10, //to prevent infinitely long visits
"max_patients" : 200, //limit number of patients that can be generated
"batch_arrival_min" : 0,
"batch_arrival_max" : 2,
"batch_arrival_lambda" : 5,
"initial_ward" : "Emergency" //patients will always arrive here from the Pool
}
ward_config
is a list of objects, with one object per ward (except Exit and Pool which cannot be configured). resource_distribution
can be one of "divide_evenly", "highest_first", "biased_highest_first" or "lowest_first". accept_overflow
can either be "always" or "never".
queue_policy
must be the name of a queue object. The default options are "MaxPQ" (highest need first), "MinPQ" (lowest need first) and "SimpleQueue" (first come, first served). Custom queue types that implement different policies can be added, see below.
begin_boarding_after
is currently only used by the simulator for the Emergency ward.
All settings apart from fill_colour
can be changed by the user, all you can set is the default.
"ward_config" : [
{
"name" : "Emergency",
"capacity" : 50,
"resources" : 50,
"resource_distribution" : "divide_evenly",
"accept_overflow" : "never",
"fill_colour" : "#F6D8AE",
"queue_policy" : "MaxPQ"
},
...
]
queue_policy
must be the name of a queue object that conforms to a simple API. To extend the simulator with an additional queue type, the new queue class must at least provide the methods shown. Queue objects are used extensively in the simulation and so new queues should be as performant as possible to avoid slowing down the simulation.
function MyNewQueue(max_size){
this.max_size = max_size //this is currently always set to Infinity
this.add = function(el){
//add a Patient object to the queue
//do not accept a duplicate patient
}
this.next = function(){
//return the Patient object at the front of the queue
}
this.length = function(){
//return the current length of the queue
}
}
emergency_wait_target
is the maximum length of time patients should have to wait in A+E before being admitted to another ward, definied as the number of simulation steps. *_cost
is the price per unit of each of the ward parameters.
Costs cannot be edited by the user. All other options can be changed be the user and the configuration file only sets the default.
"simulation_config" : {
"steps" : 100, //steps until simulation ends
"emergency_wait_target" : 15,
"staff_cost": 50,
"resource_cost": 10,
"bed_cost": 100
}