Calculation type

LengthOfStayOutlierAdjustment

Account-level outlier adjustment based on length of stay (read directly off Units on the account-level pseudo-charge): if length of stay exceeds a fee-schedule threshold, adds a per-diem amount, times the number of days over threshold, on top of the existing account-level allowed amount.

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. los = Charges[0].Units (decimal-cast). If los > T[0].Amount: P = GetFeeScheduleRecords(context, PerDiemScheduleTypeKey) (P[0] dereferenced with NO null check); Details[0].Adjust(Details[0].Amount + (los - T[0].Amount) * P[0].Amount, calc).

Parameters

KeyMeaning
ThresholdScheduleTypeKeyFee schedule key providing the length-of-stay (days) threshold above which the outlier adjustment triggers; null-checked before use.
PerDiemScheduleTypeKeyFee schedule key providing the dollar-per-day rate applied to the number of days over the threshold; its lookup record (P[0]) is NOT null-checked.

Gotchas

Same unguarded P[0].Amount null-deref risk as ChargeOutlierAdjustment: if the threshold is exceeded but PerDiemScheduleTypeKey has no matching record, this throws rather than no-op'ing. Also: length of stay is read directly from Charges[0].Units with no dedicated LOS field or unit validation -- whatever populates the account-level pseudo-charge's Units drives this calculation entirely, so a data pipeline that leaves that Units field at its default (e.g. 0 or 1) will silently produce wrong/absent outlier payments with no error.

In the source

class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CustomerDataModel.cs:1065
dispatch · CalculationEngine.cs:816 (case at 815-817), executing CalculationEngine.CalculateLengthOfStayOutlierAdjustment at CalculationEngine.cs:1921

CONFIRMED: draft formula, key_attrs, hardcoded Account level, and 'no separate Calculator class' claim all match CalculationEngine.cs:1921-1934 and CustomerDataModel.cs:1065 exactly. Added the P[0] null-deref gotcha (per critique.md's cross-cutting finding) which draft's own notes omitted.