Chapter 1. Big Data and µData

Years ago, you could use a conventional database system to store, process, and display pretty much any kind of data you might come across. These days, thanks to ever-present sensors and the ability to obtain large amounts of information in real time, our data has gotten too big, and it changes shape almost as fast as it accumulates.

Whether it’s data from high-speed stock market trades or information streaming in from a heart rate monitor, it’s big and hard to control. Big data has emerged as the catch-all term for both the data itself and also for the tools and practices we use to get it under control.

These tools and practices give us a better understanding of the data through more efficient and more enlightening analysis. Applied to financial data, it might make some of us richer. But applied to health and fitness, we can use big data techniques to help live longer, healthier lives.

The quantified self movement uses technology to capture data about as many aspects of human life as can be measured. Even a single individual can generate an incredible amount of data, depending on what you’re monitoring. Every dimension you add—heart rate, blood pressure, blood oxygen level—gets projected over time, so if you’re monitoring 24/7 and sampling every second, the amount of data gets huge.

Armed with the right devices and software, you can measure yourself, gain insights that would not be otherwise possible, and make your life better.

The Garmin “Full Circle Experience”

The Garmin “Full Circle Experience” (Figure 1-1) defines all the parts of its ecosystem that work together to create one experience that is wholly driven by a user’s fitness and wellness data stream.

wpal 0101
Figure 1-1. Garmin’s Full Circle Experience

Let’s briefly discuss each part of it:

Activity

At the bottom of the circle, you can see the user engaged in an activity. This is where it begins. The data that the wearable measures and collects is all tied to whatever activity the user is engaged in at that moment. Your job as a developer is to organize that information in a way that makes sense for a given activity, and bring it to the user in a relevant way.

Out of the box, a Garmin device may include support for many activities: running, cycling, walking, swimming, golfing, rowing, stand-up paddleboarding, skiing, and much more.

Custom Data

Every activity that your device is capable of tracking has data fields associated with it. For example, there are several data fields associated with the heart rate monitor: current heart rate, average heart rate, heart rate zone (1-5, with zones based on user profile factors such as age), and others. These fields can be displayed on an activity screen on your device, but they can also be exported to applications and APIs in the FIT format.

As a developer, you can add your own custom data to this experience with Connect IQ data fields. For example, the Strava social network for athletes has its own “Strava Live Suffer Score,” a custom data field that analyzes your workout data to tell you how hard you’re trying.

ANT Ecosystem

When the user starts an activity, the device begins recording data. That data can come from an onboard sensor, such as a built-in heart rate sensor, or from a wireless sensor the user is wearing (or has attached to a bike or exercise equipment).

Garmin uses the ANT+ protocol to communicate with external devices. ANT+ is a wireless technology that’s designed for transmitting sensor data for physical activities or other health monitoring. You can mix and match any ANT+ devices, provided that they both support the same activities. If you’ve got a temperature monitor, and your wearable or handheld supports the temperature monitoring activity, the two can talk to each other.

Note

ANT is a low-power wireless protocol that defines how devices communicate with one another. ANT+ is a higher-level protocol built on top of ANT that defines a variety of device profiles (such as heart rate monitor). While ANT is a general wireless networking protocol, ANT+ defines the specific communication format (which channel configuration to use, how to structure data) for each specific type of device. This means that any ANT+ enabled device that is capable of talking to an ANT+ enabled heart rate monitor can, indeed, talk to any ANT+ enabled heart rate monitor regardless of the device manufacturer.

Custom Device Apps

This is where you get to interact directly with the users. A custom device app lets you display information, capture data, and get input directly from the user.

Your custom apps can offer up activities that the user can start, stop, and record. You can also interact with companion phone apps and web services. You’ll use the Connect IQ SDK and developer tools to build these apps, which I discuss in Chapter 3.

Custom Tracking

The FIT (Flexible and Interoperable Data Transfer) format is a binary file format that tracks the values of fitness sensors along time and space. It includes your GPS tracks, the time at which each point on the track was sampled, and various data fields of interest along the way. For example, a biking activity would track heart rate, speed, and distance traveled at each point.

In addition to creating your own apps to record activities, and creating your own data fields to represent data that you collect, you can also record your own tracking data into the FIT format using FIT developer fields.

If you’re planning on doing any integrations with the Garmin Connect API, you’ll want to check out the FIT SDK.

Data APIs

In order to make things happen beyond the confines of your device, you’re going to need to turn to APIs to make this possible. Garmin has its own APIs, the Garmin Connect API and the Garmin Wellness API (see Table 1-1). But through the power of OAuth, which allows apps and services to authorize access to one another, you can authenticate against a well-known authority such as Google, Facebook, or Twitter.

Before you can move data through an API, you need to know where it comes from. Here’s how data flows through the system before it’s able to reach the outside world: first, the device records the data. Now, you could just export the data as a FIT file, but where’s the fun in that? The next thing that happens is that the data gets synced into Garmin Connect (often through the Garmin Connect app running on the user’s phone). Once it’s in Garmin Connect, developers can connect the data and create experiences around it.

Table 1-1. Feature comparison between Connect API and Wellness API
Feature Connect API Wellness API

All Day Step Count

Y

All Day Calorie Count

Y

All Day Distance

Y

Sleep Duration

Y

All Day Heart Rate

Y

Index Scale Information

Y

Device ID

Y

Y

Start Time of Monitoring Period

Y

Y

Activity Type

Many

Many

Duration

Y

Y

Active Seconds

Y

Y

Steps

Y

Y

Distance

Y

Y

Calories

Y

Y

Intensity

Y

Y

METs

Y

Y

Heart Rate

Y

Y

Speed

Y

Pace

Y

Cadence

Y

Power

Y

GPS

Y

Extended Community

The full circle is not closed. In addition to extending out into APIs, you can also create experiences that help build communities around workouts. Users can share their data with others, take part in challenges, and reinforce other users’ goals.

The path from a user’s body into an API is well defined in the Garmin ecosystem. The full circle experience doesn’t end with the API or with the extended community. The circle originates with the user, but it also returns there in the form of notifications, visualizations, sharing, and application experiences.

From the Body to the Cloud

The Garmin Connect API allows you to create systems that take in activity data from end users, and build on that data. For example, you could create a system that lets sports teams track the performance of the team as a whole by analyzing sensor data aggregated from individual players. You can also use the Garmin Connect API to integrate with analysis tools, social media, or games. Examples of this are Strava and TrainingPeaks.

It’s a cloud system for workout data. Access to an individual user’s feeds are managed by OAuth, so users are in control of what data is available to a system you create, and they can revoke that access if they want to.

Garmin Health/Wellness

More and more, employers are correlating employee health to work–life balance, happiness, decreased healthcare costs, and improvements in productivity. Garmin provides a wellness program based on activity tracking from its fitness devices. This program allows employers to set specific fitness goals for their employees, measure them, and reward employees who reach their goals.

Through the Garmin Wellness API, which is available to approved developers, you can roll your own wellness program and take in data from Garmin devices. The API gives you full access to data (though it does require opt-in from employees) and the ability to build wellness solutions for in-house use, or as part of a product offering you create.

In addition to the API, there are Garmin partners you can work with (for example, Validic) who provide integration between activity trackers and your application, wearable device, or in-house systems.

With the Wellness API, Garmin provides access to fitness and activity data in the form of data exports that you can bring into your wellness solutions. Garmin’s wellness solutions also offer hardware that makes it easier for employees to share their data. The vívohub can download data from users who have opted in when they walk by the device, avoiding the need for them to pair their device with an app to upload data to Garmin. To get started, check out Garmin’s developer programs, where you will find all you need to get on your way.

In Chapter 2, we’ll talk about the tools, design principles, and key platform features you will use as you create your own solutions in the Connect IQ ecosystem.

Get Wearable Programming for the Active Lifestyle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.