Shashank Shekhar’s photo
Back to all posts

Demystifying healthcare costs with canonical episodes of care

medical bill

Estimating healthcare costs is notoriously difficult. Healthcare transparency tools provide cost estimates for the total procedure cost that a facility or physician will charge a patient. Ideally this cost estimate helps you balance your healthcare budget with the co-pay at your visit to an in-network medical facility. However, there is a critical limitation of this total cost number that is often overlooked.

Let’s understand with a real example. Two people who are on the same insurance network go to the same facility for a chest MRI—yet they receive a different total cost on their bills. Where did that price difference come from?

The price difference is due to differences in how each patient is billed. In this example, it is due to a few different itemized service codes in their respective bills. One of them may receive a different service line item code either due to additional services rendered or a severity level change for a common service line item.

This complexity in the medical billing process means that a total cost estimate without any line items is not useful to understand what you might pay. So how can we produce holistic, itemized cost estimates that are useful?

The problem: medical bills are opaque

The variance in the total cost of a specific procedure at a facility or physician office depends upon the list of itemized services in each individual bill and the cost for each service listed in the fee schedule. An example of this is the total cost of a chest MRI, which is approximately 1.3 times higher when a contrastive medium service line item (indicating that contrast dye was used) is included in the bill.

In all outpatient procedures, the total cost is the sum of each itemized service cost taken from the negotiated network fee schedule. In the case of inpatient procedures, the total cost instead is a base rate or per diem rate. A total cost estimate without itemized details is not necessarily inaccurate—but it is not transparent.

medical bill with facility charges

Figure 1: A medical bill lists itemized services and a total cost

Amino is building algorithms that help unpack the system of healthcare experiences and get rid of its complexity using a database with billions of claims. Bringing transparency to healthcare costs is one of our goals. We want to not only predict the total cost of procedures, but also help you understand the component services that lead to that cost. So how can the total cost be computed by tracing the cost of each service item? It’s tricky because we don’t know what line items you will end up with on your bill.

Modeling a medical bill

Healthcare costs are a function of unit cost and utilization. Given a procedure, in order to measure changes in utilization of itemized services we first create a canonical episode definition which captures the most typical sequence of services received by patients undergoing a specific procedure.

episode of care for vaginal delivery

Figure 2: An episode is a sequence of itemized services grouped by day during a procedure

In this figure depicting a real patient’s episode for vaginal delivery, note that on the day before the procedure there are laboratory tests. The procedure day includes room and board charges. The day after has additional room and board charges and laboratory tests. Those are services used within one day before or after the delivery.

A canonical episode can be thought of as the expected set of line items for a particular procedure. It's calculated by finding commonalities in all patient visits for that procedure. More specifically, a canonical episode is the most common sequence of services grouped by day visits, across all sequences of services received by patients who had a specific procedure done.

First, we define the scope as the service items received by a patient. The scope is set by default to a three week period before and after the date of a procedure visit because it is long enough to include all associated services during any procedure. Next, each patient’s data is modeled as a sequence of service line items grouped together if they are rendered on the same day. In a claims database with time series data on a large patient population, many such sequences can be constructed. These sequences are specific to a procedure, so they are bound to share many sets of service items and differ in a few.

Such data leads one to think of a time indexed directed graph as a means to represent the sequences together. A node in this graph is a set of service items. The time index of a node is the order number it occupies in the sequence. We refer to this graph as a procedure’s population graph. A directed edge connecting two nodes in this graph represents the number of patients who received the services represented by both the nodes in order. Each path from source to sink is a candidate episode of care and the path with largest volume is the canonical episode.

canonical episode

Figure 3: The episodes from a large patient population for a given procedure, when organized as a time indexed graph, reveal the canonical episode as a frequent pattern

Tackling noise

The number of nodes with the same order number grows exponentially as the underlying patient population increases. Some of the growth can be attributed to the large diversity in patient time series data generated at thousands of medical facilities across the country. However, we found that many nodes differed by one or two services which are unrelated to the procedure but unique to the patient.

This can happen, for example, when a pending office visit for a chronic diagnosis happens a few days just before a patient’s surgery. These services will be uncorrelated to the frequently found services in the sequences that make up the procedure’s population graph. Therefore, an Occam’s razor approach is to remove services which are not rendered to at least a minimum fraction of the population.

The Algorithm

Given a population graph, we have to identify the path selected by maximum number of patients. The frequency of any particular episode can be modeled as a product of probabilities. Each probability is conditioned on the nodes (or service items set) already selected.

Equation 1: Probability of selecting the next set    of services is conditioned on all existing decisions

Tackling missing data

The edge weights in the population graph represent the volume of patients that select those two nodes adjacently in their sequence. Sadly, large datasets suffer from missing data issues. In the claims dataset, we have missing data completely at random. In a time series data of a given patient, claims data for one or more days might be missing. This implies volume measurement of sequences (based on patient time series data) across multiple nodes will be erroneous, and the error will be dependent on the items already selected.

So, we make a simplifying Markov assumption on the conditional probabilities. Based on this assumption, the approximation of the conditional probability is no longer affected by missing data at random from the noisy long range dependencies.

Equation 2: Markov assumption - Probability of selecting the next set   of services is conditioned on the last decision 

Finding canonical episodes

Taking a negative log of the product in equation 2 transforms the objective to a sum minimization problem that can be solved by an optimization routine which will find the most common sequence of nodes in the procedure’s population graph. This is the canonical episode.

canonical episodes for vaginal delivery

Figure 4: Each path traced in the time indexed graph is a canonical episode. Many canonical episodes are predicted because each represents a significant proportion of population

There is often non-negotiable heterogeneity in the manner of rendering a procedure which can be attributed to the facility type, patient’s chronic history or other related factors. It implies that a single canonical episode alone cannot effectively summarize the possible service codes that a patient might see in a procedure’s bill. In terms of probability, this means the frequency distribution of episodes is multi-modal.

Consider vaginal delivery, for example. Service items like triage hours, recovery hours, room and board hours, and diagnostic tests are correlated with each other to an extent where their different configurations can be observed with similar likelihood values in a population. This implies that the frequency distribution of common or canonical episodes is multimodal and the algorithm has to account for it. It is a hard problem to compute multiple shortest paths, but we are equipped with Yen’s algorithm which iteratively does it. Now we can generate many canonical episodes for a given procedure.

distribution of canonical episodes in a population

Figure 5: The distribution of canonical episodes in a population can be multi-modal

Given a procedure, predicting a distribution of canonical episodes instead of one canonical episode leads one to draw an analogy to a bayesian model. Such a solution which predicts many canonical episodes enables personalization to the most likely canonical episode out of many for a patient type, facility, and/or network when specific information is available.

itemized bill for vaginal delivery

itemized bill for vaginal delivery

Figure 6: Two vaginal delivery cost estimates as itemized bills. Both include itemized costs of the top canonical episode for different hospitals and insurance networks


A cost model that predicts prices for itemized services used in conjunction with a canonical episode can predict a bill with itemized cost estimates. Not just that—utilization rates of multiple canonical episodes can help identify correlations between specific itemized services to medical facilities, patient chronic conditions or other related factors.

Canonical episodes give a systematic approach for qualitative analysis of procedure definitions in a large healthcare claims database. They enable us to create better cost estimates which are easily comparable to a real bill, which will add transparency and accuracy to the quality of our results. In the future, we hope to leverage this work to build features that, given a procedure, simplify comparisons between payer networks and facilities, and find a canonical episode that corresponds best to a given patient when information is available.