An IoT-Aware System for Managing Patients' Waiting Time Using Bluetooth Low-Energy Technology

It is a common observation that whenever patients arrives at the front desk of a hospital, outpatient clinic, or other health-associated centers, they have to first queue up in a line and wait to fill in their registration form to get admitted. The long waiting time without any status updates is the most common complaint, concerning health officials. In this paper, UrNext, a location-aware mobile-based solution using Bluetooth low-energy (BLE) technology is presented to solve the problem. Recently, a technology-oriented method, the Internet of Things (IoT), has been gaining popularity in helping to solve some of the healthcare sector’s problems. The implementation of this solution could be illustrated through a simple example of when a patient arrives at a clinic for a consultation. Instead of having to wait in long lines, that patient will be greeted automatically, receive a push notification of an admittance along with an estimated waiting time for a consultation session. This will not only provide the patients with a sense of freedom but would also reduce the uncertainty levels that are generally observed, thus saving both time and money. This work aims to improve the clinics’ quality of services, organize queues and minimize waiting times, leading to patients’ comfort while reducing the burden on nurses and receptionists. The results demonstrate that the presented system is successful in its performance and helps achieves a pleasant and conducive clinic visitation process with higher productivity.


Introduction
The delicate nature and the need of all the services being provided by health institutions could easily be attributed to their direct relation with the health and wellbeing of a society. The true measure of success is measured by the unequaled level of devoted services provided to its people. In clinics, the long waiting time is the most common complaint, resulting in patients' frustrations and anxiety, and unfortunately, often resulting in patients leaving the clinic without attending their appointments. A research study, carried out in 2015 at the primary care clinic in Gombak, Malaysia, showed that more than half of the patients (53%) were enrolled within 15 minutes with an average total waiting time of 41 minutes [1]. A study in the Kingdom of Saudi Arabia showed that the average waiting time between the set appointment time and the actual doctor's meeting, in outpatient clinics, is 44.83 minutes [2]. These studies suggest that the patients wait an average of 30 to 45 minutes in order to get admitted to be treated. There are three main reasons for the long waiting time [2,3]: understaffing in the reception service causing lengthy registration time, acute shortage of health personnel to meet the increasing demand for these services, and common problems in the registration system, assigning dates, and deliberate or unintentional overlapping appointments' times.
There are various studies that focus on the problems of patients' waiting time and their repercussions. Some of those studies are found in [3][4][5][6][7][8]. UrNext, is a location-aware mobile application which uses proximity-aware device technology, such as Bluetooth low-energy (BLE) beacons. The aim of UrNext is to reduce patients' waiting time, while focusing on improving the quality of services to provide a confortable environment. Beacons are compact, low-powered transmitters responsible for connecting and communicating with smart devices in a predefined physical radius [9]. UrNext's beacon-based Bluetooth technology enables all the patients and doctors involved, to simultaneously receive relevant information, at the right moment, as per their respective geo-locations. Through the UrNext application, patients can approximately know the waiting time of their appointments, and view the size of the waiting line. In addition, a notification is simultaneously sent to the doctors when patients arrive, thus confirming their presence and resolving the doctors' issues in estimating their workload. To the best of our knowledge, no application utilizes beacon technology in the healthcare domain to overcome the queuing problem. The paper consists of 5 sections. Section 2 discusses the foundation of this topic and previous related studies. Section 3 lays down the entire system analysis and its implementations. Section 4 presents the evaluation phase of the system. Finally, Section 5 concludes the paper, along with future directions.

Bluetooth Beacons Technology
Bluetooth beacons are hardware transmitters that use BLE technology. They enable smartphones and other devices to convey their identifying elements to other compatible devices in their proximity [10]. Fig. 1, it shows how the beacon works to give continuous signals. This enables the other compatible devices to pick up the call by only sensing it through their Bluetooth connection. This generates a unique ID that is sent to the server. The server will request the application to act, and the user will receive it on the device.

Related Works
There are various works done to reduce the patients waiting time and each work is independently done with a unique approach. The following are some of the studies undertaken in this context with their corresponding methodologies. The authors in [11] have proposed an alternative approach for handling the issue of patients' waiting time. They have proposed a queuing management system which ultimately reduces the inconvenience to the patients. They have solved this issue by developing a web application. In another similar work [12], the authors have developed a mobile application to monitor the patients' waiting time with the help of IoT devices. This application has the capability of tracking the patient's vital signs like heartbeat, blood pressure and pulse rate. In [13], the authors have proposed a methodology which involves servers and their maintenance. Their ultimate goal is to monitor the hospital environment which also includes waiting times. This system has the capability to optimize the waiting times and reduce the cost of maintenance. In [14], a fully logic-based technique was implemented to manage the queues with a study analyzing the business effect on hospitals. It has been recently noted that the waiting time element is in effect influencing the customer satisfaction, and having diverse consequences on a moderate loyalty relationship [15]. Patients' waiting time is considered a serious and a major issue among professional healthcare administrators and policy-makers. This issue is very much and particularly affecting the primary healthcare sector. Waiting time is acting as a barrier to providing efficient treatment to patients and hindering the flow of visitations [16]. Similarly, in [17] the authors discovered as well that waiting time is indeed acting as a barrier for patients' care and creating a negative effect on fostering a strong bond and a friendly atmosphere between the customer and the clinic. The patients waiting time issue has been also addressed in other countries, such as in Canada [18]. In another work [19], the study shows that some patients can manage 30 minutes of wait and do not mind even if it exceeds 60 minutes but gets agitated beyond this time. Another country also conducted a study relating to patients waiting time. In their work [20] the authors from Nigeria investigated the average waiting time and concluded that around 62% of the patients wait more than 90 minutes and around 38% of the remaining wait around 180 minutes. Long waiting times are eroding healthcare efforts as the clinics are losing their patients and developing a negative reputation. In addition, as shown in [21], this issue is also affecting staff productivity [21]. In this study, different applications developed using beacon technology are presented and compared to UrNext, to explore all of the benefits it provides to all user, along with the restrictions impediments in its usage. QLess [22] is a company based in Pasadena, CA, USA. This company produces software-as-a-service solutions, known as the QLess app, to eliminate waiting lines. The application includes a Queue Management Feature, which gives the traditional waiting in queues a modern look and removes the frustration of waiting for long hours for nothing. As soon as the user selects a line, s/he ultimately will have to wait, but more conveniently and formally. Users are constantly kept updated with their waiting status, and a timely SMS alert, call alerts, or visual text notifies them of their turn to order/consult. One of the application's amazing features is the 'Waiting Room Management.' This feature allows the clinic or hospital to adjust their respective patient's timings and appointments. QLess streamlines patients' satisfaction and reduces their waiting time with its "virtual queues" features. The application also enables patients to freely control their booking and visiting schedules while staying within the confines of their homes. The SMS and call alert feature also makes it quite feasible for them to wait for their respective turns. This significantly reduces the waiting time and the anxiety triggered by the uncertainty of waiting indefinitely with no indication of when they are next. The key features of the QLess application are the follows: Live Wait Times application [23] helps the patients in choosing the best national health service (NHS) accident and emergency service or walk-in center for every patient's circumstances. The application allows searching local NHS sites, either by postcode, geographic area, phone, or device location. In each site, the waiting time is displayed, and additional information such as treatments offered, parking, and opening times are displayed when the site is tapped. The application can also locate and navigate to the nearby NHS sites. Its primary function is to provide the latest known waiting time estimations, thus helping the patients make an informed choice on an appropriate NHS site to visit. The key features of the Live Wait Times application are the follows: -searching for local NHS sites, -providing information such as treatments offered and parking and opening times about sites, -locating and navigating nearby NHS sites, and -providing the latest known waiting time.
The NoWait application [24] allows its users to book a place or a spot for themselves. All that the user has to do is simply search up the home or restaurant, or anywhere that s/he is looking for. Then, the results would notify the user of the possible waiting time that the selected place requires facilitating timely arrival while avoiding unnecessary wait. The application also can notify the user of the number of people front of the line at that moment. The key features of the NoWait application are as follows: -saving time by getting in line from home, work, or a private yacht; and -gaining peace of mind by knowing how long the wait time is at any nearby restaurant.
The BeHere application [25] is a companion application for education. BeHere is a full set of solutions to increase the classroom experience and improve on the interaction between the institution and the students. The BeHere application using iBeacon, automatically registers the students' attendance as soon as they walk through the door. Teachers can see and interact with their students in real-time and can have a full schedule at a glance. They can also seamlessly share documents with all their students, and store them offline for future use. The key features of the BeHere application are as follows: -usage of the beacon, -opening the application automatically when iBeacon identifies the device, -providing a full schedule in a glance, -providing shared documents with a swipe to all students, and -storing the documents for offline use.
A comparison of the related applications by features is shown in Tab. 1.
The above table quite clearly indicates that the BeHere application is the only application that employs beacon technology. BeHere covers the educational sector, while UrNext revolves around the healthcare sector. The same applies to the QLess and the Less Wait Times applications. However, these applications do not use the beacon technology. Furthermore, most apps do not provide an electronic registration feature. Based on the above comparison and discussion, we developed a location-aware mobile application using proximity-aware device technology. The developed application will serve the healthcare community targeting adult patients. The system performs four basic functionalities: sends a greeting message when the patient walks into the clinic, notifies the doctor and the nurse when a patient arrives, informs the patient of an estimated waiting time and queue number, allowing for a time-saver and pre-notification to patients if the doctor is unavailable for personal reasons.

System Overview
A location-aware mobile application was developed using BLE beacons, where mobile devices can be aware of the input locations. UrNext is designed to target four different types of users: doctors, receptionists, nurses, and patients, respectively. To gain a broad and precise perspective of the problem, several surveys were run with doctors, nurses, and receptionists by randomly circulating relevant questionnaires [26].
The system provides different uses for each party. The scenario of the solution (Fig. 2) is as follows. The patients are required to first turn on their mobile phone's Bluetooth only after installing the required application. The application must also be granted full access to the user's location and GPS. When this has been done, the application connects itself to the patient's Bluetooth device, resulting in the generation of a customized greeting message, an estimated waiting time, and a queue number on the mobile device. UrNext completely takes care of the patient-doctor communications and keeps both of them wellinformed at all times. The arrival of a patient, the cancellation of an appointment, and the doctor's unavailability are all broadcasted as is to the patient.
In the system, it is assumed that the patient who logs in has an appointment already, while the walk-in patients with no appointments cannot use the app.

System Architecture
UrNext uses a client-server architecture to ensure that the server is always available and that the files and applications can be accessed at any time. The server also acts as a centralized hub for storing and sharing files and supports remote access, enabling clinic staff and patients to access data on the server without physically being at the clinic [27]. The architecture design of the application is shown in Fig. 3. During implementation,

System Analysis and Design
A user-centric design method was adopted to develop the application. Two types of questionnaires were designed: a hard-copy questionnaire for doctors and nurses and an online questionnaire for patients. The questionnaires were distributed to the system stakeholders to understand the problem more broadly and hone on the needs and requirements. The questionnaires were first distributed to several doctors, nurses, and receptionists to obtain detailed information about the issues in waiting in clinics and the impact on the work process, as well as to learn of their procedures in scheduling appointments, and their  expectation from the system. Next, the online questionnaire for patients and clinic auditors was distributed to obtain a clearer picture of their needs and gather how they will respond to an application that solves the waiting problem. The survey results provided the researcher increased confidence about the system's importance to health officials and patients, and its usage in facilitating the process of organizing queues and minimizing waiting times in clinics. In the system's development process, the UrNext system uses an object-oriented analysis and design (OOAD) approach instead of a structured analysis and design. This approach focuses on objects rather than data or processors. It was followed as an object-oriented programming language was used in developing the UrNext system. OOAD also guarantees that the system shall have a longer life and less maintenance cost because most of the processes are encapsulated. Also, OOAD provides reliability and flexibility to the system [28]. In Fig. 4, a use case diagram is presented, showing the main actions performed by the system's different users.
The following are the descriptions of each use case.
Register. Create an account for the patient, so s/he can get services from the system.
Login. To log into the system. Accept next patient. This function is initiated when the nurse wants to accept the next patient when the current patient is almost finished.
Cancel or delay. This function is used when the nurse wants to notify all next patients when the doctor has emergency leave reasons and to write a comment, including set a delayed appointment.
Calculate estimated wait time and queue number. When doctors, nurses, and patients choose to display queue operations, cancel an appointment, accept the next patient, or cancel and delay, this function will be initiated. The estimated waiting time and the queue number are calculated according to the algorithm presented in Fig. 5.
Show queue number and estimated wait time. Doctors and nurses can choose to display a queue number to see the next patient and how many patients are in the queue. A patient can also see h/her queue number, estimated waiting time, and how many patients are in line before.
Log out. Allows doctors, nurses, admins, and patients to log out from the system.
Show personalized entertainment content. Allows the patient to show personalized entertainment contents.
Upload entertainment content. The system administrator can upload entertainment contents to the database.
Send notifications. The beacon will send a message to the patient's mobile by Bluetooth to notify the patient that s/he is in or out of the beacon range.

System Implementation and Integration
In developing the system, several essential software, external tools, and hardware were used to satisfy the system's needs.
Beacon [29]. A Beacon is a compact transmitter of radio waves. It is similar to Bluetooth. The signals that it transmits are picked up by other devices that are in close proximity to it. One thing worthy of noting is that the radio signals are in the form of different and unique combinations of letters and numbers. The speed of transmission of these signals is 1/10 th of the speed of a second. Any phone or a smart device that has Bluetooth can pick up these signals.
Android mobile devices. Samsung, Huawei, and LG smartphones. [30]. Official Integrated Development Environment for Android application development based on IntelliJ IDEA. Notepad++ [31]. It is a free source code editor that is used because of its support for several languages.

Android Studio
Android SDK. These tools are selected for developing different applications on Android. It allows users to debug libraries, relevant documentation for the Android application program, interfaces, and emulator created by Google [32].
CPU Monitor Advanced Lite. This application lets all the information get recorded, which are related to all the processes being run on the device.
Monkey command line tool [33]. This tool allows 'N' (number) of events to be created. It runs over the ADB commanding line. The commands include features like touches, gestures, other events.
Node.js. allows JavaScript to be implemented for the development of different web servers and other tools related to networking. It is able to handle different cores and their functionalities. These modules use an API design that does not let their writing get too much complicated [34].
Firebase database [35]. This database is hosted by a cloud and is a real-time testing system. In this database, the data is synchronized and stored as JSON to be provided simultaneously to the client.
During the initial development of the UrNext system, we started working on each function separately. In the integration of the system, we conducted it at three levels. In the first level, we worked on basic functions such as sign up, sign in, log out, and forgot password. In the second level, we implemented each user separately (patient, doctor, nurse, and admin). In the third level, we integrated all components (Fig. 6).

Application Layout and User Interface
We developed the system by adding all the functionalities and making it easier to use. Because the visual presentation of the user interface elements has a great impact on an application's user experience, we made sure that the UrNext components are well organized within the system for easy navigation and interaction. Fig. 7 shows a hierarchy diagram for the main layout of UrNext.
The interfaces were specifically designed to be kept as user-friendly, simple, and consistent as possible. Fig. 8 shows the main UrNext interfaces followed by a simple description.

Evaluation
After evaluating UrNext through system testing with different strategies and user acceptance testing (UAT), the results are discussed in this section.

System Testing
System testing shows any errors encountered during the development process, ensuring the system's performance effectiveness. For the evaluation of UrNext, we applied the following methods: unit testing, integration testing, performance testing, and stress testing.

Unit Testing
Unit testing aims to test the individual parts of the software application before integrating them to the main application and to ensure that every component works as expected [28]. All elements of the UrNext system passed this test, as shown in Tab. 2.

Integration Testing
In software testing, integration testing is when individual software modules are combined and tested as a group, usually performed after the testing of the unit and before validating the test. In this type of testing, the modules of input used which already been tested before. The process involves grouping up these modules, then combining them into even larger groups, and subsequently conveying them to a plan testing system that was already designed for this purpose. [28]. The testing of the integration in UrNext was performed using the bottom-up approach. The testing of modules takes place in ascending order, with the higher modules preceding the lower ones. This method successfully enabled all the UrNext modules to be tested.

Performance Testing
Performance testing was carried out to determine the overall quality of the designed system, considering CPU usage as one of the selected metrics in evaluating the performance of an application. We conducted the performance testing using CPU Monitor Advanced Lite and chose the Android Profile option in the Android studio, where the system showed a good response time. Fig. 9 shows the CPU usage over the last minute of the UrNext application. It also shows the average and maximum usage of memory and network, in which the average CPU utilization rate is 3%, and its maximum speed is 7%, implying that the system is a lightweight.

Stress Testing
Stress testing is the process of determining and specifying the robustness of the system. It is also used to see and observe the response of the system under high loads from the user. For this application, we used the Monkey command line tool, which works by sending an imaginary or pseudo-random sequence of user events to a running emulator. It acts as a stress test on the application. After 500 events generation, the UrNext worked as expected.

UAT
UAT aims to ensure that the requirements are met, in which the target users perform to make sure that it is reliable and could be trusted in reality-based scenarios [36]. A total of 12 users participated in the UAT, in which five of them were female students from the College of Computer and Information Science, King Saud University, three doctors, three nurses, and one admin. The usability of the system was tested according to two different criteria.
Efficiency. Assessed by measuring the time the user took to complete a task.
Satisfaction. Measured by asking the users to fill a survey to learn of their reaction when using the app. Tab. 3 shows the results of the UAT of some tasks for UrNext users.
In Tab. 3, the highest task in time was uploading the entertainment content, which is reasonable as it depends on the uploaded media's size. On the other hand, sign in, logout, and cancel an appointment took between 3 and 10 seconds only. Some tasks required writing statements, such as sign up, reset password, cancel appointments or delay appointments by the nurse, took between 15 and 25 seconds. Reset password 25 5 Cancel appointment 3