Raspcare: A Telemedicine Platform for the Treatment and Monitoring of Patients with Chronic Diseases Raspcare: A Telemedicine Platform for the Treatment and Monitoring of Patients with Chronic Diseases

Metabolic and electrophysiological measures must remain within normal values to main- tain the quality of life of chronic patients. Furthermore, depending on the age and disease stage of the individual, automatic identification of risk situations is critical for emergency support. To achieve these goals, this study proposes a technological solution termed Raspcare to help both the patients in their self-care and the medical teams monitoring the patients. The solution consists of a domestic gateway equipped with a microcontroller and various interfaces to allow interaction between the platform and household devices, such as televisions, biometric sensors, blood glucose metres, non-invasive pressure gauges, smartphones and smartwatches, among others. The gateway implements a Linux OS application responsible for executing the user’s health plan, which involves periodic measurements, medications and dietary care. Moreover, the application has data processing algorithms to establish alerts for the automatic detection of abnormal measurements and falls.


Introduction
Chronic diseases affect a significant portion of the population, especially when we select the group of individuals older than 60 years. As the population ages, the percentage of chronic patients tends to increase. Chronic diseases associated with hypertension are the leading risk factors causing mortality, accounting for 9.4 million deaths worldwide in 2010 [1]. Nevertheless, hypertension is not an inevitable consequence of ageing, but a lack of monitoring and adequate treatment increase the risk of consequences of the disease. Another chronic disease with serious consequences for quality of life is diabetes. The global prevalence of this disease in 2014 was 7% of the population, accounting for 1.5 million deaths in 2012 [1], which leads to a pessimistic longterm view. In general, chronic patients financially burden the healthcare system. Furthermore, chronic patients at an advanced stage of disease are no longer able to perform their daily activities, directly affecting their quality of life and therefore aggravating their state of health.
The best method to address this issue is to implement preventive measures. Prevention consists of monitoring the health status of chronic patients over time by conducting regular clinical examinations. Therefore, the issue is addressed at its initial stage, enabling chronic patients to treat their disease and preventing its rapid and devastating progression. Long-term prevention enables patients to maintain their quality of life and directly affects the percentage of health spending. Finally, for health managers, prevention improves the distribution of health resources, thus avoiding their collapse.
For the task of prevention, the use of telemedicine strategies is a low-cost alternative that has demonstrated effectiveness in treating chronic patients [2,3]. The strategies presented in the specialised literature [2][3][4][5][6][7][8][9][10][11][12][13] involve monitoring the health status of the patient by periodic telephone and house calls, completing an electronic patient diary with information on routine daily activities and health status and transmitting biomedical data using medical devices. Among these strategies, the best results have been achieved when strategies are combined, particularly when medical devices with data transmission capability are used.
The literature indicates that maintaining the relationship between patient and healthcare professional is a prerequisite for the success of telemedicine in the case of diabetic patients [3]. This relationship may be enhanced by telephone or web conferencing. Conversely, some of the requirements of the technology used by the patient directly affect patient adherence to the technology [3]: (i) Regarding ease of use and small size, desktop computer-based solutions have not generated good results. (ii) Transmission of patient health status data (e.g. blood glucose, blood pressure and heart rate, among others) to the specialist cannot be lengthy given its direct impact on treatment and insulin administration. In this case, algorithms that perform embedded data processing are more effective; (iii) The Internet facilitates the interaction between the patient and healthcare professionals. Internet communication is one of the secrets to the success of teleconsultation projects.
Some studies have proposed prototypes to meet the above requisites. In addition to using a smart TV as platform, which is still difficult to use due to remote control limitations, Laura et al. [9] used near-field communication (NFC) with the pressure gauge, making it difficult to purchase devices with this function. Mageroski et al. [10] used wireless sensors in clothing, on the body and in the environment. Although the solution is simple because it is wireless, its use is extremely limited by its dependency on the Internet. Furthermore, a reliable wireless broadband network is necessary, which is also an important limiting factor. Yu-Fang Chung [11] proposed a monitoring solution through a network of ZigBee wireless sensors, which provide an interface for real-time temperature and heart rate monitoring and video streaming.
According to Henriksen et al. [12], the use of patient monitoring platforms involves several risks because their data are stored and therefore may be leaked. Alternatively, another type of failure may occur. Unauthorised data access was considered a high risk due to weak or predictable passwords; however, a biometric sensor can be used to minimise this problem.
The study conducted by Santos et al. [13] should be noted. The authors designed the CareBox, a hardware based on an NVIDIA ION mini-PC with an Atom 1.6 GHz processor and 2 GB RAM, an operating system based on OpenELEC distribution and the Firefox browser. The programming was based on the Python programming language. The study focused on developing an interoperability, configuration and remote update solution. The interfaces available in the solution involve Ethernet network, Wi-Fi network and infrared, High-Definition Multimedia Interface (HDMI) and Universal Serial Bus (USB) ports. Furthermore, the solution implements fingerprint biometrics for user authentication. Regarding patient treatment, the solution implements an electronic calendar in the daily routine of the individual, including medication schedules. The solution only measures the blood pressure via Bluetooth. Finally, the television is controlled via an external device termed the Universal Serial Bus-Consumer Electronics Control (USB-CEC), which receives commands via USB and controls the television via the HDMI port. The study identified some limitations that became perspectives for future research: the remote control is not sufficiently practical for the user to perform the intended functions; no integration with smartphones is available; and more sensors must be integrated. Furthermore, the solution depends on local connectivity to load the patient care plan with the information from the schedule of activities related to the treatment of the patient.
This study proposes a new home support technological solution to monitor diabetic and hypertensive patients. In addition to helping a significant portion of chronic patients, the proposed solution is original for the following reasons: (i) it combines commercial devices certified for medical measuring; (ii) it implements a fall detection algorithm for patients using a smartwatch device [14]; (iii) it provides local operation in the absence of connectivity; and (iv) it integrates the care plan with the Google Calendar feature that is compatible with mobile devices with Android operating system. Finally, despite the exponential increase in the number of studies focused on the use of smartphones in the field of mobile health, this study proposes a platform that also meets the technological requirements of a large portion of the Brazilian population (46%) [15] with chronic diseases who have conventional television sets but no Internet access at home.

Requirements of the diabetic and hypertensive patient home monitoring platform
To monitor chronic patients at home, an indispensable device is the gateway, which is the base of the telemedicine platform. This device should act as a concentrator of the data generated by the e-health sensors, storing the data locally and synchronising them with a remote database for subsequent access by the medical team. Sensor data may or may not undergo local post-processing to generate alarms. For improved chronic patient adherence to the treatment, a patient care plan prepared by the health team should be synchronised with the patient electronic calendar to guide the daily treatment routine from medication and data acquisition times to dietary and physical activity suggestions. The architecture of the telemedicine platform with the above characteristics is presented in Figure 1.
Based on the architecture presented in Figure 1, the Raspcare platform proposed in this study implements a set of requisites for its operation in a home environment, namely: • Independent home base working as a sensor data concentrator of devices integrated with the base

Raspcare platform architecture
To implement the above requisites, the architecture presented in Figure 1 is proposed. Each block is described below. The schematic representation presented in Figure 1 represents the architecture of the platform proposed in this study, termed Raspcare. The Raspcare platform has a main module that plays the role of gateway, interfacing with the various in-home patient monitoring devices, namely: • Blood glucose and pressure metres • Biometric sensor

• Television
• Fall detection sensor The data collected by the blood glucose and pressure metres and the fall detection sensor are stored both locally on the gateway through the local monitoring software and remotely in the web application. The gateway connection with the television enables the patient to view the alarms and the history of measurements over time. The platform also implements two types of alarms: • Alarm from the Care Plan Calendar: the care plan is the treatment proposed by the physician for the patient. The plan includes dietary recommendations and the medication and measurements the patient should take throughout the day.
• Alarm indicating an abnormal situation: two abnormal situations are detected by the monitoring software. The first situation refers to blood glucose and pressure values that are compared with the abnormal values set in the monitoring software. Every time the blood glucose and pressure values are abnormal, an alarm is triggered. The second situation is related to the fall detection sensor. Every time a fall is detected, the alarm is activated.
The alarms are turned off by the patients themselves. To do this, the patient must place his or her finger on the biometric sensor that will identify the patient and inform the monitoring software to turn off the alarm.
Details on each component of the Raspcare platform are presented below.

Sensors
The sensors used in the proposed system enable telemonitoring the patient health status (blood glucose and pressure values) and activity (falls). A biometric sensor is used to scan the patient's fingerprint to ensure secure user authentication when collecting the data.
To monitor the health status, patients use portable blood glucose and pressure metres certified for medical use. These devices have a communication interface to share data. The blood glucose metre used was the OneTouch UltraMini [16], which has memory for 500 blood glucose test results, operating range of 20-600 mg/dl, and analysis method based on a glucose oxidase biosensor. The data from the blood glucose metre are transferred using an RS232-USB converter because the gateway has a USB port. The converter implements the manufacturer's protocol for accessing data stored in the device's memory. The blood pressure metre used was the G-Tech RW-450, which measures the wrist blood pressure of the individual. This is the first blood pressure monitor available in the Brazilian market with the capacity to transmit measurements stored in the memory to a computer. To collect data, serial communication with the blood pressure metre was used according to the manufacturer's communication protocols [17], as the blood pressure metre has a USB interface cable for connection with the gateway.
For activity monitoring and fall detection, accelerometre and gyroscope inertial sensors are used, which are available in most smartwatches in the market. In this study, the LG Urbane smartwatch was used.
To increase data security and facilitate user authentication, a biometric sensor was used. The authentication procedure makes it possible to disable alarms and interact with the platform. The biometric sensor used was the GT-511C1R. The biometric sensor used has a CPU ARM Cortex M3 Core, optical sensor with 14 × 12.5 mm effective area, universal asynchronous receiver/transmitter (UART) communication interface operating at 3.3 V and storage capacity for 20 fingerprints. The communication between this sensor and the gateway uses the sensor transistor-transistor logic (TTL) serial communication in addition to some resistors to change the sensor voltage (5 V) to the gateway voltage (3.3 V), and the manufacture's communication protocols [18] were used to identify the user for data input.

Gateway
The data concentrator or gateway is a device able to collect, process and communicate data on patient health and activities. The data collected by the sensors are processed and analysed in real-time through embedded algorithms (signal processing and machine learning) to identify risk situations and generate alerts sent to the cloud through the Internet. The cloud remotely stores and processes the data. The data may be accessed and monitored remotely through the user's personal devices, including televisions, smartphones, smartwatches, tablets and laptops.
The Raspcare platform includes another gateway function. This is the patient care plan, which establishes the treatment routine, measurements, medications and dietary recommendations.
To ensure that the patient adequately follows the care plan and that treatment is effective, the proposed alarm generation module generates alarms according to the Care Plan Calendar, which is implemented in the gateway and is synchronised with Google Calendar. Therefore, both the gateway connected to the television and the smartphone or smartwatch receive the alarm notification in the form of a task scheduled in Google Calendar. The loading of the Care Plan Calendar is addressed in the next section.
The hardware used to develop the platform was the Raspberry Pi 2 [19], a microcomputer with an embedded Linux operating system and Raspbian distribution, an adaptation from the Debian distribution developed by the manufacturer. This microcomputer has a 900 MHz ARM Cortex-A7 processor and 1 GB of RAM memory. Figure 2 presents the communication technologies used in each Raspcare platform device.
A base was designed and developed through 3D printing to accommodate the gateway and its peripherals, as shown in Figure 3. A frontal view depicts the position of the Raspberry board, and a top-down view shows the space for the cables and connections of the sensors.

Application modules
The Raspcare platform has three main application modules: client application, web application and fall detection application for smartwatch. As shown in Figure 4, the applications  communicate through the cloud. The fall detection application installed in the smartwatch sends the fall alert to the web application only through an HTTP request, which subsequently inserts the alert into the database. Similarly, the client application installed on the gateway connected to the Internet synchronises the blood glucose and pressure measurement data stored locally with the web application, which inserts them into the remote database. Each patient is identified through their unique ID in all operations between applications.
The client application was developed in Python language [20] due to its large number of libraries, vast documentation and efficiency. The interface was designed using the pyQt4 framework [21], and a MySQL database was used to store the data.
The database modelled consists of seven tables, namely, three tables for the data generated by the blood glucose and pressure metres with the identification (Integer), collection date (Datetime) and value inserted (String) fields; one Regarding the identification and data manipulation criteria, ID columns with an auto-increment setting were used in all tables, and all types of data are recorded in MySQL Standard Edition.
Libraries were also used to insert data into Google Calendar (Calendar API) such that by establishing a connection with the Internet, the client application will synchronise reminders in the Google Calendar of the user's personal account with prior user permission. Synchronisation with Google Calendar occurs when the Internet is available. If the user account is not registered, the browser window opens, requesting the Gmail user login and password data, which are recorded in the database for future synchronisations. Thus, the user will receive notifications on their personal tablet, smartphone or smartwatch devices.
For remote access to the data generated by the client application and by the fall detection application, the web application has a database that synchronises the data from the blood glucose and pressure measurements and the fall events detected, enabling the health team to monitor the patient remotely through a conventional webpage. The web application stores some configuration data in the database, including the login and password of the consultant physician, name and e-mail of the consultant physician and ID and name of each patient. Figure 5 presents the flowchart of the client application functions. First, the application checks if the Internet is available to add events recorded locally on the Google Calendar account of the users to notify them through their personal devices. Then, the client application queries the remote database for detected fall events. Subsequently, the application queries the activities in the Care Plan Calendar of the patient and assesses whether it is time for some activity, i.e. medication, measurement or meal. If it is time for some recorded activity, the television turns on or is switched to the HDMI channel through the HDMI-CEC protocol, and an Alarm window with the corresponding activity is displayed on the television screen. In addition, Google Calendar, via Android OS, generates a message on the devices registered in the patient's personal account, namely, smartphone, tablet and smartwatch. If the activity is a blood glucose or pressure measurement, prior patient biometric identification is required to allow the client application to collect the data. If the patient has an Internet connection, the client application sends the data to a remote server located in the cloud to allow the healthcare professional to process and analyse the data.
The fall detection application WatchAlert [14] was integrated into the Raspcare platform. WatchAlert is executed in two devices, a smartwatch and a smartphone. Sensor data are collected in the smartwatch. Then, data are sent to the smartphone for processing. If a fall occurs, it is identified. Data on falls were integrated into the database of the web application for combined analysis with the health monitoring data. For WatchAlert configuration, the users must enter their personal data, such as address, e-mail and telephone number, as shown in Figure 6. WatchAlert is turned on or off through the smartphone application.
Data on user activities and health stored in the database may be analysed and processed using an analysis and procession module of the application. This module aims to extract risk information for the user and to interpret it as an alarm that is sent to the actors (healthcare professionals and family members) involved in the care of the user. In the present version of the Raspcare platform, only the use of thresholds was implemented. The thresholds are preset according to abnormal blood glucose and pressure values.

Interaction with the television
Communication via television is a differentiating characteristic of the proposed technology because it benefits from the availability of a television set in virtually all Brazilian homes and is a form of entertainment for the elderly. A solution independent of the brand and the technology used in the television was sought, requiring only an HDMI communication port with HDMI-CEC protocol.
The HDMI-CEC communication protocol enables communication and control between devices through an HDMI cable. Some hexadecimal commands can be sent to turn the television on or off or change the channel.
To use the technology, the library libCEC available for the Linux operating system and an HDMI cable with CEC protocol support were used.
Some commands used to control the television are outlined in Table 1.

Patient care plan
The client application has a home screen (Figure 7) that displays the parameters monitored, such as blood glucose (top graph) and systolic and diastolic pressure (bottom graph) values. This screen also displays information on the next appointment, medication and meal to enable individuals to monitor their health status in their own television sets.
The home screen of the client application reflects the patient care plan, which consists of a set of patient routine data, such as medication names and times, and diet of the monitored patient. This information should be completed by the consultant physician in a spreadsheet, as shown in Figure 8, and the patient should import this information to the gateway through the client application using a pen drive or memory card.

Raspcare platform functions
The proposed platform was tested in the laboratory to validate each planned function, namely, task scheduler (interaction with the television, smartphone and smartwatch); generation of alerts/alarms; blood glucose and pressure measurements and history view.

Task scheduler
The patient care plan proposed by the health team is loaded locally in the gateway from a storage device, such as pen drive or memory card. Based on the patient care plan, the platform updates the task scheduler on the previously registered Google Calendar account of the patient, logging the medical appointments, medication and measurement times and dietary suggestions and meal hours. Of note, if the patient has no Google account or wished not to use this service, the patient will have at least one active calendar in the gateway that will be used for the television as user interface. Every time the appointment time is reached, the gateway turns the television on, notifying the patient about the task that must be completed, as shown in Figure 9.
Simultaneously, the smartphone and the smartwatch also flag the appointment from the Google Calendar service, as shown in Figure 10.  Warnings generated from the appointment calendar must be acknowledged by the user, both on the portable device, such as the smartphone, smartwatch or tablet and the gateway. From the gateway, the user should simply close the warnings by selecting the button Ok or the close window symbol in the upper right corner.
Another type of task included in the patient care plan is the periodic measurement of blood glucose or pressure values, whose warning has the same characteristics as the medical appointment notification, as shown in Figure 11.
The notification of the medication task turns the television on through the HDMI port connected to the gateway, and a notification window opens. The user can cancel the manual entry   of the values measured or accept the automatic transfer of data from the device to the gateway. In both options above, a new notification window opens that requests user confirmation by biometric authentication, as shown in Figure 12.

Generation of alarms
The Raspcare platform consists of modules that automatically analyse the signals generated by the devices. The result of this analysis may produce two types of alarms: • Abnormal blood glucose and pressure measurements: every time the gateway client application detects an abnormality after measuring blood glucose and pressure values (comparing   the measured value with a preset value in the application), an alarm is triggered, and three messages are generated. One of them is sent to the television, and a window opens that indicates the reason for the alarm (see Figure 13). Another message is sent to the web application, indicating the type of alarm and the monitored patient. Finally, a third message is generated by the web application that sends an e-mail to the consultant physician (see Figure 14).
• Fall detection: every time the fall detection module installed in the smartwatch detects a fall event, an alarm is triggered, and three messages are generated. One of them appears on the smartwatch screen (see Figure 15). Another message is sent to the web application, informing about the type of alarm and the monitored patient (see Figure 16). Finally, the third message is sent by e-mail to the consultant physician (see Figure 17).

Conclusion
The success of the treatment of the chronic patient is directly related to the execution of the care plan prepared by the health team for the patient. Scientific evidence indicates technology as a powerful tool for patient self-care.
The boost in health technology in the context of the Internet of Things (IoT) in recent years has triggered the emergence of various devices and services aimed at the chronic patient.
However, their dissemination among the population remains a great challenge. Most existing solutions are proprietary and difficult to integrate. While the Internet of Things (IoT) occupies an increasingly larger space, the lack of Internet in Brazilian homes prevails. Although wearable devices are becoming fashionable, devices certified for monitoring patient health conditions and for data transfer are rare. In Brazil, during this study, only one blood pressure metre met these requirements, whereas the main brands of blood glucose metres have versions available in the market with ease of communication and proprietary applications to help in controlling blood glucose levels. Despite the demand for health solutions and services using the IoT, much work lies ahead regarding the establishment of standards and requirements for IoT platforms.
In this study, we sought an original solution for the problem of chronic patient monitoring combined with the need for compatibility with televisions and with the possibility of interaction with smartphones and other wearable devices. Typically, studies based on IoT are limited to the development of a new smartphone application that implements the patient care plan and devices that measure either the blood glucose or blood pressure levels.
The study suggests that the starting point for using this technology is the consultant physician, who prepares and loads the patient care plan to the gateway that will be installed in the patient's home. The availability of wireless networks does not prevent the gateway from alerting the patient about tasks and collecting the data from the blood glucose and pressure metres.
User authentication is crucial for data security, which was achieved by a practical and secure solution based on a fingerprint sensor.
Conversely, integration with smartphones and wearable devices, such as smartwatches, was also implemented because these options enable the user to move while maintaining the support provided by the gateway in terms of task alerts and adding fall detection and logging functions. The selection of devices is used to monitor chronic patients with hypertension and diabetes.
Other chronic diseases are also indicated for monitoring but are outside the scope of this study.
The present study was limited to discussing the technology that helps with chronic patient self-care and the problem of one user per consultant physician. The issues inherent to the monitoring of several concurrent users by the same team are outside the scope of this study and will be addressed in future studies.
A pilot project aiming at testing the proposed technology is expected in the near future. At least 10 chronic patients with diabetes and hypertension above 70 years old and with a high risk of fall will be selected to test such technology. Internet access at home will be required.
After obtained ethical approval and the signed informed consent of the patient, patient will be monitored for at least 6 months, and sensor data will be recorded. Patients will be interviewed in order to evaluate their acceptability. Additionally, recorder data will be used to evaluate usability and impact in patient care.