Inspiration

Have you ever regretted that you could have performed better IF you hadn't been so anxious "before" important moments in your life?

We've all hoped at some point that IF we can manage stress and anxiety effectively during critical moments, we won't miss out on many life-changing opportunities.

In Australia, the framework for mental health services is a highly complex mix of public and private systems, with funding shared by the federal, state, and territory governments, individuals, and private health insurers.

Instead of expecting and waiting for the government to allocate $2.3 billion from the Federal Budget over 04 years beginning in 2022 for the National Mental Health and Suicide Prevention Plan (Australian Department of the Treasury, 2021), we believe there is a need for a more convenient and effective solution to help people manage anxiety quickly.

What it does

Our solution is to develop an integrated application between wearable and mobile devices to assist users in managing 02 different types of stress:

  • Acute stress: stress that lasts only for a short period of time
  • Chronic stress: stress that continues for a long period of time and does not go away.

For acute stress: Providing real-time support in the event of anxiety over control preceding important situations

Some wearable devices, such as the Apple Watch, can record your heartbeat and rhythm by using an electrical heart sensor to measure your heart rate and compute Heart Rate Variability (HRV), as well as produce an electrocardiogram (ECG) pattern. Zentria is a custom app collect heart rates directly from Apple watch sensor with support of HealthKit Workout.

Adults under the age of 35 have resting pulse rates that range between 60-100 beats per minute (BPM). You are nervous or your body shows a signal of stress if your heart rate suddenly increases or drops BPM and does not return to the normal pattern (especially in the case “before” an interview, exam, presentation, meeting, etc).

Our app will provide you with an alert as well as some suggestions to instant de-stress (quick and easy exercise tips, breathing tips, diet suggestions, etc). We want to help you calm down and get ready before the event, so then you can perform at your best.

For chronic stress: Mood Journal

Zentria gives users a space to input their feeling anytime. We want to encourage users to bring back their dairy or journal habits, a place to confess their struggles and fears without judgment or punishment. It likely felt good to get all of those thoughts and feelings out of your head and down on paper. The world seemed clearer.

Based on the data entered, our app will evaluate users' emotional patterns on a weekly, monthly, and quarterly basis. Providing them with a clear picture of the source of stress factors in their lives through word cloud data visualization and NLP sentiment analysis.

How we built it

Heart Rate Prediction to Monitor Stress Level

Instead of using large ECG datasets, we used a small dataset with 684 columns and 54 rows on Kaggle named Mental Stress PPG: https://www.kaggle.com/datasets/chtalhaanwar/mental-stress-ppg to train the model for fast development in this Hackathon.

Photoplethysmography (PPG) is considered an alternative indicator for mental stress detection using pulse rate variability (PRV), the time interval between two successive peaks of PPG.

This dataset has been collected for supervised machine learning classification methods with a label of two distinct values: normal or stress. After training and testing the dataset with 06 different classification algorithms, we discovered that LogisticRegression has the best accuracy with 75,9259%. This algorithm is decided to be used to predict and alert Zentria users' stress levels.

Sentiment classification using NLP With Text Analytics

We think that the act of sharing your events and stories on social media is similar to the practice of daily emotional journaling. To perform sentiment analysis, we used the Reddit Dataset: https://www.kaggle.com/datasets/ruchi798/stress-analysis-in-social-media, which is a collection of user-shared posts. Label data with the TextBlob Python module, then train with the DecisionTreeClassifier model.

TextBlob actively used Natural Language ToolKit (NLTK) to achieve its tasks. It returns polarity and subjectivity of a sentence. Polarity lies between [-1,1]: -1 defines a negative sentiment and 1 defines a positive sentiment. Subjectivity lies between [0,1]

Solution Architecture

Explanation of the typical data flow

The heart rate sensor on the smartwatch published to a DynamoDB database in near-real time. The DynamoDB database will provide data streams for a scheduled Lambda function to extract and load into Sagemaker for processing. Our machine learning algorithm deployed on AWS Sagemaker will consume a sample of the user’s heart rate data to identify whether they are currently stressed. If they are stressed, a response will be sent back to the user’s smartwatch. The data will also be transmitted to an AWS S3 bucket which can be queried with Athena when the user desires to view their historical stress data.

Challenges we ran into

The biggest challenge for our team was the difficulties we had in defining the scope of our application, as well as identifying what made it unique among competitors within the same market space. Our initial plans ended up being too ambitious for us to achieve within the given timeframe, which led to us cutting out a lot of the extra features during the actual development and implementation of our apps.

Another issue that we faced was our team's lack of expertise in developing mobile/smartwatch native applications. This resulted in a need to educate ourselves with new programming languages, and also required us to identify how our applications would integrate with each other in a cloud-based environment.

Accomplishments that we're proud of

Overall, our team is proud of the effort and progress that we've made together despite working with tools and technologies that none of us were familiar with at the beginning. Taking into consideration the limited time we had, we are satisfied with the current state of the solution that we were able to implement.

What we learned

The entire experience was a great learning journey for our team, not only in terms of technical skills but also how we operated within a group of people with diverse skill sets and experiences. Another thing to consider is that for a lot of our team members, it was the first hackathon that we had participated in. The fast-paced environment encouraged us to adapt quickly in order for us to have a chance at creating a contending project.

Our team not only had the opportunity to learn new programming languages/frameworks (Swift/React), but we also had the chance to delve deeper into the topics that we thought we were already familiar with. This was further encouraged by the mutual intersect of skills that some of our team members shared, which led to discussions about certain concepts that enabled us to consolidate each other's knowledge.

What's next for Zentria

Continue to develop a complete version of Zentria for both iOS (Apple) and wearOS (Android)

With the advancement of mental health technology in the market, we don't want to limit ourselves to Apple wearables and mobile devices only. We intend to create app that work on both Android devices.

As a result, Zentia can be used with any smartwatch that has a heart rate sensor, such as:

  • Any Apple Watch
  • Garmin Epix, Fenix, Forerunner, Instinct, Venu, Vivoactive, Vivosmart series
  • Samsung Galaxy Watch 5, Watch 4, Watch 4 Classic
  • Fitbit Charge, Versa, Sense, Inspire, Luxe Series
  • Fossil Julianna HR, Carlyle HR, Sport, Venture HR
  • Etc,...

Add more features to improve the stress-relieving capabilities of the app

During the ideation phase of the project, the team came up with many ideas that unfortunately couldn't be implemented into the submission due to time constraints. Future development could add these features into the build of the app.

These ideas included:

  • Prompting users to seek professional medical help in the case of extremely prolonged cases of chronic stress
  • Utilise blood pressure metrics in combination with heart rate data to provide a more accurate stress analysis of a user's stress level.
  • Collating all of the user’s acquired heart rate and stress data into a single file, that the user can then send to their health professional using the app

Build a Deep Learning Model on a large Electrocardiogram dataset and aim to achieve an accuracy score > 90%

With the successful test on the Photoplethysmography (PPG) dataset, we will reproduce our existing model and build a new stress prediction model with 02 famous datasets in heartbeat classification, the MIT-BIH Arrhythmia Dataset and PTB Diagnostic ECG Database. The number of samples in both collections is large enough for training a deep neural network.

By building a Deep Neural Network model on 2 big and complex datasets, we hope to be able to build an algorithm that can achieve above 90% accuracy when predicting signal of stress based on heartbeat data. That could make Zentria become the only app that predicts stress and makes instant suggestions to help users de-stress most accurately and efficiently on the market.

Using AI Text Network Analysis and Data Visualization

A simple word cloud sentiment analysis will not provide users with many useful insights into the precise root cause of their emotions as well as the relationship between factors.

We plan to integrate InfraNodus API into Zentria in the future. InfraNodus is an open-source utility that employs GPT-3 AI. It depicts a text as a network in order to show you the most important topics, their relationships, and the structural gaps between them in order to help you generate new ideas. By this way, Zentria's users can use a text network to see the connection between stressors from their daily journal data.

Reference

  1. https://developer.apple.com/documentation/healthkit/hkworkout
  2. https://towardsdatascience.com/my-absolute-go-to-for-sentiment-analysis-textblob-3ac3a11d524
  3. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5900369/
  4. https://www.hindawi.com/journals/jhe/2022/4653923/
  5. https://pitherapy.com.au/signs-of-stress-the-mind-body-connection/
  6. https://psychology.org.au/for-the-public/psychology-topics/stress

Built With

  • apple-healthkit
  • bag-of-word
  • data-analysis
  • data-visualization
  • ecg-heartbeat-dataset
  • figma
  • iconic-framework
  • logistic-regression
  • natural-language-processing
  • python
  • sentiment-analysis
  • swift
  • swiftui
  • word-cloud
Share this project:

Updates