Electronic medical records may seem like a distraction when your doctor is busy typing on a screen instead of looking you in the eye. But, as a new study shows, these systems have the potential to help identify some drug side-effects.

Researchers at Stanford University gathered about 3 million electronic medical records — with patients' names and other identifying material stripped away — to look for a link between a popular heartburn drug and heart attacks.

The drugs in question are called proton-pump inhibitors, and include Prilosec, Nexium and Prevacid. These PPIs are among the most popular medicines in the world, with sales of $14 billion a year. Roughly 20 million Americans now take the drugs for heartburn, and several versions are sold over the counter.

The researchers had conducted some laboratory work suggesting that PPIs could affect heart tissue. So Nigam Shah, an assistant professor of medicine and biomedical informatics, and his colleagues dived into the electronic medical records compiled by Stanford and a private company to see whether people who took these drugs were also at higher risk of having a heart attack.

They report in the journal PLOS One that they did indeed find a modest correlation.

"The increase in risk is about 16 to 20 percent, depending on the particular drug involved," Shah says.

Assuming that link holds up, and the risk is spread evenly throughout the population, someone with a low risk of heart attack doesn't have much to worry about. "If your risk of a cardiovascular event or a heart attack is one in a million, now it is 1.2 in a million," Shah says.

But he's more concerned about people who have a higher risk of a heart attack. Since millions of people take these medications, even a low added risk for an individual can translate to quite a few people across the population.

"I wouldn't want the public to panic and to say we should stop taking these drugs," Shah says. But he does recommend that people taking these drugs talk to their doctors to see if they are at greater than average risk for having a heart attack. "And if your baseline risk is high, then maybe you want to take something else."

The study did not find a link between heart attacks and another popular family of heartburn drugs, called H2 blockers (such as Tagamet, Pepcid and Zantac).

But other scientists aren't ready to recommend the switch to those drugs, which are considered to be somewhat less effective for many people with serious heartburn. The correlation Shah has turned up in his data might stem from other factors.

"The problem is, it's very easy to do studies of this sort that lead to conclusions that can be misleading," says Dr. David Juurlink, a drug-safety researcher at the University of Toronto. "I know because I've done that myself."

Juurlink has studied these PPI drugs and also found that people who take them are somewhat more likely to have a heart attack. But a correlation doesn't say anything directly about cause and effect. He has looked at all the factors that make someone more likely to be taking these drugs in the first place.

"Having a bad diet, drinking too much alcohol, smoking and all sorts of other things ... might lead people to be on a PPI," Juurlink says. One would expect those people to be at higher risk of heart attack, which leads Juurlink to think the medicine is likely not to blame.

Juurlink says these heartburn drugs have been studied directly in people with a high risk of heart attack, and they did not appear to increase that risk. (He adds that he takes no funding from drug companies.)

And he notes that PPIs are not risk free — they can occasionally cause kidney problems, and they've been linked to osteoporosis, Vitamin B12 deficiency and low magnesium levels.

Though Juurlink is not persuaded by the Stanford study, he says that kind of research fills an important gap in our knowledge about medications.

"Drugs are brought to market because of randomized trials, typically with a few thousand patients. And then they get used in patients who are very, very different from the patients in randomized trials," Juurlink says. "They get used in sicker patients; they get used for longer durations of time and at different doses. So it's really important that studies like this get done."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.