The lack of physicians and health emergencies in rural or isolated areas is a cause of deaths that could be prevented with the help of technology. Indeed, health monitoring devices can help patients to continuously send their health data such as heart rate or body position to a remote health-care facility where physicians can get notifications, send assistance or start specific actions depending on the situation.
That’s where connection to the Cloud, that acts as a virtual server to store, analyze data and notify the responsible facility accordingly, becomes crucial.
In the previous articles, we explained how we developed a Qt application that displays health data on the AM437x board with GPU acceleration.
Health data is highly valuable and displaying them to the patient does not make sense if they are not somehow analyzed or at least stored somewhere. As the board will not be able to store and process such amount of data, only Cloud technologies can answer this issue.
This article intends to describe how to exploit (store, analyze, visualize) these data using Cloud technologies.
The health monitoring device has been designed along with a web application as a proof a concept to show how easy it is to deploy on the Cloud using Amazon Web Services (AWS). AWS is a suite of cloud computing services that offers cost-efficient and scalable services for storage (database) and computing capacity (application) with a high-level of synergy between them.
The implemented use-case can be broken down into two parts:
- The health monitoring device stores the health data to the Cloud
- In the Cloud, an application processes the data and triggers an alert is something goes wrong. In our case, a text message will be sent if the heart rate stays at 0 BPM.
How to store your health data into the Cloud ?
The device monitors and stores the health data for analysis in a database located in the Cloud. The columns of the table would be the Patient UUID to uniquely identify the patient and the following health data. Such data would be: Galvanic Skin Response, Electromyogram (EMG), Electrocardiogram (ECG), Air Flow Breathing (AFB), Heart Rate (in BPM), Temperature, SpO2 (Peripheral Capillary Oxygen Saturation) and the Body Position.
AWS provides ready-to-deploy, flexible and secure cloud solutions that are easy to use and to manage. Moreover, it offers many database solutions that all tackle different problems:
- Amazon RDS (Relational Database Service) for relational database (MySQL, Oracle, SQL Server, PostgreSQL) service
- Amazon DynamoDB: low-latency and scalable non-relational (NoSQL) database service
- Amazon ElastiCache: in-memory caching service for web application
- Amazon Redshift: petabyte-scale data warehousing service
- Amazon SimpleDB: highly availability distributed database service
In our case, we want to design a database with only one table containing the data of one patient. We do not need to draw relations between multiples tables. Therefore, a simple non-relational database to store our data is enough. We could choose between Amazon DynamoDB and Amazon SimpleDB but as the former is seamlessly scalable and fast as the latter, Amazon DynamoDB will be chosen to answer our needs.
The data is sent to the Amazon DynamoDB service in JSON format.
As a non-relational database, DynamoDB only supports the INSERT, UPDATE and DELETE queries but provides “fast and predictable performance.”
In our use-case, only the INSERT (PutItem) query is used.
Creation of the NoSQL cloud database using DynamoDB
To create a Table in DynamoDB, go the the DynamoDB service and click on Tables, then on Create Table.
In Illustration 1: Create a table in DynamoDB, the PatientData table is created with the data UUID as the Partition Key.
In DynamoDB, a table is defined by a name and a Partition Key (or Primary key). A Sort Key can also be defined.
In Illustration 3: PatientData table, the PatientData table contains all the health metrics with the PatientUuid reference.
This database is populated by the health monitoring device application through HTTP POST requests.
Make use of your data stored in the Cloud
When the health data meet some conditions, the Cloud should send a text message to the health facility to notify on the patient’s state and trigger an action from medical staff.
To implement and execute this business logic need in the Cloud, we have to consider how much infrastructure we want to manage. We could deploy our web application:
In our use-case, the business logic to implement is simple enough to rely on the serverless solution AWS Lambda. This service handles the execution of a function without managing servers. With Amazon DynamoDB, they are the core components of the AWS Serverless Platform.
The main advantage of AWS is that all the services are perfectly integrated in each other: these functions (or Lambda) can be caused by an event in Amazon DynamoDB or Amazon S3 bucket or be invoked through the Amazon API Gateway.
The AWS Lambda will be activated whenever an item in the table is modified. The relation between a Lambda and a set of specific DynamoDB events is called a trigger.
Processing new/modified items in DynamoDB
1. Generating triggers in dynamoDB
In Illustration 4: Create a Trigger, we create a Trigger between the table PatientData and the function ProcessDynamoDBStream.
2. Use AWS Lambda to create your scenario
In our case, the implemented AWS Lambda retrieves the data inserted in the database, gets the patient’s first and last name from the UUID using DynamoDB and checks if the last six samples of the patient’s heart rate is zero. In that case, a text message is sent.
3. Mobile and messaging notifications service using Amazon SNS
The Amazon SNS (Simple Notification Service) service allows to easily send notifications to applications, mobile phones, web servers, …
It defines the concept of “topic” as a: “communication channel [used] to send messages and subscribe to notifications.” It allows to send text messages to multiple phone numbers at once .
As we send the alert to a single phone number , we use the Amazon AWS SDK (boto3) that provides an easy-to-use API removing the need of a topic.
Monitor & Control Access to the Cloud resources with CloudWatch
Relying the application in the cloud saves time and allows to get rid of scalability issue. But the cloud resources cost money and their use should be carefully monitored.
This article described the deployment of the patient monitoring solution in the Cloud. This has been tested using Amazon Web Services (AWS) and its services. However, multiple aspects provided by AWS API have not been explained such as the AWS Identity and Access Management (IAM) that provides control access management features to the AWS resources. Now that we have the data available in the Cloud, we will need some tools to visualize and monitor efficiently these data.
 http://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-topic.html  http://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html