*Part 4: Using Computers to Determine Type 2 Treatment
*

The first three articles in this series focused on what makes treating type 2 diabetes so difficult: the overwhelming number of medicines and combinations; finding effective treatments that work with our patients’ insurance coverage and household budgets; and incorporating factors beyond glucose control, such as body weight, adherence, and side effects, into our decisions.

In this installment, we discuss how those problems can be represented in ways that computers can understand. With this, we can take advantage of computers’ fast number-crunching capabilities to produce treatment recommendations that are effective, affordable, and sustainable, with other potential benefits.

Here are the tasks we need to accomplish:

- Generate every possible combination of medicines we could prescribe
- Rate each combination of medicines on its HbA1c control, affordability, the effect on patient body weight, likelihood of adherence, and side effects
- Sort the combinations by their ratings, so that the most promising ones appear first

- Explain the reason for each score so that the healthcare professional and patient can understand it

*Generating Combinations of Medicines*

Let’s say we’ve got 60 different type 2 diabetes medicines to choose from, and we know that we typically pick 1 to 5 of them in combination for treatment regimens with our patients. We need a way to generate combinations of 1 to 5 medicines out of 60, i.e., all the different ways to choose regimens with 1 medicine out of 60; the ways to choose 2 medicines out of 60; up to choosing 5 medicines.

The good news is that mathematicians have been studying this problem precisely for at least a thousand years, in a field called Combinatorics. When electronic computers became widely available around the middle of the 20th century, computer scientists translated this knowledge into procedures that run very fast on modern computers. Today you can find the combined wisdom of history’s best mathematicians and computer scientists on Amazon for under $15 (some of it available free online). These techniques are simple to implement on even the cheapest laptop computer.

*Rating HbA1c Control, Affordability, and Other Factors*

The next step in teaching a computer to make treatment recommendations is to have it rate each combination of medicines. Because we’re going to need to explain the reasoning behind these ratings, we should try to keep the rating systems as simple and straightforward as possible.

We can do this in two ways: First, we can consider each individual factor — HbA1c control, cost, adherence, etc., separately. This allows us to focus on the treatment goals for each factor in isolation. Later we’ll combine the individual factors into an overall score.

Second, we should use a rating scale that is simple, and that allows us to quantify the difference in outcomes in a meaningful way. For example (and excluding all other factors), we know from decades of research that an HbA1c level of 6.5% is generally “better” than an HbA1c level of 8.0% and that both of those are “better” than an HbA1c level of 10.0% or 3.9%. We need a way to quantify what “better” means.

A simple and straightforward way to do this is to use a 0-to-100–point scale like the ones we all experienced in grade school exams: Zero points is the worst score possible, and 100 points is the best. Besides being easy to understand, another advantage of a 0-to-100 scale is that it can express small differences easily, such as the difference between an HbA1c level of 6.9% and 7.1%.

Once we’ve separated each factor and decided on a scale, it’s time to define the scoring function. To do that, let’s start by listing what we know about HbA1c targets from the ADA:

- An HbA1c level of 7% or less is desirable for non-pregnant adults
- A more stringent goal might be 6.5% if it can be achieved without risks such as hypoglycemia
- A goal of 8.0% might be appropriate in other instances, such as patients with long-standing diabetes
- HbA1c levels below 3.9% should be avoided because of the risk of severe hypoglycemia

We might add other rules that make specific, explicit goals that aren’t stated in those above:

- Medication regimens that result in HbA1c levels above 9.0 aren’t worth anything in terms of HbA1c control (these may have other benefits, such as cardiovascular value, that are considered elsewhere).
- While severe hypoglycemia is a risk at 3.9%, we also want to avoid even moderate risks of hypoglycemia. Let’s say the cutoff for that is 4.9% and below.

There are many ways to combine these rules into a function that scores HbA1c outcomes in our 0-to-100 scale on a computer. Here’s a simple HbA1c scoring function for patients without any special considerations:

- Give 100 points to regimens with HbA1c levels between 4.5 and 7.0
- Give proportionally fewer points for regimens with HbA1c levels between 7.0 and 9.0.
- Give 0 points to any regimen with an HbA1c level above 9.0
- Give 0 points to any regimen with HbA1c levels below 4.9 (side note: we will also disqualify these regimens from further consideration because of hypoglycemia risks)
- Give proportionally fewer points to regiments with HbA1c levels between 4.9 and 5.5. Here’s how this function might look on a graph:

This graph is linear in its scoring, which fits our goal of easy understanding. The function doesn’t have to be linear, of course — this is just one way out of many possibilities.

Note also that we can tell the computer to use different HbA1c scoring functions for different kinds of patients. We don’t need to use the same scoring function for everyone. All we need to do is tell the computer what criteria to use to choose the HbA1c function (such as pregnancy, long-standing diabetes, and so on), and then define the scoring function for that kind of patient.

We can use a similar approach to create a scoring function for the regimen’s other factors. For example, we can create a scoring function for the patient’s out-of-pocket cost limit for each regimen. A simple set of rules for this might be:

- Solutions that cost the patient $0 are worth 100 points
- Solutions that exceed the patient’s monthly limit are worth 0 points (and are disqualified from further consideration)
- Solutions that cost between $0 and the patient’s monthly limit are scored on a sliding scale

Let’s say that the patient’s cost limit for their medication is $75 per month. Here’s how one version of the scoring function might look like a graph:

Again, there are many other ways to assign points in this function using the rules above. This is just one example.

We can implement a 0-to-100 scoring function for adherence similarly so that we prefer fewer medications taken fewer times per day. Our 0-to-100 scoring function for changes to body weight can be based on the patient’s starting BMI, so that we penalize weight gain in patients with obesity far more than in patients with BMIs of 19, and prefer stronger weight loss effects accordingly. And we can evaluate other side effects on a 0-to-100 scale so that both benefits and adverse risks are considered at the same time.

*Combining the Factors*

Once we’ve defined scoring functions for each factor, we need a way to combine them all into a single score for the entire regimen. As with the individual scoring functions, there are many ways that this can be accomplished. The one we use is straightforward: we multiply each factor by a *factor weight *from 0 to 1.0 to produce a f*actor product*, then add the factor products together to get an overall score:

HbA1c Control Score x HbA1c Factor Weight = HbA1c Product

Cost Score x Cost Factor Weight = Cost Product

Body Weight Score x Body Weight Factor Weight = Body Weight Product

Adherence Score x Adherence Factor Weight = Adherence Product

Side Effect Score x Side Effect Factor Weight = Side Effect Product

**Total Score **= HbA1c Product + Cost Product + Body Weight Product + Adherence Product + Side Effect Product

How do we determine the factor weights? We start by assuming that HbA1c control is the most important of the five factors we consider. Thus, it seems reasonable that whatever way we combine the factors, no other factor should be weighed higher than HbA1c control.

Next, our experience in treating a wide population of patients in Northern Kentucky indicates that the patient’s sensitivity to cost is the next-most important factor to consider when evaluating treatments. Thus, in addition to asking the patient what their monthly medication budget is, we need to know how sensitive the patient is to different levels of cost within that budget.

Suppose we ask the patient to rate their cost sensitivity on a scale from 0 to 10, with 0 representing no sensitivity at all — essentially unlimited funding available for medication — and 10 representing extreme sensitivity to even $1 increases in medication costs. At a cost sensitivity of 0, we might prioritize our five factors as follows:

- HbA1c control

- Bodyweight effects

- Side effects & benefits

- Adherence

- Cost

At a cost sensitivity of 10, we might prioritize things differently, so that HbA1c control and cost dominate the scoring:

- HbA1c Control

- Cost

- (tie) Bodyweight

- Adherence

- Side effects & benefits

It is straightforward to define a table of different factor weights and have a computer look up the one to use based on the patient’s cost sensitivity.

*Computers are Fast**,** And We Can Make Them Faster*

There are just under 6 million different ways to choose “1 to 5” medications out of 60. Each of those has to be scored using calculations similar to the ones just described. Let’s say that for one combination, scoring all of *the factors, weighing the factors, and combining the factors into a single score involves 100 separate calculations. That means we have a maximum of around 600 million calculations to perform for each patient.

Six hundred million calculations may sound like a lot, but it’s well within the capabilities of used computers found on eBay for a few hundred dollars. These near-obsolete machines, paired with a bit of modern technology, can efficiently perform 60 billion calculations per second for less than $1,000. With that modest hardware budget, you can consider every possible combination of medicines for 100 patients in 1 second.

But you don’t have to buy the hardware: you can rent it from Amazon’s cloud services for ten cents an hour. With that dime and that hour, you could make recommendations for 360,000 patients. It would take you just under 100 hours and around $10 to make recommendations for all 33 million patients with type 2 diabetes in the United States.

Can we do it faster than that? Yes, in two ways: By reducing the number of combinations we need to consider, and by scoring the combinations in parallel.

We can reduce the number of combinations by about 60% by employing a few simple observations known to every healthcare professional:

- Eliminate every combination that contains a medicine the patient is allergic to, or that is contraindicated by patient comorbidity.
- Eliminate every combination of medicines that has conflicting mechanisms of action, such as combinations that include prandial insulin with a sulfonylurea or DPP4.
- Eliminate combinations with two medicines using the same mechanisms, such as Januvia paired with Victoza.
- Eliminate any combination with medicine that costs more than the patient’s monthly budget.

Finally, it’s worth noting that the score of one combination doesn’t depend on the score of any other combination. Thus, we could score half of our combinations on one computer and a half on another computer, in about half the time as it takes to do it all on one computer. And there’s no need to limit ourselves to 2 computers: if we had 100 computers, we could divide the combinations up into 100 parts and run them on 100 computers at once, in 1/100th of the time.

Your authors do not have 100 computers readily available. But Amazon does.

Modern technology, then, makes it possible to provide a customized, cost-effective treatment regimen to every patient with type 2 diabetes in the United States in about as long as it takes to watch one episode of *Game of Thrones*. It also enables us to answer some very interesting questions, such as: easily

- How much would the HbA1c levels of the average American with type 2 diabetes improve if we gave each of them $25 per month to buy different medicines?
- What’s the right price an employer or healthcare system should pay for a new medication, given the cost and performance of every other medicine currently in the market?

In the 5th installment of this series, we will provide actual patient examples of how this program works for real live patients and their results when medical professionals use this program.

**Next time in Part 5 —****The Pros and Cons in The use of AI to treat patients with Type 2 diabetes, plus an ** **Intro to Glucose Path and How you can try the software at no cost. **

*Updated May 2, 2020. Originally published Feb. 3, 2018.*

**Bradley Eilerman MD MHI **obtained his medical degree from the University of Kentucky in 2001. He completed his internship at Vanderbilt University Medical Center in 2001 and his residency in Internal Medicine/Pediatrics at the University of Cincinnati in 2005. Dr. Eilerman went on to complete a fellowship in Diabetes, Endocrinology and Metabolism in 2008. He finished his Master’s in Health Informatics in 2016. Dr. Ellerman works as the lead physician, director of clinical research, and clinical endocrinologist for the St. Elizabeth Physician’s group where he cares for a patient base of approximately 2,500. He is licensed to practice medicine in the state of Kentucky.

**Len Testa** is a computer scientist at GlucosePATH.com, focusing on the combinatorial optimization engine and architecture. Len’s other work includes optimization software that has helped millions of people minimize their waits in line at Disney World. (He’s happy to talk about that, too.) That said, it’s widely acknowledged that Len is the “pretty face” of a much more talented group of people, and that “pretty face” is charitable, at best.