# #009 What Counts as Available Time?

### Defining dentists and hygienists' available time, and crafting the algorithm and code we can use to count it

*Hello, and welcome back to The Deliberate Practice. We are currently working on calculating financial and time numbers in a dental practice. When we are done this, we will be able to calculate dollars per hour for all of our providers. This is going to help us understand how our providers are each contributing to the practice. If you want to start at the beginning, I recommend checking out Season 1.*

Last week, we talked about some reasons why it can be challenging to define *available time*, *productive time*, and *downtime*. We looked at some examples of doctor and hygiene schedules. And we chatted about how these numbers can sometimes mislead us.

Today, we are going to review one example of what calculating available time can be challenging. Then we are going to look at a way of defining *available time* that gives us insight into our practice, while also encouraging our providers to get in, get the job done, and get out. And finally, we will look at the algorithm and code we can use to count this automatically for us.

**The Big Idea**

Counting time should be simple. It’s not—unless we make good choices.

**Learning Goals**

What makes counting available time challenging?

How can we write an algorithm and code that will count this for us?

How can we define available time in a way that encourages the behaviours we want?

## A Simple, Challenging Example

This example builds on what we looked at last week. Without digging too much into the details, let’s take the time to notice some of the problems with counting available time.

Doctor A’s schedule starts at 8 am, but her first patient doesn’t arrive until 8:30 am. Her schedule doesn’t finish until 12 pm, but someone blocked her schedule from 11 am - 12 am, to make it look like she was unavailable.

Doctor B’s schedule goes from 12 pm to 8 pm. Or does it? The first patient doesn’t arrive until 1 pm, and the last patient leaves just before 6 pm. This was less than a 5-hour day, and so it doesn’t technically require a 30-minute lunch. However, someone booked

*two*30-minute lunches in the schedule. This artificially reduces both available time and downtime.The hygienist’s schedule has a whole bunch of blocked time, artificially reducing available time and downtime.

Really, the big question, is **why**? There is no rhyme or reason to any of this. There are no rules around what constitutes a valid break or not. Another big question is, how do we calculate available time for Doctor B? He’s working out of two chairs at the same time. Does that mean he should have twice the available time? If so, what do we do about those lunch breaks that are in one chair, but not the other?

We’ve been playing around with this for a few years. And sometimes our definitions would come up with weird results. For example, if we could available time as the 8-hour day, but we count all appointments in all columns as productive time, then we could have a day where productive time is higher than available time.

## An Elegant Solution: The “Unionized Schedule”

This is the best solution I’ve come up with so far. Productive time requires a patient, a provider and a chair to be in the same place at the same time. Having multiple appointments at the same time mean that multiple patients are in multiple chairs. However, so long as the provider is following the laws of physics (ha ha), they are only in one room at one time. So, productive time is only happening in one of those appointments at any given time.

The idea here is to combine all appointments that overlap (or at least “touch”) into contiguous blocks. This basically means we are going to take the *mathematical union* of each provider’s appointments. Here’s a sketch of how it works.

I find it easier to understand how these things work by sketching out an example. Here is a schedule with a single provider working out of three chairs. Starting at the top, and working down based on whichever appointment comes up next, we can start to figure out the rules we need to create the unionized schedule.

It turns out that the algorithm is pretty simple. So long as there is no gap for the new start time, update the appointment’s end time. This turns it into a block. If there is a gap, start a new block.

The final code looks something like this. This is a Python example, with comments that basically work like pseudo-code for whatever language.

Our definitions now become:

**Available Time**. The number of ten-minute units in a provider’s day, counted from the beginning of their first appointment, to the end of their last appointment.**Productive Time**. The number of ten-minute units where there is an appointment in the unionized schedule.**Downtime**. The number of ten-minute units of white space (calculated as available time minus productive time).

## The Good, The Bad and The Ugly

Part of the elegance of this solution is that *it completely ignores blocked time*. If someone has blocked time in the schedule, for any reason, it is going to get counted as downtime, and it will not be reduced from available time. This removes one large source of inconsistency in counting available time.

Another advantage to this, is that there is no messing around with what the provider’s schedule “should be”. This eliminates confusion from (for example):

If the provider comes in on a day when they aren’t supposed to work, to see a single patient. If we are running a rule-based schedule, the provider’s schedule will either have 0 available hours, or 8 available hours. Our solution avoids this by automatically counting the provider’s schedule.

Random cases where the provider is scheduled to work in one chair, but ends up seeing an emergency in another chair. No receptionist is going to take the time to open up the second chair’s schedule. Our “unionized schedule” neatly avoids this problem.

A disadvantage of this is that *available time* becomes easy to misunderstand. It’s easy to imagine a scenario where a doctor or hygienist comes in and says, “I came in expecting to work from 8 am to 5 pm. It's not my fault that the patient showed up late. I was still available.”

And The Ugly in all of this is diagnosing when *available time* ends up being much lower than it we expect it to be. We’ll dive into that more when we start combining finances and hours to get dollars-per-hour.

## #009 What Counts as Available Time?

Hi Jeremy, this is a well thought out plan. I'm interested in knowing if other practices are taking a similar approach.