Editor’s Note: This essay contains excerpts from Extreme Measures: Finding a Better Path to the End of Life, coming February 21st, 2017 from Penguin-Random House.

A few years ago, while at a family get-together, I sat across from a retired hospice social worker named Terry. I am a physician whose practice alternates between attending on the wards of an inner-city intensive care unit and serving as a consultant on the hospital’s palliative care team.

I didn’t set out to practice this uncommon combination of medical specialties. I started out totally dedicated to using the miraculous technologies in my critical care toolbox to maximize the number of heartbeats before death. But as I increasingly found myself “rescuing” many of my seriously ill patients into a life of suffering and dependence on machines, I began to question that paradigm. I went on to learn the practice of palliative care medicine, with its focus on providing care aligned with patients’ stated values. So my ears perked up when Terry began to speak of her fear of a bad death. Then she told me a chilling story.

A year earlier, Terry had been thinking a lot about death. Although still spry at 80, she had no close family living nearby and worried that if she were no longer able to speak for herself, she might be “hijacked,” as she put it, into a bad death. She was no stranger to the overuse of technology in dying patients. There was no doubt in her mind that she would never want to be kept alive on machines if she didn’t have a chance of getting back to her life as a fully functioning individual. She had documented her preference on an advance directive, checking the box that stated:

I do not want my life to be prolonged if (1) I have an incurable and irreversible condition that will result in my death within a relatively short time, (2) I become unconscious and, to a reasonable degree of medical certainty, I will not regain consciousness, or (3) the likely risks and burdens of treatment would outweigh the expected benefits.

Then she had informed all of her close friends of this decision. But the best-laid schemes often go askew. It wasn’t long after she filled out her form that she was taken to the hospital with crushing chest pain. She had mentally rehearsed this moment, and maintained the presence of mind to bring her advance directive to the hospital. But when she handed it to the cardiologist in the emergency room and said clearly, “I don’t want to be placed on any machines at any point,” he looked at her as if she were crazy.

“If you want us to fix the problem, we might need to use machines,” he told her. She was having a heart attack, he explained, and his only chance of stopping it would be to open up any blockage he found in her coronary arteries during a catheterization with a stent, or dilator. Things might go wrong during the procedure, he explained, and he needed all tools at his disposal, including machines. A stroke, a heart attack, a puncture of the catheter through the arterial wall. He might even decide during the procedure that the blockages were too dangerous to dilate with a balloon and that she should go for open-heart surgery. No surgeon or anesthesiologist would be willing to perform heart surgery without the ability to use any means necessary to shock the heart should it stop while on the table.

They had to hurry, he admonished, because they were approaching the 90-minute window for this procedure. Time is muscle, and every minute of delay could cost her. Did she want to receive this potentially life-saving procedure? The risks were very small.

She insisted she didn’t want to be on a breathing machine if things went badly. No matter what. She had seen it many times and it had never turned out well, in her opinion. “Can’t you do the procedure, but let me die if things go badly?” she asked.

The answer was no. “I can’t let you die on the table,” he said. The doctor told her that if she wasn’t interested in the procedure, he would call the emergency room doctors in to provide medicines to treat her heart attack. But they would not fix the problem like he could. Then he made as if to leave.

She stopped him. “Just do it,” she said. And with that, she was whisked away to the cath lab, her “door to balloon time” under the requisite 90 minutes. The procedure went well, she didn’t require a breathing machine, and she left the hospital after the weekend. But she couldn’t shake the terror of having had no voice, no choice. She felt abandoned by the system she had come to for help.

This binary approach to care is often practiced by subspecialists such as cardiologists and surgeons. “If you don’t want to go with me all the way, you can’t go with me at all,” is the sentiment. It’s an on–off switch.

What would have happened if things had not gone as well as they did for Terry? What if, despite the doctor’s attempts to cure her, she ended up in the ICU on the machines that she so wanted to avoid? Would her advance directive eventually be reactivated and the machines removed? If so, when? After a day, a week, a month?

You may be wondering why Terry, a health care professional with a lot of experience around death and dying, was unable to get the procedure on her conditions. She was willing to accept the risks, including death on the table, laid out by the cardiologist. Why did she have so little control over her own care?

I cannot speak to the doctor’s reasons, but this story had a familiar ring to it. Over the years, I had noticed that patients with serious illness who had decided to forgo certain aggressive measures like cardiopulmonary resuscitation and breathing machines were sometimes rejected for surgeries and procedures I believed would benefit them. The reason given was that since the patient had chosen “comfort care”—in other words, generally opting for quality of life over quantity—it would be inappropriate to do a surgery on them, even one whose intent was to palliate, not to cure. But even a patient who is seriously or terminally ill, and has decided not to continue disease-focused treatment, might benefit from a surgery. For example, a woman with end -ovarian cancer that is not responding to further chemotherapy might achieve significant relief from a surgery to resolve an intestinal obstruction. Or a patient with a terminal lung cancer that is closing off a part of the lung might gain some time and some relief if the obstruction is dilated.

It wasn’t until I read Paula Span’s New York Times article, “A Surgery Standard Under Fire, that I began to see a bigger picture emerge. Span describes the “30-day mortality statistic,” which ranks doctors and hospitals by the percentage of their patients who die by day 30 following a surgical procedure. The statistic is widely used by payers, such as Medicare and state health agencies, and is publicly reported with the aim of improving quality of care. In theory, health care consumers and payers will choose physicians or hospitals with the lowest mortality rates for the procedure they are shopping. The implication is that the better the surgeon, the more likely her patients are to live past day 30.

But the problem, as the article notes, is that this statistic may actually be harming patients. Its impact on the reputations and careers of individual physicians and their departments may in fact discourage surgeons from operating on seriously ill patients altogether, even if the intention of the surgery is to relieve symptoms, not to prolong life. They are more likely to die from their underlying disease before 30 days, and those deaths might affect the surgeon’s 30-day mortality statistic. Thus, excluding higher risk patients from surgeries would protect a surgeon’s, or hospital’s, 30-day mortality statistic. Span writes of surgeons admitting at conferences that they will not operate on certain high risk candidates for this reason.

It has also been demonstrated that older adult patients are less likely to undergo dilation of a narrowed coronary artery, the procedure that saved Terry’s life, in states requiring public reporting of the 30-day mortality statistic. In other words, public reporting of this statistic has an impact on the care given to patients who are older and sicker.

Simultaneously, there is a parallel incentive to keep patients alive following surgeries, regardless of the patient’s preferences. There have been anecdotal reports of surgical patients dying slowly on machines in the intensive care unit for weeks after their surgeries, and for whom a palliative care consultation was delayed until day 31. This practice is not an easy thing to measure, since critically ill post-operative patients who receive maximal treatment may well die before day 30thirty, and so the data may not show a clear spike in death at day 31.

Metrics are intended to promote quality. But if they measure the wrong thing or are easy to manipulate, there can be serious consequences. And this particular metric, with its binary focus on mortality alone, can put one of our most vulnerable populations—the frail, elderly, and terminally ill—at risk.

Dr. Anne Mosenthal, who heads the surgery departments at Rutgers New Jersey Medical School and The University Hospital in Newark, New Jersey, leads The American College of Surgeons’ Committee on Surgical Palliative Care, which is exploring these concerns. Dr. Mosenthal, who is also a palliative care physician, notes that one way to address this problem is to create metrics that better reflect what people really care about, rather than focusing narrowly on short-term mortality. For example, measuring the number of days spent at home before death, or relief of pain and symptoms, might focus surgical care on outcomes that really matter to patients nearing the ends of their lives.

Or should seriously ill patients requiring palliative surgeries be removed from mortality reporting and measured by a different set of metrics? The 30-day statistic is designed to detect perioperative complications, something that is of primary concern to patients who are otherwise robust except for their surgical needs. But if a seriously ill or frail patient dies before day 30 from his underlying illness, rather than the surgery or its complications, how can we tell the difference? If such patients were removed altogether from the mortality metric, surgeons would not be disincentivized from performing operations that may benefit the patient.

Ultimately, while revising metrics can be helpful, metrics alone do not make for good patient care. The first requirement of good surgical care is that both the surgery performed and the care that follows are consistent with the patient’s goals of care. The name for this concept is “goal concordant care.” Such care should always begin with an in-depth conversation between the surgeon and the patient about the patient’s values and preferences. It should continue with the active incorporation of those findings into the plan of care. Even though Terry was lucky, she was not the recipient of goal concordant care. I fear that, if push came to shove, her preferences and values wouldn’t have been honored, and if her heart had stopped on the table, the cardiologist would have resuscitated her and placed her on a breathing machine. Which was exactly what she wanted to avoid at all costs. Terry should have been able to both have the procedure and rest assured that her wishes would always be kept primary. Goal concordant care should be the priority of all doctors.

Determining if patients are getting what they want is complex and nuanced. To be sure, our metrics must be smarter, and must avoid putting surgeons in the position of having to choose between their reputations and their patients. But ultimately, we will truly succeed only when doctors internalize the importance of learning, and then honoring, their patients’ wishes. The quality of care of seriously ill patients must be measured not only by what happens to them after surgery, but by the process that precedes surgery. This will protect all patients from either being held hostage by technology or excluded from its potential benefits.