AI Simplifying Health Tracking

Author: Matt Paterson
Last modified: June 7, 2021

  • Challenge:

    Have you ever started an exercise program or a diet only to be deterred by a couple of happy hours and a Taco Tuesday Too-Many? I have. Have you ever gotten a funny suggestion from your doctor after an annual physical about what you are eating or how often you stand up and sit back down again? What if there were a way to monitor your health in real time the same way you monitor your stock portfolio or your favorite sports team’s performance?

Benefits:

  • Keeps you motivated on your exercise program by measuring and demonstrating your progress
  • Let’s you see data visualizations comparing your food intake with your sleep cycles
  • Allows you to input your health history to identify risks of heart disease, high blood-pressure, etc
  • HealthAI can draw predictions about your future strengths and dangers if you continue or change your exercise and diet behaviors based on your individuality 

About/Background

There seem to be new diet apps and exercise software all the time. There are great running apps that track your distance and speed and output how many calories they think you just burned. There are apps that track what foods you are eating that can connect to the manufacturer of those foods and input the ingredients you are ingesting, the nutritional vitamins and minerals and caloric makeup of your food, and even apps that help you manage existing ailments such as diabetes. Apple has an entire division of software and devices dedicated to just this. But what if you want to measure them all at the same time?

Challenges

  • Irresolvable Complexity – With all of the different apps out there, how can you decide what data to track regarding your health and what does any of it even mean?
  • Improving Systems and Processes – HealthAI allows you to keep doing what you do and it provides dashboards to your health and deep-dives into the possible outcomes of various diets and activities
  • Antiquated Technology – With the arrival of IoT devices like smart scales, gps tracking apps, and smart-bikes, HealthAI collects all of this disparate data from cutting-edge sources, normalizes the data, and compares them an apple an apple a day! No more writing everything down manually, just go for a run and it runs

Where it Began

In the winter of 2020-2021, Chris Miller, founder and CEO of Cloud Brigade in Santa Cruz decided that it was time to get a little healthier. As a data geek and inventor, Chris was excited to see how tracking his progress using his gadgets might help him stay on track or be more successful in his workout and diet plan. He quickly noticed that all of the measured health factors such as miles run, miles walked, steps, sleep hours, vitamin C intake, water intake, blood pressure…etcetera…something something sodium…well after a while they all start to become just more numbers with less explanations. 

As a Machine Learning guru, Chris knows that more data usually means more chances to find correlations between seemingly unrelated things. He started wondering–does my sodium affect my energy? Does my sleep schedule affect my energy output on the bike? Can caffeine intake be correlated to resting heart rate and what might that mean for my long-term likelihood of other ailments? It was then that he asked me to start putting some of this data into a database and a data visualization tool (being weary of spurious correlations), and just like that, HealthAI was born.

Solution and Strategy

Cloud Brigade is no stranger to finding the best technologies for your business. As an AWS Partner, Cloud Brigade has experience pairing the right technology with the right problem, and HealthAI allows us to use this same process to manage your health. Using custom-built ETL scripts and Chris’s Apple Health apps and other non-Apple health apps, we are able to restructure quantitative data and use Amazon Web Services (AWS) to handle our workload in the cloud.

This Is No Ordinary Project

Building Machine Learning solutions that deploy on the edge is not as easy as it sounds. Sure, using advanced algorithms that in many cases were developed at Google or Amazon already and applying them to your business using python libraries and a little statistical knowhow seems pretty straightforward, but it takes a lot of time-consuming data engineering before you even get to the Random Forests and Neural Networks.

Smarty-Pants Technology

Before we could tackle this issue, it was important to build a solid data pipeline using AWS Glue, as is described in another article here. Glue allows us to take data from our data lake in AWS S3 where our devices have been programmed to send the data on a daily schedule, run an ETL job (Extract, Transform and Load) on the data, and insert it into our Amazon RDS (Relational Database System).

Then we had to explore all of the data, normalize it for comparison, and then re-write our pipeline and restructure the database to hold it in its proper form without duplicating, truncating, or clobbering other data. Pretty basic stuff if you’re a data engineer who writes Scala and PySpark in her sleep, but not exactly your everyday project for the rest of the world, geeky as we might be.

Photo Credit: https://medium.com/codefully-io/aws-glue-for-loading-data-from-a-file-to-the-database-extract-transform-load-fe6b722e11b8

From there, we can use Amazon Quicksight, a data dashboard and visualization software that renders comparative views of each of the different metrics. Eventually we may choose to build a visualization solution in-house using a python library such as streamlit, but for now Quicksight is a fine and robust solution with a very low cost when it stays inside an organization. 

Finally, we deploy our in-house Data Science and Machine Learning team to run exploratory data analysis, predictive modeling, and more data visualizations in Amazon Sagemaker. The goal is to also connect a Natural Language Processing (NLP) solution to incorporate user journaling as an additional input to the models. These results can help a user tailor workout and diet plans around a desired health outcome within their lifestyle, or to make changes where necessary to avoid unwanted results.

So what does this mean? This means that we can build out a working HealthAI that monitors your workouts, tracks your progress toward your goals, and demonstrates how your diet, exercise, and sleep habits all affect your general mood, well-being, and can even predict your possible health future and prevent worry.

Building the Model

In order to have a marketable app in this space, we need to wrangle every step of deploying a Machine Learning application in production. From cybersecurity policies and data partitioning, to creating a working API and managing the storage space and capacities of the various parts of the data lake; to finally perfecting how we normalize the data and enter it into the various regression, classification, and clustering models that feed our transfer learning algorithm. 

It’s also important to remember that the NLP model that will interact with users’ moods and feelings will have to be able to adapt and learn as it grows. This model can include Amazon microservices such as Lex, but it also needs to have some custom awareness as to how we employ basic NLP techniques such as lemmatizing or bigram and n-gram usage.

Technical Hurdles to Overcome

For me, a Data Scientist, the highest hurdles actually are the data engineering bits. While you can never have enough practice employing statistical models, the ocean of resources and requirements that come in to play in data munging, exploration, and imputation are nothing compared to the waterworld that is data engineering.

A Successful Integration and a Technology Handoff

One thing we have learned through our work in Machine Learning is just how time consuming and intricate each step can be. A lot of times, the work of building up the infrastructure and lining up the data so that the different parts can all communicate with each other are actually more challenging than creating and using Artificial Intelligence. This product is no different. The live application must be programmed to dynamically handle new data fields, data types, and data sources whenever the user wants to add them, the data pipeline must be programmed with the proper error handling and notification systems, and the data reports must be connected to the alert systems with bullet-proof security. However once the data science has been fully integrated with the IoT, very little regular maintenance is required to keep the system working.

The final step, after including the NLP portion, will be to package the Machine Learning model with an API connecting your model with your mobile phone, smart watch, smart scale, and other edge devices. Then you’re off to the races.

Photo Credit: https://www.agsinger.com/top-3-benefits-of-jogging-every-morning-with-your-family/

Opportunities

While this project is designed to help you gain insights into your health and fitness, it is not a niche product.  From wrangling all of the myriad data that your business has been collecting about your customers, your products, your employees, and anything from your machinery to your refrigerator, the kind of data pipelines and dashboards that HealthAI employs are a great fit for understanding all of that data in an easy to read chart. Think of it as a daily health-check on your business, or a HealthAI + BI. 

With a solution like this for your business, we can also build you a chatbot that can interact with your managers to alert them to oddities or answer quick questions like “How many widgets will the Heroes Company buy next quarter?” We’re developing a tool called Cloud Brigade AI for Business Intelligence, or CB Abi, and we can’t wait to tell you all about it very soon.

We look forward to both HealthAI and CB Abi being useful in the future.

WHAT’S NEXT

If you like what you read here, the Cloud Brigade team offers expert Machine Learning as well as Big Data services to help your organization with its insights. We look forward to hearing from you.

Please reach out to us using our Contact Form with any questions. 

If you would like to follow our work, please sign up for our newsletter.

About Matt Paterson

Matt has over 12 years of business experience in sales, entrepreneurship, machine learning and data science, and he earned his AWS Machine Learning Specialty Certification in the summer of 2021.

With a BA in English from the University of New Hampshire, Matt began building his professional foundation by surpassing expectations in sales and leadership roles before starting his own small business.

Through building data dashboards, Matt saw the importance and opportunity around this data, and opted to obtain his second degree in Computer Science. Matt’s highly technical engineering skills allow him to analyze and forecast data using Python, Scikit-Learn, Tensorflow, PyTorch and Django, while also looping in his creative problem solving and people/project management abilities to deliver solutions that people are able to use and enjoy.

When Matt’s not geeking out over data at work, he’s learning how to play the piano, running on the beach, reading fiction, or identifying exoplanets with Neural Networks and deep-diving in to other outer-space exploration topics.

CONTACT US

Would you like more information, or have an idea we can help become a reality?

Contact Us
Email Us
Call Us 831-480-7199
Newsletter Subscription