Portal Delete run (Super Admin), lab codes #3/#4, Z23 pointer #45, T1017 #46, payer note, login security-image wait
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a8af44e673
commit
fafa5285eb
21 files changed
+1509
-63
No files matched your search
@@ -0,0 +1,192 @@
|
||||
r"""
|
||||
conditions/t1017_non_billable.py — document #46 (EEWA-40, operator
|
||||
2026-10-28): T1017 by the claim's primary payer —
|
||||
|
||||
* a Medicare payer (#25's exact eCW names) or Medicaid (the dashboard's
|
||||
"Medicaid" group only, as #43/#44): unchecked and Billed Fee 0;
|
||||
* any other payer (RAE, CHP+, blank, unmapped included): nothing
|
||||
changed, Review.
|
||||
|
||||
python tests\test_conditions_t1017_non_billable.py
|
||||
|
||||
Uses hcfa_claim.html like the Medicaid uncheck tests.
|
||||
"""
|
||||
|
||||
import io
|
||||
import sys
|
||||
import pathlib
|
||||
import inspect
|
||||
import contextlib
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
sys.path.insert(0, str(ROOT / "tests"))
|
||||
|
||||
FIXTURE = pathlib.Path(__file__).resolve().parent / "fixtures" / "hcfa_claim.html"
|
||||
|
||||
from ecw_bot.conditions import t1017_non_billable as cond # noqa: E402
|
||||
from ecw_bot.conditions import CONDITIONS # noqa: E402
|
||||
from ecw_bot.conditions.base import ConditionResult, run_all # noqa: E402
|
||||
from ecw_bot.core import charge_summary as cs # noqa: E402
|
||||
from ecw_bot.selectors import claim_form as sel # noqa: E402
|
||||
from test_conditions_medicaid_uncheck_cpts import _inject_cpt_row # noqa: E402
|
||||
|
||||
CASES = []
|
||||
|
||||
|
||||
def case(fn):
|
||||
CASES.append(fn)
|
||||
return fn
|
||||
|
||||
|
||||
def _claim(payer, *codes, screen=None):
|
||||
data = {"insurance": [{"Name": payer}] if payer is not None else [],
|
||||
"cpt": [{"code": c, "checked": True, "fee": "45.00"}
|
||||
for c in codes]}
|
||||
if screen:
|
||||
data["screen"] = screen
|
||||
return data
|
||||
|
||||
|
||||
def _fee(page, n):
|
||||
return page.locator(sel.SEL_CPT_ROWS).nth(n).locator(
|
||||
sel.SEL_CPT_BILLED_FEE).first.input_value()
|
||||
|
||||
|
||||
# ── detect (no browser) ──────────────────────────────────────────────────────
|
||||
|
||||
@case
|
||||
def detect_t1017_on_any_payer():
|
||||
for payer in ("Medicare", "Medicaid", "AARP", "", None):
|
||||
assert cond.detect("C1", _claim(payer, "99213", "T1017")), payer
|
||||
assert cond.detect("C1", _claim("Medicaid", " t1017 "))
|
||||
|
||||
|
||||
@case
|
||||
def no_t1017_or_dental_never_fires_it():
|
||||
assert not cond.detect("C1", _claim("Medicaid", "99213", "T1016"))
|
||||
assert not cond.detect("C1", {})
|
||||
assert not cond.detect("C1", _claim("Medicaid", "T1017",
|
||||
screen="dental"))
|
||||
|
||||
|
||||
@case
|
||||
def which_payers_make_it_non_billable():
|
||||
for payer in ("Medicare", "HCFA Medicare", "Humana Medicare",
|
||||
"Devoted MCR UB", "Medicaid", "HCFA Medicaid"):
|
||||
assert cond.non_billable_for(_claim(payer, "T1017")), payer
|
||||
for payer in ("BH COLORADO ACCESS", "Child Health Plan Plus", "AARP",
|
||||
"NO SUCH PAYER XYZ", "", None):
|
||||
assert not cond.non_billable_for(_claim(payer, "T1017")), payer
|
||||
|
||||
|
||||
# ── apply (browser) ──────────────────────────────────────────────────────────
|
||||
|
||||
@case
|
||||
def medicaid_t1017_unchecked_and_zeroed(page):
|
||||
page.goto(FIXTURE.as_uri())
|
||||
_inject_cpt_row(page, "T1017", fee="80.00")
|
||||
result = cond.apply(page, "C1", _claim("Medicaid", "99213", "T1017"))
|
||||
assert isinstance(result, ConditionResult)
|
||||
assert result.changed and not result.review, result
|
||||
assert [c["code"] for c in result.changes] == ["T1017"], result.changes
|
||||
assert _fee(page, 3) == "0.00"
|
||||
row = page.locator(sel.SEL_CPT_ROWS).nth(3)
|
||||
assert row.locator(sel.SEL_CPT_ASSIGN_TO_PATIENT).first.is_checked() \
|
||||
is False
|
||||
assert _fee(page, 0) == "210.00", "99213 must be left alone"
|
||||
|
||||
|
||||
@case
|
||||
def medicare_t1017_unchecked_and_zeroed(page):
|
||||
page.goto(FIXTURE.as_uri())
|
||||
_inject_cpt_row(page, "T1017", fee="80.00")
|
||||
result = cond.apply(page, "C1", _claim("Humana Medicare", "T1017"))
|
||||
assert result.changed and _fee(page, 3) == "0.00", result
|
||||
|
||||
|
||||
@case
|
||||
def any_other_payer_is_review_and_nothing_changes(page):
|
||||
for payer in ("Cigna HealthCare Of Colorado", "BH COLORADO ACCESS", ""):
|
||||
page.goto(FIXTURE.as_uri())
|
||||
_inject_cpt_row(page, "T1017", fee="80.00")
|
||||
result = cond.apply(page, "C1", _claim(payer, "T1017"))
|
||||
assert result.changed is False, (payer, result)
|
||||
assert "T1017" in result.review and "check by hand" in \
|
||||
result.review, (payer, result)
|
||||
assert _fee(page, 3) == "80.00", payer
|
||||
assert "Cigna HealthCare Of Colorado" in cond.apply(
|
||||
page, "C1", _claim("Cigna HealthCare Of Colorado", "T1017")).review
|
||||
|
||||
|
||||
@case
|
||||
def the_comment_names_the_payer_group(page):
|
||||
page.goto(FIXTURE.as_uri())
|
||||
_inject_cpt_row(page, "T1017", fee="80.00")
|
||||
text = cond.summary_comment(cond.apply(page, "C1",
|
||||
_claim("Medicaid", "T1017")))
|
||||
assert "T1017" in text and "Medicaid" in text, text
|
||||
page.goto(FIXTURE.as_uri())
|
||||
_inject_cpt_row(page, "T1017", fee="80.00")
|
||||
text = cond.describe(cond.apply(page, "C1", _claim("Medicare", "T1017")))
|
||||
assert "T1017" in text and "80.00" in text, text
|
||||
|
||||
|
||||
# ── wiring ───────────────────────────────────────────────────────────────────
|
||||
|
||||
@case
|
||||
def it_is_registered_before_priced_line_check():
|
||||
names = [m.NAME for m in CONDITIONS]
|
||||
assert "t1017_non_billable" in names
|
||||
assert names.index("t1017_non_billable") < names.index(
|
||||
"priced_line_check"), names
|
||||
|
||||
|
||||
@case
|
||||
def the_charge_summary_has_a_fallback_comment():
|
||||
assert "T1017" in cs.COMMENTS["t1017_non_billable"]
|
||||
|
||||
|
||||
@case
|
||||
def run_all_leaves_t1017_unchecked_at_the_end(page):
|
||||
page.goto(FIXTURE.as_uri())
|
||||
_inject_cpt_row(page, "T1017", fee="80.00")
|
||||
with contextlib.redirect_stdout(io.StringIO()):
|
||||
results = run_all(page, "C1", _claim("Medicaid", "T1017"))
|
||||
assert "t1017_non_billable" in [r.condition_name for r in results], \
|
||||
results
|
||||
row = page.locator(sel.SEL_CPT_ROWS).nth(3)
|
||||
assert row.locator(sel.SEL_CPT_ASSIGN_TO_PATIENT).first.is_checked() \
|
||||
is False
|
||||
assert _fee(page, 3) == "0.00"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
failures = 0
|
||||
with sync_playwright() as pw:
|
||||
browser = pw.chromium.launch(headless=True)
|
||||
page = browser.new_page()
|
||||
for fn in CASES:
|
||||
name = fn.__name__.replace("_", " ")
|
||||
try:
|
||||
if len(inspect.signature(fn).parameters) == 0:
|
||||
fn()
|
||||
else:
|
||||
fn(page)
|
||||
print(f" ok {name}")
|
||||
except AssertionError as exc:
|
||||
print(f" FAIL {name}: {exc}")
|
||||
failures += 1
|
||||
except Exception as exc:
|
||||
print(f" ERROR {name}: {type(exc).__name__}: {exc}")
|
||||
failures += 1
|
||||
browser.close()
|
||||
|
||||
print(f"\n{len(CASES) - failures}/{len(CASES)} passed")
|
||||
return 1 if failures else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user