feat(sp32): extract 835 NM1*1P (service provider NPI) per ClaimPayment

This commit is contained in:
Nora
2026-07-02 16:56:01 -06:00
parent c491003287
commit d8707ba874
3 changed files with 45 additions and 3 deletions
+32
View File
@@ -178,3 +178,35 @@ def test_parse_service_payment_units_default_unit_type_to_un():
# Default to UN when SVC04 missing but units present.
assert s1.unit_type == "UN", s1.unit_type
assert s2.unit_type == "UN", s2.unit_type
def test_parse_835_extracts_service_provider_npi_from_nm1_1p():
"""SP32: NM1*1P in Loop 2100 populates ClaimPayment.service_provider_npi."""
from cyclone.parsers.parse_835 import parse as parse_835
text = (
"ISA*00* *00* *ZZ*RECEIVERID *ZZ*SENDERID *250101*1200*^*00501*000000001*0*P*:~"
"GS*HP*RECEIVER*SENDER*20250101*1200*1*X*005010X221A1~"
"ST*835*0001~"
"BPR*I*85.40*C*NON*****01*021000021*DA*123456*1511111**01*031302955*DA*9876543~"
"TRN*1*1511111*1511111~"
"DTM*405*20250101~"
"N1*PR*COLORADO MEDICAID*XV*CO MEDICAID~"
"N3*PO BOX 1100*~"
"N4*DENVER*CO*80203~"
"REF*2U*12345~"
"PER*BL*SUPPORT*TE*8005551212~"
"N1*PE*ACME CLINIC*XX*1111111111~"
"LX*1~"
"CLP*CLM001*1*85.40*85.40*0.00*MC*CLM001*11*1~"
"CAS*PR*1*0.00~"
"NM1*1P*2*RENDERING PROVIDER*****XX*2222222222~"
"SVC*HC:99213*85.40*85.40**1~"
"DTM*472*20250101~"
"SE*18*0001~"
"GE*1*1~"
"IEA*1*000000001~"
)
result = parse_835(text, payer_config=None) # type: ignore[arg-type]
assert len(result.claims) == 1
assert result.claims[0].service_provider_npi == "2222222222"