Calculation type
Maps each charge's code to an APC code via a normal or 'complexity' schedule -- choosing the complexity table when a same-account or self-referential complexity relationship is detected for any of the charge's codes -- then looks up a dollar fee for the resolved APC code (plus modifiers), including the account-level pseudo-charge in the loop.
Unused
This type appears in no customer's configuration in the snapshot.
for i = 0..NumCharges-1 (INCLUDING the account-level pseudo-charge at i=0): skip if IsExcluded(calc, charge) [ExclusionCodes match] OR (i!=0 AND IgnoreCharge(...)) -- note IgnoreCharge is never checked for i=0. isComplexityRelationship starts false ONCE per charge, then for each code on charge.GetCodeList(ComplexityRelationship's ChargeCodeDimension): walk that code's ComplexityRelationship records; a record sets isComplexityRelationship=true either when Head.Code==Head.Member (self-referential) AND (charge.Units>1 OR charge.ContainsCodes(BilateralCodes)), OR -- in the else branch, which also fires when the self-referential units/bilateral test fails -- when ANY other charge j!=i (including j=0 and including IgnoreCharge'd charges; a commented-out guard shows this filtering was once intended but is currently disabled) carries Head.Code. codeScheduleRecord = lookup this code in ComplexityAPC schedule if isComplexityRelationship else in ChargeCodeToAPC schedule; if found, look up FeeScheduleRecord in APCToAmount schedule keyed by (APC code, modifiers built from ModifierDimension if configured) and SetBase(feeScheduleRecord.Amount). No error if the code isn't found in either APC schedule -- charge is simply left unset for that code.
| Key | Meaning |
|---|---|
| ChargeCodeToAPC | Schedule type key mapping charge code -> APC code (normal, non-complexity case). |
| APCToAmount | Schedule type key (fee schedule) mapping APC code (+modifiers) -> dollar amount. |
| ComplexityRelationship | Schedule type key of codes defining the complexity-relationship grouping that decides which APC table (ComplexityAPC vs ChargeCodeToAPC) to use; also supplies the ChargeCodeDimension iterated over. |
| ComplexityAPC | Schedule type key mapping charge code -> APC code when a complexity relationship is detected. |
| BilateralCodes | List<DimensionMember>; presence on the charge, combined with a self-referential complexity record, marks complexity relationship even with Units==1. |
| ExclusionCodes | List<DimensionMember>; any matching code on the charge (checked via IsExcluded, independent of IgnoreCharge) skips that charge entirely, including the account-level pseudo-charge. |
Gotchas
(1) isComplexityRelationship is initialized ONCE per charge, outside the per-code foreach loop, and never reset between codes -- if a charge carries multiple codes on the ComplexityRelationship dimension and an EARLIER code sets the flag true, every SUBSEQUENT code on that same charge is priced off the ComplexityAPC schedule even if that later code's own rules would not have triggered complexity on its own. A reimplementer who (reasonably) resets the flag per code will get different pricing for multi-code charges. (2) The loop runs i=0..NumCharges-1 and explicitly skips the IgnoreCharge filter for i==0 -- the account-level pseudo-charge is always evaluated (subject only to ExclusionCodes), unlike most other Base calculations that start at i=1. (3) The self-referential branch (Code==Member) does not stop at the Units/BilateralCodes check when it fails -- it falls through to searching sibling charges for the same code, so two separate charge lines carrying the identical self-referential code can trigger complexity relationship even with Units==1 and no bilateral code, purely because they duplicate each other. (4) Sibling-charge search (`context.Charges[j].HasCode(...)`) has no IgnoreCharge or j==0 guard live in the code -- a commented-out line shows a stricter version was once intended -- so a charge that would itself be filtered out, or the account row, can still trigger a sibling's complexity relationship.
class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CustomerDataModel.cs:836
calculator · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:1447 (private method CalculateAPC; helper IsExcluded at :1430; no separate Calculator/Generator class)
dispatch · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:675-677 (case APCCalculation apc: CalculateAPC(apc, context);) inside ApplyBaseCalculation
CONFIRMED