Research Article Real-TimeSystemPredictionforHeartRateUsingDeep LearningandStreamProcessingPlatforms AbdullahAlharbi, 1 WaelAlosaimi, 1 RadhyaSahal, 2 andHagerSaleh 3 1 Department of Information Technology, College of Computers and Information Technology, Taif University, P.O. Box 11099, Taif 21944, Saudi Arabia 2 Faculty of Computer Science and Engineering, Hodeidah University, Al Hudaydah, Yemen 3 Faculty of Computers and Artificial Intelligence, South Valley University, Hurghada, Egypt Correspondence should be addressed to Hager Saleh; hager.saleh.fci@gmail.com Received 14 January 2021; Revised 27 January 2021; Accepted 10 February 2021; Published 23 February 2021 Academic Editor: Ahmed Mostafa Khalil Copyright © 2021 Abdullah Alharbi et al. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. Low heart rate causes a risk of death, heart disease, and cardiovascular diseases. erefore, monitoring the heart rate is critical because of the heart’s function to discover its irregularity to detect the health problems early. Rapid technological advancement (e.g., artificial intelligence and stream processing technologies) allows healthcare sectors to consolidate and analyze massive health-based data to discover risks by making more accurate predictions. erefore, this work proposes a real-time prediction system for heart rate, which helps the medical care providers and patients avoid heart rate risk in real time. e proposed system consists of two phases, namely, an offline phase and an online phase. e offline phase targets developing the model using different forecasting techniques to find the lowest root mean square error. e heart rate time-series dataset is extracted from Medical Information Mart for Intensive Care (MIMIC-II). Recurrent neural network (RNN), long short-term memory (LSTM), gated recurrent units (GRU), and bidirectional long short-term memory (BI-LSTM) are applied to heart rate time series. For the online phase, Apache Kafka and Apache Spark have been used to predict the heart rate in advance based on the best developed model. According to the experimental results, the GRU with three layers has recorded the best performance. Consequently, GRU with three layers has been used to predict heart rate 5 minutes in advance. 1.Introduction As per the World Health Organization (WHO) [1], heart disease is one of the main death reasons in the world, which reported around 17.7 million deaths worldwide every year. In particular, the heart disease (HD) is caused by any condition affecting the heart when the heart is unable to do its normal function. In particular, the heart cannot push the blood to human body to do the vital functions [2]. In medicine, heart rate (HR) is defined as the number of times the heart beats within a certain time period (i.e., minute), and the normal rate is between 60 and 100 beats per minute. e heart rate data is considered a nonstationary nature, which is unpredictable and cannot be modeled or forecasted. is unpredictability feature increases the risk for the person who has HD and makes him/her suffer coronary disorders. Compared with other risk factors (e.g., age, heredity, hy- percholesterolemia, high blood pressure, diabetes, and smoking), HD patient has double the possibility of death risks. Consequently, technology plays a vital role to early detect the high heart rate to avoid the risk of heart disease progression. Early diagnosis of HD is essential because HD treatment is most effective during the early stages of the disease. To date, many research works have been done using statistical comparative analysis, machine learning, and historical data to estimate the risk factors of diseases. Re- cently, new technologies like wearable medical sensors have been used to improve medical care by collecting real-time streaming data to be analyzed and deliver impact in Hindawi Complexity Volume 2021, Article ID 5535734, 9 pages https://doi.org/10.1155/2021/5535734