Building a pulse oximetry tracker using AWS Amplify and AWS serverless

This tutorial demonstrates a sample solution for collecting, tracking, and sharing pulse oximetry data for multiple users. It is built using AWS serverless  technologies   for reliable scalability and security. The external  application is written in  VueJS  and uses the  Amplify Framework  . Oxygen saturation measurements are  performed  manually or  using a BerryMed pulse oximeter  connected to a browser via the  Internet via Bluetooth  .





Screenshot of an external application running in a desktop browser.
Screenshot of an external application running in a desktop browser.

, ,    AWS (AWS SAM). -  REST API Amazon API Gateway , AWS Lambda .  Python -    Amazon DynamoDB .   Amazon Cognito .





:





  •  Node.js npm





  • BerryMed BM1000C





  • AWS.      AWS





High level diagram of the complete oxygen monitor application.
.

: . Amplify CLI  Amazon Cognito - .      Amazon Cognito     API.  , .





Diagram showing how Amazon Cognito authorization workflow works
, , Amazon Cognito

.  , ,  AWS Cloud9 IDE.  AWS Cloud9, , .





:





Amplify CLI, .





  1. npm install -g @aws-amplify/cli
          
          



  2. Amplify CLI .   .





    amplify configure
          
          



  3.   GitHub .





    git clone https://github.com/aws-samples/aws-serverless-oxygen-monitor-web-bluetooth.git
          
          



  4. ampify-frontend Amplify CLI.  .





    cd aws-serverless-oxygen-monitor-web-bluetooth/amplify-frontend
    amplify init
          
          



  5. AWS Amplify CLI.





    amplify push
          
          



  6.   aws_userpools_id   src / aws-exports.js .  .





    aws_user_pools_id in src / aws-exports.js file
    aws_user_pools_id src / aws-exports.js

.   AWS SAM CLI ,   AWS :





  1.    Oxygen-Monitor AWS .





  2.       aws_userpools_id   UserPoolID .





  3.  Deploy () .





  4.  API endpoint ( API),  .





    Endpiont API
    Endpiont API

  1.  ampify-frontend / src / api-config.js     .   API  .





    const apiConfig = {
      “endpoint”: “<API ENDPOINT>”
    };
    
    export default apiConfig;
          
          



  2. .





    cd aws-serverless-oxygen-monitor-web-bluetooth/amplify-frontend
    npm install
    npm run serve
          
          



    :





    You should see output like this
  3. , :





    amplify publish
          
          



    URL- .





, , .





.  .  , .





BerryMed , .   « », .  Bluetooth Chrome Android.





Bluetooth Bluetooth,   "Enter Manually" ( )  .





, .  , DynamoDB.  , .





, , .  , .  .





, , .





 GitHub  serverless-backend /    AWS SAM   Lambda .  API, - DynamoDB.  Amazon Cognito API, ¨UserPoolID¨, :





JWT, .  DynamoDB, , .





.  ,  AddLevels,  ""   DynamoDB.





 FetchLevels  .  FetchSharedUserLevels Access Table,  , .





.  ,   ManageAccess  , .   Access Table,  .  .





 GetSharedUsers  , .  . FetchUsersWithAccess  , , , .





DynamoDB AWS SAM , .  - . . ,  DynamoDB.





LevelsTable:
    Type: AWS::DynamoDB::Table
    Properties: 
      AttributeDefinitions: 
        - 
          AttributeName: "username"
          AttributeType: "S"
        - 
          AttributeName: "timestamp"
          AttributeType: "N"
      KeySchema: 
        - AttributeName: username
          KeyType: HASH
        - AttributeName: timestamp
          KeyType: RANGE
      ProvisionedThroughput: 
        ReadCapacityUnits: "5"
        WriteCapacityUnits: "5"

  SharedAccessTable:
    Type: AWS::DynamoDB::Table
    Properties: 
      AttributeDefinitions: 
        - 
          AttributeName: "username"
          AttributeType: "S"
        - 
          AttributeName: "shared_user"
          AttributeType: "S"
      KeySchema: 
        - AttributeName: username
          KeyType: HASH
        - AttributeName: shared_user
          KeyType: RANGE
      ProvisionedThroughput: 
        ReadCapacityUnits: "5"
        WriteCapacityUnits: "5"
      
      



 GitHub  ampify-frontend / src /  .  main.js  Amplify VueJS ,  aws-exports.js.  ,  api-config.js.





 components/OxygenMonitor.vue  API API.





API Vue, .





  /ConnectDevice.vue,   Bluetooth Web -  .   UUID Bluetooth  , BerryMed.    Bluetooth,  .





 handleData  .  .





 OxygenMonitor   ConnectDevice  .  .





Vue .





, , Amplify Framework .





Remote monitoring of patient vital signs is more relevant than ever. This guide demonstrates a personal health and telemedicine application solution. The complete solution includes multi-user functionality and a secure and scalable serverless server. The app uses a browser to interact with a physical device to measure oxygen saturation and heart rate. It publishes measurements to a database using a serverless API. Historical data can be displayed as a trend chart and can also be accessed by other users.








All Articles