The escape hatch
1,189 calculations are raw T-SQL, spread across 828 of 1,612 fee logics — but only 268 distinct bodies. All 268 have been read. The shapes that recur tell you more about the migration than the totals do.
Count bodies, not uses
Effort scales with distinct SQL to port; volume scales with uses. The two give opposite answers, because two snippets account for 36% of all SQL usage while172 of 268 bodies are used exactly once. A uses-weighted read makes the corpus look consolidatable. It is not — it is a long, thin, customer-specific tail.
| Dependency | Bodies | % bodies | Uses | % uses |
|---|---|---|---|---|
| none | 86 | 32.1 | 368 | 31 |
| mixed | 75 | 28 | 139 | 11.7 |
| legacy-etl | 49 | 18.3 | 100 | 8.4 |
| payer-crosswalk | 31 | 11.6 | 75 | 6.3 |
| medicare-reference | 17 | 6.3 | 493 | 41.5 |
| customer-schedule | 10 | 3.7 | 14 | 1.2 |
155 of 268 bodies (58%) need data the replacement cannot reach — legacy per-customer ETL output and payer crosswalk tables — but only 26% of uses.
| Uses | Custs | Dependency | Difficulty | What it computes |
|---|---|---|---|---|
| 236 | 8 | medicare-reference | medium | Allocates a global-surgery-period allowed amount to its post-operative portion: pulls a procedure's POST_OP percentage and GLOB_DAYS (global period length) from Medicare RVU reference data and returns Allowed / GlobalDays * PostOpRate — i.e. a per-day post-op share of the total global allowed amount. |
| 190 | 2 | medicare-reference | low | Same global-surgery post-op allocation as hash c5fd5754fcf4a52d (Allowed/GlobalDays*PostOpRate), but hardened: falls back to returning {Allowed} unchanged when GLOB_DAYS or POST_OP is missing/non-numeric/zero instead of dividing by zero. |
| 119 | 1 | none | low | A cosmetic/no-charge carve-out override: for charges whose extracted code fields flag them as 'no charge' (CS='NC'), cosmetic (CT like COS/S9999MN), or specific vision codes (V2786F/V2787F/V27878F), it returns the billed charge as-is (or zero when the billed charge is itself zero) instead of running normal fee-schedule pricing. |
| 47 | 1 | medicare-reference | medium | Caps a charge's allowed amount when its billed units exceed a per-procedure maximum-allowed-units limit (a therapy/multiple-unit cap): if the code has a configured max-units value and billed Units exceed it, the allowed amount is scaled down proportionally (Allowed * maxUnits/units); otherwise Allowed passes through unchanged. |
| 38 | 2 | none | medium | For charges flagged with a custom 'ML' (manual-limit) code = 'Yes', applies a flat 15% reduction (Allowed*0.85) unless the charge carries modifier TC/AS or its code falls in one of several excluded ranges/patterns (alpha-prefixed codes, 95xxx, lab 80047-89398, radiology 70010-79999, immunization 90281-90470/90475-90749, cardio 93000-93278). |
| 33 | 1 | mixed | high | Anesthesia fee-schedule lookup with a CRNA doubling rule: looks up a base fee from the customer's fee schedule by code/insurance/facility-type/modifier/date, then doubles it (x{Units}x2 instead of x{Units}) when the facility is flagged as a CRNA site and the matched schedule entry is itself flagged as an anesthesia line. |
| 15 | 1 | none | low | Zeroes the allowed amount for two specific drug HCPCS codes (J1097, J1096) — an unconditional 'no separate payment' exclusion for those two codes. |
| 11 | 1 | payer-crosswalk | high | Humana commercial 'carveout' fee lookup: resolves the billing provider's Humana specialty and the facility's Humana region, then looks up a flat carveout dollar amount keyed by specialty+region+procedure code+modifier+date range. |
| 11 | 1 | legacy-etl | medium | Anesthesia fee-schedule lookup restricted to anesthesia CPT codes (00100-01999) for Anthem VA/NV, selecting between two Anthem carveout schedules ('GAVA-Anthem-NV-Anes-Carveouts' vs '...Tidewater-Anes-Carveouts') based on a geo-locale code embedded in {Codes}. |
| 11 | 1 | payer-crosswalk | high | BCBS RVU-style fee lookup: resolves the billing provider's specialty and 'Exhibit B' provider flag via a BCBS-specific crosswalk, resolves the facility's type, then looks up a per-unit fee keyed by charge type+modifier(26/TC only)+specialty+ExhibitB flag+facility type+date, multiplied by Units. |
| 9 | 1 | legacy-etl | high | APG (Ambulatory Payment Group) rate computation: maps a procedure code to an APG/EAPG code, looks up that APG's relative weight for the service date, looks up a base rate by practice+rate-code+facility-zip+date, and multiplies BaseRate * Weight. |
| 8 | 1 | none | low | Optometry fee-schedule lookup that selects between a 'Optometry-Hospital' vs 'Optometry-Clinic' schedule based on the charge's place-of-service (via a secondary POS-Code-Indicators schedule), then returns the matching fee * Units. |
One rule is a third of the estate
Two bodies, both named “Modifier 55 Adj”, account for 426 uses — 35.8% of all SQL. Every one is gated by a single filter: modifier 55 present. It is Medicare's split-surgical-care rule. Porting it correctly retires more than a third of the SQL estate — but its gate is a Filter, the mechanism the replacement does not implement, one customer runs both variants, and both select their reference row withTOP 1 keyed on procedure code alone while the CMS file is keyed on code and modifier.