top of page
  • Rick Getz & Bryce Andress

Building an Asynchronous Physiology API

Updated: Aug 3, 2022

This month at Presage Technologies, we discussed moving our physiology analysis into an API in order to allow customers to easily analyze videos on demand. After reviewing possible implementations, we decided on an AWS Serverless Stack. Our key needs focused on fast response time, low overhead, and scalability. The below image shows a high level mockup of our design. To test it out for yourself, create a demo account for our Physiology API here.

Serverless Infrastructure

AWS Serverless methodology focuses on running code, managing data, and integrating applications, all without the need to manage servers. This makes it a great candidate for our use case. To create our Physiology API, we relied predominantly on the following AWS services: API Gateway, Lambda, S3, ECS Fargate, and DynamoDB.

The foundation of the Physiology API is built on top of API Gateway and AWS Lambda. API Gateway allows us to efficiently and securely handle requests from clients. We then proxy relevant requests to Lambdas to handle video upload and data retrieval.

API Gateway, however, does have limitations. One limitation is the hard limit of only allowing 10MB uploads. This limit in AWS cannot be modified with a service quota request. To circumvent this issue, we used an API Gateway plus Lambda combination that generated a pre-signed URL for our end users. The end user is then able to use that URL to securely upload their video into our private S3 Bucket without the need for further communication with our Physiology API.

Event Driven Architecture

When a video has been uploaded to S3, we rely on the concept of Event Driven Architecture to kick off the physiology analysis. AWS EventBridge fires an event to start an ECS Fargate Task that will transfer the video from S3 and start the physiology analysis. Once the processing has finished, the Fargate task will write the results to DynamoDB for later retrieval by the user. Lastly, the video is permanently deleted from S3.


Another problem the architecture had to solve was the high cost of an always running server that was capable of performing the analysis. To solve this problem, we utilized AWS EventBridge and ECS Fargate for the video analysis. This allows us to efficiently scale our workload up or down to meet demand. This has the added benefit of allowing users to upload and analyze multiple videos concurrently to reduce wait time.

Python Client

To make integration easier for developers, we created a python client that simplifies the interaction with our Physiology API and published it to PyPI. To get started, developers can install the client using the below command:

pip install presage_technologies

With this installed, users are able to interact with the Physiology API in only a few lines of code; as shown in the code block below:

from presage_technologies import Physiology

physio = Physiology("YOUR_API_KEY")
video_id = physio.queue_processing_hr_rr("path/to/your/video")

results = physio.retrieve_result(video_id)


Utilizing this technology stack, users with a wide variety of use cases are able to retrieve physiology from subjects in their videos without the need for specialized integration.

For more information, contact Presage Technologies. We would love to hear about your intended use case.

181 views0 comments

Recent Posts

See All


bottom of page