Operating payment is the federal rate with COLA on the nonlabor portion, times (1 + operating IME + operating DSH), plus the uncompensated-care add-on. The impact-file operating DSH is already the empirically justified factor and is not multiplied by 0.25. Capital payment is the Table 1D national rate times the hospital GAF, times (1 + capital IME + capital DSH). The impact file is the final-rule model, not the quarterly Provider Specific File. An outlier is the 42 CFR 412.84 marginal factor on the excess of charge-based cost over that claim payment and the wage- or GAF-adjusted fixed-loss share. No charges, or no published fixed-loss threshold, produces no outlier. The national wage-index-1 federal-rate identity is unchanged.
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 |
| IPPS operating claim | ippsOperatingClaim |
ipps.calcs.payment.operating_claim |
| IPPS capital claim | ippsCapitalClaim |
ipps.calcs.payment.capital_claim |
| IPPS outlier | ippsOutlier |
ipps.calcs.payment.outlier_payment |
A missing OPPS wage index is 1. oppsAdjusted_wageIndex_one says the
labor share then cancels. An IPPS claim at COLA 1 with IME, DSH, and
uncompensated care at 0 equals ippsOperating. Capital at GAF 1 with
IME and DSH at 0 equals ippsCapital.
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. - 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. IPPS claim payment is an
output of the formula, not a sampled point. There is 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.