HRpredict: Introducing a Web-Based Application for Heart Rate Prediction and Lifestyle Recommendations

Background: Monitoring heart health requires early detection of deviations in HR, which makes it easier to detect and address heart irregularities at an early stage. Health remote systems when combined with artificial intelligence (AI) can assist in better health outcomes through early detection of heart problems. Aims: Our main goal is to create a website application (Web-App) for web browser access, aiming to utilize a Random Forest (RF) machine learning (ML) model trained to predict the average heart rate (HR) over 10 days for different periods, and to enable lifestyle and activity recommendations. Methods: The Web-App is created using Laravel, an open-source Personal Home Page (PHP) web framework that follows the model-view-controller (MVC) architectural pattern. Results: This research resulted in a web-based ML model that can be used to predict future heart rates over a 10-day period which are utilized to establish average HR values, considering baseline and three distinct periods: morning, noon, and evening across the 10-day duration. Through this Web-App lifestyle, habit, activity, and 10-day reassessment recommendations are also provided. Conclusion: The Web-App was designed to be accessed and used through a web browser, to provide lifestyle recommendations based on predicted HR readings. To determine the impact of users adhering to recommendations, further research is required.


Introduction
An individual's heart rate (HR) refers to the number of times the heart beats in a minute [1].HR represents an important indicator of heart health [2].Unhealthy habits such as smoking and excessive alcohol consumption can affect the heart's health causing irregular heartbeats [3].According to the British Heart Foundation, irregular heartbeats are benign in individuals free of heart diseases nevertheless, abnormal heartbeats can pose a significant risk or even lead to fatal outcomes.Therefore, monitoring heart health requires early detection of deviations in HR, which makes it easier to detect and address heart irregularities at an early stage thus, managing and treating heart diseases earlier [4].
Although health applications (health apps) have shown promise in monitoring cardiovascular disease (CVD) risk factors and positively influencing users' behaviour, there exists a gap in research specifically focusing on the application of these apps in showing predicted HR changes [5].Previous studies have highlighted the positive impact of health apps on modifying user behaviour related to cardiovascular health [6].For instance, by tracking HR metrics, web-based programs improve users' awareness and understanding of daily habits [7].However, this gap underscores the need for further exploration and investigation into the potential of health apps in monitoring HR variations, thus contributing significantly to early detection and proactive management of heart-related issues.
Health remote systems when combined with artificial intelligence (AI) can assist in better health outcomes through early detection of heart problems [8] (Deutsches Forschungszentrum für Künstliche Intelligenz, DFKI) self-monitoring systems without touch interaction are in demand.Applications developed for these systems should focus on providing interactive feedback and optimal adaptation for users' needs [9].
Therefore, the purpose of this study is to develop a website application (Web-App) that utilizes an HR predictive model.Therefore, we aim to create a Web-App called "hrpredict".In this Web-App, the user provides the input information of age, average number of daily consumptions of smoking cigarettes, beer cans, energy drinks cans, and coffee cups as well as the HR at rest.The Web-App utilize a built Random Forest (RF) machine learning (ML) predictive model of HR by showing the predicted future heart rates over 10 days.The predicted heart rate values are then used to represent the average HR for baseline and for three time periods: morning, noon, and evening over a time of 10 days.Additionally, the Web-App provides lifestyle, habit, activity, and 10-day reassessment recommendations.

Materials and Methods
A web application (Web-App) was designed to be accessed and used through a web browser.The purpose of this Web-App is to utilize a Random Forest (RF) machine learning (ML) model.This model is trained to predict average HR over a period time of 10 days.The Webapp enables activities and lifestyle recommendations based on predicted HR readings as depicted in Fig. 1, which involved eight stages, starting from backend development, user interface design, data validation and storage, integration with ML model, data presentation, recommendation system, usability enhancement, and ending with development and testing.[10].A database was set to store user inputs, ML-trained model dashboard results and historical data.

User Interface Design
The website's user interface uses HyperText Markup Language (HTML), Cascading Style Sheets (CSS), and Laravel's Blade templating engine was designed.Forms were created to collect user inputs, including age, HR at rest, number of cigarettes, beer cans, energy cans and coffee cups per day.A history page was created to display a summary of the previous list of reports.

Data Validation and Storage
A server-side validation was implemented to ensure the user inputs were valid.When a user submits data through a web form or an Application Programming Interfaces (APIs) request, server-side validation is performed to verify the correctness, completeness, and validity of the data.This validation process typically involves checking the input against a set of predefined rules or constraints defined by the application.Then the validated user inputs were stored in the database for future reference.

An Integration with the Machine Learning Model
The ML-trained model was uploaded as a Python script on the server.A communication channel was established between Laravel and the ML model.When the user submits the form, the user inputs are passed to the ML model for processing.Finally, an output of HR versus time was received from the ML model and stored in the database.

Data Presentation
The ML model results were retrieved from the database and the average HR values were predicted for 10 days on the website.This would display the detailed HR readings (240 readings) in a visually appealing graph (heart rate versus time).

The Recommendation System
A static if-else code was implemented in Laravel to generate recommendations based on the user's age and average evening HR.Activities, lifestyle habits improvements and intake reductions were recommended and displayed on the website based on different ranges of age and HR values.

Usability Enhancement
A user authentication system by comparing the hash value of their provided credentials with the stored hash value was implemented to allow users to create accounts and securely access their data [11].The process involves user registration; hash storage; user authentication; hash comparison and authentication result.When users create Fig. 3. Web-App predicted heart rate readings over time for a 37-year-old man who smokes ten cigarettes, drinks one beer can, and three cups of coffee on an average per day.The average heart rate for baseline; morning; noon; evening is also predicted.
accounts, their passwords undergo one-way hashing, generating fixed-length hash values.These values are securely stored.During login, the system hashes the provided password and compares it with the stored hash.Data security is ensured when a match is made; otherwise, access is denied.A personalized dashboard was provided for each user, showing their latest reports and predicted HR time series data.A paging function was imported into the history page to allow users to easily navigate through their previous reports.

Development and Testing
The website was deployed on a web server, ensuring that the server meets the requirements of Laravel and the ML model.Extensive testing was performed to ensure the website functions correctly and handles different scenarios, such as invalid inputs or unexpected errors.The website's performance was monitored to address any issues or bugs that arose.

Results and Discussion
In this Web-App, the user provides the input information of age (years) average daily consumption of smoking (number of cigarettes), alcohol beer (number of cans), energy drinks (number of cans), and coffee (number of cups).In addition to that, the user is asked to provide his HR rest which is to be within the range of (66-71) bpm.Fig. 2 depicts the initial integration of the user with the Web-App, which includes login, onboarding and form screens.
The output information of our created Web-App was to utilize an ML predictive model by showing the predicted average HR for baseline, morning, noon, and evening periods over a time of 10 days.Fig. 3 illustrates a timeseries graph generated by our model that predicts the HR readings over a specified period of one of the 25 subjects: a 37-year-old man with a resting HR of 67 bpm.The individual in question is described as a smoker of ten cigarettes a day, a consumer of one beer can daily, and a drinker of three cups of coffee per day.Furthermore, the figure provides additional information by presenting the average HR measurements for baseline and specific periods, including morning, noon and evening.
A range of activities such as brisk walking, power walking, riding a bike on level ground of hills, playing double tennis, doing water aerobics, jogging, cycling, swimming, and sports games like basketball and soccer were recommended for this subject.Moreover, lifestyle improvement such as the reduction of habits consumption gradually, and inducing re-checking of results after 10 days to ensure user assurance (Fig. 4).

Conclusion
In conclusion, this study conducted a review of a purpose-built Web-App, designed for accessibility and utilization via a web browser.The Web-App leveraged a Random Forest predictive model for average heart rate.This application aimed to provide users with 10day forecasts of average HR for baseline and across different periods including morning, noon and evening.Additionally, to provide activities and lifestyle recommendations based on predicted HR readings.However, further research is needed to investigate the impact of user adherence to the provided recommendations.
2.1.Backend Development It involves installing Laravel on a local environmental setup.Laravel is an open-source Personal Home Page (PHP) web framework based on the model-view-controller (MVC) architectural pattern

Fig. 1 .
Fig. 1.The system architecture of the Web-App.

Fig. 4 .
Fig.4.Recommended activities and lifestyle for a 37-year-old man who smokes ten cigarettes, drinks one beer can, and three cups of coffee on an average per day.
. According to the German Research Center for Artificial Intelligence