Healthc Inform Res Search


Healthc Inform Res > Volume 26(4); 2020 > Article
Housbane, Khoubila, Ajbal, Agoub, Battas, and Othmani: Real-Time Monitoring System to Manage Mental Healthcare Emergency Unit



Real-time relevant information helps guide the healthcare decision-making process in daily clinical practice as well as the management and optimization of healthcare processes. However, proprietary business intelligence suite solutions supporting the production of decision-making information requires investment that is out of reach of small and medium-sized healthcare facilities or those with limited resources, particularly in developing countries. This paper describes our experience in designing and implementing a real-time healthcare monitoring system solution to manage healthcare emergency units.


Through the use of free Business Intelligence tools and Python data science language we designed a real-time monitoring system, which was implemented to explore the Electronic Medical Records system of a university mental health emergency unit and render an electronic dashboard to support health professional daily practice.


Three main dashboards were created to monitor patient waiting time, to access the clinical notes summary for the next waiting patient, and to obtain insights into activity during the last 24 hours.


The designed system could serve as a monitoring support model using free and user-friendly data science tools, which are good alternatives to proprietary business intelligence solutions and drastically reduce cost. Still, the key to success in decision-making systems is based on investment in human resources, business intelligence skills training, the organizational aspect of the decision-making process, and data production quality insurance.

I. Introduction

Several studies have shown that real-time relevant information helps guide the healthcare decision-making process in daily clinical practice as well as the management and optimization of healthcare processes. Internet of Things (IoT) systems help monitor daily patient parameters in home health-care [1]. The drug supply chain benefits from the use of real-time monitoring systems [2]. Mobile health (m-Health) technologies may provide appropriate follow-up support services for patient groups with post-treatment conditions [3]. Big data-based diagnostic performance dashboards help to operationally monitor diagnostic quality and safety [4]. Electronic dashboards support evidence-based decision-making to overcome hospital capacity inefficiencies [5].
However, obtaining real-time decision-making information from clinical data is not straightforward. For a healthcare facility to become data-driven, both organizational and technical decision-making process aspects must be addressed [6]. The organizational part of the decision-making process involves adopting a business decision-making strategy, notably defining strategic objectives and their correspondent key performance indicators [7]. The technical part of this process involves investing in technical infrastructure, business intelligence solutions, and staff training.
Activity-centered information system solutions intended for Electronic Health Records systems, laboratory information systems, radiology information systems, or pharmacy information systems offer perimeter-restricted and specific-functionalities dashboards and only partially fulfill facility decisional needs, which also require investment in business intelligence solutions [8]. Indeed, business analytics techniques have been recently used to address these decisional needs [9].
Studies of personal developed solutions or proprietary-based real-time dashboards as business intelligence solutions to monitor healthcare activities have been recently published [5,10]. Nevertheless, recent data science tools, such as Python and Jupyter offer a free, time-saving learning curve and user-friendly data exploring and data visualization toolkits, which could assist a large community of users in managing their own healthcare facilities.
This paper describes our experience in designing and implementing a real-time healthcare monitoring system solution through the use of data science tools.

II. Case Description

1. Project Settings

The psychiatric emergency unit of the University Psychiatric Center in Casablanca is the reference unit in the western region of Morocco for urgent and serious psychiatric disorders of patients with suicidal behavior or aggression risk. It receives 30 to 40 patients daily. The initial management of a patient must be efficient to establish a rapid assessment with minimum patient–caregiver contact. Implementation of an Electronic Medical Record (EMR) system since November 2018 has improved access to patient records, but to provide real-time monitoring of received patients and obtain quick access to their clinical notes summary, a real-time monitoring system was needed.

2. Real-Time Monitoring System Design

1) System design

The system was designed to respond to three questions: how many patients are waiting, who is the next patient, and how were patients distributed during the previous day. It was developed as a minimal-content and simplified wall-mounted dashboard. Thus, three dashboards were designed: a wall-mounted wait-time dashboard, a clinical summary dash-board, and a 24-hour managerial dashboard.
When physically received in the emergency room (ER), a patient is identified in the EMR system and his or her data is processed in real time to be retrieved in the ER dashboard. The main computed key metrics are waiting time in minutes, sociodemographic factors (age, sex), recorded clinical notes summary (established diagnosis, if one exists; history of suicidal behavior or aggression; prior hospitalization and consultation count and dates; last prescribed drugs).
Technically, we set up three physical servers running the free Linux distribution Ubuntu server. Figure 1 shows the design of the implemented real-time monitoring system.

2) Data processing

The Extract Transform Load (ETL) server runs automated ETL transformations to query EMR data, to compute key metrics, and to store results in the data warehouse (DHW) server as illustrated in Figure 2. To manage ETL transformation, we installed the free community Pentaho Data integration (Kettle). Using the graphical user interface (GUI) of Kettle, information technology (IT) users periodically manage ETL transformations. To manage DWH databases we installed the free database management system MySQL and its free management web client phpMyAdmin.

3) Data visualization

We set up a decision support system (DSS) server running the data science programming language Python and its packages to manage and visualize dashboards. We used Jupyter to create and run Python command lines within web pages called notebooks as shown in Figure 3. A Jupyter notebook is a user-friendly high-level web development environment where we import Python packages and run Python scripts for various tasks, such as data visualization or statistical operations. To create dashboard graphics, we used the Python Plotly [11] package. The Python package Sqlalchemy ( is used to connect to the data warehouse database and to query data with the structured query language (SQL) from within a Jupyter notebook. IPython ( display and Ipython html are used to render html text and webpages within a dashboard.
Dashboards created within a Jupyter notebook are shared as code-free web pages through another Python package, Voila [12], which allows healthcare professionals to visualize and interact with dashboards using only web browsers. Figure 4 shows the ER waiting time dashboard.

4) Real-time processing

To ensure real-time data processing, we configured an Ubuntu server cron job file to run automatically implemented ETL transformations and notebooks every 5 minutes as shown in Figure 5.

3. Results

1) Real-time emergency waiting time monitoring

The ER waiting time dashboard shown in Figure 6 visualizes the next patient information, namely, the patient’s identifier, waiting time, and relative difference in waiting time compared to the waiting time annual median. Colored thresholds represent the waiting time annual median, the 3rd quartile, and 80th percentile. The next waiting patients are represented on a table according to arrival date and waiting time.

2) Next patient on demand clinical notes summary

By clicking on the next patient’s identifier on the ER waiting time dashboard, the caregiver directly accesses a summary of supportive key clinical notes, allowing the caregiver to have an idea of the patient’s history as shown in Figure 7.

3) Last 24-hour ER activity monitoring

ER staff have access through the ER last 24-hour dashboard to key managerial information on patient count, characteristics, waiting time distribution, and administered psychiatric drugs as shown in Figure 8.

4) Implementation statistics

Since implementation on April 6, 2020, 2,018 cases were processed corresponding to 1,482 patients. The waiting time dashboard was trigged 1,569 times by health professionals to obtain insights into patient history through the clinical notes summary dashboard.

III. Discussion

A focus-group of the psychiatric emergency unit’s health professionals perceives the system positively and is convinced of its positive contribution to manage the activity of psychiatric emergencies, especially in the fall period when there is a significant flow of patients into the ER. They concluded that this real-time monitoring system impacts patients’ visits to the psychiatric emergency unit as follows:
  1. The ER waiting time dashboard (Figure 6) allows them to assess the flow of patients even remotely (lunch break, hospital units visit) and thus better manage time and anticipate actions (patient records consultation, asking for reinforcements or supplies);

  2. The summary of patients’ key clinical notes, which gathers and represents pertinent information according to the patient flow in real time (Figure 7) allows healthcare providers to avoid reading through all patient records or to repeat from scratch patient interrogation to create a patient history. It also strengthens the relationship with the patient as he/she has the impression that we already know him/her;

  3. The ER last 24-hour dashboard (Figure 8) is very useful to intervene quickly in business processes, such as switching time planning, providing reinforcements for heavy flow periods, and planning break times (lunch time).

Free business intelligence software can drastically reduce technological investment cost and appears to be a good alternative to proprietary solutions. It offers great flexibility and active community support. However, decision-making systems key success is based on investment in human resources, business intelligence skills training, the organizational aspect of the decision-making process, and data production quality insurance.
The main challenge encountered in implementing this DDS was data modeling because we used an SQL-based database management system. Recent NO-SQL data management solutions, such as MongoDB ( offer more flexibility because no prior data modeling is required; however, expertise and handling skills are needed before production environment utilization.
This study had some limitations. Because the system was implemented fairly recently, we were not able to conduct a long-term technical and operational evaluation. The evaluation of the impact of such a decision support system is complex as outcomes and business processes are multifactor-dependent. All positive assessment of the proposed system was based on the user focus-group’s declarative affirmations; thus, these findings should be taken as preliminary.
To conclude, this free business software-based real-time monitoring system supports mental health emergency unit health professionals in their daily practice and could be an example for other health facilities with limited resources to embrace business intelligence systems.


Conflict of Interest

No potential conflict of interest relevant to this article was reported.

Figure 1
Emergency real-time monitoring system design. Health professionals are data producers and consumers, and IT users periodically manage data processes.
Figure 2
Pentaho Kettle Extract Transformation Load (ETL) tool to retrieve emergency EMR data and to store it in the data warehouse databases.
Figure 3
Jupyter Notebook to create and manage ER dashboard.
Figure 4
Emergency waiting time dashboard webpage rendered with Voila.
Figure 5
Ubuntu Cron job file configuration to run automatically implemented ETL transformation and note-books.
Figure 6
Emergency waiting room real-time dashboard.
Figure 7
Emergency next patient clinical notes summary dashboard.
Figure 8
Emergency last 24-hour waiting time dashboard.


1. Ramirez Lopez LJ, Puerta Aponte G, Rodriguez Garcia A. Internet of Things applied in healthcare based on open hardware with low-energy consumption. Healthc Inform Res 2019;25(3):230-5.
crossref pmid pmc
2. Park YT, Lee YT, Jo EC. Constructing a real-time prescription drug monitoring system. Healthc Inform Res 2016;22(3):178-85.
crossref pmid pmc
3. Miah SJ, Hasan N, Gammack J. Follow-up decision support tool for public healthcare: a design research perspective. Healthc Inform Res 2019;25(4):313-23.
crossref pmid pmc
4. Mane KK, Rubenstein KB, Nassery N, Sharp AL, Shamim EA, Sangha NS, et al. Diagnostic performance dashboards: tracking diagnostic errors using big data. BMJ Qual Saf 2018;27(7):567-70.
crossref pmid
5. Martinez DA, Kane EM, Jalalpour M, Scheulen J, Rupani H, Toteja R, et al. An electronic dashboard to monitor patient flow at the Johns Hopkins Hospital: communication of key performance indicators using the Donabedian model. J Med Syst 2018;42(8):133.
crossref pmid pdf
6. Weggelaar-Jansen AM, Broekharst DS, de Bruijne M. Developing a hospital-wide quality and safety dashboard: a qualitative research study. BMJ Qual Saf 2018;27(12):1000-7.
crossref pmid pmc
7. Hubner-Bloder G, Ammenwerth E. Key performance indicators to benchmark hospital information systems: a delphi study. Methods Inf Med 2009;48(6):508-18.
crossref pmid pdf
8. SelectHub. Business Intelligence software tools comparison [Internet]. Denver (CO): SelectHub; c2020 [cited at 2020 Jul 24]. Available from:
9. Housbane S, Khoubila A, Ajbal K, Serhier Z, Agoub M, Battas O, et al. Monitoring mental healthcare services using business analytics. Healthc Inform Res 2020;26(2):146-52.
crossref pmid pmc pdf
10. Yoo J, Jung KY, Kim T, Lee T, Hwang SY, Yoon H, et al. A real-time autonomous dashboard for the emergency department: 5-year case study. JMIR Mhealth Uhealth 2018;6(11):e10666.
crossref pmid pmc
11. Plotly Python Graphing Library [Internet]. Montreal, Canada: Plotly; c2020 [cited at 2020 Jul 24]. Available from:
12. QuantStack. And voilà! [Internet]. [place unknown]: Medium; 2019 [cited at 2020 Jul 24]. Available from:


Browse all articles >

Editorial Office
1618 Kyungheegung Achim Bldg 3, 34, Sajik-ro 8-gil, Jongno-gu, Seoul 03174, Korea
Tel: +82-2-733-7637, +82-2-734-7637    E-mail:                

Copyright © 2024 by Korean Society of Medical Informatics.

Developed in M2community

Close layer
prev next