| 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") | |