A human heart beats about 86,000 times per day, accelerating if you drink caffeine or go for a run and slowing down if you lay down or watch TV. You probably don’t notice these fluctuations, but your fitness tracker does, collecting each tiny electrical impulse and storing it carefully on a server. Hidden among those millions of data points, reveal scientists at the University of California, San Francisco, might be signs of a medical condition that lurks deep in the hearts of some endurance athletes. But you’re not going to find them with your fitness tracker alone.

Gregory Marcus, M.D.,, director of clinical research at the UCSF Division of Cardiology, has found that fitness trackers are a gold mine of potentially life-changing medical data — but only if you use the right tools to dig it out. Parsing through data from thousands of Fit Bit and Apple Watch users with an algorithm called DeepHeart, he has managed to spot signs of atrial fibrillation, a common and often asymptomatic heart condition that can cause the heart to go haywire. Larry Bird, of Boston Celtics fame, famously suffered from the condition.

“We’ve known that atrial fibrillation can be asymptomatic and go clinically undetected,” Marcus tells Inverse. He is partnered with Cardiogram, a startup that applies machine learning to analyze heart rate data, making sense of the noise. “We saw smart watches as a way to screen for atrial fibrillation, but the first step is to develop algorithms so we can accurately detect it.”

A Disease That’s Hard to Detect

Bird, together with tennis legend Billie Jean King, didn’t notice until well into their careers that they had atrial fibrillation. To manage it, Bird to had to go on blood thinners, which caused him to develop an enlarged heart that eventually brought his career to an end. In 1999, he revealed to Sports Illustrated that he nearly passed out due to a fluttering heart during one particularly stressful game against the Chicago Bulls.

Of course, it doesn’t just affect famous athletes. A study published in The Netherlands Heart Journal earlier this year showed that the likelihood that “veteran athletes” will develop atrial fibrillation is three to eight times higher than in highly trained endurance athletes, like cyclists, cross country skiers and marathon runners. Identifying the situations that lead to episodes of atrial fibrillation are critical because the diagnosis is linked to a higher risk of three major complications: heart failure, angina, and stroke.

larry bird
Larry Bird famously suffered from atrial fibrillation but didn't know it for many years.

Data from Real Life

Atrial fibrillation is tricky to diagnose because it tends to come and go. It happens when the two upper chambers of the heart go haywire, sending out electric signals that cause rapid heart palpitations. Some people experience sustained atrial fibrillation, but others only do so under certain conditions, like during binge drinking. The benefit of constantly wearing a fitness tracker is that the data can identify the situations that cause the condition to manifest.

“The measurements are much more reflective of what truly happens to an individual,” he says. “It’s not the typical data that you get from a hospital or a study site, but data from people when they’re at home or at work.” In that sense, he can use DeepHeart to spot potential triggers for atrial filtration in people’s daily lives.

The other upside to fitness trackers is that they take repeated measurements, literally in increments of seconds throughout the day. In workout mode, they take even more frequent measurements — about once every five seconds — which is particularly useful for spotting atrial fibrillation because it tends to affect athletes who train especially hard but don’t often notice anything strange in the middle of a workout.

An Irregularly Irregular Rhythm

Heart rate data from some companies are more useful than others, says Marcus. For instance, some companies will release raw heart rate data, organized in beat-to-beat intervals; others, like Apple, won’t let scientists access data that granular. Deepheart, he explains, can make the most of the different data types out there.

It doesn’t actually look for patterns in heart rate — heart rates themselves are patterns — rather, it looks for randomness. “Atrial fibrillation can increase the heart rate, but heart rate can be normal and the thing that’s most characteristic is the randomness of the interval between heartbeats, meaning there’s absolutely no pattern to it.,” he explains. Atrial fibrillation, he says, is an “irregularly irregular rhythm.”

R-R interval
DeepHeart looks for randomness in the R-R interval, the gap between peaks when you're looking at heart rate information 

DeepHeart was first tested in a pilot study on 137 million heart beats from 9,750 participants that measured personal data using wrist-based heart rate sensors, like the Apple Watch, and heart rate data from a 12-node EKG, like you’d find in a doctor’s office. The results, published in JAMA Cardiology. DeepHeart managed to use the fitness tracker data to correctly identify signs of atrial fibrillation, outperforming even two self-report strategies traditionally used to identify the condition. But the algorithm is only as good as the data plugged into it: The higher-quality EKG data produced better predictions using DeepHeart, he says (but the wrist-based data was still “modestly” accurate).

wearable heart disease detection
Differences in heart rate data as measured by wrist-based wearables for the DeepHeart study 

DeepHeart’s integration with fitness trackers has provided a powerful proof of concept for Marcus’s next study, called mRhythm, which aims to shed light on the causes of atrial fibrillation. Right now, he has about 200,000 of the one million individuals he’ll need to do the study. The benefits will be twofold: His huge data set will not only help us understand our own heart rate data better but also also show which devices are up to the job of detecting heart disease and which ones aren’t:

“A major part of our job is apply rigorous scientific research to devices that are generally marketedd directly to the consumers without that rigorous research,” he says. “A major part of our job is to provide that.”