Skip to content

Commit 7924ed4

Browse files
authored
Merge pull request #12 from CloudCray/explicit_network_benefits
Explicit "network" values for `EligibilityOrBenefitInformation`
2 parents 2d8a628 + fd2193c commit 7924ed4

File tree

7 files changed

+133
-4
lines changed

7 files changed

+133
-4
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
TigerShark is an X12 EDI message parser that can be tailored to
22
a specific partner in the health care payment ecosystem.
33

4+
Version 0.3.3
5+
-------------
6+
7+
* Adds `in_plan_network_type` to `EligibilityOrBenefitInformation` for explicit values
8+
* Adds `out_of_plan_network` for completion's sake
9+
* Note that `in_plan_network`, `out_of_plan_network`, and `both_in_out_network` all return `False` when no value is set, although `None` would probably be more appropriate
10+
* It may be more intuitive if `in_plan_network` and `out_of_plan_network` returned `True` when `both_in_out_network` is `True`, but the behavior is preserved for backwards compatibility
11+
412
Version 0.3.2
513
-------------
614

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
ISA|00| |00| |ZZ|ZIRMED |ZZ|10864 |160405|1354|}|00501|000184077|1|P|^~
2+
GS|HB|ZIRMED|10864|20160301|1354|184065|X|005010X279A1~
3+
ST|271|0001|005010X279A1~
4+
BHT|0022|11|94309|20160301|134403~
5+
HL|1||20|1~
6+
NM1|PR|2|MEDICA COM|||||PI|123456789~
7+
HL|2|1|21|1~
8+
NM1|1P|1|James|Barraret|J.|||XX|1234567894~
9+
HL|3|2|22|0~
10+
TRN|2|434343434|9ZIRMEDCOM|ELR ID~
11+
TRN|1|422422424|9ZIRMEDCOM|ELI ID~
12+
NM1|IL|1|SMITH|JOHN||||MI|1234567899~
13+
REF|18|0404044~
14+
REF|6P|030030001000120|NEVADA EXCHANGE~
15+
N3|4040 VILLAGE AB~
16+
N4|KANSAS CITY|MO|64108~
17+
DMG|D8|19430813|M~
18+
INS|Y|18|001|25~
19+
DTP|346|D8|20160201~
20+
DTP|472|D8|20160601~
21+
DTP|356|D8|20141208~
22+
EB|L|EMP|30|EP~
23+
MSG|PCP SELECTION NOT REQUIRED~
24+
EB|W~
25+
LS|2120~
26+
NM1|PR|2|Mala Compania~
27+
N3|PO Box 983322~
28+
N4|El Fixato|TX|68887~
29+
LE|2120~
30+
EB|1|EMP|30|EP|Open Access Elect Choice~
31+
EB|G|IND|30|C1|||1500|||||Y~
32+
EB|G|IND|30|C1||24|1500|||||Y~
33+
EB|G|IND|30|C1||29|0|||||Y~
34+
EB|C|IND|30||||118|||||Y~
35+
EB|C|IND|30|||24|118|||||Y~
36+
EB|C|IND|30|||29|0|||||Y~
37+
EB|G|IND|30|C1|||0|||||N~
38+
EB|G|IND|30|C1||24|0|||||N~
39+
EB|G|IND|30|C1||29|0|||||N~
40+
EB|C|IND|30||||0|||||N~
41+
EB|C|IND|30|||24|0|||||N~
42+
EB|C|IND|30|||29|0|||||N~
43+
EB|B|EMP|98||||50|||||Y~
44+
EB|B|EMP|98||||100|||||N~
45+
EB|A|IND|50|||27||0.1||||W~
46+
EB|A|IND|52|||||0.1
47+
EB|I|EMP|1}33}48}50}86}98}UC|||||||||N~
48+
SE|74|0001~
49+
GE|1|184065~
50+
IEA|1|000184077~
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import unittest
2+
import logging
3+
import sys
4+
5+
from tigershark.facade import f271
6+
from tigershark.parsers import M271_5010_X279_A1
7+
8+
9+
class TestParsed271(unittest.TestCase):
10+
def setUp(self):
11+
m = M271_5010_X279_A1.parsed_271
12+
with open('tests/271-example-in-out-network.txt') as f:
13+
parsed = m.unmarshall(f.read().strip())
14+
self.f = f271.F271_5010(parsed)
15+
16+
def test_number_of_facades(self):
17+
self.assertEqual(len(self.f.facades), 1)
18+
19+
def test_no_network_info(self):
20+
subscriber = self.f.facades[0].subscribers[0]
21+
benefit = subscriber.eligibility_or_benefit_information[2]
22+
cov_info = benefit.coverage_information
23+
24+
self.assertEqual(cov_info.in_plan_network_type, None)
25+
self.assertEqual(cov_info.in_plan_network, False)
26+
self.assertEqual(cov_info.both_in_out_network, False)
27+
self.assertEqual(cov_info.out_of_plan_network, False)
28+
29+
def test_both_network_info(self):
30+
subscriber = self.f.facades[0].subscribers[0]
31+
benefit = subscriber.eligibility_or_benefit_information[17]
32+
cov_info = benefit.coverage_information
33+
34+
self.assertEqual(cov_info.in_plan_network_type[0], "W")
35+
self.assertEqual(cov_info.in_plan_network, False)
36+
self.assertEqual(cov_info.both_in_out_network, True)
37+
self.assertEqual(cov_info.out_of_plan_network, False)
38+
39+
def test_out_of_network_info(self):
40+
subscriber = self.f.facades[0].subscribers[0]
41+
benefit = subscriber.eligibility_or_benefit_information[16]
42+
cov_info = benefit.coverage_information
43+
44+
self.assertEqual(cov_info.in_plan_network_type[0], "N")
45+
self.assertEqual(cov_info.in_plan_network, False)
46+
self.assertEqual(cov_info.both_in_out_network, False)
47+
self.assertEqual(cov_info.out_of_plan_network, True)
48+
49+
def test_in_network_info(self):
50+
subscriber = self.f.facades[0].subscribers[0]
51+
benefit = subscriber.eligibility_or_benefit_information[15]
52+
cov_info = benefit.coverage_information
53+
54+
self.assertEqual(cov_info.in_plan_network_type[0], "Y")
55+
self.assertEqual(cov_info.in_plan_network, True)
56+
self.assertEqual(cov_info.both_in_out_network, False)
57+
self.assertEqual(cov_info.out_of_plan_network, False)
58+
59+
60+
if __name__ == "__main__":
61+
logging.basicConfig(
62+
stream=sys.stderr,
63+
level=logging.INFO,
64+
)
65+
unittest.main()

tigershark/X12/parse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def parse( self, segments ):
681681
"""If this segment matches the next segment token in the input,
682682
create the X12Segment object.
683683
:param segments: list of SegmentTokens for the current message.
684-
:returns: yields a single parsed Segment or raises StopIteration
684+
:returns: yields a single parsed Segment or ends iteration (returns)
685685
"""
686686
if isinstance(self.repeat, int):
687687
length_loop = range(self.repeat)
@@ -745,7 +745,7 @@ def parse( self, segments ):
745745
loops until a segment no longer matches.
746746
747747
:param segments: list of SegmentToken instances
748-
:returns: Yields the next X12.message.X12Loop structure or raises StopIteration
748+
:returns: Yields the next X12.message.X12Loop structure or ends interation (returns)
749749
"""
750750
# Confirm match between this loop and a segment of the structure
751751
i = 0

tigershark/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
TigerShark - An X12 EDI message parser.
33
"""
44
__all__ = ['X12VersionTuple']
5-
__version__ = "0.3.2"
5+
__version__ = "0.3.3"
66
__authors__ = [
77
"Steven Buss <[email protected]>",
88
"Steven Lott <[email protected]>",

tigershark/facade/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ def compositeList(self, *names):
617617
sep = self.segment.message.getCompositeSeparator()
618618
result = []
619619
pos = 1
620-
while self.segment.getByPos(pos) is not "":
620+
while self.segment.getByPos(pos) != "":
621621
composite = self.segment.getByPos(pos)
622622
subElts = composite.split(sep)
623623
if subElts[0] in names:

tigershark/facade/f271.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ class EligibilityOrBenefitInformation(X12SegmentBridge):
123123
authorization_or_certification = ElementAccess("EB", 11,
124124
x12type=boolean("Y"))
125125
in_plan_network = ElementAccess("EB", 12, x12type=boolean("Y"))
126+
out_of_plan_network = ElementAccess("EB", 12, x12type=boolean("N"))
126127
both_in_out_network = ElementAccess("EB", 12, x12type=boolean("W"))
128+
in_plan_network_type = ElementAccess("EB", 12, x12type=enum({
129+
"Y": "In Plan Network",
130+
"N": "Out of Plan Network",
131+
"W": "Both In and Out of Plan Network",
132+
}))
127133
ada_code = CompositeAccess("EB", "AD", 13)
128134
cpt_code = CompositeAccess("EB", "CJ", 13)
129135
hcpcs_code = CompositeAccess("EB", "HC", 13)

0 commit comments

Comments
 (0)