From 019e09aff620aceb510548f221c00c1e8ef4b830 Mon Sep 17 00:00:00 2001 From: Nora Date: Wed, 8 Jul 2026 02:39:06 -0600 Subject: [PATCH] =?UTF-8?q?fix(sp41):=20CLM07=20default=20'Y'=20=E2=86=92?= =?UTF-8?q?=20'A'=20(valid=20Assignment=20of=20Benefits=20code)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pyX12 caught a real serializer bug: CLM07 must be an Assignment of Benefits code (A/B/C/P), NOT a Yes/No value. The serializer was defaulting to 'Y', which is not in the X12 837P IG code list. After fix: - 10/10 batch-1 837P files: pyX12 OK - 10/10 batch-2 837P files: pyX12 OK - 20/20 parametric test: PASS (drives shipped SP40 validator + structural) - 1568/1577 full backend suite: PASS --- backend/src/cyclone/parsers/serialize_837.py | 4 ++-- backend/src/cyclone/rebill/spot_check.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/cyclone/parsers/serialize_837.py b/backend/src/cyclone/parsers/serialize_837.py index db2f409..6d8f93c 100644 --- a/backend/src/cyclone/parsers/serialize_837.py +++ b/backend/src/cyclone/parsers/serialize_837.py @@ -330,8 +330,8 @@ def _build_clm(claim) -> str: "", # CLM03 — non-institutional claim filing indicator "", # CLM04 — non-institutional claim filing code clm05, # CLM05 — composite POS:qualifier:frequency_code - claim.provider_signature or "Y", # CLM06 - claim.assignment or "Y", # CLM07 + claim.provider_signature or "Y", # CLM06 — Yes/No + claim.assignment or "A", # CLM07 — Assignment of Benefits (valid: A/B/C/P, NOT Y/N) # CLM08 — Benefits Assignment Certification. X12 837P requires # this when CLM07 = "Y" (the common case for in-network # professional claims). Default to "Y" when the source did diff --git a/backend/src/cyclone/rebill/spot_check.py b/backend/src/cyclone/rebill/spot_check.py index e036a37..0e8bded 100644 --- a/backend/src/cyclone/rebill/spot_check.py +++ b/backend/src/cyclone/rebill/spot_check.py @@ -174,7 +174,7 @@ def build_claim_output( facility_code_qualifier="B", frequency_code="1", provider_signature="Y", - assignment="Y", + assignment="A", # CLM07 Assignment of Benefits — valid codes are A/B/C/P, NOT Y/N (pyX12 caught this; "Y" was a serializer bug) benefits_assignment_certification="Y", release_of_info="Y", prior_auth=visit.prior_auth,