Your doctor hands you a prescription for a blood pressure drug. But is it the right one for you?

You're searching for a new primary-care physician or a specialist. Is there a way you can know whether the doctor is more partial to expensive, brand-name drugs than his peers?

Or say you've got to find a nursing home for a loved one. Wouldn't you want to know whether the staff doctor regularly prescribes drugs known to be risky for seniors or overuses psychiatric drugs to sedate residents?

For most of us, evaluating a doctor's prescribing habits is just about impossible. Even doctors themselves have little way of knowing whether their drug choices fall in line with those of their peers.

Once they graduate from medical school, physicians often have a tough time keeping up with the latest clinical trials and sorting through the hype on new drugs. Seldom are they monitored to see whether they are prescribing appropriately, and there isn't even universal agreement on what good prescribing is.

This dearth of knowledge and insight matters for both patients and doctors. Drugs are complicated. Most come with side effects and risk-benefit calculations. What may work for one person may be absolutely inappropriate, or even harmful, for someone else.

Antipsychotics, for example, are invaluable for treating severe psychiatric conditions. But they are too often used to sedate older patients suffering from dementia, despite a "black box" warning accompanying the drugs that they increase the risk of death in such patients.

The American Geriatrics Society has also labeled dozens of other drugs risky for elderly patients because they increase the risk of dizziness, fainting and falling, among other things. In most cases, safer alternatives exist. Yet the more dangerous drugs continue to be prescribed for millions of older patients.

And, as has been well documented by the Los Angeles Times and others, powerful painkillers are often misused and overprescribed, with sometimes deadly consequences.

As reporters who have long investigated healthcare and exposed frightening variations in quality, we wondered why so much secrecy shrouds the prescribing habits of doctors.

The information certainly isn't secret to drug companies. They spend millions of dollars buying prescription records from companies that purchase them from pharmacies. The drug makers then use the data to target their pitches and measure success. But when we tried to purchase the records from the companies that supply them to drug manufacturers, we were told we couldn't have them — at any price.

We next turned to Medicare, a public program that provides drug coverage to 32 million seniors and the disabled and accounts for 1 of 4 prescriptions written annually. We filed a Freedom of Information Act request for prescribing data. After months of negotiation with officials, we were given a list of the drugs prescribed by every health professional to enrollees in Medicare's prescription drug program, known as Part D.

What we found was disturbing. Although we didn't have access to patient names or medical records, it was clear that hundreds of physicians across the country were prescribing large numbers of dangerous, inappropriate or unnecessary drugs. And Medicare had done little, if anything, about it.

One Miami psychiatrist, for example, wrote 8,900 prescriptions in 2010 for powerful antipsychotics for patients older than 65, including many with dementia. The doctor said in an interview that he'd never been contacted by Medicare.

A rural Oklahoma doctor regularly prescribed the Alzheimer's drug Namenda for patients younger than 65 who did not have the disease. He told us it was because the drug helped calm the symptoms of autism and other developmental disabilities. But there is scant scientific support for this practice.

Among the top prescribers of the most-abused painkillers, we found many who had been charged with crimes, convicted, disciplined by their state medical boards or terminated from state Medicaid programs for the poor. But nearly all remained eligible to prescribe for Medicare patients.

If you or a loved one were a patient of one of these doctors, wouldn't you want to know this?

We have now taken the data and put it into an online database that allows anyone to look up a doctor's prescribing patterns and see how they compare with those of other doctors.

This information is just a start. It can't tell you whether your doctor is doing something wrong, but it can give information that allows you to ask important questions. For instance, why is your doctor choosing a drug that his peers seldom do? Does your doctor favor expensive brand-name drugs when cheaper generics are available? Has your doctor been paid to give promotional talks for drug makers?

And we'd like to see the day when all prescribing by all health professionals, not just in Medicare, is a matter of public record.

It's not only patients who benefit when medicine is more transparent. Doctors too can gain by comparing themselves to their peers and to those they admire. Clinics can see how their staffs stack up. And researchers can track patterns and examine why doctors prescribe the way they do.

One doctor told us that after studying our online database, he cornered his colleagues and peppered them with questions about their prescribing. Most, he said, were surprised when he told them their drug tallies.

Many aspects of doctors' practices remain private: The number of tests they order and procedures they perform. The number of times they make mistakes. These data could help inform the public too.

In the meantime, arming yourself with prescribing information allows you to be more active in your healthcare, or that of an aging or disabled loved one.

Former Times reporters Tracy Weber and Charles Ornstein are senior reporters at ProPublica, a nonprofit investigative journalism newsroom in New York. Their latest project, including a tool for looking up the prescribing habits of individual doctors, is at propublica.org/checkup.