Spaces:
Sleeping
Sleeping
File size: 1,015 Bytes
e1a9577 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import json
from pathlib import Path
from spine_coder.spine_coder_core import suggest_with_cpt_billing
DATA_DIR = Path(__file__).resolve().parents[1] / "synthetic_dataset"
def _rows(): return [json.loads(l) for l in (DATA_DIR / "notes_500.jsonl").read_text().splitlines() if l.strip()]
def test_cpt_presence():
counts={}
for r in _rows():
for l in r["labels"]:
counts[l["cpt"]] = counts.get(l["cpt"],0)+1
assert counts.get("22633",0) >= 80
assert counts.get("22551",0) >= 50
def test_modifiers():
mod_counts={}
for r in _rows():
out=suggest_with_cpt_billing(r["note"])
for m in out.get("case_modifiers",[]):
mod=m["modifier"]
mod_counts[mod]=mod_counts.get(mod,0)+1
assert mod_counts.get("22",0)>=30
assert mod_counts.get("53",0)>=20
assert mod_counts.get("50",0)>=60
assert mod_counts.get("62",0)>=20
assert (mod_counts.get("80",0)+mod_counts.get("82",0))>=30
print("✅ test_coverage_and_modifiers ready")
|