Calculation type
Looks up a Medicare clinical lab fee for a charge's HCPCS code, branching on service date at 2018-01-01 between a national post-2018 table and a state-keyed legacy table, then rescales by RuleMultipliers or Percentage/100.
Same ChargeLevelSqlCalculator driver. MedicareLabSqlGenerator.GetParameters: if a charge modifier equals 'QW' (the only entry in validModifiers), @Modifier is forcibly overwritten to 'QW' regardless of what GetSharedParameters originally found (the first Modifier-dimension code on the charge); otherwise @Modifier stays whatever GetSharedParameters picked. GetQuery: if @BaseDate >= 2018-01-01, pull from MedicareDataLab2018 WHERE HCPCS=@ProcedureCode with Priority=LEN(Mod), matched by '([Mod] IS NULL OR [Mod] = @Modifier)' (the extra '(@Modifier IS NULL AND [Mod] IS NULL)' clause is redundant with the standalone '[Mod] IS NULL' disjunct -- a NULL-mod row always matches regardless of @Modifier). Else (pre-2018), resolve @StateCode from Facility.StateCode falling back to MedicareDataZipCodeMap by zip if StateCode is blank/null, then pull from MedicareDataLab WHERE ProcedureCode/StateCode match and Priority=LEN(Modifiers), matched by '(@Modifier IS NULL AND Modifiers = %) OR (+ @Modifier) LIKE Modifiers'. Both branches join to MedicareScheduleLab/MedicareSchedule (end date via LEAD, partitioned by State/Carrier/LocalityCode) and pick TOP 1 ORDER BY Priority DESC. Then the same round(fee*Units,2,AwayFromZero) -> RuleMultiplier-or-DefaultMultiplier -> round chain as MedicareDME/Drug; detail.SetBase(amount, calc).
| Key | Meaning |
|---|---|
| StateCode | Optional 2-letter state code (declared on MedicareLabCalculation); only consulted in the pre-2018 branch (MedicareDataLab is state-specific) -- ignored entirely for post-2018 dates. Falls back to a zip-code lookup (MedicareDataZipCodeMap) via the charge's facility if blank. |
| BaseDate | Optional override date (inherited from MedicareCalculation); determines both the schedule period AND which of the two data-source branches (2018+ vs legacy) runs; defaults to context.ServiceDate. |
| Percentage | Decimal, default 100 (inherited); DefaultMultiplier = Percentage/100 applied when no RuleMultipliers rule matches. |
| RuleMultipliers | List<IMultiplierRule> (IHasRuleMultipliers); matched rule's Multiplier overrides the Percentage-derived DefaultMultiplier. |
Gotchas
Only the literal modifier code 'QW' is ever specially selected for the lookup (validModifiers = ['QW']); any other charge modifier the schedule might care about is not consulted -- @Modifier just carries whatever GetSharedParameters found first, which may not even correspond to a row in the schedule, silently falling back to whichever NULL-Mod/wildcard row exists (per the WHERE-clause simplification above) rather than throwing or erroring. The 2018-cutoff branch selection is driven by @BaseDate, which itself can be overridden by the calc's own BaseDate field, so setting BaseDate to a pre-2018 date on an otherwise-current calc silently switches which physical table (and which StateCode logic) is consulted. Same round(fee*Units)->multiplier->round chain as MedicareDME/Drug, absent from the draft's formula.
class · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/PricingEngine/Calculations/Medicare/MedicareLabCalculation.cs:6
calculator · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/PricingEngine/Calculations/Medicare/MedicareLabSqlGenerator.cs:11
dispatch · /home/cary/src/mdc/MdClarity/MDClarity/MDClarityCore/Backend/CalculationEngine.cs:703
CORRECTED: draft's two-branch description and modifier-priority note were essentially right, but it did not simplify/verify the compound WHERE-clause boolean logic (the 'AND' clause is redundant with the standalone IS NULL disjunct, meaning any NULL-Mod schedule row is an unconditional match), did not note that BaseDate itself controls which of the two source tables is used, and omitted the round-then-multiply-then-round sequencing shared with MedicareDME/Drug.