In one of the first test-runs of a leading computer program that mines patient information from electronic health records, data scientists and medical researchers at Stanford University School of Medicine have identified a potential link between a common class of heartburn medicines and an increased risk for heart attacks.

The preliminary results show that data-mining has potential to become a valuable tool in finding hidden drug safety issues in real-world data on patients’ responses to medicines, says Nigam Shah, who led the analysis as a biomedical informatics expert at Stanford. The technology could someday be used to complement the tightly-controlled clinical trials that drug companies and the Food and Drug Administration currently rely on to vet the safety of drugs before they are approved.

Shah also says his study, which was published Wednesday in PLOS One, reinforces the need for a closer look at a class of popular heartburn drugs including Nexium and Prilosec known as proton pump inhibitors. Last year, researchers from National Yang-Ming University in Taiwan showed that for every 4,357 patients who took proton pump inhibitors for two weeks, there would be one additional heart attack as compared with patients who did not take the drugs.

The greater significance of Shah’s study, though, was as a demonstration of a computer application that uses natural language processing to scan hundreds of thousands of electronic health records for key words and phrases. Every healthcare provider who sees Medicare patients is required by the Obama administration to begin using electronic health records this year. These records offer a sea of digital information on patients who have had surgery or taken medicines – but few researchers have found an effective way to wade through it.

In one of the first tests of the new program, Shah’s team analyzed the health records of 3 million patients to examine the proposed connection between proton pump inhibitors and risk of heart attack. The analysis found that patients were slightly more likely to have a heart attack after they began taking the medicines. Nicholas Leeper, a surgeon at Stanford University School of Medicine described the effect as a “relatively modest increase.”

Since the study only examined health records, further clinical research in patients would be necessary to establish a true link. However, the second-largest class of heartburn medicines, known as H2 blockers such as Zantac and Tagamet, did not show any such association. More than 100 million prescriptions are written for proton pump inhibitors a year, which are considered more effective than H2 blockers and make up $14 billion in annual sales. Proton pump inhibitors, which have been sold in the U.S. since 1989, were made available as over-the-counter treatments starting in 2003.

Bill Howe, a data analysis expert at the University of Washington eScience Institute, says the demonstration was a good sign that the Stanford program could be used in combination with human experiments to identify out drug safety issues in the future. But he also points out that Shah was unable to control for obesity, which is a contributor to both heartburn and heart disease.

Pharmaceutical companies must demonstrate that a medicine is safe and effective through a battery of clinical trials which are overseen by the FDA. These trials are great at catching immediate and acute side effects of a medicine – such as diarrhea or loss of appetite. But once pharmaceutical companies launch a new drug, it can be hard to detect the subtle or long-term effects of taking these medicines. Outside parties don’t typically have access to a healthcare provider’s electronic health records, which could provide clues that tip companies or the FDA off to underlying safety issues.

“The sad truth is that when it comes to picking out bad drugs, there's no incentive for hospitals or health systems to do that,” Shah says. “Pharma and the FDA are supposed to watch out for bad drugs but they don't have the electronic health records.” Complications or side effects that occur after a drug is approved, known as adverse drug events, cause 2 million injuries, hospitalizations and deaths in the U.S. each year and up to $75 billion in health care costs.

The new application could be used for more than just detecting adverse events. A man who is to undergo prostate surgery and is concerned about impotence might use a version of the system to compare impotency in men who had the surgery done at different hospitals or by certain physicians. Or doctors might log in to see what medicines have worked best in a group of patients who were not well-represented in clinical trials.

“That data is sitting there in the electronic health record,” Shah says. “Why not use it?” His team also contested a warning that the FDA placed on one medicine called cilostazol, after analyzing data that suggested it was safer than previously thought.

Shah, who is a medical doctor with a doctorate in informatics, does not recommend stopping any medication without consulting with a physician. His computer program still has a 15 percent error rate based on tests his team ran after inventing it in 2013. But he also says his results should at least give physicians and patients a reason to pause and consider their specific situation and full range of options before they begin treatment for heartburn.

“At the bare minimum, if someone’s taking proton pump inhibitors over the counter for more than 14 days which is what is recommended on the box, and you haven't told your doctor, please tell your doctor,” Shah says. Next, he will focus on tweaking the accuracy of his software and seeking funding for an experiment to determine whether proton pump inhibitors do cause an increased risk of heart attack.

In response to the study, Proctor and Gamble which sells Prilosec, referred to a statement by Barb Kochanowski, vice president of regulatory and scientific affairs at the Consumer Healthcare Products Association that said, “Millions of consumers rely on over-the-counter proton pump inhibitors to relieve frequent heartburn symptoms. As with any over-the-counter medication, consumers should read the label and follow directions closely to understand what the medicine is used for, to ensure appropriate dosing and to avoid drug interactions. Further, severe or ongoing symptoms should be immediately reported to a healthcare provider.”

Michele Meixell, director of external communications for AstraZeneca which sells Nexium, said in an email, “Patient safety is an important priority for AstraZeneca and we believe all of our medicines, including Nexium (esomeprazole magnesium), are generally safe and effective when used in accordance with the label. This has been established through human data studies and more than a decade of real world clinical use.”