DEV Community

eth shihao
eth shihao

Posted on

Modeling Dental PPO Write-Offs, Deductibles, and Split-Year Annual Maximums in Deterministic TypeScript

A PPO can pay $0.00 for a crown with a $1,200.01 allowance and 50% plan coinsurance if a root canal exhausts the annual maximum in December. In the synthetic case below, the plan pays $575.01 for the same crown in January, even after a new $50.00 deductible. The difference comes from the balances available when each claim line is processed.

Use strictly de-identified inputs. The examples here use synthetic fees, procedure labels, and artificial benefit-year keys. Leave names, member IDs, real service dates, and free-text records out of calculator inputs, test fixtures, and logs. The TypeScript blocks form one script. Paste them in order into dental-ppo.ts and run node dental-ppo.ts with Node.js 24. HHS guidance on de-identification

Resolve the PPO allowance before calculating coinsurance

Keep the provider's submitted fee, a UCR benchmark (usual, customary, and reasonable), and the PPO contracted fee in distinct fields. This model covers in-network services under a contract that limits the allowed charge to the lower of the submitted fee and contracted fee. The write-off is submitted − allowed. The crown has a $1,600.00 submitted fee, a $1,400.00 illustrative UCR benchmark, and a $1,200.01 contracted fee. Its contractual write-off is $399.99. Substituting the benchmark for the submitted fee would wrongly report $199.99. After processing, submitted = write-off + plan payment + patient amount. ADA guidance on UCR and plan limits · ADA guide to reading an explanation of benefits

For each line, apply any remaining deductible to the allowance, multiply the remainder by the plan's share, round to cents, then cap the payment at the available annual benefit for lines that count toward it. The patient amount is allowed − plan payment. That subtraction includes the deductible and any amount left uncovered by the cap.

The fixture pays 100% for preventive, 80% for basic, and 50% for major. Preventive care skips the deductible and counts toward the annual maximum in this example. Those are independent policy flags. Use the carrier's classification for each service and its rounding rule. This example uses round-half-up per line. One published PPO brochure classifies root canals as major and defines a completion date for reporting and benefits. ADA PPO plan basics · Delta Dental’s FEDVIP plan brochure

import assert from 'node:assert/strict';

const BPS = 10_000n;
type Category = 'preventive' | 'basic' | 'major';
type Rule = { planBps: bigint; waivesDeductible: boolean; countsTowardMax: boolean };
type Balances = { deductibleLeft: bigint; annualMaxLeft: bigint };
type Plan = { fresh: Balances; rules: Record<Category, Rule> };
type Procedure = {
  label: string;
  category: Category;
  submittedCents: bigint;
  contractedCents: bigint;
};
type ScheduledProcedure = Procedure & { benefitYear: number };

function min(left: bigint, right: bigint): bigint {
  return left < right ? left : right;
}

function priceLine(line: Procedure, rule: Rule, before: Balances) {
  if (line.submittedCents < 0n || line.contractedCents < 0n ||
      rule.planBps < 0n || rule.planBps > BPS) {
    throw new RangeError(`Invalid fee or plan rate for ${line.label}`);
  }

  const allowed = min(line.submittedCents, line.contractedCents);
  const writeOff = line.submittedCents - allowed;
  const deductible = rule.waivesDeductible ? 0n : min(allowed, before.deductibleLeft);
  const uncappedPlan = ((allowed - deductible) * rule.planBps + BPS / 2n) / BPS;
  const planPaid = rule.countsTowardMax ? min(uncappedPlan, before.annualMaxLeft) : uncappedPlan;
  const patient = allowed - planPaid;

  return {
    allowed, writeOff, deductible, uncappedPlan, planPaid, patient,
    after: {
      deductibleLeft: before.deductibleLeft - deductible,
      annualMaxLeft: before.annualMaxLeft - (rule.countsTowardMax ? planPaid : 0n),
    },
  };
}

function estimate(
  plan: Plan,
  opening: { benefitYear: number; balances: Balances },
  lines: readonly ScheduledProcedure[],
) {
  let { benefitYear, balances } = opening;
  if (!Number.isSafeInteger(benefitYear) || balances.deductibleLeft < 0n ||
      balances.annualMaxLeft < 0n || balances.deductibleLeft > plan.fresh.deductibleLeft ||
      balances.annualMaxLeft > plan.fresh.annualMaxLeft) {
    throw new RangeError('Invalid opening benefit year or balances');
  }

  return lines.map((line) => {
    if (!Number.isSafeInteger(line.benefitYear) || line.benefitYear < benefitYear) {
      throw new RangeError(`Out-of-order benefit year for ${line.label}`);
    }
    if (line.benefitYear > benefitYear) {
      benefitYear = line.benefitYear;
      balances = plan.fresh;
    }
    const result = priceLine(line, plan.rules[line.category], balances);
    balances = result.after;
    return { ...result, label: line.label, benefitYear };
  });
}
Enter fullscreen mode Exit fullscreen mode

Compare December and January with the same procedure fees

Start December with $25.00 of deductible and $620.00 of annual plan benefits remaining. The plan resets both balances in January to a $50.00 deductible and a $1,500.00 maximum. This comparison assumes the same plan terms both years, continued eligibility, and no carryover of unused benefits. Both scenarios begin with a preventive visit and then a root canal in December. Only the crown moves.

Procedure Submitted fee UCR benchmark Contracted fee Write-off
Preventive visit $160.00 $140.00 $120.00 $40.00
Root canal, basic $1,180.00 $1,025.00 $900.01 $279.99
Crown, major $1,600.00 $1,400.00 $1,200.01 $399.99
Line Deductible applied Plan share before cap Plan pays Patient pays Plan max left
December preventive, both scenarios $0.00 $120.00 $120.00 $0.00 $500.00
December root canal, both scenarios $25.00 $700.01 $500.00 $400.01 $0.00
Crown in December $0.00 $600.01 $0.00 $1,200.01 $0.00
Crown in January $50.00 $575.01 $575.01 $625.00 $924.99

The patient total is $1,600.02 with everything in December and $1,025.01 with the crown in January, a difference of $575.01. To reproduce the same-year root canal and crown portion interactively, enter the two contracted fees as allowances and use the post-preventive balances of $25.00 deductible and $500.00 annual maximum. Crown and root canal copay estimator

const plan: Plan = {
  fresh: { deductibleLeft: 5_000n, annualMaxLeft: 150_000n },
  rules: {
    preventive: { planBps: 10_000n, waivesDeductible: true, countsTowardMax: true },
    basic: { planBps: 8_000n, waivesDeductible: false, countsTowardMax: true },
    major: { planBps: 5_000n, waivesDeductible: false, countsTowardMax: true },
  },
};
const december = 1;
const january = 2;
const opening = {
  benefitYear: december,
  balances: { deductibleLeft: 2_500n, annualMaxLeft: 62_000n },
};
const procedures = [
  { label: 'Preventive', category: 'preventive', submittedCents: 16_000n,
    ucrCents: 14_000n, contractedCents: 12_000n, benefitYear: december },
  { label: 'Root canal', category: 'basic', submittedCents: 118_000n,
    ucrCents: 102_500n, contractedCents: 90_001n, benefitYear: december },
  { label: 'Crown', category: 'major', submittedCents: 160_000n,
    ucrCents: 140_000n, contractedCents: 120_001n, benefitYear: december },
] satisfies Array<ScheduledProcedure & { ucrCents: bigint }>;
const [preventive, rootCanal, crown] = procedures;
const sameYear = estimate(plan, opening, procedures);
const splitYear = estimate(plan, opening, [preventive, rootCanal, { ...crown, benefitYear: january }]);

assert.equal(crown.ucrCents - sameYear[2].allowed, 19_999n);
assert.deepEqual([sameYear[0], sameYear[1], sameYear[2], splitYear[2]].map((row) => [
  row.allowed, row.writeOff, row.deductible, row.uncappedPlan, row.planPaid,
  row.patient, row.after.deductibleLeft, row.after.annualMaxLeft,
]), [
  [12_000n, 4_000n, 0n, 12_000n, 12_000n, 0n, 2_500n, 50_000n],
  [90_001n, 27_999n, 2_500n, 70_001n, 50_000n, 40_001n, 0n, 0n],
  [120_001n, 39_999n, 0n, 60_001n, 0n, 120_001n, 0n, 0n],
  [120_001n, 39_999n, 5_000n, 57_501n, 57_501n, 62_500n, 0n, 92_499n],
]);
for (const scenario of [sameYear, splitYear]) {
  scenario.forEach((row, index) => {
    assert.equal(row.writeOff + row.planPaid + row.patient, procedures[index].submittedCents);
  });
}
const sameTotal = sameYear.reduce((sum, row) => sum + row.patient, 0n);
const splitTotal = splitYear.reduce((sum, row) => sum + row.patient, 0n);
assert.equal(sameTotal, 160_002n);
assert.equal(splitTotal, 102_501n);
assert.equal(sameTotal - splitTotal, 57_501n);

const preventiveOutsideCap = priceLine(preventive,
  { ...plan.rules.preventive, countsTowardMax: false }, opening.balances);
assert.deepEqual(preventiveOutsideCap.after, opening.balances);
console.log({ sameYearPatientCents: sameTotal, splitYearPatientCents: splitTotal });
Enter fullscreen mode Exit fullscreen mode

Assign the correct benefit year before pricing the line

Pass procedures in the order the model should consume the deductible and maximum. Assign each line its benefit-year key using the carrier's rules for the procedure and coverage period. A completion rule can put a multivisit procedure into a different benefit year from its first appointment. When plan terms change, use the applicable policy and opening balances for each year. If a plan carries some benefits forward, apply the verified carryover to the new year's opening maximum. Clinical timing belongs with the treating dentist. Delta Dental’s FEDVIP plan brochure, including endodontic completion rules

The same running-balance model can compare implant placement, abutment, and crown across two years. Start by confirming coverage and allowances for each component. The fixture assumes covered services under one plan. Implant exclusions, separate caps, alternate benefits, and secondary coverage require additional rules. Dental implant annual maximum split calculator

Keep the allowance, write-off, deductible, uncapped share, capped payment, and ending balances in the estimate output. Those fields let a reviewer locate the first difference when comparing an estimate with an explanation of benefits. DentalPlanPack’s estimate workbench

Top comments (0)