Counterparty Validation
The highest confidence signal: payer and hospital independently report similar rates for the same ROID. A match earns score 7.
The Logic
For each payer rate column, check if it matches any hospital rate within ±20% (or ±10% for rates above $15,000). And vice versa for hospital rates.
-- Counterparty Validation (Score = 7)
-- Highest confidence: payer and hospital independently agree
-- For a PAYER rate, check against ALL hospital rates:
CASE WHEN
any_match(
filter(hospital_rates_array, h -> h IS NOT NULL),
h ->
-- Match within +/-20% (or +/-10% for rates > $15k)
ABS(payer_rate - h) <= CASE
WHEN payer_rate < 15000 THEN 0.20 ELSE 0.10
END * payer_rate
OR
ABS(payer_rate - h) <= CASE
WHEN payer_rate < 15000 THEN 0.20 ELSE 0.10
END * h
)
-- Must ALSO pass outlier bounds for this bill type
AND rate BETWEEN medicare_lower AND medicare_upper
THEN 7 + (rate / 1e8) -- 7.xxxxx: tiny tiebreaker for higher rates
END
-- For a HOSPITAL rate, same logic but checks payer_rates_array
-- Symmetric: both directions must pass for Score = 7
Walk-Through: Counterparty Validation
Payer and hospital MRF files are independently produced. Differences arise from rounding, per-day vs per-case structures, and reporting methodology variations. The 20% tolerance (10% above $15K) accounts for these structural differences while requiring fundamental agreement.
Both directions are checked independently. A payer rate gets score 7 if it matches a hospital rate, AND a hospital rate gets score 7 if it matches a payer rate. Both validated rates compete in the final selection.