Skip to content

Commit

Permalink
Add missing 835 footer and provider adjustment segments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Buss committed Jan 23, 2013
1 parent db844eb commit aeaeec6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/835-example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ ISA|00| |00| |ZZ|MYCLEARINGHOUSE|ZZ|RECVCODE |120323|193
~AMT|B6|12145.65
~LQ|HE|N220
~LQ|HE|M68
~PLB|743238060|20121231|WO^12104411559120820 001GAL295513|-361.19
~SE|43|0001
~GE|1|15555
~IEA|1|000015442
8 changes: 8 additions & 0 deletions tests/test_835.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ def test_claims(self):
"dispute."))
self.assertEqual(l.notes[1], "M68")

def test_footer(self):
footer = self.f.facades[0].footer
self.assertEqual(len(footer.provider_adjustments), 1)
adj = footer.provider_adjustments[0]
self.assertEqual(adj.provider_id, '743238060')
self.assertEqual(adj.date, datetime.date(2012,12,31))
self.assertEqual(adj.amount_1, Decimal('-361.19'))


if __name__ == "__main__":
logging.basicConfig(
Expand Down
28 changes: 28 additions & 0 deletions tigershark/facade/f835.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from decimal import Decimal

from tigershark.facade import X12LoopBridge
from tigershark.facade import X12SegmentBridge
from tigershark.facade import ElementAccess
from tigershark.facade import ElementSequenceAccess
from tigershark.facade import CompositeAccess
from tigershark.facade import SegmentSequenceAccess
from tigershark.facade import SegmentConversion
from tigershark.facade import D8
from tigershark.facade import Money
from tigershark.facade import Facade
Expand Down Expand Up @@ -125,6 +128,30 @@ def __init__(self, aLoop, *args, **kwargs):
self.production_date = Header._ProductionDate(aLoop, *args, **kwargs)


class ProviderAdjustments(X12SegmentBridge):
provider_id = ElementAccess("PLB", 1)
date = ElementAccess("PLB", 2, x12type=D8)
reason_1 = ElementAccess("PLB", 3)
amount_1 = ElementAccess("PLB", 4, x12type=Money)
reason_2 = ElementAccess("PLB", 5)
amount_2 = ElementAccess("PLB", 6, x12type=Money)
reason_3 = ElementAccess("PLB", 7)
amount_3 = ElementAccess("PLB", 8, x12type=Money)
reason_4 = ElementAccess("PLB", 9)
amount_4 = ElementAccess("PLB", 10, x12type=Money)
reason_5 = ElementAccess("PLB", 11)
amount_5 = ElementAccess("PLB", 12, x12type=Money)
reason_6 = ElementAccess("PLB", 13)
amount_6 = ElementAccess("PLB", 14, x12type=Money)


class Footer(Facade, X12LoopBridge):
loopName = "FOOTER"

provider_adjustments = SegmentSequenceAccess("PLB",
x12type=SegmentConversion(ProviderAdjustments))


class Payer(X12LoopBridge):
"""Payer information from the 1000A loop."""
loopName = "1000A"
Expand Down Expand Up @@ -434,3 +461,4 @@ def __init__(self, anX12Message):
self.claims_overview = first(self.loops(ClaimsOverview,
anX12Message))
self.claims = self.loops(Claim, anX12Message)
self.footer = first(self.loops(Footer, anX12Message))

0 comments on commit aeaeec6

Please sign in to comment.