1 Introduction

The healthcare system is a complex adaptive system with many stakeholders and multidimensional interactions; it consists of agents, processes, and technologies. Given that agents, processes, and technologies can be configured in many different ways, simulation models are required to understand the system’s behavior. Simulation is useful when direct experimentation is costly or infeasible. This will enable physicians to make logical and systematic decisions to address policy problems and make decisions that will deliver the most cost-effective care.

The complexity of the healthcare system is characterized by chaotic, nonlinear behavior and interdependencies among its agents. In this chapter, we analyze the complex behavior of agents in the Seven Oaks General Hospital emergency department (SOGH-ED). SOGH is an acute care community 304-bed hospital with the second busiest emergency department in Winnipeg, Canada.

1.1 The Setting: Seven Oaks General Hospital Emergency Department

The Seven Oaks General Hospital Emergency Department (SOGH-ED) can be viewed as a black box that takes in patients as inputs and patients as processes that produce desirable outputs. The ED ecosystem comprises of agents and the available resources. The agents include the physician, physician assistants, nurses, nurse practitioners, and the patients. The patient agent serves as the input to the ED ecosystem, and interactions among all agents (i.e., patient agent, physician agent, nurse agent, etc.) determine the output of the ecosystem. Understanding the causal links in the ED ecosystem can bring about optimum utilization of the ED resources, saving costs and improving the quality of care. The challenge is how to properly identify and process those causal links that contribute to a given ED ecosystem operation.

1.2 Improving Patient Flow in the Emergency Department

Simulating the ED using a computer model developed on the agent-based NetLogo [1] software allows an understanding of the variations in ED process flows that arise from changes affecting the causal links between the ED system’s agents. This can provide the ED management with a decision support tool to improve the quality of care and save costs by optimizing the use of resources.

2 Agent-Based Models

Agent-based models are used to simulate the complex and dynamic behavior of systems with very large number of entities in economics, politics, populations, and epidemics. They are computational models that usually involve numerous discrete agents. In this chapter, our agent-based models were analyzed using statistical methods, and we performed the simulations based on results of the statistical distributions.

Agent-based models are generally suitable for modeling complex systems. A complex system usually involves large number of events that have unpredictable system properties [2]. According to a study by the ISPOR Health Science Policy Council, there are three main methods for simulating complex systems in healthcare—systems dynamics, discrete event simulation, and agent-based modeling (ABM). Due to the autonomous behavior of the agent in the ED, ABM is the most suitable methodology [3].

2.1 SOGH-ED Model

Analysis of the SOGH-ED identified the core agents and their characteristics. We developed a stock and flow model followed by a causal loop diagram to describe the SOGH-ED processes. Simulations for modeling complex systems were carried out on processes in the ED ecosystem, and changes in the ecosystem were observed over time.

The stock and flow model is mostly used in analyzing the state of the system and its rate of change over time [4], while a causal loop diagram (CLD) is used to understand and account for the possibility of feedback in the system which in turn helps us in connecting the numerous variables and summarizing the result [4]. The next section describes both approaches as they relate to the SOGH-ED.

2.2 Current State Description (Stock and Flow Model)

Process and ecosystem analysis was performed to build an agent-based model.

2.2.1 Stocks vs Flows

It is worthy to note the differences between stocks and flows . A stock amounts to the quantity within a specific time period, while the flow constitutes the rate between two time periods. For example, the number of patients at a particular time in the ED represents the stock, while the number of patients within a certain time period represents the flow.

The stock and flow model is useful for understanding the arrival rates and inter-arrival rates of the agents in our simulation. This is very important in codifying the behavior of the system with greater accuracy.

The Seven Oaks General Hospital emergency department (SOGH-ED) stock and flow model is shown in Fig. 15.1. It describes the flow of patients through the SOGH-ED. There are two main stock values:

Fig. 15.1
figure 1

Seven Oaks General Hospital emergency department (SOGH-ED) stock and flow model. The diagram shows the flow of a patient from one phase to the other and highlights the dependency of flow in relation to the availability of staff at each treatment stage

  1. 1.

    Patients in specific treatment phase

  2. 2.

    Hospital staff providing care

In the stock and flow diagram in Fig. 15.1, the stocks are depicted in rectangles. The stocks change over time depending on the inflows and outflows. The stocks also capture the state of the system and send signals to the rest of the system. Although stocks start with an initial value, they can only be changed by flows in and out of the system. In the SOGH-ED, the delays are usually caused by the values of the stocks at a particular instant.

The flows, depicted by the “data transmission” symbol, i.e., represent changes per time unit, for example, the rate of arrival per hour, rate of triage per hour, etc.

The major identified flow values are:

  1. 1.

    Arrival rate

  2. 2.

    Triage rate

  3. 3.

    Bed take rate

  4. 4.

    Patients take rate

  5. 5.

    Patients free rate

  6. 6.

    Bed free rate

The links in our SOGH-ED stock and flow represent influence, and the values outside the stock or flow represent auxiliary variables or parameters which are names given to constraints that directly influence the stocks and flows. Parameters are different from stocks because they do not accumulate over time.

2.3 The Patient’s Journey Through the SOGH-ED

The patient journey through the ED consists of a triage phase followed a several post-triage steps. The dynamics of the patient journey are visualized in a causal loop diagram (Fig. 15.2).

Fig. 15.2
figure 2

Seven Oaks General Hospital emergency department (SOGH-ED) causal loop diagram. CCC chief complaint category, CTAS Canadian Triage and Acuity Scale, WTBS waiting to be seen, TIP treatment in progress, PTIP posttreatment in progress, PD pending discharge, TBADM to be admitted, ERH ER (emergency rooms) HOLD

The journey through ED has three phases and is influenced by its agents and behaviors as outlined above:

  • Triage phase

  • Assessment and treatment phase

  • Discharge/post-discharge phase

From here on, phase names are placed between ** and agent states between <>.

2.3.1 Triage Step

As patients arrive at the hospital, they are put into <queue for triage>. As soon as the triage nurse becomes available, the patient from the queue is taken and moved to *triage* phase, and <nurse> is marked as busy. When the triage ends, the patient goes to <waiting for bed> state and the <nurse> is marked as free.

2.3.2 Post-triage Step

After triage, the patient <waiting for bed> goes through the following phases:

  • *waiting for nurse assessment* (<bed is blocked>)

  • *assessed by nurse* (<nurse is blocked>)

  • *waiting for physician assessment* (<nurse is unblocked>)

  • *assessed by physician* (<physician is blocked>)

Following the initial assessment, the treating <physician is unblocked>, and the *treatment* phase begins, which again entails a number of nurse and physician visits.

2.3.3 Discharge

When the treatment has been finalized, the patient enters the waiting for *discharge* phase and is discharged at some point in time, <unblocking his bed>.

Any of these phases can be interrupted depending on whether or not another consultation is needed.

2.4 Causal Loop Diagram of the SOGH-ED

The causal loop diagram aims to explore the systems dynamics of the SOGH-ED.

Each causal loop in Fig. 15.2 contains two entities (nodes) AND one influence (connection) as follows:

  • Entities: The noun phrases (TIP, E-TIP, WTBS)

  • Influences: The relationships between two entities

  • Positive causal link: Causes an increase in the variable directly connected to it

  • Negative causal link: Causes a reduction in the other variable directly connected to it

The causal loop diagram tells a coherent story about how different variables or factors affect the SOGH-ED flow. Such factors include:

  • Chief complaint category (CCC)

  • Canadian Triage and Acuity Score (CTAS)

  • Waiting to be seen (WTBS) time

  • Treatment in progress (TIP)

  • Estimated treatment in progress (E-TIP)

  • Pending discharge (PD)

  • To be admitted (TBADM)

  • ER (emergency rooms) HOLD (ERH)

In the SOGH CLD, a positive causal link (red arrow line) between two nodes indicates that the parameters will change in the same direction, while a negative causal link (blue arrow line) connecting two nodes indicates that the parameters will change in opposite directions. The black arrow line represents the logical connector link which shows a direct connection between two variables.

2.4.1 Reinforcing and Balancing Feedback Loops

A loop group with an even number of positive links in a CLD is called a reinforcing loop, while a loop with an odd number of positive links is called a balancing loop.

A reinforcing loop, as the name implies, will result in an outcome that influences the current state, hence producing more of the same effect, resulting in a growth or decline. A balancing loop, on the other hand, will help move a current state to a target goal.

Feedback loops help to make decisions that can regulate the behavior of a system in order to maintain some stability [5]. The positive loops in a CLD are called “reinforcing loops,” while the negative loops are referred to as “balancing loop.” Reinforcing and balancing loops help to determine the “weights” in a dynamic system; the discovery of patterns or formulas can help to determine how the combination of factors might lead to a “stable system.”

$$\displaystyle \begin{aligned} \begin{array}{rcl} T_{1}({\mathrm{WTBS}}) &\displaystyle = \varDelta t{0}\binom{\mathrm{{waiting \ for}}}{\mathrm{{triage \ nurse}}} + \varDelta t{1}\binom{\mathrm{{waiting}}}{\mathrm{{for \ bed}}} + \varDelta t{2}\binom{\mathrm{{waiting \ for}}}{\mathrm{{nurse \ assessment}}} \\ &\displaystyle \quad +\varDelta t{3}\binom{\mathrm{nurse}}{\mathrm{assessment}} + \varDelta t{4}\binom{\mathrm{{waiting \ for}}}{\mathrm{{physician \ assessment}}} \\ &\displaystyle \quad + \varDelta t{5}\binom{\mathrm{physician}}{\mathrm{assessment}} \end{array} \end{aligned} $$
(15.1)

The above formula was used in the simulation and helped to check the *waiting to be seen* (WTBS) time for its validity. The formula shows that WTBS is a function of several other factors; applying the same formulas in another emergency department will need some calibration to reflect that particular system.

The formula

$$\displaystyle \begin{aligned} F\binom{\mathrm{Assessment}}{\mathrm{time}} = \gamma\binom{\mathrm{average}}{\mathrm{physicians}} + h\binom{\mathrm{average}}{\mathrm{nurses}} + b \end{aligned} $$
(15.2)

determines the assessment time for patient as a function of three main variables: the number of available nurses, the number of available physicians, and the number of available beds.Footnote 1

3 Modeling and Simulation of the SOGH-ED

This section describes the algorithm used for the SOGH-ED simulation. It is based on the typical behavior of the agents and their interactions in the different sections within the ED environment.

3.1 The Journey Through the ED

The patient’s path is divided into three main phases:

  • Waiting for treatment

  • Treatment

  • Posttreatment

The length of stay in the ED strongly depends on the severity of the patient’s illness, which is measured by Canadian Triage and Acuity Scale (CTAS) [6]. The Emergency Department Information System (EDIS) datasets and simulation output can also be analyzed to ensure the assessment time intervals follow the CTAS guidelines.

3.2 The ED Environment

The ED ecosystem is divided into four zones (Fig. 15.3):

Fig. 15.3
figure 3

Seven layout of the Oaks General Hospital emergency department (SOGH-ED)

  • Waiting room

  • Triage zone

  • Bed area

  • Staff area

3.3 ED Resources

Patients go through various treatment procedures that involve any of the three resources:

  • Providers.

    Physicians, physician assistants, and nurse practitioners

    They take part in treatment and posttreatment phases. Doctor types differ by effectiveness or experience, which is a defining factor in the treatment phase duration.

  • Nurses.

    Treatment area nurses, minor treatment area (MTA) nurses, and holding area nurses

    Triage nurses play a KEY role in the waiting for treatment phase. Their function is to determine a patient’s CTAS and to allocate him in the correct bed area.

  • Bed Areas.

    Treatment, minor treatment area (MTA), and monitor or holding area beds

    The nurses associated with these areas take care of patients on those PODs. The first three types of beds are used in treatment phases, while the latter type is used in posttreatment. The most acute patients are put onto monitor beds, and the least on MTA beds.

3.4 Model Design

The experimental setup consists of three components, the simulation model, an empirical dataset, and the steps of the care process.

  • The SOGH-ED NetLogo simulation model. The SOGH-ED layout is divided into four zones as shown in Fig. 15.3: waiting room, triage zone, bed area, and staff area.

  • Empirical datasets. The input file was generated from the SOGH Emergency Department Information System (EDIS).

  • The care process.

    • *Waiting for treatment*

      The *waiting for treatment* phase begins with patients’ arrival. The time of arrival was generated using distributions received by analysis of real patients’ arrival times. The arrival rate strongly depends on certain periods of the day. After arrival, a patient is put into the waiting room. When the triage nurse becomes available, she takes the longest waiting patient to the triage zone. The triage nurse decides the patient’s CTAS and where he should be allocated (DTL = desired treatment location). CTAS and DTL are generated based on derived probabilities. The probability of getting a specific DTL depends on the patient’s CTAS. After triage, the patient goes to the waiting room until a bed becomes available. The bed the patient finally gets (ATL = actual treatment location) depends on his CTAS, DTL, and current bed availability. After the patient gets his bed, the *waiting for treatment* phase has finished.

    • *Treatment*

      The *treatment* phase consists of consecutive visits of doctors and nurses. The next steps on the patient’s path are the initial nurse and doctor assessments. The nurse with the lowest number of patients adds a new patient to the end of her list. When she reaches the top of the list, the patient is assessed. After the nurse assessment, the patient can now be assessed by a doctor. The now doctor adds him to his list and carries out an assessment when it is the patient’s turn.

      Following the assessment, the doctor estimates the time required to treat this patient (E-TIP—estimated treatment in progress). E-TIP is generated based on average treatment times, and this depends on the patient’s CTAS. E-TIP values are generated based on average treatment times, which depend on the patient’s CTAS; CTAS in turn determines the number of necessary treatment steps.

      One treatment course consists of first artificial wait time, nurse assessment, second artificial wait time, and doctor assessment. The duration of nurse assessment is 15 min. The wait time values and doctor assessment duration values are calculated based on E-TIP, the number of treatment steps, and the doctor’s experience.

      During the last doctor’s assessment, the doctor will decide whether posttreatment is needed. If needed, the E-PTIP (estimated posttreatment in process) is generated, and the patient is moved to the waiting room, and the *posttreatment* phase begins. Otherwise, the patient is discharged. In both cases the *treatment* phase is considered to have finished.

    • *Posttreatment*

      A patient who is recommended for *posttreatment* stays in the waiting room until a bed in the holding area becomes available. Posttreatment time estimation is similar to that of the treatment time estimation, using E-PTIP instead of E-TIP. After the last posttreatment step, the patient is discharged.

    • Shift timing

      From 10:00 pm to 10:00 am, the MTA department is closed: The patients, MTA nurse, and nurse practitioner go home. Also, one of the physicians is at home between 2:00 am and 7:00 am.

      There are short breaks for nurses every few hours. All nurses are divided into three shifts and they go on breaks by turns.

      Nurses are also divided into PODs. If the nurse is free, but the other nurse in the same POD has patients, the first nurse will help with those patients. Table 15.1 shows how the patients are distributed in various treatment areas according to their CTAS.

      Table 15.1 SOGH-ED triage category distributions

3.5 Model Validation

The *waiting to be seen* (WTBS) time and the *treatment in progress* (TIP) time of our simulation output results are compared against the EDIS data using SAS statistical software [7].

The simulation was run using all the parameters of the “real world” as captured by EDIS, i.e., the simulation took account of the process flow contingent to the urgency of care levels (CTAS) and the availability of service providers at the time of arrival. Table 15.2 shows the comparison of the simulation output to the actual historical ED utilization data for each CTAS category.

Table 15.2 Comparison of simulation output and historical ED utilization data (EDIS) for each CTAS category

3.6 Stability of the SOGH-ED Model

Comparison of the data indicates the similarities between the simulation and the historical distribution of patients across the acuity categories (CTAS). Tables 15.3, 15.4, and 15.5 show the descriptive statistics for three simulation runs confirming the consistency in the time variable outcomes of the simulation model.

Table 15.3 Descriptive statistics of time variables—first run
Table 15.4 Descriptive statistics of time variables—second run
Table 15.5 Descriptive statistics of time variables—third run

3.7 Comparison of WTBS and TIP Between Model and EDIS

Table 15.6 shows the comparison of the time variables (WTBS, TIP) between the simulation runs and the time variables in the EDIS datasets.

Table 15.6 Sample statistics for WTBS and E-TIP

The null hypothesis assumes equal means between the time variables in the simulation output and the EDIS dataset. The t-test (Table 15.7) confirms that there is no statistically significant difference between the simulation output results and the EDIS dataset for WTBS and TIP.

Table 15.7 T-test results

4 Conclusions

This work provides SOGH-ED management with a tool that allows them to analyze the overall state of the ED system. Most importantly, the simulation model allows users to determine bottlenecks in the system and identifies not only the problem but also its cause.

It has been shown empirically that the model is able to recreate the outcomes corresponding with the “real-world system” of the SOGH-ED as evidenced by its historical dataset (EDIS). This provides initial evidence that problems modeled by this simulation model could identify outcomes that most likely will reflect those encountered in the real world.

Although more testing and validation are required, our initial results are encouraging that the approach is feasible for this task. We have provided a tool that can be used to simulate the outcomes of changes to staffing levels and staff composition. It also allows the testing of new process streams without compromising patient safety like fast track treatment (FTT) [8].

In the future, we aim to integrate our model with the real-time EDIS datasets to enable mangers to make decisions based on real-time demands.

5 The Journey

This project gave me my moment of opportunity to delve directly from theoretical applications of complex adaptive systems into its application in the real world—the emergency department. Walking into the emergency department for the first time as a non-patient, I recollect how the doctors and nurses were moving helter-skelter. There were stretcher patients in the lobby that were in the queue for bed space, and the ED seemed to have been over its capacity. I went ahead to discuss this project with the principal investigators, and after 2 h, I returned to meet an almost empty ED. The chaotic set of interactions I observed earlier had resulted in the emergence of an ordered system through self-organization among agents. At that point, I had started observing the systematic behavior of a complex system in the ED environment. Then, I realized I could potentially simulate the key components that drove the system between order and chaos.

Take-Home Message

  • The careful analysis of individual parts in a complex system can result in the global emergence of a stable system

  • Focusing on the important factors will give a good insight to the scale of complexity in the system

  • Some approaches in multi-agent systems such as the stock and flow and feedback loops serve as a mechanism to better understand the complexity of the system

  • The validation process can be performed iteratively to achieve the required level of confidence for the model results