Calculation type

MultipleEndoscopyAdjustment

Implements the CMS multiple-endoscopy base-procedure rule: for each family of charges sharing the same schedule rollup base code, the top-ranked unit is paid in full and every other unit in the family is reduced by a freshly re-priced 'base procedure' amount.

91
uses
7
customers
Adjustment
category
Charge
applies at

What it computes

rollups = IMultipleEndoscopyScheduleRepo.GetCodeScheduleRecords(context, ScheduleType); group charges (i=1..NumCharges-1, not IgnoreCharge'd, rollup.Code != null) into baseCodes[rollup.Code] -> list of indices. For each base-code group: affected = calculationEngine.GetChargeOrder(group, SortBy) (per-unit descending); baseAmount = re-run calculationEngine.CalculateAmountAllowedBase on a synthetic 1-unit charge coded with the base procedure code, built by merging the shared attributes of every affected charge (BuildSharedContextCharge nulls out ChargeTypeID/BillTypeKey/ProviderID/Coverage/ScheduledTime/PatientAge/IsCustom wherever they differ across the group) - this reads Details[1].Amount from a cloned context, not a plain schedule lookup. Then for each charge in ranked order: adjustedUnits = charge.Units; the FIRST charge processed with Units>0 gets adjustedUnits -= 1 (its one 'free' unit); adjustmentAmount = MoneyMath.Multiply(baseAmount, adjustedUnits) (decimal*int overload, no rounding applied at this step); if adjustmentAmount > detail.Amount: Adjust(0.0M); else if adjustmentAmount > 0.0M: Adjust(detail.Amount - adjustmentAmount); else if adjustmentAmount==0.0M and affected.Count>1: Adjust(detail.Amount) unchanged (re-stamp so the marker is recorded); if affected.Count==1 and adjustmentAmount==0, no Adjust call happens at all.

Parameters

KeyMeaning
ScheduleTypeFee/rollup schedule used both to resolve each charge's endoscopy base code (IMultipleEndoscopyScheduleRepo.GetCodeScheduleRecords) and, via IScheduleCache.GetScheduleType, the ChargeCodeDimension used to build the synthetic base-procedure charge (defaults to ProcedureCode if the schedule has none set).
SortBySortChargesBy enum ranking charges within each base-code family (per-unit amount, descending) before the full-payment-for-top-unit rule is applied.

Gotchas

1) baseAmount is computed ONCE per base-code family by re-running the ENTIRE base-pricing pipeline (CalculateAmountAllowedBase) on a synthetic merged charge, not by a fee-schedule lookup - it inherits every quirk of whatever base calculation chain the account is configured with (effective-dating, provider-specific fee schedules if ProviderID happened to be identical across the group and survived the merge, etc.). 2) The 'first unit is free' logic only fires on a charge with Units>0; if the top-ranked charge in a family has Units==0, the firstCharge flag is NOT consumed and the free-unit discount silently shifts to the next charge in rank order instead. 3) MoneyMath.Multiply(decimal, int) performs no rounding at all (unlike the decimal*double overload used by MultipleProcedureAdjustment/MultipleSurgeryAdjustment) - correctness here depends entirely on baseAmount already being rounded upstream. 4) A base-code family with exactly one member and Units<=1 produces adjustmentAmount==0 with affected.Count==1, so detail.Adjust is never invoked for that charge at all - not even a re-stamp - leaving no record in detail.Adjustments that this calculation type ever ran on it.

In the source

class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/PricingEngine/Adjustments/MultipleEndoscopyAdjustment.cs:6
calculator · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/PricingEngine/Adjustments/Calculators/MultipleEndoscopyAdjustmentCalculator.cs:12
dispatch · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:769-773

CONFIRMED - re-read MultipleEndoscopyAdjustment.cs and MultipleEndoscopyAdjustmentCalculator.cs in full; the draft's formula and three-branch Adjust logic matched the code exactly (consistent with the critique's independent spot-check). Added rounding-overload and first-unit-edge-case gotchas the draft did not cover.