Calculation type

ChargeOutlierAdjustment

Account-level outlier adjustment (Medicare cost-outlier-style logic): if total charged amount on the account (excluding ignored charges) exceeds a fee-schedule threshold, adds a payment on top of (or, in one mode, replaces) the account-level allowed amount based on a percentage of the amount over/at threshold.

0
uses
0
customers
Adjustment
category
Account
applies at

Unused

This type appears in no customer's configuration in the snapshot.

What it computes

T = GetFeeScheduleRecords(context, ThresholdScheduleTypeKey); only proceeds if T[0] != null. charges = sum(AmountCharged) and allowed = sum(Details[i].Amount) over i=1..NumCharges-1 excluding IgnoreCharge lines. If charges > T[0].Amount: P = GetFeeScheduleRecords(context, PercentageScheduleTypeKey) (P[0] dereferenced with NO null check); if ApplyToTotalCharges: z = charges*(P[0].Amount/100) - allowed; else: z = Details[0].Amount + (charges - T[0].Amount)*(P[0].Amount/100.0M); Details[0].Adjust(z, calc).

Parameters

KeyMeaning
ThresholdScheduleTypeKeyFee schedule key providing the charge-amount threshold above which the outlier adjustment triggers; null-checked before use.
PercentageScheduleTypeKeyFee schedule key providing the percentage applied to the charges (or the excess over threshold); its lookup record (P[0]) is NOT null-checked.
ApplyToTotalChargesBoolean, default false; when true the adjustment recomputes the account amount as percentage-of-total-charges minus already-allowed (an outright REPLACEMENT of the effective total), rather than ADDING percentage-of-excess-over-threshold on top of the existing account-level Details[0].Amount.

Gotchas

P[0].Amount is dereferenced with no null-guard (unlike T[0], which is checked) -- if PercentageScheduleTypeKey resolves to no matching fee-schedule record while the threshold IS exceeded, this throws a NullReferenceException at pricing time rather than being a silent no-op. Also: 'allowed' sums Details[i].Amount only for i=1..NumCharges-1 (excludes the account-level Details[0] itself), so in the ApplyToTotalCharges branch the new Details[0] value is computed purely from line-level allowed totals, discarding whatever Details[0].Amount already held (unlike the non-ApplyToTotalCharges branch, which explicitly adds onto Details[0].Amount).

In the source

class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CustomerDataModel.cs:1042
dispatch · CalculationEngine.cs:813 (case at 812-814), executing CalculationEngine.CalculateChargeOutlierAdjustment at CalculationEngine.cs:1882

CONFIRMED: draft formula, key_attrs, hardcoded Account level, class hierarchy (Calculation, IAdjustment, no ScheduleTypeCalculation base), and 'no separate Calculator class' claim all match CalculationEngine.cs:1882-1918 and CustomerDataModel.cs:1042 exactly. Added the P[0] null-deref gotcha, which the draft's own notes omitted but critique.md independently flagged as missing from both outlier records.