Multi-Hospital Management: Combining Vital Signs IoT Data and the Elasticity Technique to Support Healthcare 4.0

: Smart cities can improve the quality of life of citizens by optimizing the utilization of resources. In an IoT-connected environment, people’s health can be constantly monitored, which can help identify medical problems before they become serious. However, overcrowded hospitals can lead to long waiting times for patients to receive treatment. The literature presents alternatives to address this problem by adjusting care capacity to demand. However, there is still a need for a solution that can adjust human resources in multiple healthcare settings, which is the reality of cities. This work introduces HealCity, a smart-city-focused model that can monitor patients’ use of healthcare settings and adapt the allocation of health professionals to meet their needs. HealCity uses vital signs (IoT) data in prediction techniques to anticipate when the demand for a given environment will exceed its capacity and suggests actions to allocate health professionals accordingly. Additionally, we introduce the concept of multilevel proactive human resources elasticity in smart cities, thus managing human resources at different levels of a smart city. An algorithm is also devised to automatically manage and identify the appropriate hospital for a possible future patient. Furthermore, some IoT deployment considerations are presented based on a hardware implementation for the proposed model. HealCity was evaluated with four hospital settings and obtained promising results: Compared to hospitals with rigid professional allocations, it reduced waiting time for care by up to 87.62%.


Introduction
Smart cities take advantage of the integration of physical infrastructure, information and communication technology, social services, and business resources to optimize decisionmaking and improve city operations [1,2].It can improve resource utilization efficiency, optimize urban operation and services, and improve the quality of life of citizens [3,4].This concept refers to the use of various information technologies or innovative concepts, such as the Internet of Things (IoT), Cyber-Physical Systems (CPS), or Wireless Sensor Networks (WSNs) [5][6][7] to improve the quality of life of people.Various applications and systems can be imagined for smart cities, including smart buildings [8], smart homes [9], waste management [10], environmental detection [11], smart energy [12], traffic [13,14] and healthcare [15].
According to Rejeb et al. [16], IoT is revolutionizing healthcare by allowing personalized, preventive, and collaborative approaches to patient care, as well as improving living conditions.This technology is transforming the way healthcare is delivered.The Internet of Medical Things (IoMT) represents an essential part of IoT, which can be utilized to gather and analyze patient health data, therefore enhancing quality of life [17].In increasingly smarter cities, patient data can be captured as transparently as possible, with vital signs collected in real time by IoT sensors attached to people's clothes and even in the environments through which they pass [18,19].The Internet of Things utilized in smart cities offers a way for health systems to acquire and examine data, combined with machine learning methods, to identify health problems and illnesses early [20].With uninterrupted capture of vital signs and data from other patients, it is possible not only to identify health disorders that may occur in advance but also to plan and establish countermeasures to mitigate the damage that may be caused.
The Coronavirus Disease (COVID-19) pandemic outbreak had a huge impact on the development and operation of cities around the world and the daily lives of people [21].The last pandemic humanity faced before COVID-19 was the H1N1/influenza pandemic in 2009 [22], and even with all the technological advances of the last decade, we were not prepared for this disease.This illness claimed the lives of almost 7 million people in just over three years [23], making the epidemic the defining global health crisis of our time and the greatest challenge since World War II [24].Even with the end of COVID-19 as a global health emergency declared by the World Health Organization (WHO) [23], the impact we had with this last pandemic showed us the importance of preparing for the next pandemics, epidemics, and outbreaks that may arise in the future.The prevention and control of pandemics require the implementation and management of new technologies [21].
Hospitals are essential to provide the population with the necessary medical care.Optimizing the management of resources and processes in these facilities is of utmost importance, especially in underdeveloped countries.Here, the high number of patients and the scarcity of resources often result in long waiting times [25,26].According to [27], no matter how easy or complex a situation may be, if medical personnel do not respond in a timely manner, the health of patients is put in question and is no longer secure.Healthcare professionals are indispensable for the health and well-being of the patient [28].Figure 1 demonstrates the problem that can arise from a static approach to human resource management.When attendants are assigned to specific care stations, it can lead to an unequal distribution of demand, with some areas having too few attendants while others have too many.A more flexible approach to resource allocation would allow attendants with low utilization to be moved to areas with greater demand.Depending on the case, even going to the neighboring hospital, since people with altered vital signs in their homes may be moving to these hospitals.It is essential to devise effective strategies to adjust the number of professionals in accordance with the current state of the health sector in real time.
Figure 1.Problem use-case example of a scenario where there is an inefficient static allocation of attendants in two hospitals.The level of dissatisfaction is higher in rooms that have fewer attendants available, and it is easy to see that idle attendants in a room could easily go to rooms with greater need.Additionally, we have people with health problems at home or at work who can sometimes end up heading to one of these two hospitals.
In the literature, several works attempted to address the problem, even indirectly, with the most varied proposals.However, despite the various approaches, there is still a significant open gap in proposing on-the-fly human resource adjustments for multiple healthcare settings, which is the reality of cities.Furthermore, no existing Human Resources Management (HRM) approach considers the health status of people who have not yet arrived at hospitals.
In this context, based on the Internet of Things, cloud computing elasticity, and smart cities concepts, we present a model for the lastic allocation of human resources in smart cities' healthcare settings (HealCity, for short).HealCity offers an effective way to assign medical staff by moving them and assigning additional professionals to the areas with the highest demand while considering their time limitations.Hence, the primary goal of the model is to adjust the service capacity of hospitals in smart cities to accommodate any level of workload or patient influx.We emphasize that the term human resources refers only to professionals who act as collaborators in healthcare settings.Although patients can also be considered human resources in a broader interpretation, in this work, we use the term only for collaborators, as used for HRM approaches in the literature.Furthermore, we present an implementation of the proposed IoT framework, elucidating several considerations pertinent to IoT deployment.
The main scientific contributions of this article are three-fold: (i) We devise Smart cities-based Human Resources Elasticity, which includes an algorithm for dynamic managing human resource distribution in healthcare environments, making use of IoT sensors to keep track of patients' health disorders demand, and some evaluation metrics for smart cities IoT-enabled hospitals; (ii) In the context of an infrastructure of multi-hospitals, we envisage the definition of scalable hierarchical architecture for human resources management systems in smart cities; and (iii) We introduce a novel algorithm for automatic management and identification of the appropriate hospital for a possible patient, proposing some new mathematical formalisms.
This article is structured as follows.Section 2 delineates the related work pertinent to our investigation.Section 3 presents the HealCity model for health human resources management in smart cities. Section 4 expresses HealCity's evaluation methodology.Section 5 presents the results found in HealCity's implementation.Section 6 presents our IoT deployment considerations.Section 7 presents the lessons learned with the HealCity model.Ultimately, Section 8 delineates the conclusions and outlines prospective avenues for future research.

Related Work
Many studies have been conducted to attempt to address problems related to human resource allocation in healthcare settings, even if not directly, with a wide range of approaches.Some articles propose sharing human resources between hospitals [29,30], others propose adjustments in work shifts [31], others only identify the number of people needed to respond to the demand of patients [32,33], and others come up with adjustments on-the-fly [34][35][36].Table 1 provides a comprehensive overview of the articles collected, presenting some key attributes while highlighting existing gaps.
Analysis of the selected articles reveals a focus on resource insufficiency for patient care prediction or problem-solving, often employing many smart city technologies such as IoT and AI algorithms in the healthcare domain.In particular, it becomes evident that the use of technology is not only a possibility but a reality, with numerous instances in the scientific community where it is actively employed for this purpose.However, none of these approaches seeks to identify the health status of the patients and adjust the capacity for care before this patient arrives at hospitals.In this context, we can outline some of the main gaps in the area, which include:

•
None of the models analyzed the health status of patients outside hospitals to predict the future use of resources in smart cities; • The observed models lack on proposing solutions to proactively address problems in human resources load before they actually happen; • None of these approaches propose a system for on-the-fly adjustments to multiple healthcare settings; and • There is a gap of proposals for smart cities in the health area that relate the admission of patients to hospitals when considering the vital signs from the citizens of a city.
Although there are various approaches to collecting vital signs in the literature, the challenge arises when trying to merge these approaches into a model for human resource management.
Based on the literature review, it is evident that improving the efficiency of human resource use makes a difference in the quality of patient care.Therefore, strategies to adjust service capacity to the needs of hospital environments in advance are extremely necessary.Although data prediction and the Internet of Things hold promise for future healthcare solutions and process automation, their potential remains largely underused, as it is possible to harness these technologies to propose solutions and optimize and maximize the utilization of current human resources.

HealCity Model
The literature review indicates that most strategies focus on optimizing human resource utilization but do not assess the health condition of patients outside of hospitals or the overcrowding of patients in certain areas, disregarding the potential advantages that effective distribution of health resources could provide to patients [29,31].As presented in Section 1, reducing waiting time for care is one of the biggest challenges for healthcare in smart cities.
Based on this background, we introduce HealCity, a multilevel model for efficient human resource management based on patients' flow within and outside the hospital environments.In particular, HealCity applies the concept of elasticity from cloud computing to the context of human resources, allowing adjustment of hospital attendance capacity in response to patient demand.This involves dynamic allocation, deallocation, and reallocation of healthcare professionals based on the requirements of hospitals and smart city needs.HealCity consolidates data from various sources: arrivals and needs of patients (using sensors spread throughout the smart city, sensors attached to people and a smart city dataset), movement of patients (using sensors), and availability of medical staff (using sensors and a dataset).These insightful data serve as the foundation for implementing elasticity-driven allocation of resources.Through this model, HealCity calculates an optimized allocation of human resources, which contributes to reducing patient waiting times, a critical factor during times of pandemic or viral outbreaks.Hence, HealCity introduces the concept of Smart cities-based Human Resources Elasticity in healthcare settings, which can be defined as follows.

Definition 1 (Smart cities-based Human Resources Elasticity). Smart cities-based Human
Resources Elasticity is an extension of the concept of resource elasticity in cloud computing [38] to dynamically allocate health professionals based on patient demand in smart cities. Smart cities-based Human Resources Elasticity uses sensors to keep track of patients' demand inside and outside healthcare settings and, based on a proactive elasticity approach, suggests a strategic distribution of medical staff by relocating them to the areas with the highest demand throughout the smart city, while always taking into account the current quality of services provided by these healthcare facilities.

Design Decisions
Our model is based on the idea that each individual must have a wearable device connected to them in the system to be identified and must wear it throughout their day in the smart city, both indoors and outdoors.These devices must be able to monitor people's health status in real time.In this way, the system can continuously track the health of citizens in the smart city.Readers in the city must be able to receive citizen sensor data.These readers must be able to read data in real time and must communicate with an edge server close to the user to reduce communication latency.These sensors must be able to detect changes in vital signs such as heart rate, heart rate variation, respiratory rate, temperature, and oxygen saturation [39].In addition to collecting people's vital signs, these readers must be able to indicate the location of people passing by.Therefore, data indicating abnormalities in these vital signs are compressed and then sent to the city cloud, which is responsible for analyzing these data and determining if the patient needs hospital care.To illustrate this, Figure 2 (adapted from [39]) shows a view of a tree-based hierarchical structure of smart cities that focuses on the collection of vital signs and mobile health, where vital signs captured in various environments are sent to hospitals after being processed in the cloud infrastructure.
This model provides a comprehensive monitoring infrastructure for smart cities that can be used to improve various aspects of public health.HealCity uses two different approaches to acquire patient information.First, we use a Real-Time Location System (RTLS) [40] within the hospital environment to identify the movement of patients in the hospitals.In the other approach, the model acquires data through the VitalSense [41] service for smart cities, which is responsible for informing us of the people in the city and their location who have altered vital signs and, consequently, who may need medical care.VitalSense is a scalable fog-based solution for real-time monitoring and processing of patient data using wearable devices [41].Maintaining privacy and security is crucial when managing patient information [42].VitalSense fog nodes create an RSA 2048 key pair for data encryption at the edge layer.Data are encrypted by edge controllers using the public key and decrypted by fog nodes using the private key.Moreover, VitalSense utilizes homomorphic encryption algorithms at this layer to ensure the security of all data in transit.Raw data can be sent to external third-party services and public clouds capable of performing arithmetic operations on the data without direct access.These entities cannot view the actual data and must request decryption of their computational results from a fog node.In this way, the service provided by VitalSense is handy for this work, as its fog nodes apply data aggregation and prediction algorithms to produce alarms for critical health situations, and simultaneously establish a secure environment for processing patient data.Smart city hierarchical tree-based structure view with a focus on monitoring patients' health parameters.People wear sensors that transmit health parameters to a fog-cloud infrastructure that provides health information directly to healthcare settings.In this structure, citizens are at the lowest level, interacting with edge devices, while hospitals are at the highest level, interacting with data already processed by the cloud infrastructure.

Architecture
HealCity architecture models two main services: (i) a decision-making service, responsible for human resources management decisions; and (ii) a web service, named HealCity app, responsible for visualization layer for the use of hospital managers, human resources, patients, and people in general.Figure 3 presents the architectural components and network topology within the proposed framework.
HealCity model is based on a modular structure responsible for information handling from initial sensor data acquisition to the outcome shown in the HealCity app. Figure 4 presents the HealCity modules (Capture, Formatter, Elastic, Predict and HealCity App) detailing our proposed architecture.
Capture receives and preprocesses data captured by sensors scattered around the smart city and sends them to the Formatter, responsible for identifying patients' movement through healthcare settings.Subsequently, Predict determines the route taken by patients as they move through the hospital and the duration of their stay in each area.Using these data, Predict identifies patterns pertinent to patient arrivals within these settings and temporal patterns associated with the duration of care waiting times, using these data to forecast subsequent patient arrivals.
Elastic verifies the allocation of human resources in each hospital environment and generates an optimized allocation of human resources on the fly.Our system generates notifications for human resources and patients to reallocate based on predicted demand.Since humans may not follow notifications, we point out that effective reallocation depends on the user meeting that was proposed by HealCity.Elastic and Predict can run both on the edge, on the fog, and on the cloud.In Section 3.3, we detail the algorithms responsible for elastic human resources management in the smart city.Finally, the HealCity app displays information processed by the other application modules, sending elasticity notifications to human resources or generating dashboards for managers.Thus, as input level, as shown in Figure 5, patients provide their location and vital signs to the system.VitalSense services handle patient data, filtering data from only patients with altered vital signs and providing their clinical risk and localization.Human resources provide the system with their work shifts, their hospital and allocated room, and the specialties they serve.Finally, hospital environments provide average care time in their rooms, patients waiting according to the clinical risk level, and human resources allocated in each room.HealCity can use this information as input to generate and communicate elasticity actions to human resources, indicating the specific hospital or room to which they are to be assigned.In addition, HealCity can show healthcare settings the necessary changes in their care structure and the patient's arrival prediction.Finally, HealCity must produce an output that informs people with altered vital signs to seek medical attention and specifies the appropriate healthcare environment for their needs.HealCity proposes a scalable hierarchical solution in which we have edge nodes in hospitals that do their processing and make allocation decisions locally.These communicate with a fog node higher in the hierarchy.Fog nodes do not need to know if the one below is an edge of a hospital or if it is another fog node, and they do not even know if the above is the last level.This way, we can add more hospitals under any fog node and as many fog nodes as needed.Let us say that we have four hospitals in the same neighborhood.We can add a fog node for this neighborhood.We identified that two hospitals are closer and the other two are farther away.We can create a fog to handle only these two hospitals and link this fog and the other two hospitals to another fog node, for example.Therefore, at the last level, in the cloud, we execute the same algorithm.The only difference is that there is no level above, so the decisions are final.Figure 6

Multilevel Elasticity of Human Resources in Smart Cities
HealCity models a multilevel approach to perform human resource allocation, deallocation, and reallocation in the various hospitals throughout a smart city.Based on this approach, our model considers human resource elasticity differently at (i) the room-level, where our approach needs to estimate the future utilization of each room and identify if the attendants count is adequate to meet patients' demand (as discussed next, in Section 3.3.1),at (ii) the hospital level, where HealCity needs to ensure that the number of attendants is adequate to handle the demand from patients in all rooms within the hospital, allowing for the movement of attendants across rooms (as detailed in Section 3.3.2),and at (iii) the regional-level, where HealCity should verify if there are sufficient attendants to meet patients' demand in the smart city regions, with attendants moving between hospitals, and also propose movement for patients who have not yet been to any health environment (as detailed forward in Section 3.3.3).A diagram of these three levels is presented in Figure 7.

Reception room
Can release 1 human resource HealCity model adapts a proactive elasticity strategy using upper and lower thresholds based on the duration of patient waiting times within each queue of a smart healthcare system, as shown in Figure 8.

Room-Level Proactive Elasticity
At the room-level, HealCity must recognize the specific requirements of a given room.At this stage, the human resource elasticity manager should not be concerned with other rooms in hospitals or the city but should only determine how many attendants are necessary to satisfy his own future demand for care.To this end, a time series is generated for the number of patients arriving at each time point and for the service time to input an ARIMA prediction model [43].Consequently, when our model detects waiting times that are not in accordance with established limits, HealCity must calculate the amount of health resources required to meet the patient's demand, thus recognizing the need for adjustments in that particular room.HealCity model uses a parallel allocation of human resources, inspired by similar strategies used in elastic systems [38] and high-performance computing [44].Therefore, HealCity introduces a mathematical formalism to calculate the Proactive Human Resources Elastic Speedup (PHRES), details of which will follow.Table 2 presents a summary of this mathematical notation.

Nomenclature Description
Equation (1) defines the Proactive Human Resources Elastic Speedup for a hospital room r between two times f i and f f , considering a proactive allocation of attendants a.In this way, it is possible to estimate the care time of patients before any overload occurs, allowing the hospital to adjust its resources proactively to ensure a good level of patient service.
where a denotes the quantity of attendants designated for allocation within the temporal interval demarcated by f i and f f , and ACT(r, f i , f f ) ′ and ENP(r, f i , f f ) ′ represent the forecasted average duration of care and the anticipated patient count at room r, respectively, using ARIMA and an analysis of the altered vital signs of people in their homes who will need medical attention in the near future.
We can express the average care time in room r over the time interval [t i , t f ] using Equation ( 2), where CDT(x[i]) represents the duration of care for the i th element of the care vector x for room r.Therefore, for each calculated room r, we generate a time series of ACT(r, t i , t f ) to predict ACT(r, f i , f f ) ′ between future times f i and f f .
Therefore, we can estimate the number of patients waiting for care in room r during the time interval [t i , t f ] using Equation (3).In this equation, NWP(r, t i ) denotes the number of waiting patients for care in room r at time instant t i , and N IP(r, t n ) refers to the number of incoming patients in room r at time instant t n .
Additionally, for each designated room, excluding the reception area, a time series for N IP(r, t i , t f ) is constructed.This allows for the prognostication of forthcoming patient admissions and the determination of ENP(r, f i , f f ) ′ .
Furthermore, for each room, excluding the reception area, a time series for N IP(r, t i , t f ) is generated.This allows us to predict the forthcoming patient admissions and the determination of ENP(r, f i , f f ) ′ .For the reception room, instead of generating a time series for N IP(r, t i , t f ), we will effectively analyze people with altered signs at their homes to define which will arrive at the hospitals to find ENP(r, f i , f f ) ′ , as detailed in Section 3.4.
Using the aforementioned equations, HealCity can predict the waiting time of any hospital room.Changing the attribute a in the equation PHRES, with increasing and decreasing the number of health professionals present, HealCity can determine the number of attendants necessary to align the waiting times of any given room with the predetermined thresholds, as defined by the smart city manager.Algorithm 1 describes our approach to assess whether to increase or reduce the workforce in any specific room r with complexity of O(n).

Hospital-Level Proactive Elasticity
At the hospital level, HealCity is tasked with managing room-specific requisitions across the entire hospital under analysis.The objective is to ensure that each room has the necessary number of attendants, only considering reallocating health professionals between different sectors or de-allocating human resources that are no longer necessary.Algorithm 2 presents the pseudocode for proactive elasticity at the hospital level with complexity of O(2n 2 ).In the HealCity framework, every designated room necessitates a specific specialty for the human resources assigned therein.Concurrently, each healthcare professional possesses a comprehensive list of their specialties.The reallocation of human resources is strictly conducted among professionals possessing the requisite specialty for the intended destination room.
Elastic systems are subject to hysteresis, the system's inclination to revert to its former state when the initiating impulse is no longer present.In our context, hysteresis occurs when a human resource is needed again in the room that previously released it.To mitigate the phenomenon of human resource hysteresis, we implement a cooldown-based strategy [45].In particular, whenever a resource is reallocated from a given room A to another room B, if room A needs that resource back in the subsequent time step, its need will only be met if another room has free resources, avoiding the hysteresis effect.This strategy can increase response time but will never leave a room unattended.If a room needs the resource it has already provided more urgently, the model will assign another person to that position.Therefore, we accept a slight increase in cost to reduce hysteresis.
The algorithm also identifies situations where the demand for care in all hospital rooms is low enough to deallocate some attendants without affecting patient care quality.In such cases, HealCity identifies which attendants are working beyond their regular working hours and deallocates them to reduce the hospital's financial costs.

Regional-Level Proactive Elasticity
At the regional-level, HealCity needs to handle hospital-level requests from the entire smart city being analyzed.The objective is to ensure that each room in each hospital has the necessary number of attendants.Here, our algorithm follows the same idea as the previous level but considers the possibility of moving health professionals between different hospitals and allocating new professionals if needed.For this process, we propose a new definition for the cost of allocation or reallocation of people.This cost is the estimated time to reallocate a human resource between two hospitals or to allocate a new attendant to a specific healthcare setting.We define this cost as the distance in time for movement provided in real-time by the Distance Matrix API of Google Cloud [46] adding the estimated time for the internal allocation process.The Distance Matrix API has a method that returns the travel time between two points (departure and arrival) considering current traffic conditions, expressed in seconds.Therefore, new mathematical formalisms are needed.
Let ATV(r) denote the allocation time vector of room r during the time interval between the first time instant of the system (0) and the current time instant.Using this function and the aforementioned size(x) function, we can express the estimated allocation time in room r using Equation (4), where x[] = ATV(r) is the allocation time vector for room r, and ADT(x[j]) represents the allocation duration time for the i-th element of the vector x.
L(x) is a function that returns the geographic location of a given healthcare environment or human resource x.Using this function, Equation (5) represents the cost of allocation or reallocation: where o represents the origin place, which can be a healthcare environment in the case of reallocation or the human resource's home in the case of an allocation, and d represents the destination place needing a human resource.
Figure 9 presents the fluxogram for the proactive elasticity of the regional-level.To achieve human resources allocation and reallocation at the regional level, each node performs the following steps: checking if healthcare environments in the nodes below require human resources, identifying the node with the most significant need, and checking for available human resources in lower nodes.If available, the model selects the node with the lowest reallocation cost and checks whether the cost to reallocate is lower than the cost to allocate.If the cost to reallocate is less, then the model performs reallocation.If the cost to allocate is less, then the model allocates a new human resource.If no human resources are available in the lower nodes, the algorithm checks for a node above, passing the decision to the next level if one exists.If not, the model allocates a new human resource.The elasticity manager, at each node level, constantly monitors the workload and resources of the healthcare environment, including the availability of attendants with the required specialties.Whenever a room needs additional human resources, the elasticity manager searches for available attendants with the required specialty and reallocates (or allocates) them to the needed room.In this way, the healthcare environment can efficiently allocate its resources and minimize patient waiting time.

Management of People Outside Healthcare Settings Who Need Medical Care
As we have already mentioned, our model has the differential mission of considering people with altered vital signs outside of the health environments when planning the hospital care capacity of the smart city.HealCity also notifies people who need medical care to travel to these environments and takes them into account when making automatic adjustments to the structure of human resources.Therefore, whenever HealCity receives a patient with altered vital signs, with an indication of medical intervention from VitalSense, our model executes Algorithm 3 to set the appropriate hospital for the patient with the complexity of O(n).First, our system identifies the patient's geographic location and the time required for the patient to travel to each of the hospitals present in the algorithm.For this, the algorithm uses the patient's location as the point of origin and the hospital's address as the destination point and makes a query to the Google Maps API to find the travel time.The API allows the shortest time or shortest path to be calculated.In certain places, the physical distance, even being smaller, can have a much higher time cost due to traffic rules or the flow of people.Our model starts with a shorter time.
Thus, with estimated distance times, the algorithm sorts the hospitals in the list from closest to farthest.At first, the most interesting approach for the patient would be to go to the hospital with the shortest possible travel time, but this may not always be the best choice.This situation is illustrated in Figure 10, where even if there are hospitals closer to the patient, the hospital that is more convenient for the patient is the farthest.Thus, our model tries to show the closest hospital that can already provide care for the patient, or that may have its care capacity adjusted for that.At first, the algorithm analyzes whether the hospital in question has allocated employees, those working outside their work shift.We reject the healthcare environment if the hospital in question has cases like this.This decision occurs since the algorithm only allocates employees when it is not possible to reallocate them anywhere.Therefore, that hospital is already above capacity and is not the most appropriate.In addition, the algorithm wants to deallocate this human resource as quickly as possible since it is more expensive for the hospital.If the hospital does not have someone assigned, we analyze whether the waiting time for admission is good.If time permits, we will link this patient to this hospital.Otherwise, we move on to the next one, and so on.
If we go through all the hospitals that do not have anyone allocated and all have bad triage time, we go back to the beginning of the list and check if this hospital may still receive more human resources for triage.If so, we will register the patient in this hospital.If not, we move on to the next one.If we cover all hospitals, we perform the same procedure as those that have people allocated.If it is still impossible to register the patient in any hospital, we select the hospital with the lowest number of patients waiting to link the patient.
Once linked, the system must alert the patient that s/he must go to the hospital by SMS or APP notification, requesting a response whether or not s/he will accept the suggestion to go to medical care.If the patient answers YES, the system is sure that the patient will go to the chosen hospital in the near future.This ensures the arrival of the patient.If the patient answers NO, the system already knows in advance that the patient will not come to the hospital, and even disregarding the same, it will continue to monitor the patient's risk.If the patient does not respond, the model uses a confidence equation to estimate whether or not the patient will go for care.
Let PN IP(r, t i , t f ) denote the predicted number of patients incoming from a hospital room r between t i and t f times.We emphasize that the PN IP(r, t i , t f ) function only considers patients who did not respond to the notification, those whom we are anticipating the incoming but who have not confirmed it.Thus, the confidence in the arrival of the patient in the hospital room r between t i and t f times is defined by Equation ( 6), where N IP(r, t n ) refers to the number of patients who did not respond to the notification and still came to the hospital room r at the t n time instant.
The future number of incoming patients, those who have confirmed that they are coming to the hospital, of a hospital room r between t i and t f times is defined by the function FN IP(r, f i , f f ).The possible future number of patients waiting in a hospital room r between f i and f f future times is defined by Equation ( 7), where we consider the patients that we are sure will come to the hospital, through equation FN IP(r, f i , f f ) and our estimates for those we are not sure, through equation PN IP(r, f i , f f ) and the proposed confidence equation C(r, t i , t f .For the confidence equation, we use as initial time instant t i the first time instant of the system (0), and as final time instant t f , the current instant of time (t a ).Thus, the proposed equation is used to calculate the ENP(r, f i , f f ) ′ of the triage room.

Evaluation Methodology
To evaluate the HealCity model, we emulate a set of hospitals located in a hypothetical smart city.Taking into account the inaccessibility of real data for a set of hospitals, for each hospital, we define the use of the same parameters used by a real health environment located in Guarulhos, Brazil [47].Regarding patient workload, we defined synthetic workloads based on the actual load of this same environment, as mentioned above.According to [48], synthetic workloads are widely used in the academic community to assess the effectiveness of elasticity approaches.

Performance Evaluation Parameters
To emulate hospital environments, we used the data collected in the study of [47] conducted in a hospital in Guarulhos, Brazil.Based on Brazilian Law No. 13467 [49] and Decree-Law No. 5452 [50], some conditions must be met for a professional to be considered for allocation: (i) The minimum rest period for a human resource to be available for allocation is 11 h; (ii) An allocated employee is not allowed to work outside of their regular shift for more than 12 h; (iii) Allocated employees must be deallocated no later than 11 h before their next normal work shift; and (iv) Each employee must have a 36-h rest period within the same week.
We have established thresholds that are suitable for our Brazilian hospital data in our case study.We have set the upper threshold of HealCity (100%) at 30 min, as suggested in the Brazilian Law Project of 14 June 2018 [51].Based on several studies [44,[52][53][54] HealCity has set its lower threshold at 9 min (30% of the maximum waiting time).For elasticity actions, we established a 10-min hospital-level reallocation process (human resource movement between rooms in the same hospital), a 60-min regional-level reallocation process (human resource movement between hospitals), and a 60-min allocation procedure (intended to simulate the movement of a new staff member to the healthcare facility).

Considered Scenarios
To evaluate the HealCity model, we consider it necessary to compare a smart city emulated with the use of the proposed model and without the use of the model to visualize improvements in serving the population with the use of HealCity.Therefore, as explained previously, the set of hospitals to be emulated was based on the one described by Capocci et al. [47] in their research.Although Capocci et al. [47] is not part of our related work, since their study focused solely on performing simulations of the environment they studied, in their article, the authors identified bottlenecks in the health unit studied and proposed an adjustment to the service, where whenever the number of patients waiting was greater than 2 in the triage room, one of the nurses in the medication room should go and help the triage attendant and after the number returns to equal or less than 2, return to their original room, the equivalent of a reallocation between the two rooms based on the number of patients waiting.Therefore, to better evaluate our model, we understand that we can also compare HealCity with the suggestion proposed by Capocci et al. [47] since we are using the same input parameters as a basis.
We analyze three distinct situations using the same input parameters, each using the emulation procedure.The distinctions between scenarios are associated with the application of the HealCity model and the methodology proposed by Capocci et al. [47] and will be outlined as follows: • S1: Smart city without any human resource management approach: the first scenario is based on the emulation of a city with a non-elastic group of four hospitals; • S2: Smart city with Capocci et al. [47] approach: the second scenario focuses on the emulation of a smart city with a group of four hospitals using the human resources adjustment proposed by Capocci et al. [47]; and • S3: Smart city with HealCity's elasticity model: the third scenario is based on the emulation of a smart city with a group of four hospitals with HealCity's elasticity model for human resource management.

Workload
HealCity uses an allocation of 11 human resources per shift, as found in [47] Regarding the patient load, we model different wave loads for each hospital in the proposed smart city as shown in Figure 11.The wave workload behavior is based on that proposed by Rostirolla et al. [54].Thus, the wave workload is most closely related to the reality of the hospital.

Performance Evaluation Metrics
To evaluate the HealCity model, we considered the following metrics as used by [55]: We evaluated the waiting time by looking at the difference between the maximum waiting time in the different scenarios.We calculate the cost of human resources based on what Brazilian legislation determines as the cost of a professional working outside of their normal working period.According to the Brazilian government [49], professionals working outside their normal working hours must earn at least 50% more.Based on this, we used Equation (8) for Human resource cost proposed by Fischer et al. [55]: where at the t n time instant, HR(t n ) is the total number of human resources in their regular working hours, while AllocHR(t n ) is the amount of medical staff that have been allocated or are in the process of being allocated outside of their regular working hours.We proposed a metric to compare the elastic and non-elastic allocation of health professionals in terms of the number of human resources.Our model is designed to maximize the use of existing healthcare professionals in the hospital.We can compare the static allocation of S1, which has 11 hospital employees working, with the elastic allocation of HealCity, where the number of medical staff changes throughout the day.The results in Table 3 compare the expected results of the second scenario (when the Capocci et al. [47] approach is used) and the third scenario (when HealCity is used) with the results of the current hospital environment without any approach to human resource management.The main objective of HealCity is to reduce the amount of time spent waiting for medical care.To achieve this, we anticipate that the cost and number of human resources will need to be increased, as long as this increase has a beneficial effect on reducing the waiting time.

Performance Evaluation and Results Analysis
We conducted three emulations of the smart city using the evaluation methodology proposed for the HealCity model.We analyzed each hospital individually, although there were human resources movements between hospitals.In this way, we can say that each of the four hospitals was simulated for the three scenarios (S1, S2, and S3), resulting in a total of 12 emulated hospital environments.
As seen in Figure 12, the data collected showed a significant decrease in waiting time when our elasticity approaches were used compared to the hospital without them.Due to our human resource elasticity, HealCity has been shown to decrease the average maximum waiting time by 80.33%, 87.64%, 91.52% and 90.98% for Hospital 1, Hospital 2, Hospital 3, and Hospital 4, respectively, as compared to the scenario in which no human resources managements are performed, totaling a reduction of 87.62% in the smart city average.When we compare S2 (using the strategy proposed by Capocci et al. [47]) and S3 (using our strategy), HealCity has been shown to decrease the maximum waiting time by 21.93%, 40.11%, 55.27% and 55.67% for Hospital 1, Hospital 2, Hospital 3, and Hospital 4, respectively, totaling a reduction of 41.79% in the smart city average.
We anticipated that the human resource cost would be higher between scenarios.For this metric, it would not make sense to compare hospital-to-hospital costs since, in the HealCity model, all hospitals are able to share professionals.In this way, we consider the total cost of the smart city since, at certain times, a hospital may have less than the 11 professionals proposed in its original workload as it transferred a professional to another hospital, which in this context would have 12 professionals, without generate overtime costs.Figure 13 shows the cost of human resources for S1 compared to S3 and S2 compared to S3.We can observe that the cost ranged from 44 to 51.52 per hour in HealCity's approach.For the S3 scenario, the cost increased by 9.68% compared to other scenarios.HIGHLIGHTS (i) At this time, S3 had worse performance due to the fact that the Electrocardiogram room had moved an employee to Collection Exams in the previous cycle.As a result of our cooldown strategy, we were unable to assign the same attendant back in the next cycle.Consequently, the increase in demand was only addressed in the subsequent cycle, as we did not have attendants available for assignment.(ii) At this point, S3 had a longer wait time than S2 due to the screening room reaching its maximum attendant capacity, which prevented the model from assigning more attendants to help.In contrast, S2 had previously assigned professionals to the room, thus minimizing the effect.(iii) At the beginning of the emulation, the wait time in S3 was longer than in S2, as S2 used a professional moving strategy when a condition occurred, while S3 operated through monitoring cycles.Consequently, S2 had slightly better performance at this stage, as the initial response was faster than the S3 monitoring cycle.(iv) The city average changed at this point, since it was previously discussed in item "ii".We anticipated an increase in the number of human resources used in the smart city.Figure 14 shows the elastic number of human resources used for medical care in S3, the only scenario in which the number of employees can vary.The elastic number of human resources ranged from 44 to 52 per hour.Furthermore, as seen in Figure 14, it is evident that patient waiting time decreases by 87.62% and 41.79% due to HealCity reallocation and allocation procedures between scenarios S1/S3 and S2/S3, respectively.

Discussion
The results of the HealCity model in the emulated smart city are presented in Table 4.The maximum waiting time decreased between scenarios S1, S2, and S3, as expected in our evaluation methodology.Additionally, the human resources cost and the elastic number of human resources used increased between scenarios S1/S2 and S3, as expected.Therefore, the objectives of the evaluation methodology were met using the HealCity model in the proposed smart city.Our aim was to reduce the maximum waiting time.The HealCity model was successful in doing so for the proposed smart city, with an average maximum waiting time of 24.04 min for S3.However, when we looked at the longer waiting times throughout the simulation period, the upper limit was exceeded (111, 117, 79, 54, and 46.75 min in Hospitals 1, 2, 3, and 4, respectively).This was likely due to the limited number of care stations available for the allocation of new human resources.Human resources cost increased inversely proportional to the decrease in waiting time, as expected.Thus, it is evident that a mere increase of 9.68% in cost resulted in a decrease of up to 87.62% in average waiting time.We anticipated that the elastic number of human resources used metric would increase between scenarios S1/S2 and S3, and this was indeed the case.
Thus, our model had encouraging results, adding a new vision for Human Resource Management in the healthcare context in smart cities.We would emphasize that for the HealCity context, it is not possible to perform a quantitative analysis in comparison with the related works since the environments and contexts of each work are different.Therefore, we propose a qualitative analysis comparing the HealCity model with related works to present the features that our model proposes that differentiate it from other works in the literature and highlight the contribution of HealCity to the area.Table 5 presents the proposed qualitative analysis.In this way, the HealCity model proposed an approach to fill all the gaps found in related works, as follows: • HealCity integrates data captured by IoT sensors in smart cities and analyzes the health status of patients outside hospitals to predict the future use of resources and the overload of patients in hospital environments in smart cities; • HealCity can identify demand in a healthcare environment, and propose concrete solutions to proactively address the issue of hospital resource shortages before they happen; • HealCity can optimize processes in an automated way proposing on-the-fly adjustments to multiples healthcare environments; and • HealCity relates the admission of patients to hospitals with the vital signs of the population of cities, merging these approaches into a model for human resource management.

IoT Deployment Considerations
Besides verifying the HealCity model's effectiveness in managing elastic human resources through software testing, it was also deemed necessary to conduct hardwarelevel analysis.Given that the HealCity model employs the Internet of Things and an RTLS system for tracking patient locations, movements, and duration of stay in various settings, therefore measuring care provision time, we considered it beneficial to implement the RTLS system in an actual setting to assess its capability in monitoring human movements.In exploring technologies for the Internet of Things, we selected RFID technology for testing the model due to its automatic identification feature, which reduces human errors in identification tasks.Moreover, as noted by Boulos et al. [56], RTLS solutions that integrate technologies like RFID can achieve precision and flexibility levels that surpass other technologies for specific applications.
For our RTLS system, we use the Intermec IF2 (https://www.honeywellaidc.com/products/rfid/fixed-readers/if2) RFID reader.The choice of this reader is based on the fact that it works with up to four antennas to read tags, which allows the capture area to be increased by installing several antennas.Additionally, unlike readers like the Identix miniPad (https://www.identix.us.com/minipad) that have a reading radius of a few centimeters, each IF2 reader antenna can perform readings of tags-RFID located up to a few meters away.The tags used were EPC adhesive labels.We installed the IF2 reader with just one antenna, initially located above the laboratory entrance door, and then we relocated it next to that same door, as can be seen in Figure 15.Based on our proposed RTLS system, we identify the area around the antenna capable of capturing tags-RFID.To do so, we installed the antenna in a location approximately 1.1 m high.We can note that laterally, the antenna's capture limit is around 80 cm.Diagonally, this limit increases to around 90 cm, which indicates that the signal radius is not circular.Figure 16 shows the estimated signal radius for the antenna.The antenna's frontal capture area proved to be extremely superior when compared to the lateral area.We can note that in a straight line, it is possible to accurately identify a tag located up to 4.2 m away from the antenna.From 70 cm from the antenna, the capture beam reaches the ground and extends up to 3.7 m away.Figure 17 shows the estimated signal frontal radius for the antenna.Therefore, we identified that for better capture accuracy, the ideal would be to install four antennas, the maximum limit available for the IF2 reader, around the door to which you want to record the passage of people.The antennas must be located as close as possible to the door frame and equally spaced in relation to its height.Using the previously measured capture radius, the coverage radius for a single door and a double door can be estimated using the four antennas together, as can be seen in Figure 18.As can be seen in Figure 18, with the use of four antennas around a simple door, there are no points where they are not capable of capturing a tag, making the allocation of ideal for this scenario.As for use on double doors, there are some points where they are not able to read tags.However, as shown in Figure 17, as the patient enters the environment, the point reading blindness gradually decreases, causing it to be identified.

Lessons Learned and Technology Transfer
HealCity model showed us that using an elasticity-based approach allowed us to reduce waiting times for medical care in smart cities.To do this, patients would not need to take any extra steps in the hospital; they could wear a wearable sensor to collect vital signs and approximate location.HealCity can be used to identify bottlenecks in patient care flow and optimize processes in healthcare settings.In the HealCity case study, the waiting time decreased by 80.33%, 87.64%, 91.52% and 90.98% for Hospital 1, Hospital 2, Hospital 3, and Hospital 4, respectively, totaling a reduction of 87.62% in the smart city average, with a minimal increase in cost (9.68%).
Despite promising outcomes, there are certain limitations that must be taken into account when implementing the HealCity model in a real-world smart city: (i) both personnel and patients must wear their wearable sensor while in the smart city; (ii) HealCity only sends out notifications to human resources, but the actual movement of staff in the smart city depends on their own choice to adhere to these notifications; (iii) sensors infrastructure must be preinstalled in the smart city for the system to function correctly; (iv) the risk of each room is not taken into account in reallocation procedures.
Furthermore, to implement a model at this level of human resource sharing, there must be a public policy for sharing professionals between healthcare environments from different hospital networks, or all adjustments on a regional scale must be limited only to professionals of a common employee network.There must also be public policies that allow data capture at this level and data sharing between the players involved.We could consider rewarding employees who are willing to take part in the allocation model with higher pay, which would be beneficial in two ways: the public would receive better services, and healthcare professionals would be better compensated.Moreover, the medical team needs to be trained to understand the importance of following the recommendations proposed by the model.At the same time, city managers need to invest in the monitoring infrastructure proposed by VitalSense, and hospital managers need to invest in the infrastructure proposed by HealCity hospitals.The major incentive for public policies and investment in infrastructure is the possibility of saving lives.
Initially, we envisage the implementation of the HealCity model in a municipal public health network.In this way, all health professionals are municipal public employees.We intend to implement the proposed model in the city of Porto Alegre, located in Brazil, through the municipal health network, which currently consists of 132 health centers, 4 family clinics [57], 4 emergency care units, two public managed hospitals, two hospitals with shared management with the private network [58] and 4000 employees [59].In this setting, our model holds significant potential, impacting public policies to ease the mobility of professionals and to foster investments in technological infrastructure, therefore enhancing patient care quality through the simplification of human resources management in hospitals.

Conclusions and Future Work
This article presented the HealCity model, which goes beyond the related work by proposing the use of elasticity to anticipate future problems, providing a model for human resources optimization to improve patient experience.Using wearable sensors and an ARIMA-based prediction engine, it is possible to collect data in time series to better organize professionals and prevent or reduce the severity of patient treatment problems.This broadens the application of the elasticity paradigm from cloud computing for human resources management, introducing new mathematical formalisms, algorithms, and definitions to enable a flexible and dynamic distribution of medical staff in hospital settings located in smart cities.Also, HealCity highlights some IoT deployment considerations, presenting details about hardware and software to install the proposed solution in real environments.The HealCity approach had a significant improvement in terms of waiting time reduction (41.79% in the smart city average), with a minimal increase in cost (9.68%).
In future work, we intend to use the data generated in this work, especially those related to the occupancy rates of healthcare professionals, to propose new adjustments in the allocation of professionals.The idea is to take into account not only the waiting time but also the number of people waiting, allowing rooms to be without medical staff if no patients are waiting and improving load balancing between professionals.In addition, we intend to adjust our cooldown period strategy to take into account the risk of the rooms, allowing rooms with higher urgency to skip this cooldown period to improve response time.Furthermore, since our model includes a user interface at the HealCity App module, we want to provide a user feedback study to demonstrate the usability and acceptability of our proposed system.

Figure 2 .
Figure2.Smart city hierarchical tree-based structure view with a focus on monitoring patients' health parameters.People wear sensors that transmit health parameters to a fog-cloud infrastructure that provides health information directly to healthcare settings.In this structure, citizens are at the lowest level, interacting with edge devices, while hospitals are at the highest level, interacting with data already processed by the cloud infrastructure.

Figure 3 .
Figure 3. Architectural components and network topology in HealCity model with a (i) web service; (ii) HealCity service for information processing and decision-making; (iii) a sensor network to capture citizens' vital signs and locations; and (iv) hospital managers, patients and people in general, or human resources.

Figure 4 .
Figure 4. HealCity Model Architecture Overview, illustrating the data trajectory beginning in the Capture module, which assimilates users' movement data via RTLS sensors.These data are subsequently processed across various designated modules, culminating in the display of elasticity notifications within the HealCity app.

Figure 8 .
Figure 8. Proactive elasticity acts to anticipate the care waiting time, so the allocation and deallocation of human resources are carried out in advance prior to the achievement of predetermined thresholds.

Algorithm 1 :begin 2 upper← 4 n ← 0; 5 a ′ ← a; 6 if 9 a
Room-Level Proactive ElasticityData: Room r, number of attendants a, future initial time f i , future final time f f Result: Number of medical staff members to add or remove 1 Upper Threshold of waiting time in r; 3 lower ← Lower Threshold of waiting time in r; PHRES(r, a, f i , f f ) > upper then 7 while a ′ < limit(r) and PHRES(r, a ′ ,f i , f f ) > upper do 8 n ← n + 1; ′ ← a + n; PHRES(r, a, f i , f f ) < lower then 12 while a ′ > 0 and PHRES(r, a ′ , f i , f f ) < lower do 13 n ← n − 1; 14 a ′ ← a + n;

Algorithm 2 :begin 2 l 3 forall 4 a ← quantity of attendants assigned to r; 5 q 6 lsort l, number of available medical staff; 9 l 10 sort l, number of available medical staff; 11 forall 13 execute 15 h
Hospital-Level Proactive ElasticityData: Enumeration of hospital rooms h, comprehensive vector v encompassing all hospital attendants, future initial time f i , and future final time f f Result: Vector of rooms and quantity of attendants to allocate or deallocate l 1 ← a fresh vector containing room and the respective number of attendants to either assign or remove; Room r on hospital room list h do ← run Algorithm 1 for Room-level Proactive Elasticity using r, a, f i and f f as Data; ← executeHuman Resources Release Algorithm with l and the assigned attendants of v as data; Room r on list l do 12 l r ← sort l, number of available medical staff with room r specialty; Human Resources Reallocation Algorithm using r and l r as Data;14 end ← rooms of l vector; 16 return l;

Algorithm 3 :begin 2 o ← patient p localization; 3 l 4 a 5 forall 6 d
Set the appropriate hospital for the patient Data: Hospital list c, patient p Result: Updated patient p 1 ← a new vector of hospitals and estimated travel times; ← a new vector of hospitals and estimated travel times; Hospital h on hospital list c do ← hospital h localization;

Figure 10 .
Figure 10.Example of patient with altered vital signs in a smart city with three hospitals available.Even if there are hospitals closer, the most suitable for the patient is the farthest away.

Figure 11 .
Figure 11.A graphical illustration of the wave workloads used in HealCity evaluation (based on Rostirolla et al. [54]).

Figure 12 . 13 .
Figure 12.Maximum waiting time at the hospital for each of the proposed scenarios, S1 (in red), S2 (in orange), and S3 (in green), for (a) Hospital 1, (b) Hospital 2, (c) Hospital 3 and (d) Hospital 4, and average of maximum waiting time at (e) Smart City.

Figure 14 .
Figure 14.Elastic number of human resources used compared with average of maximum waiting time at the smart city in S3.

Figure 15 .
Figure 15.Intermec IF2 RFID reader installed in the Internet of Things and Distributed Applications laboratory of the PPGCA at Unisinos where in (A) the antenna was installed above the door and in (B) the antenna was installed next to the door.

Figure 16 .
Figure 16.RFID-tags reading area around the Intermec IF2 reader antenna.

Figure 17 .
Figure 17.RFID-tags front reading area of the Intermec IF2 reader antenna.

Figure 18 .
Figure 18.Proposed installation of the Intermec IF2 reader antennas in two scenarios: (A) with a single door and (B) with a double door, where in both examples the doors are 2.1 m high.
CAPTIONFigure 6.HealCity's scalable hierarchical solution, where we can add more hospitals under any fog node and as many fog nodes as needed.

19 end 20 end 21
15 forall Hospital h on vector of hospitals and estimated travel times l do 16 if h triage time is adequate then 17 p.setHospital(h); 18 return p; forall Hospital h on vector of hospitals and estimated travel times l do 22 if h triage room can allocate more attendants then 23 p.setHospital(h); 24 return p;

31 end 32 end 33 forall
Hospital h on vector of hospitals and estimated travel times a do 34 if h triage room can allocate more attendants then 35 p.setHospital(h);

Table 3 .
Evaluation metrics and expected results in each scenario.

Table 4 .
Evaluation metrics and results found, where the best results in M1 are highlighted in green and the worst in red.

Table 5 .
Comparative qualitative assessment of the HealCity model versus Related work.