Skip to main content

Treatment scheduling and compliance determinaitons

Introduction

This article describes RehabAlpha's logic for answering the question

Are my scheduled treatments compliant according to my treatment plan?

At first glance, this seems like an easy question to answer, but there are some tricky situations and "gotchas" to consider.

Basics

We'll start by considering a patient, Kevin, who ahs been admitted to a skilled nursing facility on January 1, 2026. On the same day Kevin was admitted to the SNF, a physical therapist created a PT case and did an evaluation.

When considering treatments and compliance, the therapy case is the appropriate mental container to encapsulate your thinking. Bear in mind:

  1. The therapy case determines when a "week" starts and ends (e.g. "Sunday to Saturday" or "Monday to Sunday").
  2. In RehabAlpha, every treatment points to its parent therapy case.

Here are some properties regarding therapy cases:

  • A therapy case can have treatments without having an evaluation
  • A therapy case can have an evaluation without having treatments
  • A therapy case can have an evaluation and multiple recertifications
  • A therapy case cannot have multiple evaluations
  • A therapy case can have an evaluation without a treatment plan
  • A therapy case cannnot have a recertification without a treatment plan
  • A therapy case cannot have a recertification without also having exactly one evaluation
  • If a therapy case has a recertification, the evaluation must have a treatment plan

The evaluation and recertifications in a therapy case are broadly referred to as "certifications".

Here are some properties regarding evaluations:

  • An evaluation must have an evaluation date
  • An evaluation may or may not include a treatment plan

A treatment plan specifies the timeline and rules for treating the patient.

  • Every treatment plan must have a start date called the "cert date"
  • The cert date for an evaluation may not be earlier than the evaluation date, but it can be later
  • The cert date for a recertification may not be earlier than the recertification date, but it can be later
  • A treatment plan can have 0, 1, or multiple treatment periods
  • Treatment periods are sequential and contiguous (non overlapping with no gaps)
  • Every treatment period has a date range.
  • The first treatment period's start date equals the treatment plan cert date
  • The last treatment period's end date can be indefinite

A given treatment period can have a specified frequency. For example, a treatment period could be defined like

Patient shall receive 3 treatments per week for 2 weeks from May 24, 2026 to Jun 6, 2026.

In this example, the frequency is weekly. We refer to the weeks themselves as "compliance windows".

If the treatment period specifies a daily frequency like...

Patient shall receive 20 minutes of treatment per day for 2 weeks from May 24, 2026 to Jun 6, 2026.

then the compliance windows are the individual dates between May 24, 2026 and Jun 6, 2026 (inclusive).

When the frequency is weekly, the weeks start on a weekday determine by the startOfWeek property of the therapy case. For example, if the case says that weeks start on Sunday, then compliance windows for a weekly treatment period will always start on Sunday and end on Saturday.

The treatment plan has a start date which cannot be earlier than its parent certification's date (but it could be later).

A treatment plan is comprised of "treatment periods". If a given certification has a treatment plan and that treatment plan has multiple treatment periods, the treatment periods are necessarily sequential, non overlapping and contiguous.

The last treatment period in a treatment plan may have an indefinite duration.

A treatment period can have a frequency like "per week" or "per day". If it has a frequency, the frequency is used to determine "compliance periods".

Complexity 1 - weekly treatment periods

Recall our fake patient, Kevin, with a Physical Therapy case. Our PT did an evaluation on Jan 1, 2026, a Thursday.

Suppose the case specifies that weeks start on Sunday, and suppose the evaluation has a treatment plan whose cert date matches the eval date (Jan 1, 2026), with a single treatment period that specifies...

Patient shall receive 4 tretments per week for 3 weeks.

Immediately this raises a question:

When is week 1?

Visually, you could partition dates in this vicinity into weeks like so:

1/1 (cert date)
|
12/28 | 1/4 1/11 1/18
| | | | |
|---------------------|---------------------|---------------------|
Sun Thu Sun Sun Sun

In RehabAlpha, we define week 1 as the period 12/28 - 1/1. In other words, week 1 is the true 7-day week that encapsulates the cert date, even though a portion of the week comes before the cert date. We might also call this period the "compliance window". Subsequent weeks are counted from week 1. So, in this example, you'd have

WeekCompliance periodTreatable periodIs partial?
112/28 - 1/31/1 - 1/3Yes
21/4 - 1/101/4 - 1/10No
31/11 - 1/171/11 - 1/17No

Note that we define a "treatable period" as the portion of a compliance period that overlaps with the certification period.

What happens if the treatment plan calls for 6 treatments per week?

In this case, the initial week only includes 5 days. So, we call it a "partial week". In Rehabalpha, every partial week is considered compliant as long as there aren't more treatments than allowed by a single week. Furthermore, RehabAlpha's autoscheduler will attempt to cram as many treatments into a partial week as it can without making the week non-compliant. (Note that the auto-scheduler will never assign more than one treatment on a given day, for a given therapy case.)

Complexity 2 - upcoming recertifications

The next bit of complexity has to do with overlapping treatment plans. Recall, a treatment period a portion of treatment plan.

Consider the following scenario

  • case defines weeks starting on Sunday
  • eval cert date is 1/1, a Thursday
  • eval treatment plan calls for 3 tx/wk for 3 weeks
  • recert date is 1/14, a Wednesday
  • recert treatment plan cert date is 1/15, a Thursday
  • recert treatment plan calls for 1 tx/wk for 3 weeks
1/1 (cert date) 1/15 (recert cert date)
| |
12/28 | 1/4 1/11 | 1/18 1/25 2/1
| | | | | | | |
|---------------------|---------------------|---------------------| | |
Sun Thu Sun | | | | |
|---------------------|---------------------|---------------------|
Sun Thu Sun Sun Sun

In this example, the recert treatment plan overlaps the evaluation treatment plan.

Suppose today is 1/10. The upcoming recertification and its treatment plan are in place to help us plan therapists and case loads. RehabAlpha is faced with two challenges:

  1. RehabAlpha's autoscheduler must decide whether to create or delete upcoming treatments
  2. RehabAlpha's notice system must be able to evaluate the planned treatments and decide if the therapy case is compliant in accordance with the case's treatment plans.

Resolver

The way RehabAlpha resolves this complexity is as follows:

  1. Sort the therapy case's certifications with treatment plans by treatment plan cert date, newest to oldest.
  2. Pick the latest treatment plan in the therapy case.
  3. Using the selected treatment plan, establish the treatable periods.
  4. Next, pick the preceding treatment plan.
  5. Exclude any portion of the preceding treatment plan that falls on or after the next newer treatment plan's cert date.
  6. Establish treatable periods using the non-excluded portion of the treatment plan.
  7. Repeat steps 4-6 until we process all treatment plans for the case.

Once a newer treatment plan becomes effective, older treatment plans do not become effective again later.

This means that if an evaluation treatment plan is indefinite, and a later recertification treatment plan lasts for 3 weeks, the evaluation treatment plan still does not resume after the recertification treatment plan ends. Likewise, if a newer treatment plan has 0 treatment periods, it still supersedes older treatment plans from its cert date forward.

For our example above, the recertification would establish the following treatable periods:

CertificationWeekCompliance periodTreatable periodIs partial?
2 (recert)11/11 - 1/171/15 - 1/17Yes
2 (recert)21/18 - 1/241/18 - 1/24No
2 (recert)31/25 - 1/311/25 - 1/31No

Then, the evaluation would establish these treatable periods:

CertificationWeekCompliance periodTreatable periodIs partial?
1 (eval)112/28 - 1/31/1 - 1/3Yes
1 (eval)21/4 - 1/101/4 - 1/10No
1 (eval)31/11 - 1/171/11 - 1/14Yes

All the treatable periods should be non-overlapping, so they can easily be unioned into a single set of treatable periods

CertificationWeekCompliance periodTreatable periodIs partial?
1 (eval)112/28 - 1/31/1 - 1/3Yes
1 (eval)21/4 - 1/101/4 - 1/10No
1 (eval)31/11 - 1/171/11 - 1/14Yes
2 (recert)11/11 - 1/171/15 - 1/17Yes
2 (recert)21/18 - 1/241/18 - 1/24No
2 (recert)31/25 - 1/311/25 - 1/31No

We can also derive a table of distince compliance periods:

Compliance period
12/28 - 1/3
1/4 - 1/10
1/11 - 1/17
1/18 - 1/24
1/25 - 1/31

The tricky logic involves the overlapping portion of the treatment plans. RehabAlpha handles this by evaluating treatable periods and compliance periods separately.

  1. For the treatable period 1/11 - 1/14, this is a partial treatable period. RehabAlpha considers it non-compliant if there are more than the allowed number of treatments (3), otherwise it's considered compliant. For example, if the period has 1 or even 0 treatments, we consider it compliant.
  2. For the treatable period 1/15 - 1/17, the same thing applies. It's a partial treatable period. RehabAlpha considers it non-compliant if there are more than the allowed number of treatments (1), otherwise it's considered compliant.
  3. For the compliance period 1/11 - 1/17, RehabAlpha also applies an anti-stacking cap because both treatable periods use the same metric (treatments) and the same compliance-window basis (per week). RehabAlpha considers the compliance period non-compliant if it has more than 3 treatments, which is the highest weekly allowance from any treatable period that intersects the compliance period. This means that 3 treatments from 1/11 - 1/14 plus 1 treatment from 1/15 - 1/17 would be non-compliant, even though neither partial treatable period exceeds its own limit.

This anti-stacking rule only applies when the overlapping treatment rules can be compared using the same metric and compliance-window basis. For example, if one treatment period specifies 3 treatments per week and another specifies 1 treatment per week, RehabAlpha can apply a weekly anti-stacking cap. However, if one treatment period specifies 3 treatments per week and another specifies 20 treatments in 30 days, RehabAlpha evaluates each rule in its native compliance windows and does not convert the 30-day rule into a weekly rule. Likewise, if one treatment period specifies 20 minutes per day and another specifies 3 treatments per week, RehabAlpha evaluates minutes and treatment counts separately.

As for the autoscheduler, it should always attempt to create as many treatments in a period (compliance or treatable) as it can without making the period noncompliant and without generating more than one treatment on a given day (for the same therapy case).