Design of intelligent monitoring of loneliness in the elderly using a serverless architecture with real-time communication API
Abstract
BACKGROUND:
Loneliness and social isolation are recognized as critical public health issues. Older people are at greater risk of loneliness and social isolation as they deal with things like living alone, loss of family or friends, chronic illness, and hearing loss. Loneliness increases a person’s risk of premature death from all causes, including dementia, heart disease, and stroke. To address these issues, the inclusion of technological platforms and the use of commercial monitoring devices are vastly increasing in healthcare and elderly care.
OBJECTIVE:
The objective of this study is to design and develop a loneliness monitor serverless architecture to obtain real-time data from commercial activity wristbands through an Application Programming Interface.
METHODS:
For the design and development of the architecture, the Amazon Web Services platform has been used. To monitor loneliness, the Fitbit Charge 5 bracelet was selected. Through the web Application Programming Interface offered by the AWS Lambda service, the data is obtained and stored in AWS services with an automated frequency thanks to the event bridge.
RESULTS:
In the pilot stage in which the system is, it is showing great possibilities in the ease of collecting data and programming the sampling frequency. Once the request is made, the data is automatically analyzed to monitor loneliness.
CONCLUSION:
The proposed architecture shows great potential for easy data collection, analysis, security, personalization, real-time inference, and scalability of sensors and actuators in the future. It has powerful benefits to apply in the health sector and reduces cases of depression and loneliness.
1.Introduction
Loneliness can be defined as negative subjective personal feelings due to low-quality or non-social connections [1]. Older people are at greater risk of loneliness and social isolation as they are more likely to deal with living alone, loss of family or friends, chronic illness, and hearing loss [2]. The Centers for Disease Control and Prevention recognizes loneliness and social isolation in the elderly as critical public health issues [3]. Prevalence studies report that there are countries in Europe where between 18.7% and 24.2% of middle-aged people feel lonely [1]. In the case of the United States, 33% of middle-aged people manifest it and 25% of those over 65 are socially isolated [3]. Loneliness increases a person’s risk of premature death from all causes, including dementia, heart disease, and stroke [4].
It is mostly believed that loneliness only affects older people as they age but is experienced across all age groups as O’Sullivan et al. conclude by reviewing the systematic review and meta-analysis of 113 countries during the COVID-19 pandemic [5]. Variations in loneliness by age and region require further exploration and data collection because not everyone is at the same risk of feeling lonely. The state of loneliness is affected by situations of poverty, poor physical or mental health, few community connections, and living alone. These increase the risk of loneliness. A better understanding of the situation and impact of the loneliness experience is required. Also in different cultures and geographical variations.
It is important to see the increase in loneliness in the general and older population since 1970. As indicated by Crowe et al. [6]. The incidence has increased from 11% to 50% in people over 80 years of age. They suggest a multisystem approach strategy that can be developed from the health and care systems at a global level.
The use of innovative technological tools in homes and nursing homes is giving positive results. As Waycott et al. [7] analyzed with 11 interviews, immersive virtual reality (VR) is being used as an enriching experience for people living in care homes, with healthcare staff playing a key role in helping clients use virtual reality. It is an opportunity where users have fun and allows them to travel virtually where it generates opportunities to make memories while exercising among all residents. Although they conclude that the possibility of customizing the technology to be used for each user is important.
Passive sensing and Wearables-Based Solutions have been used to monitor and manage loneliness. For instance, Site et al. [8] studied a combination of the domains of gerontology, social psychology, architecture, and portable wireless technology to monitor and attempt to predict loneliness. Elmer et al. [9] use passive sensing collecting data from smartphone data to analyze time-stamped sensor data of social interactions. With that, they generate multistate survival models.
The main contribution of this study is the design and development of a portable smart real-time loneliness monitor. Therefore, it is important to mention the role of using innovative tool technologies to implement these systems in homes and residences. Cloud computing is growing as serverless architectures are used. The design of architectures through cloud services is considered to function as a service (FaaS) that allows to develop and run applications or backend as a service (BaaS) as storage [10].
Serverless architectures have been used for a blockchain hyper ledger fabric-enabled consortium architecture providing security, integrity, transparency, and provenance to health-related transactions and exchanges of sensitive clinical information [11]. Also for creating an AI-powered smart healthcare framework to reduce heart disease-related deaths and prevent financial losses by reducing misdiagnoses [12]. Moreover, serverless architectures have great advantages such as including deploying applications simply without the necessity of using a dedicated server, the combination of security with performance, reducing operating costs and development times, having no scaling restrictions, streamlining internal processes and facilitating continuous improvement [13].
Finally, the main objective is the design of a customizable loneliness monitoring system capable of storing using Amazon Web Services (AWS) and the commercial activity bracelet, specifically the Fitbit Charge 5 model.
2.Materials and methods
In this section, the methods and materials used for the design of the proposed monitoring architecture are shown. In the case of hardware, the commercial Fitbit Charge 5 bracelet has been chosen and in the case of software development with the database, it has been selected to develop it through cloud computing thanks to AWS. Figure 1 shows the design of the serverless architecture implemented using AWS services.
Figure 1.
AWS serverless architecture.
![AWS serverless architecture.](https://ip.ios.semcs.net:443/media/thc/2023/31-6/thc-31-6-thc235006/thc-31-thc235006-g001.jpg)
2.1Hardware description
Wearable consumer activity trackers have become very popular over the past few years. These devices provide near-continuous information about physical activity, heart rate, and sleep [14].
2.1.1Fitbit Charge 5
The Fitbit Charge 5 is a commercial activity wristband that collects biometrics including 24-hour heart rate and active zone minutes and also manages stress thanks to the EDA sensor. It tracks in addition sleep, oxygen saturation, physical activity and calorie consumption [15].
Fitbit automatically stores biometric data, through the companion app, in its remote server. To access the data from somewhere other than the Fitbit app, a new app must be registered to make a Web API call. This data can be retrieved using the Fitbit Web APIs.
It requires specific authorization credentials to do so, including access tokens and user ID obtained after a new app has been registered on the Fitbit dev website. To validate and obtain the access tokens, you must go through the authorization process designed for the OAuth 2.0 standard, in this way, you can select the scopes to which you are authorized to have access. The OAuth application creates the client ID and secret to use to invoke the access token. Each access token is only valid for 8 hours by default before it must be updated again, although it can be modified when generating accesses [16, 17].
2.1.2Selected data
To monitor loneliness, it has been decided to use the following requests:
• Get Daily Activity Summary: This request returns a summary and list of user activities and log and activity entries for a given day. In the list can be found the distance and steps taken, the calories burned and the type of activity performed [18].
• Get Heart Rate Series by Date: This request returns a time series of the heart rate during a specific period. In this series can find the maximum frequency, the minimum frequency, the resting heart rate and the different calorie-burning zones.
• Get Sleep Log by Date: This request returns a list of the user’s recorded sleep logs for a given date. In the list can find the sleep efficiency, the duration even the details of the sleep level.
2.2Test and data collected
For the testing the proposed architecture, a series of laboratory tests were carried out to verify the correct connection with the Fitbit database and the subsequent recording of the data in the AWS DynamoDB table. The population included in the test were 3 users over 18 years of age. The data used in this investigation corresponds to all the laboratory tests carried out since January 2023, the duration of the collection of tests was an approximate period of 3 months collected with the same Fitbit bracelet using different users.
2.3Serverless architecture
In this study, we used the services provided by the general-purpose IoT platform AWS, taking advantage of the benefits of serverless architectures.
• Lambda: It is a service that works by triggering events and enabling code execution when required without managing servers. It supplies a programming code that receives input events from external or internal sources [19].
• API-Gateway: It is a service that provides benefits in security, monitoring, publishing, and maintenance in REST, WebSocket and HTTP API with PUT, POST, GET, PATCH, and DELETE methods. With Lambda users can create APIs, further using and connecting to other AWS services. Finally, the API gateway allows exposing an endpoint for accessing the data as an intermediary for other applications or clients [17].
• DynamoDB: This service is a fully managed NoSQL database and is designed to run high-performance applications at any scale. It offers security, backups, in-memory caching, and the possibility to import or export data. The saved data can be accessed, added and edited via API or Lambda [17].
• Amazon EventBridge: This service helps in the creation of event-based applications thanks to the fact that it makes a connection between events and AWS services. You can embed, filter, transform, and deliver events, but you also have the option of managing event buses [20].
• AWS Systems Manager: This service is the secure management operations centre for applications and resources. For this in particular, the parameter store is useful, it is a secure and hierarchical storage for the administration of configuration data and the administration of secrets such as passwords and database strings. The store can be accessed through scripts [21].
3.Results
3.1Serverless architecture description
3.1.1Fitbit connection for request
Once the access tokens and renewal of access to the data have been obtained through the Fitbit Dev application registration, two string-type parameters have been created in the systems Manager service parameter store. This way the tokens can be modified when they are updated and are protected with additional security.
To make requests to the Fitbit database, the AWS lambda function called “fitbit_connect” is called through an event, as shown in Fig. 2. The function obtains the tokens stored in the store and calls the internal function “get_activity” by passing it the desired tokens, date, and activity. This function makes the requests following the examples that Fitbit proposes. If it detects an error in the request because the access token is expired, call the “get_tokens” function and then redo the request changing the old security access with the new tokens in the correspondence parameter store. Once the request has been made successfully, the data is filtered to obtain a JSON that allows it to be correctly saved in the database. To this JSON the data of the company, professional and user are added. Finally, the internal function “storing_data” is activated, which sends the JSON to the Dynamo DB database table.
3.1.2Continuous data collection
To request the data from the Fitbit server, we have created a rule within the default event bus of the Amazon EventBridge for the Lambda function activation from time to time to check the evolution during the day. The selected time interval is 15 minutes.
3.1.3Database table model
Figure 2.
“Fitbit_connect” lambda function functionality and connection between other services.
![“Fitbit_connect” lambda function functionality and connection between other services.](https://ip.ios.semcs.net:443/media/thc/2023/31-6/thc-31-6-thc235006/thc-31-thc235006-g002.jpg)
We designed a DynamoDB database table with a combination of partition key and sort key as seen in Table 1. The parameters from left to right have been ordered depending on the hierarchy of the data to increase the number of queries from lambda. There are five types of possible data for the table taking into account that in the project there will be different companies that manage the professionals who will monitor the users of the devices.
Table 1
Partition and sort keys for each type of data for the DynamoDB table
Type | Partition key | Sort key |
---|---|---|
Company | COMP | COMP#<company_name> |
Professional | PROF#<professional_name> | COMP#<company_name> |
User | USER#<user_name> | PROF#<professional_name> |
Device | SENSOR | USER#<user_name> |
Measurement | USER#<user_name> | Sensor_type(Fitbit)#<timestamp> |
3.1.4Database request
We implemented the read, upload, and delete operations in lambda to make requests to the database to be able to analyze the data collected and visualize them on the web. This function receives information on the action and variables to execute the demanded request. Below are summarized implemented actions of the lambda function:
• User actions: Create and delete individual users for a specific professional, also read all the existing users or users for a professional.
• Company actions: Create and delete individual companies, and also read all the existing companies.
• Professional actions: Create and delete individual professionals for a specifically created company, also read all the existing professionals or professionals for a company.
• Device actions: Create and delete individual devices for a specific user, also read all the existing devices or devices for a user.
• Measurement actions: Save, and delete a measurement requested to Fitbit and also read all the existing measurements for a user.
Figure 3.
Example with part of the data collected and saved to the DynamoDB table following the partition key and sort key combination.
![Example with part of the data collected and saved to the DynamoDB table following the partition key and sort key combination.](https://ip.ios.semcs.net:443/media/thc/2023/31-6/thc-31-6-thc235006/thc-31-thc235006-g003.jpg)
3.2Measurement experiments
As explained in Section 2.2, the proposed architecture has been tested by performing a laboratory test using a Fitbit bracelet. To do this when three different test users have registered in the mobile app. During the tests, the users have worn the bracelet for a whole week and then charge the battery and change the user for the following week. For each user, the band was reset when it was their turn to assign the band to each user in the Fitbit account. For each user, two variables have been generated in the store where the access tokens of each user account are stored. Once the test was complete, it was verified that the generated data was successfully saved to Amazon DynamoDB, as shown in Fig. 3. It was verified that the Amazon function verified all the users indicated in the store, but when filtering the response obtained, if it did not return registered activity, it did not send the data to the database, only allowing data to be registered when necessary. More than 8,000 samples were collected and the database structure was maintained throughout the test.
4.Discussion
The developed monitoring system showed great potential and is an attractive approach for real-time monitoring in healthcare. Wearable consumer activity trackers have the advantage of security and privacy communication with the user using mobile phone authentication sessions in the communication app. As Perumal et al. [22] conclude, the communication with wearable devices with the encryption of mobile phones provide secure and private communications. It also has applications in detecting more possible medical episodes than conventional monitoring [23].
As for the serverless architecture proposed, it has the advantages of scaling and instant deployment of services which allows the increase of users using the monitor which could help increase the use of possible monitors in the health system [12]. Also, the communication system using API complies with the requirements of cross-border transactions involving massive IoT application data and considers the privacy of users [12, 24]. Storing the data in the DynamoDB database allows cost-efficient and secure IoT systems supported by AWS security systems for health data taking into account that third-party auditors regularly test and verify the effectiveness of AWS security [25].
This design also has limitations, this are the data collection capacity and the precision of the same of the selected commercial bracelet. It must also take into account the rigorous control that should be in the residences. A bracelet change could occur and not be notified, which would result in the data being misclassified.
This research showed the potential benefits that a serverless solution coupled with the use of sensors could provide in health care and third age.
5.Conclusions
In this paper, a new system has been proposed by combining wearable devices and Serverless Computing technology architecture to monitor loneliness. The developed architecture shows great potential for easy data collection, analysis, security, personalization, real-time inference, and scalability of sensors and actuators in the future. It has powerful benefits to apply in the health sector and reduces cases of depression and loneliness.
The limitations of this study are the difficulty of carrying out an extensive test with real users in residences and homes for the elderly and that with this method of extracting data from Fitbit some of the data obtained through the calls is accumulated for the day and not very detailed throughout the day.
In future work, we want collect more data developing the designed system in some residences and with caregivers and psychologists detecting which users are lonely to later carry out a analysis by applying statistical analysis and data cleaning to develop artificial intelligence in AWS Sagemaker.
Later, the artificial intelligence models will be programmed in AWS to detect possible loneliness alarms before further development. In addition, using AI to make predictions and generate warnings to professionals of possible risks of loneliness in users.
Conflict of interest
None to report.
References
[1] | Surkalim DL, Luo M, Eres R, Gebel K, Van Buskirk J, Bauman A, et al. The prevalence of loneliness across 113 countries: systematic review and meta-analysis. BMJ [Internet]. (2022) Feb 9 [cited 2023 Jun 22]; 376. Available from: https://www.bmj.com/content/376/bmj-2021-067068. |
[2] | Qualter P, Mund M, Heu L, Zhao L, Wu L. The association between social participation and loneliness of the chinese older adults over time – the mediating effect of social support. Int J Environ Res Public Heal 2022, Vol 19, Page 815 [Internet]. (2022) Jan 12 [cited 2023 Jun 22]; 19: (2): 815. Available from: https://www.mdpi.com/1660-4601/19/2/815/htm. |
[3] | Social Isolation and Loneliness in Older Adults. Soc Isol Loneliness Older Adults. (2022) May 14; |
[4] | Holt-Lunstad J, Steptoe A. Social isolation: An underappreciated determinant of physical health. Curr Opin Psychol. (2022) Feb 1; 43: : 232-7. |
[5] | O’Sullivan R, Leavey G, Lawlor B. We need a public health approach to loneliness. BMJ [Internet]. (2022) Feb 9 [cited 2023 Sep 8]; 376. Available from: https://www.bmj.com/content/376/bmj.o280. |
[6] | Crowe CL, Liu L, Bagnarol N, Fried LP, Bagnarol N. Loneliness prevention and the role of the Public Health system. Perspect Public Health [Internet]. (2022) Jul 11 [cited 2023 Sep 8]. Available from: doi: 10.1177/17579139221106579. |
[7] | Waycott J, Kelly RM, Baker S, Barbosa Neves B, Thach KS, Lederman R. The Role of Staff in Facilitating Immersive Virtual Reality for Enrichment in Aged Care: An Ethic of Care Perspective. Conf Hum Factors Comput Syst – Proc [Internet]. (2022) Apr 29 [cited 2023 Sep 8]; 17. Available from: doi: 10.1145/3491102.3501956. |
[8] | Site A, Lohan ES, Jolanki O, Valkama O, Hernandez RR, Latikka R, et al. Managing perceived loneliness and social-isolation levels for older adults: A survey with focus on wearables-based solutions. Sensors 2022, Vol 22, Page 1108 [Internet]. (2022) Feb 1 [cited 2023 Jun 22]; 22: (3): 1108. Available from: https://www.mdpi.com/1424-8220/22/3/1108/htm. |
[9] | Elmer T, Lodder G. Modeling social interaction dynamics measured with smartphone sensors: An ambulatory assessment study on social interactions and loneliness. https://doi.org/101177/02654075221122069 [Internet]. (2022) Aug 20 [cited 2023 Jul 3]; 40: (2): 654-69. Available from: doi: 10.1177/02654075221122069. |
[10] | Li Y, Lin Y, Wang Y, Ye K, Xu CZ. Serverless Computing: State-of-the-Art, Challenges and Opportunities. IEEE Trans Serv Comput. (2022) Mar 1. |
[11] | Ayub Khan A, Wagan AA, Laghari AA, Gilal AR, Aziz IA, Talpur BA. BIoMT: A State-of-the-Art Consortium Serverless Network Architecture for Healthcare System Using Blockchain Smart Contracts. IEEE Access. (2022) ; 10: : 78887-98. |
[12] | Golec M, Gill SS, Parlikad AK, Uhlig S. HealthFaaS: AI based Smart Healthcare System for Heart Patients using Serverless Computing. IEEE Internet Things J. (2023) . |
[13] | Sanchez AO, Ugarte UG, Herrera MJG, Bastidas OJ, Garcia-Zapirain B. Design and implementation of food quality system using a Serverless Architecture: case study of gluten intolerance. Telemat [Internet]. (2022) Dec 27 [cited 2023 Jun 23]; 7475-86. Available from: https://www.provinciajournal.com/index.php/telematique/article/view/1030. |
[14] | Mayorga-Vega D, Casado-Robles C, López-Fernández I, Viciana J. Activity wristband-based physical activity recommendations in young people. Sci Sports. (2022) Jun 1; 37: (4): 303-15. |
[15] | Pulsera de actividad |
[16] | Web API [Internet]. [cited 2023 Jul 3]. Available from: https://dev.fitbit.com/build/reference/web-api/. |
[17] | Sim S-H, Paranjpe T, Roberts N, Zhao M. Exploring Edge Machine Learning-based Stress Prediction using Wearable Devices. 2022 21st IEEE Int Conf Mach Learn Appl [Internet]. (2022) Dec [cited 2023 Jul 3]; pp. 1266-73. Available from: https://ieeexplore.ieee.org/document/10069495/. |
[18] | Get Daily Activity Summary [Internet]. [cited 2023 Jul 3]. Available from: https://dev.fitbit.com/build/reference/web-api/activity/get-daily-activity-summary/. |
[19] | AWS Lambda Documentation [Internet]. [cited 2023 Jul 3]. Available from: https://docs.aws.amazon.com/lambda/?icmpid=docs_homepage_featuredsvcs. |
[20] | Krishna VSVM, Vamsi TSR, Kavitha S. Automation of Forensic Analysis for AWS Aurora using EventBridge and Athena. 6th Int Conf Electron Commun Aerosp Technol ICECA 2022 – Proc. (2022) ; pp. 262-9. |
[21] | AWS Systems Manager Documentation [Internet]. [cited 2023 Jul 3]. Available from: https://docs.aws.amazon.com/systems-manager/. |
[22] | Perumal P, Subha S. An analysis of a secure communication for healthcare system using wearable devices based on elliptic curve cryptography. World Rev Sci Technol Sustain Dev. (2022) ; 18: (1): 51-8. |
[23] | Webster CS, Scheeren TWL, Wan YI. Patient monitoring, wearable devices, and the healthcare information ecosystem. Br J Anaesth. (2022) May 1; 128: (5): 756-8. |
[24] | Ouyang R, Wang J, Xu H, Chen S, Xiong X, Tolba A, et al. A Microservice and Serverless Architecture for Secure IoT System. Sensors 2023, Vol 23, Page 4868 [Internet]. (2023) May 18 [cited 2023 Jul 3]; 23: (10): 4868. Available from: https://www.mdpi.com/1424-8220/23/10/4868/htm. |
[25] | Lakhan A, Mohammed MA, Rashid AN, Kadry S, Abdulkareem KH, Nedoma J, et al. Restricted boltzmann machine assisted secure serverless edge system for internet of medical things. IEEE J Biomed Heal Informatics. (2023) Feb 1; 27: (2): 673-83. |