138 lines
3.4 KiB
Python
138 lines
3.4 KiB
Python
"""The LEAD target registry matches the spec's IDs."""
|
||
|
||
from __future__ import annotations
|
||
|
||
import pytest
|
||
from typer.testing import CliRunner
|
||
|
||
from cli import app
|
||
from lead.targets import TARGETS, by_id
|
||
|
||
runner = CliRunner()
|
||
|
||
EXPECTED_IDS = {
|
||
"Q.ACR",
|
||
"Q.UAMCC",
|
||
"Q.DAH",
|
||
"Q.TFU",
|
||
"Q.CAHPS",
|
||
"Q.CBP",
|
||
"Q.GSD",
|
||
"HN.1",
|
||
"HN.2",
|
||
"HN.3",
|
||
"HN.4",
|
||
"HN.5",
|
||
"HN.6",
|
||
"HN.7",
|
||
"RA.PROSP",
|
||
"RA.CONC",
|
||
"RA.ESRD",
|
||
"RA.NORM",
|
||
"RA.CI",
|
||
"RA.CAP",
|
||
"RA.SAHS",
|
||
"BM.HISTORICAL",
|
||
"BM.VOLUNTARY_GUARDRAIL",
|
||
"BM.REGIONAL",
|
||
"BM.SPENDING_DESIGNATION",
|
||
"BM.ADJ_CAP",
|
||
"BM.REGIONAL_EFFICIENCY",
|
||
"BM.PRIOR_SAVINGS",
|
||
"BM.PY",
|
||
"BM.DISCOUNT",
|
||
"BM.QUALITY_WITHHOLD",
|
||
"BM.QUALITY_EARN_BACK",
|
||
"BM.RETENTION",
|
||
"BM.GROSS",
|
||
"BM.SHARED",
|
||
"BM.SEQUESTRATION",
|
||
}
|
||
|
||
NAMES = {
|
||
"HN.1": "mobility-impairment diagnosis",
|
||
"HN.2": "hospital bed or transfer-equipment DME claim",
|
||
"HN.3": "Kim claims-based frailty index",
|
||
"HN.4": "A&D risk score ≥ 3.0",
|
||
"HN.5": "ESRD risk score ≥ 0.35",
|
||
"HN.6": "A&D 2.0–3.0 or ESRD 0.24–0.35 plus ≥ 2 unplanned admissions",
|
||
"HN.7": "≥ 45 covered SNF days",
|
||
"RA.PROSP": "non-High Needs A&D",
|
||
"RA.CONC": "High Needs concurrent",
|
||
"RA.CAP": "4% High Needs growth cap",
|
||
"RA.SAHS": "anomalous-billing and skin-substitute mitigation",
|
||
"BM.HISTORICAL": "historical_benchmark",
|
||
"BM.VOLUNTARY_GUARDRAIL": "voluntary_guardrail",
|
||
"BM.REGIONAL": "regional_ffs_expenditure",
|
||
"BM.SPENDING_DESIGNATION": "spending_designation",
|
||
"BM.ADJ_CAP": "benchmark_adjustment_cap",
|
||
"BM.REGIONAL_EFFICIENCY": "regional_efficiency_adjustment",
|
||
"BM.PRIOR_SAVINGS": "prior_savings_adjustment",
|
||
"BM.PY": "performance_year_benchmark_pbpm",
|
||
"BM.DISCOUNT": "apply_discount",
|
||
"BM.QUALITY_WITHHOLD": "quality_withhold",
|
||
"BM.QUALITY_EARN_BACK": "quality_earn_back",
|
||
"BM.RETENTION": "retention_incentive_adjustment",
|
||
"BM.GROSS": "gross_savings_losses",
|
||
"BM.SHARED": "shared_savings_losses",
|
||
"BM.SEQUESTRATION": "sequestration_amount",
|
||
}
|
||
|
||
|
||
def test_registry_matches_the_spec():
|
||
assert {t.id for t in TARGETS} == EXPECTED_IDS
|
||
assert [t.id for t in TARGETS] == [
|
||
"Q.ACR",
|
||
"Q.UAMCC",
|
||
"Q.DAH",
|
||
"Q.TFU",
|
||
"Q.CAHPS",
|
||
"Q.CBP",
|
||
"Q.GSD",
|
||
"HN.1",
|
||
"HN.2",
|
||
"HN.3",
|
||
"HN.4",
|
||
"HN.5",
|
||
"HN.6",
|
||
"HN.7",
|
||
"RA.PROSP",
|
||
"RA.CONC",
|
||
"RA.ESRD",
|
||
"RA.NORM",
|
||
"RA.CI",
|
||
"RA.CAP",
|
||
"RA.SAHS",
|
||
"BM.HISTORICAL",
|
||
"BM.VOLUNTARY_GUARDRAIL",
|
||
"BM.REGIONAL",
|
||
"BM.SPENDING_DESIGNATION",
|
||
"BM.ADJ_CAP",
|
||
"BM.REGIONAL_EFFICIENCY",
|
||
"BM.PRIOR_SAVINGS",
|
||
"BM.PY",
|
||
"BM.DISCOUNT",
|
||
"BM.QUALITY_WITHHOLD",
|
||
"BM.QUALITY_EARN_BACK",
|
||
"BM.RETENTION",
|
||
"BM.GROSS",
|
||
"BM.SHARED",
|
||
"BM.SEQUESTRATION",
|
||
]
|
||
assert by_id("HN.3").name.startswith("Kim")
|
||
assert by_id("Q.ACR").family == "quality"
|
||
for target_id, name in NAMES.items():
|
||
assert by_id(target_id).name == name
|
||
|
||
|
||
def test_unknown_target_raises():
|
||
with pytest.raises(KeyError):
|
||
by_id("nope")
|
||
|
||
|
||
def test_targets_command_lists_the_registry():
|
||
result = runner.invoke(app, ["lead", "targets"])
|
||
assert result.exit_code == 0
|
||
assert "HN.3" in result.stdout
|
||
assert "BM.SEQUESTRATION" in result.stdout
|