fix(835): correct SVC04/SVC05 mapping per X12 005010X221A1

X12 835 SVC segment:
  SVC01 = composite procedure
  SVC02 = charge
  SVC03 = payment
  SVC04 = Unit or Basis for Measurement Code (UN, MJ, DA, ...)
  SVC05 = Service Unit Count

The parser previously read SVC04 as the units count and SVC05 as the
unit type — backwards. On real 835s (and the canonical minimal
fixture), SVC04 carries the code 'UN' which fails Decimal parsing, so
the units always came out as None and the code string was assigned to
unit_type. SP7's line-level matcher couldn't compare units on the SVC
side against the claim side because of this.

- _consume_service_payment: SVC04 → unit_type, SVC05 → units count
- Default unit_type to 'UN' when only the count is present
- minimal_835.txt + unbalanced_835.txt: swap positions to match spec
- Add 2 regression tests (units-and-unit-type, default-unit-type-to-UN)
This commit is contained in:
Tyler
2026-06-20 20:44:28 -06:00
parent 3f4e6849c6
commit 2893676c0b
4 changed files with 68 additions and 15 deletions
+2 -2
View File
@@ -12,9 +12,9 @@ N4*Montrose*CO*814014063~
LX*1~
CLP*CLM001*1*100.00*85.00*15.00*MC*CLM001*12*1~
CAS*CO*45*15.00~
SVC*HC:S5130:U2*60.00*50.00*7.73*UN*20260602~
SVC*HC:S5130:U2*60.00*50.00*UN*7.73*20260602~
DTM*472*20260602~
SVC*HC:S5130:U2*40.00*35.00*7.73*UN*20260603~
SVC*HC:S5130:U2*40.00*35.00*UN*7.73*20260603~
DTM*472*20260603~
SE*22*991102984~
GE*1*991102984~
+2 -2
View File
@@ -12,9 +12,9 @@ N4*Montrose*CO*814014063~
LX*1~
CLP*CLM001*1*100.00*85.00*15.00*MC*CLM001*12*1~
CAS*CO*45*15.00~
SVC*HC:S5130:U2*60.00*50.00*7.73*UN*20260602~
SVC*HC:S5130:U2*60.00*50.00*UN*7.73*20260602~
DTM*472*20260602~
SVC*HC:S5130:U2*40.00*35.00*7.73*UN*20260603~
SVC*HC:S5130:U2*40.00*35.00*UN*7.73*20260603~
DTM*472*20260603~
SE*22*991102985~
GE*1*991102985~