feat(sp32): extract 837p NM1*82 (rendering provider NPI) per ClaimOutput

This commit is contained in:
Nora
2026-07-02 17:04:07 -06:00
parent d8707ba874
commit 4d3eef22ef
4 changed files with 83 additions and 1 deletions
+13
View File
@@ -68,3 +68,16 @@ def test_parse_uses_generic_config_when_requested():
assert len(result.claims) == 1
# No patient-loop rule on generic config
assert result.claims[0].validation.passed is True
def test_parse_837_extracts_rendering_provider_npi_from_nm1_82():
"""SP32: NM1*82 (rendering provider) populates ClaimOutput.rendering_provider_npi."""
from pathlib import Path
text = Path("tests/fixtures/co_medicaid_837p_with_renderer.txt").read_text()
result = parse(text, PayerConfig.co_medicaid())
assert len(result.claims) >= 1
# Find the claim that has the rendering NPI (others may not).
matches = [c for c in result.claims if c.rendering_provider_npi is not None]
assert len(matches) == 1
assert matches[0].rendering_provider_npi == "1234567893"