A new study indicates the Apple Watch could potentially detect the most common form of heart arrhythmia, atrial fibrillation (AFib).

Researchers from a startup called Cardiogram devised an application for the Apple Watch powered by a novel deep learning algorithm that was able to identify these heart abnormalities with 97 percent accuracy compared to an electrocardiogram.

The team tested their program by collecting data regarding heart rate and EKG measurements from the 6,158 people who received Apple Watches as part of the eHeart study, which was held at the University of California, San Francisco (UCSF). This investigation essentially aimed to collect data about heart health in order to create new strategies to treat heart disease.

Most patients recruited for this endeavor had normal heart readings, but about 200 had already been diagnosed with Afib.

Engineers used this information to help the algorithm understand the difference between normal and abnormal heart rhythms.

Next, the team tested their program on 51 patients at UCSF set to undergo an operation known as a cardioversion, in which physicians use chemical or electrical methods to convert the heart back to normal rhythm.

Heart rate samples before the procedure were compared to samples of patients after the operation when the heart was restored to a normal rhythm. The application scanned through these metrics accurately identifying Afib.

A blog post written by Avesh Singh, a software engineer at Cardiogram acknowledged there is more work to be done before they algorithm can be deployed in public, including testing its efficacy in different situations like when the user is sleeping, running, or driving.

Still, the crew at Cardiogram wants to explore how wearables and other forms of health data could help treat certain diseases.

“In the future, you could imagine Cardiogram sends you a notification: “We noticed an abnormality in your heartbeat. Want to chat with a cardiologist?” After connecting you with a doctor, we will monitor the effectiveness of your treatment plan. “Looks like your beta blocker medication is working, but loses effectiveness after 12 hours. Why don’t you increase your dosage?” Using wearables, we can not only detect disease early, but can also guide patients down the road to recovery,” wrote Singh.