Cover remaining uncovered lines in bcda (client, store, log, pipe/cclf, flatten), bib (sync, spider, translate, ingest, item, store, format, ui), cms (express wrappers, log edge cases), api (base, gitea, rustfs, woodpecker, zotero), bls (table import), and pfs (pragma on race guard). 37,687 statements, 0 missed — 11,061 tests passing.
1721 lines
54 KiB
Python
1721 lines
54 KiB
Python
"""Tests for cms.express — auto-cast narwhals functions.
|
|
|
|
Tests the shared _helpers module (auto_cast, _is_numeric,
|
|
_is_date, cast_numeric) plus representative functions from
|
|
each domain module (aco, enrollment, facility, provider,
|
|
drug_spending, innovation, market, program_statistics,
|
|
utilization).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import narwhals as nw
|
|
import polars as pl
|
|
import pytest
|
|
|
|
from cms.express._helpers import (
|
|
_is_date,
|
|
_is_numeric,
|
|
auto_cast,
|
|
cast_numeric,
|
|
)
|
|
|
|
|
|
def _nw_cast_numeric(df: pl.DataFrame, col: str) -> pl.DataFrame:
|
|
"""Helper: apply narwhals cast_numeric via narwhals."""
|
|
ndf = nw.from_native(df)
|
|
result = ndf.select(cast_numeric(col))
|
|
return nw.to_native(result)
|
|
|
|
|
|
def _nw_auto_cast(df: pl.DataFrame) -> pl.DataFrame:
|
|
"""Helper: apply narwhals auto_cast via narwhals."""
|
|
ndf = nw.from_native(df)
|
|
result = auto_cast(ndf)
|
|
return nw.to_native(result)
|
|
|
|
|
|
# ── _is_numeric heuristic ───────────────────────────────────────
|
|
|
|
|
|
class TestIsNumeric:
|
|
"""Column name heuristic that identifies numeric columns."""
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"tot_benes",
|
|
"tot_dschrgs",
|
|
"tot_pymt_amt",
|
|
"bene_avg_age",
|
|
"bene_avg_risk_scre",
|
|
"latitude",
|
|
"longitude",
|
|
"lat",
|
|
"long",
|
|
],
|
|
)
|
|
def test_exact_matches(self, name: str) -> None:
|
|
assert _is_numeric(name)
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"claim_cnt",
|
|
"avg_pct",
|
|
"total_amt",
|
|
"some_rate",
|
|
"cost_avg",
|
|
"med_cst",
|
|
"tot_pymt",
|
|
"mdcr_chrg",
|
|
"bene_scre",
|
|
"case_ratio",
|
|
"total_pmt",
|
|
"all_cost",
|
|
"drug_spend",
|
|
"total_spending",
|
|
"total_expenditure",
|
|
"pop_per_capita",
|
|
"svc_utilization",
|
|
"visit_volume",
|
|
"net_total",
|
|
"col_sum",
|
|
"col_mean",
|
|
"col_median",
|
|
"col_std",
|
|
"col_min",
|
|
"col_max",
|
|
"supply_days",
|
|
"pill_qty",
|
|
"rx_fills",
|
|
"day_suply",
|
|
"med_units",
|
|
"total_beneficiaries",
|
|
"all_services",
|
|
"all_claims",
|
|
"total_discharges",
|
|
"total_visits",
|
|
"total_episodes",
|
|
"total_stays",
|
|
"total_events",
|
|
"some_outlier",
|
|
"some_transfer",
|
|
],
|
|
)
|
|
def test_suffix_matches(self, name: str) -> None:
|
|
assert _is_numeric(name)
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"avg_something",
|
|
"tot_something",
|
|
"total_something",
|
|
"pct_something",
|
|
"rate_something",
|
|
],
|
|
)
|
|
def test_prefix_matches(self, name: str) -> None:
|
|
assert _is_numeric(name)
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"aco_num",
|
|
"prvdr_num",
|
|
"clm_num",
|
|
"npi_num",
|
|
"line_num",
|
|
],
|
|
)
|
|
def test_not_numeric_identifiers(self, name: str) -> None:
|
|
assert not _is_numeric(name)
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"payment_color",
|
|
"risk_dual_color",
|
|
"measure_description",
|
|
"active_flag",
|
|
"state_cd",
|
|
"hcpcs_code",
|
|
"provider_name",
|
|
"facility_type",
|
|
"note_text",
|
|
"record_id",
|
|
"state_abrvtn",
|
|
"county_fips",
|
|
"zip_ruca",
|
|
"measure_desc",
|
|
"data_src",
|
|
"dual_sw",
|
|
"quality_indicator",
|
|
"measure_label",
|
|
"outcome_category",
|
|
"claim_status",
|
|
],
|
|
)
|
|
def test_not_numeric_suffixes_override(self, name: str) -> None:
|
|
assert not _is_numeric(name)
|
|
|
|
def test_plain_column_not_numeric(self) -> None:
|
|
assert not _is_numeric("provider_name")
|
|
assert not _is_numeric("state")
|
|
assert not _is_numeric("city")
|
|
|
|
|
|
# ── _is_date heuristic ──────────────────────────────────────────
|
|
|
|
|
|
class TestIsDate:
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"service_date",
|
|
"enrollment_dt",
|
|
"claim_date",
|
|
"effective_date",
|
|
],
|
|
)
|
|
def test_date_patterns(self, name: str) -> None:
|
|
assert _is_date(name)
|
|
|
|
@pytest.mark.parametrize(
|
|
"name",
|
|
[
|
|
"provider_name",
|
|
"claim_cnt",
|
|
"status",
|
|
],
|
|
)
|
|
def test_not_date(self, name: str) -> None:
|
|
assert not _is_date(name)
|
|
|
|
def test_date_mid_pattern(self) -> None:
|
|
assert _is_date("effective_date_range")
|
|
assert _is_date("last_dt_active")
|
|
|
|
|
|
# ── cast_numeric ────────────────────────────────────────────────
|
|
|
|
|
|
class TestCastNumeric:
|
|
"""cast_numeric strips noise and casts to Float64."""
|
|
|
|
def test_clean_number(self) -> None:
|
|
df = pl.DataFrame({"val_amt": ["100.5"]})
|
|
result = _nw_cast_numeric(df, "val_amt")
|
|
assert result["val_amt"].dtype == pl.Float64
|
|
assert result["val_amt"][0] == pytest.approx(100.5)
|
|
|
|
def test_comma_thousands(self) -> None:
|
|
df = pl.DataFrame({"val_amt": ["1,234.56"]})
|
|
result = _nw_cast_numeric(df, "val_amt")
|
|
assert result["val_amt"][0] == pytest.approx(1234.56)
|
|
|
|
def test_dollar_prefix(self) -> None:
|
|
df = pl.DataFrame({"val_amt": ["$99.00"]})
|
|
result = _nw_cast_numeric(df, "val_amt")
|
|
assert result["val_amt"][0] == pytest.approx(99.0)
|
|
|
|
def test_percent_suffix(self) -> None:
|
|
df = pl.DataFrame({"val_pct": ["42.5%"]})
|
|
result = _nw_cast_numeric(df, "val_pct")
|
|
assert result["val_pct"][0] == pytest.approx(42.5)
|
|
|
|
def test_suppression_star(self) -> None:
|
|
df = pl.DataFrame({"val_cnt": ["*"]})
|
|
result = _nw_cast_numeric(df, "val_cnt")
|
|
assert result["val_cnt"][0] is None
|
|
|
|
def test_na_string(self) -> None:
|
|
df = pl.DataFrame({"val_cnt": ["N/A"]})
|
|
result = _nw_cast_numeric(df, "val_cnt")
|
|
assert result["val_cnt"][0] is None
|
|
|
|
def test_na_short(self) -> None:
|
|
df = pl.DataFrame({"val_cnt": ["NA"]})
|
|
result = _nw_cast_numeric(df, "val_cnt")
|
|
assert result["val_cnt"][0] is None
|
|
|
|
def test_dot_sentinel(self) -> None:
|
|
df = pl.DataFrame({"val_cnt": ["."]})
|
|
result = _nw_cast_numeric(df, "val_cnt")
|
|
assert result["val_cnt"][0] is None
|
|
|
|
def test_empty_string(self) -> None:
|
|
df = pl.DataFrame({"val_cnt": [""]})
|
|
result = _nw_cast_numeric(df, "val_cnt")
|
|
assert result["val_cnt"][0] is None
|
|
|
|
def test_null_passthrough(self) -> None:
|
|
df = pl.DataFrame(
|
|
{"val_cnt": [None]},
|
|
schema={"val_cnt": pl.String},
|
|
)
|
|
result = _nw_cast_numeric(df, "val_cnt")
|
|
assert result["val_cnt"][0] is None
|
|
|
|
def test_whitespace_stripped(self) -> None:
|
|
df = pl.DataFrame({"val_amt": [" 55.5 "]})
|
|
result = _nw_cast_numeric(df, "val_amt")
|
|
assert result["val_amt"][0] == pytest.approx(55.5)
|
|
|
|
|
|
# ── auto_cast ───────────────────────────────────────────────────
|
|
|
|
|
|
class TestAutoCast:
|
|
"""auto_cast applies heuristic casts to string columns."""
|
|
|
|
def test_numeric_columns_cast(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["Acme"],
|
|
"tot_pymt_amt": ["100.50"],
|
|
"claim_cnt": ["5"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
assert result["provider_name"].dtype == pl.String
|
|
assert result["tot_pymt_amt"].dtype == pl.Float64
|
|
assert result["claim_cnt"].dtype == pl.Float64
|
|
|
|
def test_non_string_columns_untouched(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"count_col": [42],
|
|
"name": ["test"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
assert result["count_col"].dtype in (
|
|
pl.Int64,
|
|
pl.Int32,
|
|
)
|
|
|
|
def test_preserves_row_count(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["A", "B", "C"],
|
|
"tot_pymt_amt": ["10", "20", "30"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
assert len(result) == 3
|
|
|
|
def test_preserves_all_columns(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"col_a": ["x"],
|
|
"col_b": ["y"],
|
|
"val_amt": ["1.0"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
assert set(result.columns) == {
|
|
"col_a",
|
|
"col_b",
|
|
"val_amt",
|
|
}
|
|
|
|
def test_no_numeric_columns_passthrough(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"name": ["Alice"],
|
|
"city": ["Austin"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
assert result["name"].dtype == pl.String
|
|
assert result["city"].dtype == pl.String
|
|
|
|
def test_excluded_suffix_not_cast(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"cost_flag": ["Y"],
|
|
"cost_amt": ["100"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
assert result["cost_flag"].dtype == pl.String
|
|
assert result["cost_amt"].dtype == pl.Float64
|
|
|
|
def test_suppressed_values_become_null(self) -> None:
|
|
df = pl.DataFrame(
|
|
{
|
|
"tot_pymt_amt": ["100", "*", "N/A", "200"],
|
|
}
|
|
)
|
|
result = _nw_auto_cast(df)
|
|
vals = result["tot_pymt_amt"].to_list()
|
|
assert vals[0] == pytest.approx(100.0)
|
|
assert vals[1] is None
|
|
assert vals[2] is None
|
|
assert vals[3] == pytest.approx(200.0)
|
|
|
|
|
|
# ── Domain module tests ─────────────────────────────────────────
|
|
# Each domain module has auto-generated @nw.narwhalify
|
|
# functions that delegate to auto_cast. We test a
|
|
# representative function from each domain to verify the
|
|
# decorator plumbing works end-to-end.
|
|
|
|
|
|
class TestAcoDomain:
|
|
"""cms.express.aco — representative function test."""
|
|
|
|
def test_accountable_care_organizations(self) -> None:
|
|
from cms.express.aco import (
|
|
accountable_care_organizations,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"aco_num": ["A1234"],
|
|
"aco_name": ["Test ACO"],
|
|
"tot_benes": ["5000"],
|
|
"total_spending": ["$1,200,000"],
|
|
}
|
|
)
|
|
result = accountable_care_organizations(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert len(result) == 1
|
|
assert result["aco_num"].dtype == pl.String
|
|
assert result["tot_benes"].dtype == pl.Float64
|
|
assert result["total_spending"].dtype == pl.Float64
|
|
|
|
def test_aco_reach_providers(self) -> None:
|
|
from cms.express.aco import aco_reach_providers
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["Dr. Smith"],
|
|
"npi_num": ["1234567890"],
|
|
"total_beneficiaries": ["150"],
|
|
}
|
|
)
|
|
result = aco_reach_providers(df)
|
|
assert len(result) == 1
|
|
assert result["total_beneficiaries"].dtype == pl.Float64
|
|
assert result["provider_name"].dtype == pl.String
|
|
|
|
|
|
class TestEnrollmentDomain:
|
|
"""cms.express.enrollment — representative function."""
|
|
|
|
def test_medicare_monthly_enrollment(self) -> None:
|
|
from cms.express.enrollment import (
|
|
medicare_monthly_enrollment,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"state": ["TX"],
|
|
"tot_benes": ["12345"],
|
|
"bene_avg_age": ["72.5"],
|
|
}
|
|
)
|
|
result = medicare_monthly_enrollment(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["tot_benes"].dtype == pl.Float64
|
|
assert result["bene_avg_age"].dtype == pl.Float64
|
|
assert result["state"].dtype == pl.String
|
|
|
|
def test_preserves_row_count(self) -> None:
|
|
from cms.express.enrollment import (
|
|
medicare_monthly_enrollment,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"state": ["TX", "CA", "NY"],
|
|
"tot_benes": ["100", "200", "300"],
|
|
}
|
|
)
|
|
result = medicare_monthly_enrollment(df)
|
|
assert len(result) == 3
|
|
|
|
|
|
class TestFacilityDomain:
|
|
"""cms.express.facility — representative function."""
|
|
|
|
def test_hospital_service_area(self) -> None:
|
|
from cms.express.facility import (
|
|
hospital_service_area,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["General Hospital"],
|
|
"state_cd": ["TX"],
|
|
"tot_discharges": ["450"],
|
|
}
|
|
)
|
|
result = hospital_service_area(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["tot_discharges"].dtype == pl.Float64
|
|
assert result["state_cd"].dtype == pl.String
|
|
|
|
def test_medicare_dialysis_facilities(self) -> None:
|
|
from cms.express.facility import (
|
|
medicare_dialysis_facilities,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"facility_name": ["Dialysis Center"],
|
|
"tot_benes": ["200"],
|
|
"lat": ["30.26"],
|
|
"long": ["-97.74"],
|
|
}
|
|
)
|
|
result = medicare_dialysis_facilities(df)
|
|
assert result["tot_benes"].dtype == pl.Float64
|
|
assert result["lat"].dtype == pl.Float64
|
|
assert result["long"].dtype == pl.Float64
|
|
|
|
|
|
class TestProviderDomain:
|
|
"""cms.express.provider — representative function."""
|
|
|
|
def test_opt_out_affidavits(self) -> None:
|
|
from cms.express.provider import opt_out_affidavits
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["Dr. Jones"],
|
|
"npi_num": ["9876543210"],
|
|
"state_cd": ["CA"],
|
|
}
|
|
)
|
|
result = opt_out_affidavits(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert len(result) == 1
|
|
assert result["npi_num"].dtype == pl.String
|
|
|
|
def test_order_referring(self) -> None:
|
|
from cms.express.provider import order_referring
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"npi_num": ["111"],
|
|
"provider_name": ["Smith"],
|
|
"tot_services": ["42"],
|
|
}
|
|
)
|
|
result = order_referring(df)
|
|
assert result["tot_services"].dtype == pl.Float64
|
|
|
|
|
|
class TestDrugSpendingDomain:
|
|
"""cms.express.drug_spending — representative function."""
|
|
|
|
def test_medicaid_spending_by_drug(self) -> None:
|
|
from cms.express.drug_spending import (
|
|
medicaid_spending_by_drug,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"drug_name": ["Lipitor"],
|
|
"tot_drug_cst": ["$1,500.00"],
|
|
"tot_claims": ["50"],
|
|
"tot_30day_fills": ["45"],
|
|
}
|
|
)
|
|
result = medicaid_spending_by_drug(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["tot_drug_cst"].dtype == pl.Float64
|
|
assert result["tot_claims"].dtype == pl.Float64
|
|
assert result["tot_30day_fills"].dtype == pl.Float64
|
|
assert result["drug_name"].dtype == pl.String
|
|
|
|
|
|
class TestInnovationDomain:
|
|
"""cms.express.innovation — representative function."""
|
|
|
|
def test_agency_healthcare_quality(self) -> None:
|
|
from cms.express.innovation import (
|
|
agency_healthcare_research_quality_patient_safety_indicator_11_measure_rates,
|
|
)
|
|
|
|
fn = (
|
|
agency_healthcare_research_quality_patient_safety_indicator_11_measure_rates
|
|
)
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["Hospital A"],
|
|
"measure_rate": ["0.85"],
|
|
}
|
|
)
|
|
result = fn(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["measure_rate"].dtype == pl.Float64
|
|
|
|
|
|
class TestMarketDomain:
|
|
"""cms.express.market — representative function."""
|
|
|
|
def test_market_saturation(self) -> None:
|
|
from cms.express.market import (
|
|
market_saturation_utilization_state_county,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"state": ["TX"],
|
|
"county_name": ["Travis"],
|
|
"tot_benes": ["8000"],
|
|
"total_utilization": ["3500"],
|
|
}
|
|
)
|
|
result = market_saturation_utilization_state_county(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["tot_benes"].dtype == pl.Float64
|
|
assert result["total_utilization"].dtype == pl.Float64
|
|
assert result["state"].dtype == pl.String
|
|
|
|
|
|
class TestProgramStatisticsDomain:
|
|
"""cms.express.program_statistics — representative."""
|
|
|
|
def test_program_stats_hha(self) -> None:
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_home_health_agency,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"state": ["TX"],
|
|
"tot_benes": ["1200"],
|
|
"tot_visits": ["5000"],
|
|
}
|
|
)
|
|
result = program_statistics_medicare_home_health_agency(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["tot_benes"].dtype == pl.Float64
|
|
assert result["tot_visits"].dtype == pl.Float64
|
|
|
|
|
|
class TestUtilizationDomain:
|
|
"""cms.express.utilization — representative function."""
|
|
|
|
def test_ambulatory_specialty_model(self) -> None:
|
|
from cms.express.utilization import (
|
|
ambulatory_specialty_model_participants,
|
|
)
|
|
|
|
df = pl.DataFrame(
|
|
{
|
|
"provider_name": ["Clinic A"],
|
|
"npi_num": ["1234567890"],
|
|
"total_beneficiaries": ["300"],
|
|
"total_episodes": ["150"],
|
|
}
|
|
)
|
|
result = ambulatory_specialty_model_participants(df)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert result["total_beneficiaries"].dtype == pl.Float64
|
|
assert result["total_episodes"].dtype == pl.Float64
|
|
assert result["npi_num"].dtype == pl.String
|
|
|
|
|
|
# ── Cross-domain consistency ────────────────────────────────────
|
|
|
|
|
|
class TestCrossDomainConsistency:
|
|
"""Verify all domain modules follow same pattern."""
|
|
|
|
def test_all_domains_importable(self) -> None:
|
|
import cms.express.aco
|
|
import cms.express.drug_spending
|
|
import cms.express.enrollment
|
|
import cms.express.facility
|
|
import cms.express.innovation
|
|
import cms.express.market
|
|
import cms.express.program_statistics
|
|
import cms.express.provider
|
|
import cms.express.utilization
|
|
|
|
modules = [
|
|
cms.express.aco,
|
|
cms.express.drug_spending,
|
|
cms.express.enrollment,
|
|
cms.express.facility,
|
|
cms.express.innovation,
|
|
cms.express.market,
|
|
cms.express.program_statistics,
|
|
cms.express.provider,
|
|
cms.express.utilization,
|
|
]
|
|
for mod in modules:
|
|
# Every module should have callable attrs
|
|
callables = [
|
|
name
|
|
for name in dir(mod)
|
|
if callable(getattr(mod, name)) and not name.startswith("_")
|
|
]
|
|
assert len(callables) > 0, f"{mod.__name__} has no public callables"
|
|
|
|
def test_domain_functions_accept_polars(self) -> None:
|
|
"""Every narwhalified function should accept a
|
|
polars DataFrame and return one."""
|
|
from cms.express.aco import (
|
|
accountable_care_organizations,
|
|
)
|
|
from cms.express.enrollment import (
|
|
medicare_monthly_enrollment,
|
|
)
|
|
from cms.express.facility import (
|
|
hospital_service_area,
|
|
)
|
|
from cms.express.provider import (
|
|
opt_out_affidavits,
|
|
)
|
|
|
|
minimal = pl.DataFrame({"col_a": ["x"]})
|
|
for fn in [
|
|
accountable_care_organizations,
|
|
medicare_monthly_enrollment,
|
|
hospital_service_area,
|
|
opt_out_affidavits,
|
|
]:
|
|
result = fn(minimal)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert len(result) == 1
|
|
|
|
|
|
# ── Exhaustive coverage: call every uncovered function ────────
|
|
# Each function is @nw.narwhalify wrapping auto_cast(param).
|
|
# A single-row, single-string-column DataFrame is sufficient to
|
|
# exercise the return line.
|
|
|
|
_MINIMAL = pl.DataFrame({"col_a": ["x"]})
|
|
|
|
|
|
def _call(fn):
|
|
"""Call a narwhalified express function with minimal input."""
|
|
result = fn(_MINIMAL)
|
|
assert isinstance(result, pl.DataFrame)
|
|
assert len(result) == 1
|
|
|
|
|
|
# ── aco (remaining functions) ────────────────────────────────
|
|
|
|
|
|
class TestAcoExhaustive:
|
|
def test_accountable_care_organization_participants(self):
|
|
from cms.express.aco import (
|
|
accountable_care_organization_participants,
|
|
)
|
|
|
|
_call(accountable_care_organization_participants)
|
|
|
|
def test_aco_snf_affiliates(self):
|
|
from cms.express.aco import (
|
|
accountable_care_organization_skilled_nursing_facility_affiliates,
|
|
)
|
|
|
|
_call(accountable_care_organization_skilled_nursing_facility_affiliates)
|
|
|
|
def test_aco_reach_aligned_beneficiaries(self):
|
|
from cms.express.aco import aco_reach_aligned_beneficiaries
|
|
|
|
_call(aco_reach_aligned_beneficiaries)
|
|
|
|
def test_aco_reach_eligible_beneficiaries(self):
|
|
from cms.express.aco import aco_reach_eligible_beneficiaries
|
|
|
|
_call(aco_reach_eligible_beneficiaries)
|
|
|
|
def test_aco_reach_financial_quality_results(self):
|
|
from cms.express.aco import aco_reach_financial_quality_results
|
|
|
|
_call(aco_reach_financial_quality_results)
|
|
|
|
def test_advance_investment_payment_spend_plan(self):
|
|
from cms.express.aco import advance_investment_payment_spend_plan
|
|
|
|
_call(advance_investment_payment_spend_plan)
|
|
|
|
def test_county_level_aggregate(self):
|
|
from cms.express.aco import (
|
|
county_level_aggregate_expenditure_risk_score_data_assignable_beneficiaries,
|
|
)
|
|
|
|
_call(
|
|
county_level_aggregate_expenditure_risk_score_data_assignable_beneficiaries
|
|
)
|
|
|
|
def test_number_aco_assigned_beneficiaries_by_county(self):
|
|
from cms.express.aco import (
|
|
number_accountable_care_organization_assigned_beneficiaries_by_county,
|
|
)
|
|
|
|
_call(number_accountable_care_organization_assigned_beneficiaries_by_county)
|
|
|
|
def test_performance_year_financial_quality_results(self):
|
|
from cms.express.aco import (
|
|
performance_year_financial_quality_results,
|
|
)
|
|
|
|
_call(performance_year_financial_quality_results)
|
|
|
|
def test_pioneer_aco_model(self):
|
|
from cms.express.aco import pioneer_aco_model
|
|
|
|
_call(pioneer_aco_model)
|
|
|
|
def test_reach_acos(self):
|
|
from cms.express.aco import reach_acos
|
|
|
|
_call(reach_acos)
|
|
|
|
def test_value_modifier(self):
|
|
from cms.express.aco import value_modifier
|
|
|
|
_call(value_modifier)
|
|
|
|
|
|
# ── drug_spending (remaining functions) ──────────────────────
|
|
|
|
|
|
class TestDrugSpendingExhaustive:
|
|
def test_medicaid_opioid_prescribing_rates(self):
|
|
from cms.express.drug_spending import (
|
|
medicaid_opioid_prescribing_rates_by_geography,
|
|
)
|
|
|
|
_call(medicaid_opioid_prescribing_rates_by_geography)
|
|
|
|
def test_medicare_part_b_discarded_drug_units(self):
|
|
from cms.express.drug_spending import (
|
|
medicare_part_b_discarded_drug_units,
|
|
)
|
|
|
|
_call(medicare_part_b_discarded_drug_units)
|
|
|
|
def test_medicare_part_b_spending_by_drug(self):
|
|
from cms.express.drug_spending import (
|
|
medicare_part_b_spending_by_drug,
|
|
)
|
|
|
|
_call(medicare_part_b_spending_by_drug)
|
|
|
|
def test_medicare_part_d_opioid_prescribing_rates(self):
|
|
from cms.express.drug_spending import (
|
|
medicare_part_d_opioid_prescribing_rates_by_geography,
|
|
)
|
|
|
|
_call(medicare_part_d_opioid_prescribing_rates_by_geography)
|
|
|
|
def test_medicare_part_d_spending_by_drug(self):
|
|
from cms.express.drug_spending import (
|
|
medicare_part_d_spending_by_drug,
|
|
)
|
|
|
|
_call(medicare_part_d_spending_by_drug)
|
|
|
|
def test_medicare_quarterly_part_b_spending(self):
|
|
from cms.express.drug_spending import (
|
|
medicare_quarterly_part_b_spending_by_drug,
|
|
)
|
|
|
|
_call(medicare_quarterly_part_b_spending_by_drug)
|
|
|
|
def test_medicare_quarterly_part_d_spending(self):
|
|
from cms.express.drug_spending import (
|
|
medicare_quarterly_part_d_spending_by_drug,
|
|
)
|
|
|
|
_call(medicare_quarterly_part_d_spending_by_drug)
|
|
|
|
def test_monthly_prescription_drug_plan(self):
|
|
from cms.express.drug_spending import (
|
|
monthly_prescription_drug_plan_formulary_pharmacy_network_information,
|
|
)
|
|
|
|
_call(monthly_prescription_drug_plan_formulary_pharmacy_network_information)
|
|
|
|
def test_quarterly_prescription_drug_plan(self):
|
|
from cms.express.drug_spending import (
|
|
quarterly_prescription_drug_plan_formulary_pharmacy_network_pricing_information,
|
|
)
|
|
|
|
_call(
|
|
quarterly_prescription_drug_plan_formulary_pharmacy_network_pricing_information
|
|
)
|
|
|
|
|
|
# ── enrollment (remaining functions) ─────────────────────────
|
|
|
|
|
|
class TestEnrollmentExhaustive:
|
|
def test_fee_service_public_provider_enrollment(self):
|
|
from cms.express.enrollment import (
|
|
medicare_fee_service_public_provider_enrollment,
|
|
)
|
|
|
|
_call(medicare_fee_service_public_provider_enrollment)
|
|
|
|
def test_program_stats_ma_enrollment(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_advantage_other_health_plan_enrollment,
|
|
)
|
|
|
|
_call(program_statistics_medicare_advantage_other_health_plan_enrollment)
|
|
|
|
def test_program_stats_deaths(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_deaths,
|
|
)
|
|
|
|
_call(program_statistics_medicare_deaths)
|
|
|
|
def test_program_stats_dual_enrollment(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_medicaid_dual_enrollment,
|
|
)
|
|
|
|
_call(program_statistics_medicare_medicaid_dual_enrollment)
|
|
|
|
def test_program_stats_newly_enrolled(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_newly_enrolled,
|
|
)
|
|
|
|
_call(program_statistics_medicare_newly_enrolled)
|
|
|
|
def test_program_stats_part_d_enrollment(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_part_d_enrollment,
|
|
)
|
|
|
|
_call(program_statistics_medicare_part_d_enrollment)
|
|
|
|
def test_program_stats_premiums(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_premiums,
|
|
)
|
|
|
|
_call(program_statistics_medicare_premiums)
|
|
|
|
def test_program_stats_total_enrollment(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_medicare_total_enrollment,
|
|
)
|
|
|
|
_call(program_statistics_medicare_total_enrollment)
|
|
|
|
def test_program_stats_original_enrollment(self):
|
|
from cms.express.enrollment import (
|
|
program_statistics_original_medicare_enrollment,
|
|
)
|
|
|
|
_call(program_statistics_original_medicare_enrollment)
|
|
|
|
|
|
# ── facility (remaining functions) ───────────────────────────
|
|
|
|
|
|
class TestFacilityExhaustive:
|
|
def test_deficit_reduction_act(self):
|
|
from cms.express.facility import (
|
|
deficit_reduction_act_hospital_acquired_condition_measures,
|
|
)
|
|
|
|
_call(deficit_reduction_act_hospital_acquired_condition_measures)
|
|
|
|
def test_esrd_facility_aggregation(self):
|
|
from cms.express.facility import (
|
|
end_stage_renal_disease_facility_aggregation_group_performance,
|
|
)
|
|
|
|
_call(end_stage_renal_disease_facility_aggregation_group_performance)
|
|
|
|
def test_facility_level_mds_frequency(self):
|
|
from cms.express.facility import (
|
|
facility_level_minimum_data_set_frequency,
|
|
)
|
|
|
|
_call(facility_level_minimum_data_set_frequency)
|
|
|
|
def test_fqhc_all_owners(self):
|
|
from cms.express.facility import (
|
|
federally_qualified_health_center_all_owners,
|
|
)
|
|
|
|
_call(federally_qualified_health_center_all_owners)
|
|
|
|
def test_fqhc_enrollments(self):
|
|
from cms.express.facility import (
|
|
federally_qualified_health_center_enrollments,
|
|
)
|
|
|
|
_call(federally_qualified_health_center_enrollments)
|
|
|
|
def test_hha_all_owners(self):
|
|
from cms.express.facility import home_health_agency_all_owners
|
|
|
|
_call(home_health_agency_all_owners)
|
|
|
|
def test_hha_cost_report(self):
|
|
from cms.express.facility import home_health_agency_cost_report
|
|
|
|
_call(home_health_agency_cost_report)
|
|
|
|
def test_hha_enrollments(self):
|
|
from cms.express.facility import home_health_agency_enrollments
|
|
|
|
_call(home_health_agency_enrollments)
|
|
|
|
def test_home_infusion_therapy_providers(self):
|
|
from cms.express.facility import home_infusion_therapy_providers
|
|
|
|
_call(home_infusion_therapy_providers)
|
|
|
|
def test_hospice_all_owners(self):
|
|
from cms.express.facility import hospice_all_owners
|
|
|
|
_call(hospice_all_owners)
|
|
|
|
def test_hospice_enrollments(self):
|
|
from cms.express.facility import hospice_enrollments
|
|
|
|
_call(hospice_enrollments)
|
|
|
|
def test_hospital_all_owners(self):
|
|
from cms.express.facility import hospital_all_owners
|
|
|
|
_call(hospital_all_owners)
|
|
|
|
def test_hospital_change_ownership(self):
|
|
from cms.express.facility import hospital_change_ownership
|
|
|
|
_call(hospital_change_ownership)
|
|
|
|
def test_hospital_change_ownership_owner_information(self):
|
|
from cms.express.facility import (
|
|
hospital_change_ownership_owner_information,
|
|
)
|
|
|
|
_call(hospital_change_ownership_owner_information)
|
|
|
|
def test_hospital_enrollments(self):
|
|
from cms.express.facility import hospital_enrollments
|
|
|
|
_call(hospital_enrollments)
|
|
|
|
def test_hospital_price_transparency(self):
|
|
from cms.express.facility import (
|
|
hospital_price_transparency_enforcement_activities_outcomes,
|
|
)
|
|
|
|
_call(hospital_price_transparency_enforcement_activities_outcomes)
|
|
|
|
def test_hospital_provider_cost_report(self):
|
|
from cms.express.facility import hospital_provider_cost_report
|
|
|
|
_call(hospital_provider_cost_report)
|
|
|
|
def test_income_asset_ownership(self):
|
|
from cms.express.facility import income_asset_ownership
|
|
|
|
_call(income_asset_ownership)
|
|
|
|
def test_long_term_care_facility_characteristics(self):
|
|
from cms.express.facility import (
|
|
long_term_care_facility_characteristics,
|
|
)
|
|
|
|
_call(long_term_care_facility_characteristics)
|
|
|
|
def test_geographic_variation_hrr(self):
|
|
from cms.express.facility import (
|
|
medicare_geographic_variation_by_hospital_referral_region,
|
|
)
|
|
|
|
_call(medicare_geographic_variation_by_hospital_referral_region)
|
|
|
|
def test_pac_hha_geo_provider(self):
|
|
from cms.express.facility import (
|
|
medicare_post_acute_care_utilization_home_health_agency_by_geography_provider_case_mix_grouping,
|
|
)
|
|
|
|
_call(
|
|
medicare_post_acute_care_utilization_home_health_agency_by_geography_provider_case_mix_grouping
|
|
)
|
|
|
|
def test_pac_snf_geo_provider(self):
|
|
from cms.express.facility import (
|
|
medicare_post_acute_care_utilization_skilled_nursing_facility_by_geography_provider_case_mix_grouping,
|
|
)
|
|
|
|
_call(
|
|
medicare_post_acute_care_utilization_skilled_nursing_facility_by_geography_provider_case_mix_grouping
|
|
)
|
|
|
|
def test_mds_frequency(self):
|
|
from cms.express.facility import minimum_data_set_frequency
|
|
|
|
_call(minimum_data_set_frequency)
|
|
|
|
def test_nursing_home_chain(self):
|
|
from cms.express.facility import (
|
|
nursing_home_chain_performance_measures,
|
|
)
|
|
|
|
_call(nursing_home_chain_performance_measures)
|
|
|
|
def test_opioid_treatment_providers(self):
|
|
from cms.express.facility import opioid_treatment_program_providers
|
|
|
|
_call(opioid_treatment_program_providers)
|
|
|
|
def test_pbj_daily_non_nurse(self):
|
|
from cms.express.facility import (
|
|
payroll_based_journal_daily_non_nurse_staffing,
|
|
)
|
|
|
|
_call(payroll_based_journal_daily_non_nurse_staffing)
|
|
|
|
def test_pbj_daily_nurse(self):
|
|
from cms.express.facility import (
|
|
payroll_based_journal_daily_nurse_staffing,
|
|
)
|
|
|
|
_call(payroll_based_journal_daily_nurse_staffing)
|
|
|
|
def test_pbj_employee_detail(self):
|
|
from cms.express.facility import (
|
|
payroll_based_journal_employee_detail_nursing_home_staffing,
|
|
)
|
|
|
|
_call(payroll_based_journal_employee_detail_nursing_home_staffing)
|
|
|
|
def test_rhc_all_owners(self):
|
|
from cms.express.facility import rural_health_clinic_all_owners
|
|
|
|
_call(rural_health_clinic_all_owners)
|
|
|
|
def test_rhc_enrollments(self):
|
|
from cms.express.facility import rural_health_clinic_enrollments
|
|
|
|
_call(rural_health_clinic_enrollments)
|
|
|
|
def test_snf_all_owners(self):
|
|
from cms.express.facility import (
|
|
skilled_nursing_facility_all_owners,
|
|
)
|
|
|
|
_call(skilled_nursing_facility_all_owners)
|
|
|
|
def test_snf_change_ownership(self):
|
|
from cms.express.facility import (
|
|
skilled_nursing_facility_change_ownership,
|
|
)
|
|
|
|
_call(skilled_nursing_facility_change_ownership)
|
|
|
|
def test_snf_change_ownership_owner_info(self):
|
|
from cms.express.facility import (
|
|
skilled_nursing_facility_change_ownership_owner_information,
|
|
)
|
|
|
|
_call(skilled_nursing_facility_change_ownership_owner_information)
|
|
|
|
def test_snf_cost_report(self):
|
|
from cms.express.facility import (
|
|
skilled_nursing_facility_cost_report,
|
|
)
|
|
|
|
_call(skilled_nursing_facility_cost_report)
|
|
|
|
def test_snf_enrollments(self):
|
|
from cms.express.facility import (
|
|
skilled_nursing_facility_enrollments,
|
|
)
|
|
|
|
_call(skilled_nursing_facility_enrollments)
|
|
|
|
|
|
# ── innovation (remaining functions) ─────────────────────────
|
|
|
|
|
|
class TestInnovationExhaustive:
|
|
def test_ccjr_model_msas(self):
|
|
from cms.express.innovation import (
|
|
comprehensive_care_joint_replacement_model_metropolitan_statistical_areas,
|
|
)
|
|
|
|
_call(comprehensive_care_joint_replacement_model_metropolitan_statistical_areas)
|
|
|
|
def test_cpc_initiative(self):
|
|
from cms.express.innovation import (
|
|
cpc_initiative_participating_primary_care_practices,
|
|
)
|
|
|
|
_call(cpc_initiative_participating_primary_care_practices)
|
|
|
|
def test_innovation_data_reports(self):
|
|
from cms.express.innovation import innovation_center_data_reports
|
|
|
|
_call(innovation_center_data_reports)
|
|
|
|
def test_innovation_advisors(self):
|
|
from cms.express.innovation import (
|
|
innovation_center_innovation_advisors,
|
|
)
|
|
|
|
_call(innovation_center_innovation_advisors)
|
|
|
|
def test_innovation_milestones(self):
|
|
from cms.express.innovation import (
|
|
innovation_center_milestones_updates,
|
|
)
|
|
|
|
_call(innovation_center_milestones_updates)
|
|
|
|
def test_innovation_model_awardees(self):
|
|
from cms.express.innovation import (
|
|
innovation_center_model_awardees,
|
|
)
|
|
|
|
_call(innovation_center_model_awardees)
|
|
|
|
def test_innovation_model_participants(self):
|
|
from cms.express.innovation import (
|
|
innovation_center_model_participants,
|
|
)
|
|
|
|
_call(innovation_center_model_participants)
|
|
|
|
def test_innovation_model_summary(self):
|
|
from cms.express.innovation import (
|
|
innovation_center_model_summary_information,
|
|
)
|
|
|
|
_call(innovation_center_model_summary_information)
|
|
|
|
def test_innovation_webinars_forums(self):
|
|
from cms.express.innovation import (
|
|
innovation_center_webinars_forums,
|
|
)
|
|
|
|
_call(innovation_center_webinars_forums)
|
|
|
|
def test_kidney_care_choices(self):
|
|
from cms.express.innovation import kidney_care_choices_model
|
|
|
|
_call(kidney_care_choices_model)
|
|
|
|
def test_strong_start_awardees(self):
|
|
from cms.express.innovation import strong_start_awardees
|
|
|
|
_call(strong_start_awardees)
|
|
|
|
|
|
# ── market (remaining functions) ─────────────────────────────
|
|
|
|
|
|
class TestMarketExhaustive:
|
|
def test_market_saturation_cbsa(self):
|
|
from cms.express.market import (
|
|
market_saturation_utilization_core_based_statistical_areas,
|
|
)
|
|
|
|
_call(market_saturation_utilization_core_based_statistical_areas)
|
|
|
|
def test_medicaid_managed_care(self):
|
|
from cms.express.market import medicaid_managed_care
|
|
|
|
_call(medicaid_managed_care)
|
|
|
|
def test_medicare_demonstrations(self):
|
|
from cms.express.market import medicare_demonstrations
|
|
|
|
_call(medicare_demonstrations)
|
|
|
|
def test_medicare_diabetes_prevention(self):
|
|
from cms.express.market import (
|
|
medicare_diabetes_prevention_program,
|
|
)
|
|
|
|
_call(medicare_diabetes_prevention_program)
|
|
|
|
def test_program_stats_ma_inpatient(self):
|
|
from cms.express.market import (
|
|
program_statistics_medicare_advantage_inpatient_hospital,
|
|
)
|
|
|
|
_call(program_statistics_medicare_advantage_inpatient_hospital)
|
|
|
|
def test_program_stats_ma_outpatient(self):
|
|
from cms.express.market import (
|
|
program_statistics_medicare_advantage_outpatient_facility,
|
|
)
|
|
|
|
_call(program_statistics_medicare_advantage_outpatient_facility)
|
|
|
|
def test_program_stats_ma_physician(self):
|
|
from cms.express.market import (
|
|
program_statistics_medicare_advantage_physician_non_physician_practitioner_supplier,
|
|
)
|
|
|
|
_call(
|
|
program_statistics_medicare_advantage_physician_non_physician_practitioner_supplier
|
|
)
|
|
|
|
def test_program_stats_ma_snf(self):
|
|
from cms.express.market import (
|
|
program_statistics_medicare_advantage_skilled_nursing_facility,
|
|
)
|
|
|
|
_call(program_statistics_medicare_advantage_skilled_nursing_facility)
|
|
|
|
|
|
# ── program_statistics (remaining functions) ─────────────────
|
|
|
|
|
|
class TestProgramStatisticsExhaustive:
|
|
def test_hospice(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_hospice,
|
|
)
|
|
|
|
_call(program_statistics_medicare_hospice)
|
|
|
|
def test_inpatient_hospital(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_inpatient_hospital,
|
|
)
|
|
|
|
_call(program_statistics_medicare_inpatient_hospital)
|
|
|
|
def test_outpatient_facility(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_outpatient_facility,
|
|
)
|
|
|
|
_call(program_statistics_medicare_outpatient_facility)
|
|
|
|
def test_part_d(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_part_d,
|
|
)
|
|
|
|
_call(program_statistics_medicare_part_d)
|
|
|
|
def test_part_b_all_types(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_part_part_b_all_types_service,
|
|
)
|
|
|
|
_call(program_statistics_medicare_part_part_b_all_types_service)
|
|
|
|
def test_physician_supplier(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_physician_non_physician_practitioner_supplier,
|
|
)
|
|
|
|
_call(program_statistics_medicare_physician_non_physician_practitioner_supplier)
|
|
|
|
def test_providers(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_providers,
|
|
)
|
|
|
|
_call(program_statistics_medicare_providers)
|
|
|
|
def test_snf(self):
|
|
from cms.express.program_statistics import (
|
|
program_statistics_medicare_skilled_nursing_facility,
|
|
)
|
|
|
|
_call(program_statistics_medicare_skilled_nursing_facility)
|
|
|
|
|
|
# ── provider (remaining functions) ───────────────────────────
|
|
|
|
|
|
class TestProviderExhaustive:
|
|
def test_fiscal_intermediary(self):
|
|
from cms.express.provider import (
|
|
fiscal_intermediary_shared_system_attending_rendering,
|
|
)
|
|
|
|
_call(fiscal_intermediary_shared_system_attending_rendering)
|
|
|
|
def test_managing_clinician(self):
|
|
from cms.express.provider import (
|
|
managing_clinician_aggregation_group_performance,
|
|
)
|
|
|
|
_call(managing_clinician_aggregation_group_performance)
|
|
|
|
def test_clinical_lab_fee_schedule(self):
|
|
from cms.express.provider import (
|
|
medicare_clinical_laboratory_fee_schedule_private_payer_rates_volumes,
|
|
)
|
|
|
|
_call(medicare_clinical_laboratory_fee_schedule_private_payer_rates_volumes)
|
|
|
|
def test_fee_service_cert(self):
|
|
from cms.express.provider import (
|
|
medicare_fee_service_comprehensive_error_rate_testing,
|
|
)
|
|
|
|
_call(medicare_fee_service_comprehensive_error_rate_testing)
|
|
|
|
def test_part_d_prescribers_by_geography(self):
|
|
from cms.express.provider import (
|
|
medicare_part_d_prescribers_by_geography_drug,
|
|
)
|
|
|
|
_call(medicare_part_d_prescribers_by_geography_drug)
|
|
|
|
def test_part_d_prescribers_by_provider(self):
|
|
from cms.express.provider import (
|
|
medicare_part_d_prescribers_by_provider,
|
|
)
|
|
|
|
_call(medicare_part_d_prescribers_by_provider)
|
|
|
|
def test_part_d_prescribers_by_provider_drug(self):
|
|
from cms.express.provider import (
|
|
medicare_part_d_prescribers_by_provider_drug,
|
|
)
|
|
|
|
_call(medicare_part_d_prescribers_by_provider_drug)
|
|
|
|
def test_physician_by_geography_service(self):
|
|
from cms.express.provider import (
|
|
medicare_physician_other_practitioners_by_geography_service,
|
|
)
|
|
|
|
_call(medicare_physician_other_practitioners_by_geography_service)
|
|
|
|
def test_physician_by_provider(self):
|
|
from cms.express.provider import (
|
|
medicare_physician_other_practitioners_by_provider,
|
|
)
|
|
|
|
_call(medicare_physician_other_practitioners_by_provider)
|
|
|
|
def test_physician_by_provider_service(self):
|
|
from cms.express.provider import (
|
|
medicare_physician_other_practitioners_by_provider_service,
|
|
)
|
|
|
|
_call(medicare_physician_other_practitioners_by_provider_service)
|
|
|
|
def test_taxonomy_crosswalk(self):
|
|
from cms.express.provider import (
|
|
medicare_provider_supplier_taxonomy_crosswalk,
|
|
)
|
|
|
|
_call(medicare_provider_supplier_taxonomy_crosswalk)
|
|
|
|
def test_pending_initial_non_physicians(self):
|
|
from cms.express.provider import (
|
|
pending_initial_logging_tracking_non_physicians,
|
|
)
|
|
|
|
_call(pending_initial_logging_tracking_non_physicians)
|
|
|
|
def test_pending_initial_physicians(self):
|
|
from cms.express.provider import (
|
|
pending_initial_logging_tracking_physicians,
|
|
)
|
|
|
|
_call(pending_initial_logging_tracking_physicians)
|
|
|
|
def test_physician_supplier_procedure_summary(self):
|
|
from cms.express.provider import (
|
|
physician_supplier_procedure_summary,
|
|
)
|
|
|
|
_call(physician_supplier_procedure_summary)
|
|
|
|
def test_provider_services_clinical_labs(self):
|
|
from cms.express.provider import (
|
|
provider_services_file_clinical_laboratories,
|
|
)
|
|
|
|
_call(provider_services_file_clinical_laboratories)
|
|
|
|
def test_provider_services_iqies(self):
|
|
from cms.express.provider import (
|
|
provider_services_file_internet_quality_improvement_evaluation_system,
|
|
)
|
|
|
|
_call(provider_services_file_internet_quality_improvement_evaluation_system)
|
|
|
|
def test_provider_services_qies(self):
|
|
from cms.express.provider import (
|
|
provider_services_file_quality_improvement_evaluation_system,
|
|
)
|
|
|
|
_call(provider_services_file_quality_improvement_evaluation_system)
|
|
|
|
def test_missing_digital_contact(self):
|
|
from cms.express.provider import (
|
|
public_reporting_missing_digital_contact_information,
|
|
)
|
|
|
|
_call(public_reporting_missing_digital_contact_information)
|
|
|
|
def test_quality_payment_program(self):
|
|
from cms.express.provider import (
|
|
quality_payment_program_experience,
|
|
)
|
|
|
|
_call(quality_payment_program_experience)
|
|
|
|
def test_restructured_betos(self):
|
|
from cms.express.provider import (
|
|
restructured_betos_classification_system,
|
|
)
|
|
|
|
_call(restructured_betos_classification_system)
|
|
|
|
def test_revalidation_clinic_group(self):
|
|
from cms.express.provider import (
|
|
revalidation_clinic_group_practice_reassignment,
|
|
)
|
|
|
|
_call(revalidation_clinic_group_practice_reassignment)
|
|
|
|
def test_revalidation_due_date(self):
|
|
from cms.express.provider import revalidation_due_date_list
|
|
|
|
_call(revalidation_due_date_list)
|
|
|
|
def test_revalidation_reassignment(self):
|
|
from cms.express.provider import revalidation_reassignment_list
|
|
|
|
_call(revalidation_reassignment_list)
|
|
|
|
|
|
# ── utilization (remaining functions) ────────────────────────
|
|
|
|
|
|
class TestUtilizationExhaustive:
|
|
def test_ma_geographic_variation(self):
|
|
from cms.express.utilization import (
|
|
medicare_advantage_geographic_variation_national_state,
|
|
)
|
|
|
|
_call(medicare_advantage_geographic_variation_national_state)
|
|
|
|
def test_covid_hospitalization_trends(self):
|
|
from cms.express.utilization import (
|
|
medicare_covid_19_hospitalization_trends,
|
|
)
|
|
|
|
_call(medicare_covid_19_hospitalization_trends)
|
|
|
|
def test_mcbs_cost_supplement(self):
|
|
from cms.express.utilization import (
|
|
medicare_current_beneficiary_survey_cost_supplement,
|
|
)
|
|
|
|
_call(medicare_current_beneficiary_survey_cost_supplement)
|
|
|
|
def test_mcbs_covid_supplement(self):
|
|
from cms.express.utilization import (
|
|
medicare_current_beneficiary_survey_covid_19_supplement,
|
|
)
|
|
|
|
_call(medicare_current_beneficiary_survey_covid_19_supplement)
|
|
|
|
def test_mcbs_survey_file(self):
|
|
from cms.express.utilization import (
|
|
medicare_current_beneficiary_survey_survey_file,
|
|
)
|
|
|
|
_call(medicare_current_beneficiary_survey_survey_file)
|
|
|
|
def test_dme_by_geography_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_durable_medical_equipment_devices_supplies_by_geography_service,
|
|
)
|
|
|
|
_call(medicare_durable_medical_equipment_devices_supplies_by_geography_service)
|
|
|
|
def test_dme_by_referring_provider(self):
|
|
from cms.express.utilization import (
|
|
medicare_durable_medical_equipment_devices_supplies_by_referring_provider,
|
|
)
|
|
|
|
_call(medicare_durable_medical_equipment_devices_supplies_by_referring_provider)
|
|
|
|
def test_dme_by_referring_provider_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_durable_medical_equipment_devices_supplies_by_referring_provider_service,
|
|
)
|
|
|
|
_call(
|
|
medicare_durable_medical_equipment_devices_supplies_by_referring_provider_service
|
|
)
|
|
|
|
def test_dme_by_supplier(self):
|
|
from cms.express.utilization import (
|
|
medicare_durable_medical_equipment_devices_supplies_by_supplier,
|
|
)
|
|
|
|
_call(medicare_durable_medical_equipment_devices_supplies_by_supplier)
|
|
|
|
def test_dme_by_supplier_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_durable_medical_equipment_devices_supplies_by_supplier_service,
|
|
)
|
|
|
|
_call(medicare_durable_medical_equipment_devices_supplies_by_supplier_service)
|
|
|
|
def test_geographic_variation_national_state_county(self):
|
|
from cms.express.utilization import (
|
|
medicare_geographic_variation_by_national_state_county,
|
|
)
|
|
|
|
_call(medicare_geographic_variation_by_national_state_county)
|
|
|
|
def test_inpatient_by_geography_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_inpatient_hospitals_by_geography_service,
|
|
)
|
|
|
|
_call(medicare_inpatient_hospitals_by_geography_service)
|
|
|
|
def test_inpatient_by_provider(self):
|
|
from cms.express.utilization import (
|
|
medicare_inpatient_hospitals_by_provider,
|
|
)
|
|
|
|
_call(medicare_inpatient_hospitals_by_provider)
|
|
|
|
def test_inpatient_by_provider_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_inpatient_hospitals_by_provider_service,
|
|
)
|
|
|
|
_call(medicare_inpatient_hospitals_by_provider_service)
|
|
|
|
def test_outpatient_by_geography_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_outpatient_hospitals_by_geography_service,
|
|
)
|
|
|
|
_call(medicare_outpatient_hospitals_by_geography_service)
|
|
|
|
def test_outpatient_by_provider_service(self):
|
|
from cms.express.utilization import (
|
|
medicare_outpatient_hospitals_by_provider_service,
|
|
)
|
|
|
|
_call(medicare_outpatient_hospitals_by_provider_service)
|
|
|
|
def test_pac_hha(self):
|
|
from cms.express.utilization import (
|
|
medicare_post_acute_care_utilization_home_health_agency,
|
|
)
|
|
|
|
_call(medicare_post_acute_care_utilization_home_health_agency)
|
|
|
|
def test_pac_hospice(self):
|
|
from cms.express.utilization import (
|
|
medicare_post_acute_care_utilization_hospice,
|
|
)
|
|
|
|
_call(medicare_post_acute_care_utilization_hospice)
|
|
|
|
def test_pac_irf(self):
|
|
from cms.express.utilization import (
|
|
medicare_post_acute_care_utilization_inpatient_rehabilitation_facility,
|
|
)
|
|
|
|
_call(medicare_post_acute_care_utilization_inpatient_rehabilitation_facility)
|
|
|
|
def test_pac_irf_geo_provider(self):
|
|
from cms.express.utilization import (
|
|
medicare_post_acute_care_utilization_inpatient_rehabilitation_facility_by_geography_provider_case_mix_grouping,
|
|
)
|
|
|
|
_call(
|
|
medicare_post_acute_care_utilization_inpatient_rehabilitation_facility_by_geography_provider_case_mix_grouping
|
|
)
|
|
|
|
def test_pac_ltch(self):
|
|
from cms.express.utilization import (
|
|
medicare_post_acute_care_utilization_long_term_care_hospital,
|
|
)
|
|
|
|
_call(medicare_post_acute_care_utilization_long_term_care_hospital)
|
|
|
|
def test_pac_snf(self):
|
|
from cms.express.utilization import (
|
|
medicare_post_acute_care_utilization_skilled_nursing_facility,
|
|
)
|
|
|
|
_call(medicare_post_acute_care_utilization_skilled_nursing_facility)
|
|
|
|
def test_telehealth_trends(self):
|
|
from cms.express.utilization import medicare_telehealth_trends
|
|
|
|
_call(medicare_telehealth_trends)
|
|
|
|
|
|
# ── _helpers: cast_integer, cast_date ────────────────────────
|
|
|
|
|
|
class TestCastInteger:
|
|
"""cast_integer casts string column to Int64."""
|
|
|
|
def test_clean_integer(self) -> None:
|
|
from cms.express._helpers import cast_integer
|
|
|
|
df = pl.DataFrame({"val": ["42"]})
|
|
ndf = nw.from_native(df)
|
|
result = nw.to_native(ndf.select(cast_integer("val")))
|
|
assert result["val"].dtype == pl.Int64
|
|
assert result["val"][0] == 42
|
|
|
|
def test_null_passthrough(self) -> None:
|
|
from cms.express._helpers import cast_integer
|
|
|
|
df = pl.DataFrame({"val": [None]}, schema={"val": pl.String})
|
|
ndf = nw.from_native(df)
|
|
result = nw.to_native(ndf.select(cast_integer("val")))
|
|
assert result["val"][0] is None
|
|
|
|
def test_float_truncated(self) -> None:
|
|
from cms.express._helpers import cast_integer
|
|
|
|
df = pl.DataFrame({"val": ["99.7"]})
|
|
ndf = nw.from_native(df)
|
|
result = nw.to_native(ndf.select(cast_integer("val")))
|
|
assert result["val"][0] == 99
|
|
|
|
|
|
class TestCastDate:
|
|
"""cast_date casts string column to Date."""
|
|
|
|
def test_valid_date(self) -> None:
|
|
from cms.express._helpers import cast_date
|
|
|
|
df = pl.DataFrame({"val": ["2024-01-15"]})
|
|
ndf = nw.from_native(df)
|
|
result = nw.to_native(ndf.select(cast_date("val")))
|
|
assert result["val"].dtype == pl.Date
|
|
|
|
def test_null_passthrough(self) -> None:
|
|
from cms.express._helpers import cast_date
|
|
|
|
df = pl.DataFrame({"val": [None]}, schema={"val": pl.String})
|
|
ndf = nw.from_native(df)
|
|
result = nw.to_native(ndf.select(cast_date("val")))
|
|
assert result["val"][0] is None
|