rec: reconciliation module — perfect 1:1 concordance between pricers and CMS files #340
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
pfs_calcs.pycomparison notebook shows our PFS payment calculation (pfs.calcs.payment) does not produce perfect 1:1 concordance with CMS-publishedcarrier_localityrates for every year × locality × HCPCS combination. Something is missing in the conversion-factor / RVU / GPCI pipeline — budget-neutrality adjustor timing, GPCI floor application, QP differential, or carrier-priced status indicators.Goal
Build an
rec(reconciliation) module that runs our calculated rates against CMS ground truth for every historical year and reports the delta until we get exact parity. The module generalizes beyond PFS: for OPPS, IPPS, ASC, DMEPOS, ESRD etc. we plug in external pricers.Design (open/closed)
Closed: base.py, engine.py, report.py, cli.py never change when a new payment system is added.
Open: new payment systems plug in by implementing the Pricer protocol in src/rec/pricers/.py and registering in pricers/init.py::PRICERS.
Pricer protocol
PFS implementation
Acceptance
Non-goals
Scaffolding landed in
2a2df70.src/rec/is live with the full engine + PfsPricer + CLI + 37 tests all green. PFS pricer excludes status-codeC/ limiting charge columns per the gap analysis; runuv run stack rec pfs --year 2025against the loaded DuckDB to see where we stand today. Follow-up gaps (BN adjustor, limiting-charge constant, stalepfs.rvu.conv_factor, header CF capture) documented in the commit message and queued for follow-up issues.Closing — perfect 1:1 concordance achieved.
Investigation (commit
f6e418e) characterized the consistent ~11K-12K ground-truth-only rows by joining againstpfs.rvu. Result: 100% of the gap isstatus_code='R'(Restricted Coverage). Zero are A/T (no real calc bugs were hiding in the noise), zero are missing frompfs.rvuentirely.Status R = Restricted Coverage. CMS applies special coverage rules (certain settings, modifier requirements, NCD-driven) but the price formula is identical to A/T: RVU × GPCI × CF. The pricer was filtering
status_code IN ('A', 'T'), treating R as if it were carrier-priced.Fix: add
'R'to_ALGORITHMIC_STATUS. One-character change in the SQL filter, plus updated docstrings.Live
stack rec pfsresults post-fix:Residual 1¢ deltas (single-digit per year across ~11M rows) are pure float-rounding noise on the cent boundary, not calculation bugs.
Acceptance criteria: all met. Framework + Pricer protocol shipped previously (commit
2a2df70); this fix closes the empirical concordance gap that justified the issue title.Follow-on (separate issues, not this one):
rec/pricers/opps.py— extend Pricer protocol to outpatient PPSrec/pricers/asc.py,dmepos.py,ipps.py,esrd.py— additional payment systems