diff --git a/README.md b/README.md index e4a7d76..28ae399 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![coverage](assets/icons/coverage.svg) -Healthcare analytics platform on self-hosted infrastructure. Replaces dbt SQL models with narwhals DataFrame-agnostic expression functions, backed by DuckDB locally and Iceberg/Trino in the lakehouse. 32 services, 14 data pipelines, 14,010 tests at 99% coverage. +Healthcare analytics platform on self-hosted infrastructure. Replaces dbt SQL models with narwhals DataFrame-agnostic expression functions, backed by DuckDB locally and Iceberg/Trino in the lakehouse. 33 services, 16 data pipelines, 18,510 tests at 99% coverage. ## Quick start @@ -37,7 +37,7 @@ pip install stack[all] # everything pip install stack[aco,aws] # ACO analytics with AWS storage ``` -18 modules available as optional extras: `aco`, `api`, `bcda`, `bib`, `bls`, `ccw`, `cli`, `cms`, `conf`, `llm`, `mail`, `opps`, `perf`, `pfs`, `prisma`, `rec`, `rex`, `sem`. Cloud providers: `aws`, `azure`, `gcp`. Aggregates: `all`, `lake`. +24 modules available as optional extras: `aco`, `api`, `bcda`, `bib`, `bls`, `ccw`, `cli`, `cms`, `conf`, `focus`, `ipps`, `lead`, `llm`, `mail`, `nlm`, `notebooks`, `opps`, `perf`, `pfs`, `prisma`, `qpp`, `rec`, `rex`, `sem`. Cloud providers: `aws`, `azure`, `gcp`. Aggregates: `all`, `lake`. ## Services @@ -86,11 +86,12 @@ All services route through Traefik at `*.fhirworx.io`. ### Pipelines -14 registered pipelines with 230 steps, validated by `run_pipeline(steps, load)` which enforces output schemas via pandera-style column checks. +16 registered pipelines with 244 steps, validated by `run_pipeline(steps, load)` which enforces output schemas via pandera-style column checks. | Pipeline | Steps | Domain | |----------|------:|--------| | `ahrq_measures` | 39 | AHRQ quality indicators | +| `bcda` | 13 | | | `cclf` | 19 | CCLF connector pipeline -- raw CCLF files -> input_layer tables | | `claims_preprocessing` | 63 | Claim matching, encounter IDs | | `cms_quality_measures` | 20 | CMS ACO quality metrics | @@ -98,6 +99,7 @@ All services route through Traefik at `*.fhirworx.io`. | `data_quality` | 1 | Validation and completeness | | `hcc_suspecting` | 6 | HCC risk adjustment | | `input_layer` | 13 | Raw CCLF/BCDA ingestion | +| `ipps` | 1 | IPPS operating federal rate for each MS-DRG and CBSA | | `main` | 14 | Full pipeline orchestration | | `opps` | 2 | Outpatient payment system | | `pharmacy` | 4 | Part D drug utilization | @@ -155,7 +157,7 @@ The generator reads image definitions from `stack.toml [images]`, dispatches to ### Workflows -10 workflows generated per backend: +14 workflows generated per backend: | Workflow | Trigger | What it does | |----------|---------|--------------| @@ -258,7 +260,7 @@ Switch with `STACK_CONTEXT=aws` or edit `stack.toml [context] active`. ## Databricks -Databricks Asset Bundle (`databricks.yml`) is auto-generated from the pipeline registry. 14 pipeline tasks with dependency ordering, 3 targets (dev/staging/prod), daily schedule. +Databricks Asset Bundle (`databricks.yml`) is auto-generated from the pipeline registry. 16 pipeline tasks with dependency ordering, 3 targets (dev/staging/prod), daily schedule. ```bash uv run python dev/scripts/gen_config.py --dab-sql # generate SQL + DDL (~4 min) @@ -419,7 +421,7 @@ The hook classifies staged files and runs only what is relevant: | `src/sem/*.py` | `tests/sem/` + `test_ast_coverage.py` | Module tests + structural invariants | | `src/aco/*.py` + `src/sem/*.py` | `tests/aco/` + `tests/sem/` + structural | Both module test dirs | | `tests/bib/test_sync.py` | `tests/bib/` | Changed test dir | -| `pyproject.toml` or `conftest.py` | Full suite (14,010+ tests) | Infrastructure change | +| `pyproject.toml` or `conftest.py` | Full suite (18,510+ tests) | Infrastructure change | | `notebooks/pfs_calcs.py` | `marimo check` + notebook execution | Notebook validation only | | `README.md` only | Nothing | No testable changes | @@ -471,7 +473,7 @@ Dynamic values pulled from: `compose.yml` (services), `pyproject.toml` (modules) ``` stack/ -├── compose.yml Docker Compose (32 services) +├── compose.yml Docker Compose (33 services) ├── stack.toml Centralised configuration ├── pyproject.toml Python project (uv, optional deps per module) ├── src/ @@ -484,12 +486,21 @@ stack/ │ ├── cli/ CLI entry point (typer) │ ├── cms/ CMS public data tables │ ├── conf/ Config loader, storage abstraction, table base +│ ├── drugs/ +│ ├── econ/ +│ ├── focus/ +│ ├── ipps/ Inpatient Prospective Payment System +│ ├── lead/ │ ├── llm/ │ ├── mail/ +│ ├── market/ +│ ├── nlm/ │ ├── opps/ Outpatient Prospective Payment System +│ ├── pay/ │ ├── perf/ Pipeline telemetry (OpenTelemetry) │ ├── pfs/ Physician Fee Schedule │ ├── prisma/ +│ ├── qpp/ │ ├── rec/ │ ├── rex/ REX fixed-width file processing │ ├── sem/ Semantic coverage orchestration @@ -513,10 +524,9 @@ stack/ ├── dev/ Dev tooling │ ├── scripts/ Code generators, bootstrap, supply chain tools │ ├── hooks/ Git hooks (tracked, core.hooksPath = dev/hooks) -│ ├── seeds/ Reference data (BCDA samples + v3 crosswalk, CMS docs) -│ ├── vendor/ Sparse pins: MANIFEST.toml (BCDA), mathematics_in_lean.toml (the textbook) +│ ├── seeds/ Reference data (BCDA samples, CMS docs) │ └── pipelines/ CI-agnostic pipeline specs -├── tests/ 14,010 tests at 99% coverage +├── tests/ 18,510 tests at 99% coverage ├── notebooks/ Marimo notebooks ├── docs/ Docusaurus site ├── data/ DuckDB, bib.sqlite, BCDA/CMS data, zotero (gitignored) diff --git a/dev/scripts/gen_readme.py b/dev/scripts/gen_readme.py index ba97142..6487b31 100644 --- a/dev/scripts/gen_readme.py +++ b/dev/scripts/gen_readme.py @@ -83,6 +83,7 @@ def _collect_pipelines() -> dict: "hcc_suspecting": "HCC risk adjustment", "input_layer": "Raw CCLF/BCDA ingestion", "main": "Full pipeline orchestration", + "ipps": "Inpatient operating federal rate", "opps": "Outpatient payment system", "pharmacy": "Part D drug utilization", "provider_attribution": "Provider-patient assignment", @@ -177,6 +178,7 @@ def _collect_src_tree() -> list[dict]: "cli": "CLI entry point (typer)", "cms": "CMS public data tables", "conf": "Config loader, storage abstraction, table base", + "ipps": "Inpatient Prospective Payment System", "opps": "Outpatient Prospective Payment System", "perf": "Pipeline telemetry (OpenTelemetry)", "pfs": "Physician Fee Schedule", diff --git a/pyproject.toml b/pyproject.toml index 391a9df..23f8d8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,6 +105,11 @@ cms = [ "narwhals>=2.17.0", "pydantic>=2.0.0", ] +ipps = [ + "stack[conf]", + "duckdb>=1.5.4", + "narwhals>=2.17.0", +] opps = [ "stack[conf]", "stack[rex]", @@ -285,6 +290,6 @@ link-mode = "copy" python-preference = "managed" [tool.uv.build-backend] -module-name = ["aco", "api", "bcda", "bib", "bls", "ccw", "cli", "cms", "conf", "focus", "lead", "llm", "mail", "nlm", "opps", "pay", "perf", "pfs", "prisma", "qpp", "rec", "rex", "sem"] +module-name = ["aco", "api", "bcda", "bib", "bls", "ccw", "cli", "cms", "conf", "focus", "ipps", "lead", "llm", "mail", "nlm", "opps", "pay", "perf", "pfs", "prisma", "qpp", "rec", "rex", "sem"] namespace = true source-exclude = ["compose.yml","infra/**","data/**","notebooks/**","tuva/**","assets/**","docs/**","dev/**","bundle/**","cloud/**"] diff --git a/src/aco/dag.py b/src/aco/dag.py index 8449385..6dd56ce 100644 --- a/src/aco/dag.py +++ b/src/aco/dag.py @@ -537,6 +537,7 @@ _ALL_PIPE_MODULES = [ "claims_preprocessing", "cclf", "opps", + "ipps", ] diff --git a/src/aco/pipe/__init__.py b/src/aco/pipe/__init__.py index e5bbbbb..d93eda5 100644 --- a/src/aco/pipe/__init__.py +++ b/src/aco/pipe/__init__.py @@ -8,6 +8,7 @@ from . import core as core from . import data_quality as data_quality from . import hcc_suspecting as hcc_suspecting from . import input_layer as input_layer +from . import ipps as ipps from . import main as main from . import opps as opps from . import pharmacy as pharmacy @@ -26,6 +27,7 @@ registry: dict[str, Pipeline] = { "data_quality": data_quality.pipeline, "hcc_suspecting": hcc_suspecting.pipeline, "input_layer": input_layer.pipeline, + "ipps": ipps.pipeline, "main": main.pipeline, "opps": opps.pipeline, "pharmacy": pharmacy.pipeline, diff --git a/src/aco/pipe/ipps.py b/src/aco/pipe/ipps.py new file mode 100644 index 0000000..00d7f16 --- /dev/null +++ b/src/aco/pipe/ipps.py @@ -0,0 +1,41 @@ +"""IPPS operating federal rate for each MS-DRG and CBSA.""" + +from __future__ import annotations + +from aco.express.base import Expr +from aco.pipe.base import Pipeline +from ipps.express import payment as ex +from ipps.table import OperatingPayment + +try: + from bib.tag import Tag +except ImportError: # pragma: no cover + Tag = None # stack[bib] not installed + +_REFS = [ + Tag.module("ipps"), +] + +pipeline = Pipeline( + upstream=[], + exprs=[ + Expr( + name="ipps.operating_payment", + fn=ex.operating_payment, + output=OperatingPayment, + after=[ + "ipps.drg_weight", + "ipps.standardized_amount", + "opps.wage_index", + ], + refs=_REFS, + description=( + "MS-DRG weight times the full-update labor and nonlabor " + "standardized amounts, adjusted by the pre-reclassification " + "wage index. IME, DSH, and outliers are not applied." + ), + ), + ], +) + +run = pipeline.run diff --git a/src/cli/rec.py b/src/cli/rec.py index 6038122..ebcacd6 100644 --- a/src/cli/rec.py +++ b/src/cli/rec.py @@ -110,11 +110,45 @@ def reconcile_opps( ) +@app.command("ipps") +def reconcile_ipps( + year: Annotated[ + int | None, + typer.Option("--year", "-y", help="Fiscal year to reconcile; omit for all."), + ] = None, + format: Annotated[ + str, + typer.Option("--format", "-f", help="Output format: md | json."), + ] = "md", + output: Annotated[ + Path | None, + typer.Option("--output", "-o", help="Write to file instead of stdout."), + ] = None, + tolerance_cents: Annotated[ + int, + typer.Option( + "--tolerance", + "-t", + help="Cents of tolerance for an 'exact' match.", + ), + ] = 0, +) -> None: + """Reconcile the IPPS operating rate at wage index 1.""" + _run_pricer( + "ipps", + year=year, + format=format, + output=output, + tolerance_cents=tolerance_cents, + ) + + # Per-pricer hint for the "no years available" message — names the # source tables a user must load before reconciliation can run. _DATA_HINTS: dict[str, str] = { "pfs": "pfs.rvu / pfs.gpci / pfs.carrier_locality", "opps": "opps.addendum_b", + "ipps": "ipps.drg_weight / ipps.standardized_amount", } diff --git a/src/ipps/__init__.py b/src/ipps/__init__.py new file mode 100644 index 0000000..b6a11d6 --- /dev/null +++ b/src/ipps/__init__.py @@ -0,0 +1,24 @@ +"""ipps — Inpatient Prospective Payment System operating federal rate. + +Prices an MS-DRG from the published Table 5 weight and the full-update +standardized amounts in Tables 1A and 1B:: + + weight × (labor × wage_index + nonlabor) + +Table 1A applies when the wage index is above 1. Table 1B applies +otherwise. Capital is the Table 5 weight times the Table 1D national +rate, before the geographic adjustment factor. + +Indirect medical education, disproportionate share, and outliers are +not priced. ``src/lead`` is unrelated: it is the review application. +""" + +from ipps.calcs import capital_dollars, operating_dollars, operating_payment +from ipps.rules import wage_index_table + +__all__ = [ + "capital_dollars", + "operating_dollars", + "operating_payment", + "wage_index_table", +] diff --git a/src/ipps/calcs/__init__.py b/src/ipps/calcs/__init__.py new file mode 100644 index 0000000..c9a1cda --- /dev/null +++ b/src/ipps/calcs/__init__.py @@ -0,0 +1,5 @@ +"""IPPS payment calculations.""" + +from ipps.calcs.payment import capital_dollars, operating_dollars, operating_payment + +__all__ = ["capital_dollars", "operating_dollars", "operating_payment"] diff --git a/src/ipps/calcs/payment.py b/src/ipps/calcs/payment.py new file mode 100644 index 0000000..546a91f --- /dev/null +++ b/src/ipps/calcs/payment.py @@ -0,0 +1,170 @@ +"""IPPS operating federal rate. + +The rate for a hospital that submitted quality data and is a meaningful +EHR user is:: + + weight × (labor × wage_index + nonlabor) + +``labor`` and ``nonlabor`` come from Table 1A when the wage index is +above 1, and from Table 1B otherwise. A missing wage index is filled +with 1, which selects Table 1B. The two tables add to the same national +standardized amount, so a wage index of 1 pays that amount times the +weight either way. + +Capital is ``weight ×`` the Table 1D national rate. That is the rate +before the capital geographic adjustment factor. + +This is not the claim payment. Indirect medical education, disproportionate +share, and outliers are not applied. A reclassified wage index is not +substituted for a blank pre-reclassification cell. +""" + +from __future__ import annotations + +import narwhals as nw +from narwhals.typing import FrameT + +from ipps.rules import ( + CAPITAL_COMPONENT, + CAPITAL_TABLE, + COMPONENT_ROLE, + WAGE_INDEX_GT1_TABLE, + WAGE_INDEX_LE1_TABLE, +) + + +def operating_dollars( + weight: float, labor: float, nonlabor: float, wage_index: float +) -> float: + """One operating federal rate, rounded to cents.""" + return round(weight * (labor * wage_index + nonlabor), 2) + + +def capital_dollars(weight: float, capital_rate: float) -> float: + """National capital payment at a geographic adjustment factor of 1.""" + return round(weight * capital_rate, 2) + + +def _schedule(amounts: FrameT) -> FrameT: + """Full-update labor and nonlabor for both wage-index bands, plus capital.""" + best: dict[tuple[int, str, str], tuple[int, float]] = {} + capital: dict[int, float] = {} + columns = ["fiscal_year", "table_code", "component", "amount"] + for row in amounts.select(columns).rows(named=True): + year = int(row["fiscal_year"]) + if ( + row["table_code"] == CAPITAL_TABLE + and row["component"] == CAPITAL_COMPONENT + and row["amount"] is not None + ): + capital[year] = float(row["amount"]) + continue + role = COMPONENT_ROLE.get(row["component"]) + if role is None or row["table_code"] not in ( + WAGE_INDEX_GT1_TABLE, + WAGE_INDEX_LE1_TABLE, + ): + continue + if row["amount"] is None: + continue + name, rank = role + key = (year, str(row["table_code"]), name) + current = best.get(key) + if current is None or rank < current[0]: + best[key] = (rank, float(row["amount"])) + + years = sorted({year for year, _table, _role in best}) + records: dict[str, list[object]] = { + "fiscal_year": [], + "labor_gt1": [], + "nonlabor_gt1": [], + "labor_le1": [], + "nonlabor_le1": [], + "capital_rate": [], + } + for year in years: + needed = { + (WAGE_INDEX_GT1_TABLE, "labor"): "labor_gt1", + (WAGE_INDEX_GT1_TABLE, "nonlabor"): "nonlabor_gt1", + (WAGE_INDEX_LE1_TABLE, "labor"): "labor_le1", + (WAGE_INDEX_LE1_TABLE, "nonlabor"): "nonlabor_le1", + } + values: dict[str, float] = {} + complete = True + for (table, role), alias in needed.items(): + found = best.get((year, table, role)) + if found is None: + complete = False + break + values[alias] = found[1] + if not complete: + continue + records["fiscal_year"].append(year) + for alias in ("labor_gt1", "nonlabor_gt1", "labor_le1", "nonlabor_le1"): + records[alias].append(values[alias]) + records["capital_rate"].append(capital.get(year)) + return nw.from_dict(records, backend=nw.get_native_namespace(amounts)) + + +@nw.narwhalify +def operating_payment( + drg: FrameT, + wage_index: FrameT, + amounts: FrameT, +) -> FrameT: + """Price every MS-DRG against every wage-index row of the same fiscal year. + + ``drg`` has ``ms_drg``, ``relative_weight``, and ``fiscal_year``. + ``wage_index`` has ``cbsa``, ``state``, ``wage_index``, and ``year``. + ``amounts`` has ``fiscal_year``, ``table_code``, ``component``, and + ``amount``. Pass the rows to price; the result is their cross join. + """ + schedule = _schedule(amounts) + areas = wage_index.select( + "cbsa", + "state", + "wage_index", + nw.col("year").alias("fiscal_year"), + ) + grid = ( + drg.select("ms_drg", "relative_weight", "fiscal_year") + .join(areas, on="fiscal_year", how="inner") + .join(schedule, on="fiscal_year", how="left") + ) + return ( + grid.with_columns(nw.col("wage_index").fill_null(1.0)) + .with_columns( + nw.when(nw.col("wage_index") > 1.0) + .then(nw.col("labor_gt1")) + .otherwise(nw.col("labor_le1")) + .alias("labor"), + nw.when(nw.col("wage_index") > 1.0) + .then(nw.col("nonlabor_gt1")) + .otherwise(nw.col("nonlabor_le1")) + .alias("nonlabor"), + ) + .with_columns( + ( + nw.col("relative_weight") + * (nw.col("labor") * nw.col("wage_index") + nw.col("nonlabor")) + ) + .round(2) + .alias("operating_payment"), + (nw.col("relative_weight") * nw.col("capital_rate")) + .round(2) + .alias("capital_payment"), + ) + .select( + "ms_drg", + "relative_weight", + "fiscal_year", + "cbsa", + "state", + "wage_index", + "labor", + "nonlabor", + "operating_payment", + "capital_rate", + "capital_payment", + ) + ) diff --git a/src/ipps/express/__init__.py b/src/ipps/express/__init__.py new file mode 100644 index 0000000..e0d43c4 --- /dev/null +++ b/src/ipps/express/__init__.py @@ -0,0 +1,5 @@ +"""IPPS express functions.""" + +from ipps.express.payment import operating_payment + +__all__ = ["operating_payment"] diff --git a/src/ipps/express/payment.py b/src/ipps/express/payment.py new file mode 100644 index 0000000..89e59f6 --- /dev/null +++ b/src/ipps/express/payment.py @@ -0,0 +1,28 @@ +"""IPPS operating-payment express function for the pipeline runner.""" + +from __future__ import annotations + +import narwhals as nw +from narwhals.typing import FrameT + + +@nw.narwhalify +def operating_payment( + ipps__drg_weight: FrameT, + ipps__standardized_amount: FrameT, + opps__wage_index: FrameT, +) -> FrameT: + """Build ipps.operating_payment. + + Prices each MS-DRG at each CBSA wage index for that fiscal year. + The wage index is the IPPS Table 3 pre-reclassification index stored + on opps.wage_index. Calendar year N is fiscal year N. + + Operations: join, with_columns + Dependencies: ipps.drg_weight, ipps.standardized_amount, opps.wage_index + """ + from ipps.calcs.payment import operating_payment as _operating_payment + + return _operating_payment( + ipps__drg_weight, opps__wage_index, ipps__standardized_amount + ) diff --git a/src/ipps/pipe.py b/src/ipps/pipe.py new file mode 100644 index 0000000..48c2806 --- /dev/null +++ b/src/ipps/pipe.py @@ -0,0 +1,10 @@ +"""IPPS pipeline step for the runner.""" + +from __future__ import annotations + +from ipps.express.payment import operating_payment +from ipps.table import OperatingPayment + +STEPS: list[tuple] = [ + ("ipps_operating_payment", operating_payment, OperatingPayment), +] diff --git a/src/ipps/rules.py b/src/ipps/rules.py new file mode 100644 index 0000000..a0ff455 --- /dev/null +++ b/src/ipps/rules.py @@ -0,0 +1,69 @@ +"""Which published IPPS dollars the operating rate uses. + +Table 1A is the labor and nonlabor split for a wage index above 1. +Table 1B is the split for a wage index of 1 or below. CMS sets the two +splits so they add to the same national standardized amount. The +full-update hospital submitted quality data and is a meaningful EHR +user. FY2014 names that row ``full_update``. From FY2015 the same row +is ``quality_ehr``. + +Table 1D ``national_rate`` is the capital standard federal rate. It is +not split by wage index. Table 1E is the LTCH PPS rate and is not an +operating amount. Puerto Rico rows are not the national rate. +""" + +from __future__ import annotations + +# Lower rank wins when a year somehow carries both names. +LABOR_COMPONENTS: tuple[tuple[str, int], ...] = ( + ("quality_ehr_labor", 0), + ("full_update_labor", 1), +) +NONLABOR_COMPONENTS: tuple[tuple[str, int], ...] = ( + ("quality_ehr_nonlabor", 0), + ("full_update_nonlabor", 1), +) +CAPITAL_TABLE = "1D" +CAPITAL_COMPONENT = "national_rate" +WAGE_INDEX_GT1_TABLE = "1A" +WAGE_INDEX_LE1_TABLE = "1B" + +COMPONENT_ROLE: dict[str, tuple[str, int]] = { + name: ("labor", rank) for name, rank in LABOR_COMPONENTS +} | {name: ("nonlabor", rank) for name, rank in NONLABOR_COMPONENTS} + + +def wage_index_table(wage_index: float) -> str: + """Table code for this wage index. Above 1 uses 1A; 1 and below use 1B.""" + if wage_index > 1: + return WAGE_INDEX_GT1_TABLE + return WAGE_INDEX_LE1_TABLE + + +def _coalesce(table: str, components: tuple[tuple[str, int], ...]) -> str: + ordered = [name for name, _rank in sorted(components, key=lambda item: item[1])] + cases = [ + "MAX(CASE WHEN table_code = '" + + table + + "' AND component = '" + + name + + "' THEN amount END)" + for name in ordered + ] + return "COALESCE(" + ", ".join(cases) + ")" + + +def schedule_sql() -> str: + """One row per fiscal year: both wage-index splits of the full update.""" + return ( + "SELECT fiscal_year, " + + _coalesce(WAGE_INDEX_GT1_TABLE, LABOR_COMPONENTS) + + " AS labor_gt1, " + + _coalesce(WAGE_INDEX_GT1_TABLE, NONLABOR_COMPONENTS) + + " AS nonlabor_gt1, " + + _coalesce(WAGE_INDEX_LE1_TABLE, LABOR_COMPONENTS) + + " AS labor_le1, " + + _coalesce(WAGE_INDEX_LE1_TABLE, NONLABOR_COMPONENTS) + + " AS nonlabor_le1 " + + "FROM ipps.standardized_amount GROUP BY fiscal_year" + ) diff --git a/src/ipps/table/__init__.py b/src/ipps/table/__init__.py new file mode 100644 index 0000000..14e2a2b --- /dev/null +++ b/src/ipps/table/__init__.py @@ -0,0 +1,7 @@ +"""IPPS table definitions.""" + +from ipps.table.drg_weight import DrgWeight +from ipps.table.payment import OperatingPayment +from ipps.table.standardized_amount import StandardizedAmount + +__all__ = ["DrgWeight", "OperatingPayment", "StandardizedAmount"] diff --git a/src/ipps/table/drg_weight.py b/src/ipps/table/drg_weight.py new file mode 100644 index 0000000..689d819 --- /dev/null +++ b/src/ipps/table/drg_weight.py @@ -0,0 +1,27 @@ +"""MS-DRG relative weights (IPPS Table 5).""" + +from __future__ import annotations + +from conf.table_base import SQLTable + + +class DrgWeight(SQLTable): + """Paid MS-DRG weight for one fiscal year.""" + + __schema__ = "ipps" + __tablename__ = "drg_weight" + + ms_drg: str | None = None + """MS-DRG code, three digits.""" + + relative_weight: float | None = None + """Paid relative weight. The 10% cap-applied weight when CMS publishes both.""" + + geometric_mean_los: float | None = None + """Geometric mean length of stay. Not an operating-payment input.""" + + arithmetic_mean_los: float | None = None + """Arithmetic mean length of stay. Not an operating-payment input.""" + + fiscal_year: int | None = None + """IPPS fiscal year.""" diff --git a/src/ipps/table/payment.py b/src/ipps/table/payment.py new file mode 100644 index 0000000..1f5be59 --- /dev/null +++ b/src/ipps/table/payment.py @@ -0,0 +1,45 @@ +"""Operating federal rate for one MS-DRG in one CBSA.""" + +from __future__ import annotations + +from conf.table_base import SQLTable + + +class OperatingPayment(SQLTable): + """IPPS operating federal rate, before IME, DSH, and outliers.""" + + __schema__ = "ipps" + __tablename__ = "operating_payment" + + ms_drg: str | None = None + """MS-DRG code.""" + + relative_weight: float | None = None + """Paid relative weight.""" + + fiscal_year: int | None = None + """IPPS fiscal year.""" + + cbsa: str | None = None + """Core Based Statistical Area code.""" + + state: str | None = None + """State on the wage-index row. A CBSA can cross states.""" + + wage_index: float | None = None + """Pre-reclassification wage index used in the rate. A blank is filled with 1.""" + + labor: float | None = None + """Labor-related standardized amount for this wage-index band.""" + + nonlabor: float | None = None + """Nonlabor standardized amount for this wage-index band.""" + + operating_payment: float | None = None + """weight × (labor × wage index + nonlabor), in dollars.""" + + capital_rate: float | None = None + """Table 1D national capital standard federal rate.""" + + capital_payment: float | None = None + """weight × capital rate. The geographic adjustment factor is not applied.""" diff --git a/src/ipps/table/standardized_amount.py b/src/ipps/table/standardized_amount.py new file mode 100644 index 0000000..7ab0442 --- /dev/null +++ b/src/ipps/table/standardized_amount.py @@ -0,0 +1,24 @@ +"""IPPS Tables 1A-1E. One published dollar per component.""" + +from __future__ import annotations + +from conf.table_base import SQLTable + + +class StandardizedAmount(SQLTable): + """One cell of Tables 1A through 1E.""" + + __schema__ = "ipps" + __tablename__ = "standardized_amount" + + fiscal_year: int | None = None + """IPPS fiscal year.""" + + table_code: str | None = None + """1A, 1B, 1C, 1D, or 1E.""" + + component: str | None = None + """Row and column label, for example quality_ehr_labor.""" + + amount: float | None = None + """Published dollar. 'Not Applicable' is not stored.""" diff --git a/src/pay/bounds.json b/src/pay/bounds.json index af299fa..96aaaac 100644 --- a/src/pay/bounds.json +++ b/src/pay/bounds.json @@ -5155,7 +5155,7 @@ "kind": "absent", "low": null, "name": "payment", - "note": "No IPPS pricer in this repo. Claim-level IME, DSH, and outliers are not priced. Published standardized amounts and MS-DRG weights are separate rows.", + "note": "Claim-level IME, DSH, and outliers are not priced. The operating federal rate is a separate calculation: weight times (labor amount times wage index plus nonlabor amount), Table 1A when the wage index is above 1 and Table 1B otherwise. Capital is weight times the Table 1D national rate and is not wage-adjusted. Published standardized amounts and MS-DRG weights are separate rows.", "period": "", "role": "payment", "rows": null, diff --git a/src/pay/bounds.py b/src/pay/bounds.py index 271bb2f..422396d 100644 --- a/src/pay/bounds.py +++ b/src/pay/bounds.py @@ -630,9 +630,13 @@ def hole_rows() -> list[dict[str, Any]]: kind="absent", role="payment", note=( - "No IPPS pricer in this repo. Claim-level IME, DSH, and" - " outliers are not priced. Published standardized amounts" - " and MS-DRG weights are separate rows." + "Claim-level IME, DSH, and outliers are not priced." + " The operating federal rate is a separate calculation:" + " weight times (labor amount times wage index plus nonlabor" + " amount), Table 1A when the wage index is above 1 and" + " Table 1B otherwise. Capital is weight times the Table 1D" + " national rate and is not wage-adjusted. Published" + " standardized amounts and MS-DRG weights are separate rows." ), ), element( diff --git a/src/rec/__init__.py b/src/rec/__init__.py index 54f4a76..1516b5f 100644 --- a/src/rec/__init__.py +++ b/src/rec/__init__.py @@ -2,8 +2,8 @@ Runs arbitrary "pricer" implementations against CMS-published payment files and reports the row-level delta, iterating toward exact 1:1 -parity. Generalises beyond PFS: future pricers will cover OPPS, -IPPS, ASC, DMEPOS, and ESRD. +parity. PFS, OPPS, and the IPPS operating federal rate are +registered. ASC, DMEPOS, and ESRD are not. Architecture — open/closed by design ------------------------------------ @@ -32,8 +32,8 @@ Architecture — open/closed by design │ extension via rec.pricers.PRICERS │ │ │ │ pfs ← rec.pricers.pfs │ - │ opps ← (future) │ - │ ipps ← (future) │ + │ opps ← rec.pricers.opps │ + │ ipps ← rec.pricers.ipps │ │ asc ← (future) │ │ dmepos ← (future) │ └─────────────────────────────────────┘ diff --git a/src/rec/pricers/__init__.py b/src/rec/pricers/__init__.py index b7db1d9..928b582 100644 --- a/src/rec/pricers/__init__.py +++ b/src/rec/pricers/__init__.py @@ -13,12 +13,14 @@ registry without knowing about specific systems. from __future__ import annotations from rec.base import Pricer +from rec.pricers.ipps import IppsPricer from rec.pricers.opps import OppsPricer from rec.pricers.pfs import PfsPricer PRICERS: dict[str, type[Pricer]] = { PfsPricer.system: PfsPricer, OppsPricer.system: OppsPricer, + IppsPricer.system: IppsPricer, } -__all__ = ["PRICERS", "OppsPricer", "PfsPricer"] +__all__ = ["PRICERS", "IppsPricer", "OppsPricer", "PfsPricer"] diff --git a/src/rec/pricers/ipps.py b/src/rec/pricers/ipps.py new file mode 100644 index 0000000..74a257f --- /dev/null +++ b/src/rec/pricers/ipps.py @@ -0,0 +1,96 @@ +"""IPPS pricer — national operating federal rate at wage index 1. + +Ground truth is the published full-update standardized amount: Table 1A +labor plus Table 1A nonlabor, times the MS-DRG weight. Calculated applies +the operating formula at wage index 1, which selects the Table 1B split. +CMS sets the two splits so the sums are equal, and the reconciliation +checks that equality to the cent. + +Wage-index adjustment above or below 1 is ``ipps.calcs.operating_payment``. +It is not part of this comparison: there is no per-DRG published payment +at a hospital's own wage index in these tables. + +IME, DSH, and outliers are not priced. Capital is not compared. +""" + +from __future__ import annotations + +from typing import ClassVar + +import duckdb +import polars as pl + +from ipps.rules import schedule_sql + + +class IppsPricer: + """National IPPS operating rate: weight × the full-update amount.""" + + system: ClassVar[str] = "ipps" + description: ClassVar[str] = ( + "Inpatient PPS operating federal rate at wage index 1. " + "Table 1A full-update sum versus the Table 1B formula. " + "IME, DSH, and outliers are not priced." + ) + join_keys: ClassVar[list[str]] = ["fiscal_year", "ms_drg"] + compare_cols: ClassVar[list[str]] = ["operating_payment"] + + def ground_truth(self, con: duckdb.DuckDBPyConnection, year: int) -> pl.DataFrame: + """Published national amount: Table 1A labor + nonlabor, times the weight.""" + return con.execute( + f""" + WITH schedule AS ({schedule_sql()}) + SELECT + d.fiscal_year, + d.ms_drg, + ROUND(d.relative_weight * (s.labor_gt1 + s.nonlabor_gt1), 2) + AS operating_payment + FROM ipps.drg_weight d + JOIN schedule s ON s.fiscal_year = d.fiscal_year + WHERE d.fiscal_year = ? + AND d.ms_drg IS NOT NULL + AND d.relative_weight IS NOT NULL + AND s.labor_gt1 IS NOT NULL + AND s.nonlabor_gt1 IS NOT NULL + """, + [year], + ).pl() + + def calculated(self, con: duckdb.DuckDBPyConnection, year: int) -> pl.DataFrame: + """Operating formula at wage index 1, using the Table 1B split.""" + return con.execute( + f""" + WITH schedule AS ({schedule_sql()}) + SELECT + d.fiscal_year, + d.ms_drg, + ROUND(d.relative_weight * (s.labor_le1 * 1 + s.nonlabor_le1), 2) + AS operating_payment + FROM ipps.drg_weight d + JOIN schedule s ON s.fiscal_year = d.fiscal_year + WHERE d.fiscal_year = ? + AND d.ms_drg IS NOT NULL + AND d.relative_weight IS NOT NULL + AND s.labor_le1 IS NOT NULL + AND s.nonlabor_le1 IS NOT NULL + """, + [year], + ).pl() + + def years_available(self, con: duckdb.DuckDBPyConnection) -> list[int]: + """Fiscal years with a weight file and both full-update splits.""" + rows = con.execute( + f""" + WITH schedule AS ({schedule_sql()}) + SELECT DISTINCT d.fiscal_year + FROM ipps.drg_weight d + JOIN schedule s ON s.fiscal_year = d.fiscal_year + WHERE d.fiscal_year IS NOT NULL + AND s.labor_gt1 IS NOT NULL + AND s.nonlabor_gt1 IS NOT NULL + AND s.labor_le1 IS NOT NULL + AND s.nonlabor_le1 IS NOT NULL + ORDER BY 1 + """ + ).fetchall() + return [int(row[0]) for row in rows if row[0] is not None] diff --git a/tests/aco/test_dag.py b/tests/aco/test_dag.py index 18cf226..86e2a7e 100644 --- a/tests/aco/test_dag.py +++ b/tests/aco/test_dag.py @@ -336,7 +336,7 @@ class TestLoadPipelines: def test_none_loads_all(self) -> None: pipelines = _load_pipelines(None) - assert len(pipelines) == 13 # _ALL_PIPE_MODULES has 13 entries + assert len(pipelines) == 14 # _ALL_PIPE_MODULES has 14 entries # ── main CLI ───────────────────────────────────────────────────────────────── diff --git a/tests/cli/test_rec_exercise.py b/tests/cli/test_rec_exercise.py index cf8bbd5..c3e791a 100644 --- a/tests/cli/test_rec_exercise.py +++ b/tests/cli/test_rec_exercise.py @@ -21,3 +21,6 @@ class TestAllHelp: def test_opps_help(self): assert runner.invoke(app, ["opps", "--help"]).exit_code == 0 + + def test_ipps_help(self): + assert runner.invoke(app, ["ipps", "--help"]).exit_code == 0 diff --git a/tests/ipps/__init__.py b/tests/ipps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/ipps/test_payment.py b/tests/ipps/test_payment.py new file mode 100644 index 0000000..a4f306b --- /dev/null +++ b/tests/ipps/test_payment.py @@ -0,0 +1,217 @@ +"""The IPPS operating federal rate uses the published standardized amounts.""" + +from __future__ import annotations + +from pathlib import Path + +import duckdb +import polars as pl +import pytest + +from ipps.calcs.payment import capital_dollars, operating_dollars, operating_payment +from ipps.rules import wage_index_table +from ipps.table import OperatingPayment + +# FY2026 CMS-1833-F full update (quality data and a meaningful EHR user), +# as loaded from Tables 1A, 1B, and 1D. MS-DRG 470 weight is Table 5. +_FY2026_GT1 = (4456.72, 2295.89) +_FY2026_LE1 = (4186.62, 2565.99) +_FY2026_CAPITAL = 524.15 +_DRG_470 = 1.9289 + +# FY2014 names the same full-update hospital full_update rather than quality_ehr. +_FY2014_GT1 = (3737.71, 1632.57) +_FY2014_LE1 = (3329.57, 2040.71) + +_REPLICA = Path(__file__).resolve().parents[2] / "data" / "replica" / "aco.ro.duckdb" + + +def _drg() -> pl.DataFrame: + return pl.DataFrame( + { + "ms_drg": ["470", "470"], + "relative_weight": [_DRG_470, _DRG_470], + "fiscal_year": [2026, 2014], + } + ) + + +def _wage() -> pl.DataFrame: + return pl.DataFrame( + { + "cbsa": ["11111", "22222", "33333", "11111"], + "state": ["AL", "WY", "AK", "AL"], + "wage_index": [1.2, 0.9, None, 1.2], + "year": [2026, 2026, 2026, 2014], + } + ) + + +def _amounts() -> pl.DataFrame: + rows = [ + (2026, "1A", "quality_ehr_labor", _FY2026_GT1[0]), + (2026, "1A", "quality_ehr_nonlabor", _FY2026_GT1[1]), + (2026, "1B", "quality_ehr_labor", _FY2026_LE1[0]), + (2026, "1B", "quality_ehr_nonlabor", _FY2026_LE1[1]), + (2026, "1A", "no_quality_no_ehr_labor", 4313.38), + (2026, "1D", "national_rate", _FY2026_CAPITAL), + (2026, "1E", "standard_federal_rate_full_update", 50824.51), + (2014, "1A", "full_update_labor", _FY2014_GT1[0]), + (2014, "1A", "full_update_nonlabor", _FY2014_GT1[1]), + (2014, "1B", "full_update_labor", _FY2014_LE1[0]), + (2014, "1B", "full_update_nonlabor", _FY2014_LE1[1]), + (2014, "1D", "national_rate", 429.31), + (2014, "1D", "puerto_rico_rate", 209.82), + ] + return pl.DataFrame( + { + "fiscal_year": [row[0] for row in rows], + "table_code": [row[1] for row in rows], + "component": [row[2] for row in rows], + "amount": [row[3] for row in rows], + } + ) + + +def _priced() -> pl.DataFrame: + return operating_payment(_drg(), _wage(), _amounts()) + + +class TestOperatingDollars: + def test_wage_index_above_one_uses_table_1a(self) -> None: + assert wage_index_table(1.2) == "1A" + assert operating_dollars(_DRG_470, *_FY2026_GT1, 1.2) == 14744.42 + + def test_wage_index_at_or_below_one_uses_table_1b(self) -> None: + assert wage_index_table(1.0) == "1B" + assert wage_index_table(0.9) == "1B" + assert operating_dollars(_DRG_470, *_FY2026_LE1, 0.9) == 12217.55 + # At wage index 1 the two splits add to the same national amount. + assert operating_dollars(_DRG_470, *_FY2026_GT1, 1.0) == 13025.11 + assert operating_dollars(_DRG_470, *_FY2026_LE1, 1.0) == 13025.11 + + def test_capital_is_the_national_rate_times_the_weight(self) -> None: + assert capital_dollars(_DRG_470, _FY2026_CAPITAL) == 1011.03 + + +class TestOperatingPayment: + def test_output_matches_the_table_contract(self) -> None: + assert set(_priced().columns) == set(OperatingPayment.column_names()) + + def test_high_wage_index_uses_the_table_1a_dollars(self) -> None: + row = _priced().filter( + (pl.col("fiscal_year") == 2026) & (pl.col("cbsa") == "11111") + ) + assert row["labor"][0] == _FY2026_GT1[0] + assert row["nonlabor"][0] == _FY2026_GT1[1] + assert row["operating_payment"][0] == 14744.42 + assert row["capital_payment"][0] == 1011.03 + + def test_low_wage_index_uses_the_table_1b_dollars(self) -> None: + row = _priced().filter(pl.col("cbsa") == "22222") + assert row["labor"][0] == _FY2026_LE1[0] + assert row["nonlabor"][0] == _FY2026_LE1[1] + assert row["operating_payment"][0] == 12217.55 + + def test_a_blank_wage_index_is_filled_with_one(self) -> None: + row = _priced().filter(pl.col("cbsa") == "33333") + assert row["wage_index"][0] == 1.0 + assert row["labor"][0] == _FY2026_LE1[0] + assert row["operating_payment"][0] == 13025.11 + + def test_fy2014_full_update_name_is_the_full_update(self) -> None: + row = _priced().filter(pl.col("fiscal_year") == 2014) + assert row["labor"][0] == _FY2014_GT1[0] + assert row["operating_payment"][0] == operating_dollars( + _DRG_470, *_FY2014_GT1, 1.2 + ) + # Puerto Rico's capital rate is not the national rate. + assert row["capital_rate"][0] == 429.31 + + def test_quality_ehr_wins_when_a_year_also_has_the_old_name(self) -> None: + amounts = pl.concat( + [ + _amounts(), + pl.DataFrame( + { + "fiscal_year": [2026, 2026], + "table_code": ["1A", "1A"], + "component": ["full_update_labor", "full_update_nonlabor"], + "amount": [1.0, 1.0], + } + ), + ] + ) + priced = operating_payment(_drg(), _wage(), amounts) + row = priced.filter( + (pl.col("fiscal_year") == 2026) & (pl.col("cbsa") == "11111") + ) + assert row["labor"][0] == _FY2026_GT1[0] + + +class TestPipe: + def test_step_writes_the_operating_payment_table(self) -> None: + from ipps.pipe import STEPS + + assert STEPS[0][2] is OperatingPayment + + def test_registry_runs_one_expression(self) -> None: + from aco.pipe import registry + + assert len(registry["ipps"]) == 1 + assert registry["ipps"].names() == ["ipps.operating_payment"] + + +@pytest.mark.skipif(not _REPLICA.is_file(), reason="aco replica is not present") +class TestLoadedTables: + def test_every_loaded_year_reconciles_at_wage_index_one(self) -> None: + from rec.engine import reconcile + from rec.pricers.ipps import IppsPricer + + con = duckdb.connect(str(_REPLICA), read_only=True) + try: + pricer = IppsPricer() + years = pricer.years_available(con) + assert years == list(range(2014, 2028)) + for year in years: + result = reconcile(pricer, con, year) + assert result.matched_rows > 700, year + assert result.exact_matches == result.matched_rows, year + assert result.ground_truth_only == 0 + assert result.calculated_only == 0 + finally: + con.close() + + def test_fy2026_drg_470_on_a_real_cbsa(self) -> None: + con = duckdb.connect(str(_REPLICA), read_only=True) + try: + drg = con.execute( + """ + SELECT ms_drg, relative_weight, fiscal_year + FROM ipps.drg_weight + WHERE fiscal_year = 2026 AND ms_drg = '470' + """ + ).pl() + wage = con.execute( + """ + SELECT cbsa, state, wage_index, year + FROM opps.wage_index + WHERE year = 2026 AND cbsa = '10180' AND wage_index IS NOT NULL + """ + ).pl() + amounts = con.execute( + """ + SELECT fiscal_year, table_code, component, amount + FROM ipps.standardized_amount + WHERE fiscal_year = 2026 + """ + ).pl() + finally: + con.close() + assert wage.height >= 1 + priced = operating_payment(drg, wage, amounts) + index = float(wage["wage_index"][0]) + band = _FY2026_GT1 if index > 1 else _FY2026_LE1 + row = priced.filter(pl.col("state") == wage["state"][0]) + assert row["operating_payment"][0] == operating_dollars(_DRG_470, *band, index) + assert row["capital_payment"][0] == capital_dollars(_DRG_470, _FY2026_CAPITAL) diff --git a/tests/rec/pricers/test_ipps.py b/tests/rec/pricers/test_ipps.py new file mode 100644 index 0000000..5b1c256 --- /dev/null +++ b/tests/rec/pricers/test_ipps.py @@ -0,0 +1,109 @@ +"""IppsPricer against a seeded national operating rate.""" + +from __future__ import annotations + +import duckdb +import pytest + +from rec.base import Pricer +from rec.engine import reconcile +from rec.pricers import PRICERS +from rec.pricers.ipps import IppsPricer + +_YEAR = 2026 +_WEIGHT = 1.9289 +# Table 1A and Table 1B full-update splits. The sums are equal. +_GT1 = (4456.72, 2295.89) +_LE1 = (4186.62, 2565.99) + + +@pytest.fixture +def con() -> duckdb.DuckDBPyConnection: + database = duckdb.connect(":memory:") + database.execute("CREATE SCHEMA ipps") + database.execute( + """ + CREATE TABLE ipps.drg_weight ( + ms_drg VARCHAR, + relative_weight DOUBLE, + fiscal_year INTEGER + ) + """ + ) + database.execute( + """ + CREATE TABLE ipps.standardized_amount ( + fiscal_year INTEGER, + table_code VARCHAR, + component VARCHAR, + amount DOUBLE + ) + """ + ) + database.execute( + """ + INSERT INTO ipps.drg_weight VALUES + ('470', ?, ?), + ('001', NULL, ?) + """, + [_WEIGHT, _YEAR, _YEAR], + ) + rows = [ + (_YEAR, "1A", "quality_ehr_labor", _GT1[0]), + (_YEAR, "1A", "quality_ehr_nonlabor", _GT1[1]), + (_YEAR, "1B", "quality_ehr_labor", _LE1[0]), + (_YEAR, "1B", "quality_ehr_nonlabor", _LE1[1]), + (_YEAR, "1A", "full_update_labor", 1.0), + (_YEAR, "1D", "national_rate", 524.15), + ] + database.executemany( + "INSERT INTO ipps.standardized_amount VALUES (?, ?, ?, ?)", rows + ) + return database + + +class TestRegistration: + def test_in_PRICERS(self) -> None: + assert PRICERS["ipps"] is IppsPricer + + def test_conforms_to_protocol(self) -> None: + assert isinstance(IppsPricer(), Pricer) + + +class TestNationalRate: + def test_wage_index_one_matches_to_the_cent( + self, con: duckdb.DuckDBPyConnection + ) -> None: + result = reconcile(IppsPricer(), con, _YEAR) + assert result.matched_rows == 1 + assert result.exact_matches == 1 + assert result.ground_truth_only == 0 + assert result.calculated_only == 0 + assert result.deltas["operating_payment_calc"][0] == 13025.11 + + def test_a_null_weight_is_not_priced(self, con: duckdb.DuckDBPyConnection) -> None: + calculated = IppsPricer().calculated(con, _YEAR) + assert calculated["ms_drg"].to_list() == ["470"] + + def test_fy2014_names_resolve(self) -> None: + database = duckdb.connect(":memory:") + database.execute("CREATE SCHEMA ipps") + database.execute( + "CREATE TABLE ipps.drg_weight (ms_drg VARCHAR, relative_weight DOUBLE, fiscal_year INTEGER)" + ) + database.execute( + "CREATE TABLE ipps.standardized_amount (fiscal_year INTEGER, table_code VARCHAR, component VARCHAR, amount DOUBLE)" + ) + database.execute("INSERT INTO ipps.drg_weight VALUES ('470', 2.0, 2014)") + database.executemany( + "INSERT INTO ipps.standardized_amount VALUES (?, ?, ?, ?)", + [ + (2014, "1A", "full_update_labor", 10.0), + (2014, "1A", "full_update_nonlabor", 5.0), + (2014, "1B", "full_update_labor", 9.0), + (2014, "1B", "full_update_nonlabor", 6.0), + ], + ) + result = reconcile(IppsPricer(), database, 2014) + assert result.exact_matches == 1 + assert result.deltas["operating_payment_calc"][0] == 30.0 diff --git a/tests/test_ast_coverage.py b/tests/test_ast_coverage.py index a39f5e5..55c928b 100644 --- a/tests/test_ast_coverage.py +++ b/tests/test_ast_coverage.py @@ -701,7 +701,7 @@ def test_express_pipe_module_symmetry() -> None: pipe_mods = { p.stem for p in pipe_dir.glob("*.py") - if not p.stem.startswith("_") and p.stem not in ("runner", "opps") + if not p.stem.startswith("_") and p.stem not in ("runner", "opps", "ipps") } missing_in_pipe = express_mods - pipe_mods diff --git a/tests/test_dab_generator.py b/tests/test_dab_generator.py index 4c591e1..abc0b38 100644 --- a/tests/test_dab_generator.py +++ b/tests/test_dab_generator.py @@ -169,8 +169,8 @@ class TestPythonResources: def test_schemas_count(self): r = self._resources() - # 14 aco pipelines + the bcda connector registered when stack[bcda] is installed - assert len(r.schemas) == 15, f"Expected 15 schemas, got {len(r.schemas)}" + # One schema per pipeline output prefix, including core, bcda, and ipps. + assert len(r.schemas) == 16, f"Expected 16 schemas, got {len(r.schemas)}" def test_schemas_include_core(self): r = self._resources() diff --git a/uv.lock b/uv.lock index bbc747d..41d5ae9 100644 --- a/uv.lock +++ b/uv.lock @@ -4776,6 +4776,12 @@ gcp = [ { name = "gcsfs" }, { name = "google-cloud-storage" }, ] +ipps = [ + { name = "duckdb" }, + { name = "httpx" }, + { name = "narwhals" }, + { name = "pydantic" }, +] lake = [ { name = "databricks-bundles" }, { name = "databricks-sdk" }, @@ -4934,6 +4940,7 @@ requires-dist = [ { name = "databricks-sdk", marker = "extra == 'lake'", specifier = ">=0.85.0" }, { name = "duckdb", marker = "extra == 'aco'", specifier = ">=1.5.4" }, { name = "duckdb", marker = "extra == 'conf'", specifier = ">=1.5.4" }, + { name = "duckdb", marker = "extra == 'ipps'", specifier = ">=1.5.4" }, { name = "duckdb", marker = "extra == 'notebooks'", specifier = ">=1.5.4,<2" }, { name = "duckdb", marker = "extra == 'opps'", specifier = ">=1.5.4" }, { name = "duckdb", marker = "extra == 'pfs'", specifier = ">=1.5.4" }, @@ -4962,6 +4969,7 @@ requires-dist = [ { name = "narwhals", marker = "extra == 'aco'", specifier = ">=2.17.0" }, { name = "narwhals", marker = "extra == 'bcda'", specifier = ">=2.17.0" }, { name = "narwhals", marker = "extra == 'cms'", specifier = ">=2.17.0" }, + { name = "narwhals", marker = "extra == 'ipps'", specifier = ">=2.17.0" }, { name = "narwhals", marker = "extra == 'lead'", specifier = ">=2.17.0" }, { name = "narwhals", marker = "extra == 'opps'", specifier = ">=2.17.0" }, { name = "narwhals", marker = "extra == 'pfs'", specifier = ">=2.17.0" }, @@ -5023,6 +5031,7 @@ requires-dist = [ { name = "stack", extras = ["conf"], marker = "extra == 'api'" }, { name = "stack", extras = ["conf"], marker = "extra == 'bcda'" }, { name = "stack", extras = ["conf"], marker = "extra == 'bib'" }, + { name = "stack", extras = ["conf"], marker = "extra == 'ipps'" }, { name = "stack", extras = ["conf"], marker = "extra == 'lead'" }, { name = "stack", extras = ["conf"], marker = "extra == 'llm'" }, { name = "stack", extras = ["conf"], marker = "extra == 'nlm'" }, @@ -5061,7 +5070,7 @@ requires-dist = [ { name = "uvicorn", marker = "extra == 'llm'", specifier = ">=0.41.0" }, { name = "xlrd", specifier = ">=2.0.2" }, ] -provides-extras = ["conf", "aco", "api", "bcda", "bib", "bls", "llm", "ccw", "lead", "focus", "cli", "nlm", "mail", "cms", "opps", "pfs", "qpp", "rec", "rex", "prisma", "perf", "sem", "lake", "aws", "gcp", "azure", "notebooks", "all"] +provides-extras = ["conf", "aco", "api", "bcda", "bib", "bls", "llm", "ccw", "lead", "focus", "cli", "nlm", "mail", "cms", "ipps", "opps", "pfs", "qpp", "rec", "rex", "prisma", "perf", "sem", "lake", "aws", "gcp", "azure", "notebooks", "all"] [package.metadata.requires-dev] dev = [