A patient has $250.00 left in dental benefits and $50.00 left on the deductible. The cleaning pays $85.00 under a preventive waiver. That leaves the deductible intact and reduces the annual maximum to $165.00. The next line, a crown, has an $800.01 PPO fee. After the deductible, 50% of $750.01 rounds to $375.01. The insurer can pay only the $165.00 left in benefits, so the patient's crown balance is $635.01.
| CDT | Billed | PPO write-off | Deductible applied | Insurer pays | Patient pays |
|---|---|---|---|---|---|
| D1110 | $100.00 | $15.00 | $0.00 | $85.00 | $0.00 |
| D2740 | $1,200.01 | $400.00 | $50.00 | $165.00 | $635.01 |
| Total | $1,300.01 | $415.00 | $50.00 | $250.00 | $635.01 |
The deductible column explains part of the patient payment. Adding it again to the total double-counts $50.00.
Follow the allowed fee and the two payment limits
The example mapping assigns a preventive tier to D1110, a basic tier to D2391, a major tier to D2740, and an ortho tier to D8090. A carrier can place procedures in different tiers. Use its benefit schedule to supply a procedure or plan-level category override. Orthodontic payments draw on a separate lifetime maximum. Processing order matters when several lines share a deductible or maximum.
A PPO contract lowers the collectible fee and creates a write-off. On an out-of-network line billed at $100.00 with a UCR allowance of $60.00, the primary plan calculates coverage on $60.00. The $40.00 above that allowance remains collectible in the single-plan example. A secondary plan can supply a different allowance. The estimator bounds both plans' combined payments by the larger allowance and the collectible fee.
For a $100.01 allowed charge with the deductibles met, the primary at 50% pays $50.01. A secondary at 80% would pay $80.01 on its own. Under standard coordination of benefits in this model, it pays the remaining $50.00. Under non-duplication, it pays $30.00, the difference between its standalone benefit and the primary payment. That leaves $20.00 to the patient. Each balance decreases by the actual payment for that plan and line.
Benchmark ordered claim ledgers
Run this from the repository root with Node.js 20 or later. The timed cases compare 40-line single coverage, 40-line standard COB, and 400-line non-duplication. The varied fees, categories, and plan balances are synthetic. Workloads include whole-dollar and odd-cent amounts, a mix of PPO and UCR lines, and capped benefits. MIT source repository
node --input-type=module <<'JS'
import assert from 'node:assert/strict';
import { performance } from 'node:perf_hooks';
import { estimateTreatmentPlan } from './src/index.js';
const primary = {
coveragePercent: { preventive: 100, basic: 80, major: 50, ortho: 50 },
deductibleRemainingCents: 5000, annualMaxRemainingCents: 25_000,
orthoLifetimeMaxRemainingCents: 12_000, waivePreventiveDeductible: true,
};
const example = estimateTreatmentPlan({
primary,
procedures: [
{ code: 'D1110', billedCents: 10_000, contractedFeeCents: 8500 },
{ code: 'D2740', billedCents: 120_001, contractedFeeCents: 80_001 },
],
});
assert.equal(example.lines[1].primary.coinsuranceBenefitCents, 37_501);
assert.equal(example.totals.patientCents, 63_501);
assert.equal(example.remaining.primary.annualMaxRemainingCents, 0);
const secondary = {
coveragePercent: { preventive: 90, basic: '62.35', major: 55, ortho: 60 },
deductibleRemainingCents: 4500, annualMaxRemainingCents: 160_000,
orthoLifetimeMaxRemainingCents: 35_000, waivePreventiveDeductible: true,
};
const templates = [
{ code: 'D1110', billedCents: 10_000, contractedFeeCents: 8500 },
{ code: 'D2391', billedCents: 23_001, contractedFeeCents: 18_001 },
{ code: 'D2740', billedCents: 120_001, contractedFeeCents: 80_001 },
{ code: 'D8090', billedCents: 71_500, ucrFeeCents: 60_001, secondaryAllowedCents: 64_001 },
];
const measurements = [];
const scenarios = [
{ name: 'Single', size: 40, batches: 300, secondary: null },
{ name: 'Standard', size: 40, batches: 300, secondary, cobMode: 'standard' },
{ name: 'Non-duplication', size: 400, batches: 50, secondary, cobMode: 'non-duplication' },
];
for (const scenario of scenarios) {
const procedures = Array.from({ length: scenario.size }, (_, i) => templates[i % templates.length]);
const fixture = {
procedures, primary: { ...primary, annualMaxRemainingCents: 550_000 },
secondary: scenario.secondary, cobMode: scenario.cobMode,
};
const result = estimateTreatmentPlan(fixture);
for (const row of [...result.lines, result.totals]) {
assert.equal(row.billedCents, row.writeOffCents + row.primaryPaidCents + row.secondaryPaidCents + row.patientCents);
}
assert.equal(result.remaining.primary.orthoLifetimeMaxRemainingCents, 0);
for (let i = 0; i < 40; i++) estimateTreatmentPlan(fixture);
const samples = [];
for (let sample = 0; sample < 5; sample++) {
let checksum = 0;
const start = performance.now();
for (let i = 0; i < scenario.batches; i++) {
checksum += estimateTreatmentPlan(fixture).totals.patientCents;
}
samples.push((performance.now() - start) / scenario.batches);
assert.equal(checksum, result.totals.patientCents * scenario.batches);
}
samples.sort((a, b) => a - b);
measurements.push({ case: scenario.name, lines: scenario.size, medianMsPerPlan: samples[2].toFixed(3) });
}
console.log(process.version, process.platform, process.arch);
console.table(measurements);
JS
One run on Node.js 24.14.1 for macOS arm64 produced these medians per estimate.
| Coverage | Lines | Median ms |
|---|---|---|
| Single | 40 | 0.016 |
| Standard COB | 40 | 0.022 |
| Non-duplication | 400 | 0.198 |
The timed loop includes validation, integer-cent benefit calculation, and ledger allocation. Each median comes from five warmed samples. To measure the effect of changing COB formulas, use the same line count and fees for both modes. With real plan terms, carrier rules determine the order and credit applied to deductibles, maximums, and secondary benefits.
Switch between standard and non-duplication in the interactive GitHub Pages demo. See DentalPlan for dental cost workflows and BoatHaul for transport cost estimates.
Top comments (0)