The wage index, pass-through rates, the missing APC years, the CY2027 work GPCI, equipment usage, IPPS standardized amounts, MS-DRG weights, and the MSSP and REACH financial results now come from the CMS files. The snapshot records those observed ranges. Maintenance stays the published 5/100. There is still no IPPS or LEAD pricer.
Pay
Lean 4 ceilings for the Medicare payment formulas this repo already computes. Python joins the CMS files. These definitions are the exact rational values those calculations have to meet.
Toolchain leanprover/lean4:v4.34.0, the same pin as the vendored
Mathematics in Lean textbook. Mathlib is required at v4.34.0.
Pay/Basic.lean checks the rational identities with norm_num and
ring. pay-cases imports only the definitions, so printing the cases
does not link mathlib.
What is a formula
| Method | Ceiling | Where Python computes it |
|---|---|---|
| PFS fee schedule | pfsPayment |
pfs.calcs.payment.payment |
| Non-PAR limiting charge | limitingCharge |
pfs.calcs.payment.limiting_charge |
| OPPS wage adjustment | oppsAdjusted |
opps.calcs.payment.payment |
| Part B drug limit | aspPaymentLimit |
opps.express.payment.skin_sub_impact (ASP × 1.06) |
| Equipment cost / minute | equipmentCostPerMinute |
pfs.calcs.payment.equipment_cost_per_use |
| MPPR on later PE ranks | mpprPe |
pfs.calcs.payment.mppr_reduction |
| QPP year offset | paymentYear |
qpp (payment_year = performance_year + 2) |
| REACH quality earn-back | reachEarnBack |
Documented on the REACH quality table; CMS publishes the column |
A missing OPPS wage index is 1. oppsAdjusted_wageIndex_one says the
labor share then cancels.
What is not a formula here
ceiling records the rest.
- MSSP and REACH settlements are the published CMS tables under
src/aco. There is no shared-savings function to put a maximum on. - IPPS has no pricer in this repo.
- LEAD in this repo is the review application (
src/lead), not a payment model. No LEAD pricer is invented here. - QPP thresholds stay in
src/qpp, cited to the Federal Register. Only the two-year offset is a formula in this slice.
Bounds
src/pay/bounds.json is the fence for a later search. Published
constants (a year's conversion factor, ASP + 6%, the limiting-charge
factor, the 60% labor share, the two-year QPP offset) are points, not
knobs. Observed rows are the per-period minimum and maximum in the
replica for the columns the formulas read. A global span is not stored.
The free knobs are a tag confidence in [0, 1], a REACH quality score in
[0, 1], and an MPPR rank that is an integer of at least 1. The year
window is whichever periods the file lists.
pay.bounds.allows rejects a point outside that row. It also rejects
proposed NPRM numbers, an unstated null (nothing is imputed), and a
limiting-charge fee, which is an output of pfsPayment. The OPPS wage
index is the IPPS final-rule table for that fiscal year (Table 3, or
Table 4A and 4B in FY2014 and FY2015). A blank pre-reclassification
index stays blank. Equipment maintenance is the published factor 5/100
for every item; the straight-line function still fills a missing factor
with 0, and that fill is not the CMS factor. There is no IPPS claim
pricer and no LEAD pricer. Standardized amounts and MS-DRG weights are
published points and ranges. MSSP and REACH settlements stay published
tables; the observed dollar columns are separate rows, and there is no
savings function to sample. The budget-neutrality adjustor is already
inside the conversion factor.
Rebuild the file from the registries and data/replica/aco.ro.duckdb
when either changes. A checkout without the replica still checks the
registries against the committed file.
Check
lake exe cache get # mathlib oleans; do not build mathlib from source
lake build
lake exe pay-cases > cases.json
.gitea/workflows/lean-pay.yml runs that check when lean/ or the
workflow file changes. The runner downloads Lean 4.34.0 from the GitHub
release (releases.lean-lang.org times out from this network) and uses
the mathlib olean cache.
tests/pay/test_ceiling.py runs the Python functions on these inputs
and requires the rationals in cases.json. When lake is on PATH it
also requires pay-cases to reprint that file.