Building a Smart Watch Geofence Feature

This project was interesting as it involved working with a smart watch company. Our task was to design and maintain an API that would support seamless streaming of monitoring data into the geoBingAn Saas platform. The metrics being monitored included:

  • heart beat rate
  • blood oxygen level
  • battery level
 

One of the main goals of this collaboration was to be able to gain insight and alerts from monitoring data. One such feature we were tasked with developing was the geofence feature where users would be able to define safe zones. If smart watch users left these safe zones, observers would receive an alert similar to the message below notifying them of the user that left the safe zone and monitoring data recorded at that time.

 
Notion image

This is a high level overview of how the architecture is setup:

Notion image

The smart watch is configured to continuously send monitoring data to the Django API deployed via AWS Lambda, Amazon RDS with PostgreSQL is being used as the primary data source. As monitoring data is coming in, a function is triggered that leverages the Haversine formula to check for watches that are outside the defined safe zones. Using the LINE Messaging API SDK for Python we are able to generate Line Flex messages and send alerts via the Line Messaging API to smart watch observers. For the observers to receive a notification they must have the LINE app installed and they must be subscribed to the Line Bot channel.

This was a challenging but fulfilling project because it gave us an insight into the usefulness of this feature and proved how it can help people. Being able to monitor your loved ones even when you are not around and using a platform you are already familiar with was a big selling point for customers.

One thing we had to keep in mind was to avoid bombarding observers with too many alerts in a time. Defining a threshold delay was vital to finding a right balance between providing enough information to the observer and overwhelming them with alerts.

 

Architecture Pros:

  • AWS Lambda provided a us a way to reduce costs
 

Architecture Cons:

  • With the frequency of incoming data, we were experiencing more issues with PostgreSQL. To analyze historical data and considering moving time windows we realized leveraging a time series database would be a better option.
 

LINE setups:

Line Flex Message Simulator: Tool that allows you to design Line Flex messages

https://developers.line.biz/flex-simulator/

 

Line Developers Console: Setup Line bot channel and configuration for Line Messaging API

https://developers.line.biz/console/