Skip to content

Commit 28754c1

Browse files
authored
Merge pull request #13 from CloudCray/service_type_code_cleanup
Cleans up Service Type Codes, version bump to 0.3.4
2 parents 7924ed4 + e27f1e7 commit 28754c1

File tree

11 files changed

+79577
-19
lines changed

11 files changed

+79577
-19
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
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+
5+
Version 0.3.4
6+
-------------
7+
8+
This patch cleans up the X12 271 Service Type Codes to bring them in line with current use. This patch also includes
9+
parsers for the 5010 versions of Professional (X222A1) and Institutional (X223A1) 837 transactions.
10+
* Updates `enums.eligibility.service_type_codes` to include new and missing Service Type Codes
11+
* Adds `enums.eligibility.deprecated_service_type_codes`, a tuple of service type codes that have been deprecated by
12+
X12
13+
* Adds `X12_5010_X222A1` and `X12_5010_X223A1` parsers for 837 5010 messages
14+
* This does NOT add or update any facades related to 837 transactions (existing 837 facades only function for 4010
15+
messages)
16+
17+
The `service_type_codes` dict was last updated in June 2012. Since then, 21 Service Type Codes have been added,
18+
7 of which have already been deprecated.
19+
20+
13 Service Type Codes have been deprecated by X12 (including 7 added in this patch). All 13 have been
21+
preserved in `service_type_codes`, as this module may be used to parse existing/old 271 responses. The
22+
`deprecated_service_type_codes` tuple has been added as a helper to identify which codes are considered inactive.
23+
24+
Note: the code `EO` ("ECHO-OSCAR") appears to have been added in error temporarily as a duplicate of `E0`
25+
("ECHO-ZERO") for a 4-month span in 2017. The code has been added back in on the chance it made its way into
26+
any production systems.
27+
28+
New Service Type Codes:
29+
30+
| Code | Label | Date Added | Date Deprecated |
31+
| --- | --- | --- | --- |
32+
| E29 | Technical Cardiac Rehabilitation Services Component | 09/30/2012 | 07/01/2016 |
33+
| E30 | Professional Cardiac Rehabilitation Services Component | 09/30/2012 | 07/01/2016 |
34+
| E31 | Professional Intensive Cardiac Rehabilitation Services Component | 09/30/2012 | 07/01/2016 |
35+
| E32 | Intensive Cardiac Rehabilitation - Technical Component | 06/02/2013 | 05/01/2017 |
36+
| E33 | Intensive Cardiac Rehabilitation | 06/02/2013 | |
37+
| E34 | Pulmonary Rehabilitation - Technical Component | 06/02/2013 | 05/01/2017 |
38+
| E35 | Pulmonary Rehabilitation - Professional Component | 06/02/2013 | 05/01/2017 |
39+
| E36 | Convenience Care | 06/02/2013 | |
40+
| E37 | Telemedicine | 07/01/2015 | |
41+
| E38 | Pharmacist Services | 07/01/2015 | |
42+
| E39 | Diabetic Education | 03/01/2016 | |
43+
| E40 | Early Intervention | 11/01/2016 | |
44+
| EO | Applied Behavioral Analysis Therapy | 03/01/2017 | 07/01/2017 |
45+
| F1 | Medical Coverage | 11/01/2015 | |
46+
| F2 | Social Work Coverage | 11/01/2015 | |
47+
| F3 | Dental Coverage | 11/01/2015 | |
48+
| F4 | Hearing Coverage | 11/01/2015 | |
49+
| F5 | Prescription Drug Coverage | 11/01/2015 | |
50+
| F6 | Vision Coverage | 11/01/2015 | |
51+
| F7 | Orthodontia Coverage | 11/01/2015 | |
52+
| F8 | Mental Health Coverage | 11/01/2015 | |
53+
54+
More on service type codes on the [official X12 website](https://x12.org/codes/service-type-codes).
55+
* _Note: Use the
56+
"Show All" filter to view current and deprecated codes (page only displays current codes by default.)_
57+
58+
459
Version 0.3.3
560
-------------
661

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
ISA*00* *00* *ZZ*1234567 *ZZ*11111 *170508*1141*^*00501*000000101*1*P*:~
2+
GS*HC*XXXXXXX*XXXXX*20170617*1741*101*X*005010X223A2~
3+
ST*837*987654*005010X223A2~
4+
BHT*0019*00*0123*19960918*0932*CH~
5+
NM1*41*2*JONES HOSPITAL*****46*12345~
6+
PER*IC*JANE DOE*TE*9005555555~
7+
NM1*40*2*MEDICARE*****46*00120~
8+
HL*1**20*1~
9+
PRV*BI*PXC*203BA0200N~
10+
NM1*85*2*JONES HOSPITAL*****XX*9876540809~
11+
N3*225 MAIN STREET BARKLEY BUILDING~
12+
N4*CENTERVILLE*PA*17111~
13+
REF*EI*567891234~
14+
PER*IC*CONNIE*TE*3055551234~
15+
HL*2*1*22*0~
16+
SBR*P*18*******MB~
17+
NM1*IL*1*DOE*JOHN*T***MI*030005074A~
18+
N3*125 CITY AVENUE~
19+
N4*CENTERVILLE*PA*17111~
20+
DMG*D8*19261111*M~
21+
NM1*PR*2*MEDICARE B*****PI*00435~
22+
REF*G2*330127~
23+
CLM*756048Q*89.93**14:A:1*A*Y*Y~
24+
DTP*434*RD8*19960911~
25+
CL1*3**01~
26+
HI*BK:3669~
27+
HI*BF:4019*BF:79431~
28+
HI*BH:A1:D8:19261111*BH:A2:D8:19911101*BH:B1:D8:19261111*BH:B2:D8:19870101~
29+
HI*BE:A2:::15.31~
30+
HI*BG:09~
31+
NM1*71*1*JONES*JOHN*J~
32+
REF*1G*B99937~
33+
SBR*S*01*351630*STATE TEACHERS*****CI~
34+
OI***Y***Y~
35+
NM1*IL*1*DOE*JANE*S***MI*222004433~
36+
N3*125 CITY AVENUE~
37+
N4*CENTERVILLE*PA*17111~
38+
NM1*PR*2*STATE TEACHERS*****PI*1135~
39+
LX*1~
40+
SV2*0305*HC:85025*13.39*UN*1~
41+
DTP*472*D8*19960911~
42+
LX*2~
43+
SV2*0730*HC:93005*76.54*UN*3~
44+
DTP*472*D8*19960911~
45+
SE*42*987654~
46+
GE*1*101~
47+
GS*HC*XXXXXXX*XXXXX*20170617*1741*101*X*005010X223A2~
48+
ST*837*987654*005010X223A2~
49+
BHT*0019*00*0123*19960918*0932*CH~
50+
NM1*41*2*JONES HOSPITAL*****46*12345~
51+
PER*IC*JANE DOE*TE*9005555555~
52+
NM1*40*2*MEDICARE*****46*00120~
53+
HL*1**20*1~
54+
PRV*BI*PXC*203BA0200N~
55+
NM1*85*2*JONES HOSPITAL*****XX*9876540809~
56+
N3*225 MAIN STREET BARKLEY BUILDING~
57+
N4*CENTERVILLE*PA*17111~
58+
REF*EI*567891234~
59+
PER*IC*CONNIE*TE*3055551234~
60+
HL*2*1*22*0~
61+
SBR*P*18*******MB~
62+
NM1*IL*1*DOE*JOHN*T***MI*030005074A~
63+
N3*125 CITY AVENUE~
64+
N4*CENTERVILLE*PA*17111~
65+
DMG*D8*19261111*M~
66+
NM1*PR*2*MEDICARE B*****PI*00435~
67+
REF*G2*330127~
68+
CLM*756048Q*89.93**14:A:1*A*Y*Y~
69+
DTP*434*RD8*19960911~
70+
CL1*3**01~
71+
HI*BK:3669~
72+
HI*BF:4019*BF:79431~
73+
HI*BH:A1:D8:19261111*BH:A2:D8:19911101*BH:B1:D8:19261111*BH:B2:D8:19870101~
74+
HI*BE:A2:::15.31~
75+
HI*BG:09~
76+
NM1*71*1*JONES*JOHN*J~
77+
REF*1G*B99937~
78+
SBR*S*01*351630*STATE TEACHERS*****CI~
79+
OI***Y***Y~
80+
NM1*IL*1*DOE*JANE*S***MI*222004433~
81+
N3*125 CITY AVENUE~
82+
N4*CENTERVILLE*PA*17111~
83+
NM1*PR*2*STATE TEACHERS*****PI*1135~
84+
LX*1~
85+
SV2*0305*HC:85025*13.39*UN*1~
86+
DTP*472*D8*19960911~
87+
LX*2~
88+
SV2*0730*HC:93005*76.54*UN*3~
89+
DTP*472*D8*19960911~
90+
SE*42*987654~
91+
GE*1*101~
92+
IEA*1*000000101~
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ISA*00* *00* *ZZ*1234567 *ZZ*11111 *170508*1141*^*00501*000000101*1*P*:~
2+
GS*HC*XXXXXXX*XXXXX*20170617*1741*101*X*005010X222A1~
3+
ST*837*1239*005010X222A1~
4+
BHT*0019*00*010*20170617*1741*CH~
5+
NM1*41*2*SUBMITTER*****46*ABC123~
6+
PER*IC*BOB SMITH*TE*4805551212~
7+
NM1*40*2*RECEIVER*****46*44556~
8+
HL*1**20*1~
9+
NM1*85*2*BILLING PROVIDER*****XX*1122334455~
10+
N3*1234 SOME ROAD~
11+
N4*CHICAGO*IL*606739999~
12+
REF*EI*999999999~
13+
HL*2*1*22*0~
14+
SBR*P*18*******12~
15+
NM1*IL*1*BLOGGS*JOE****MI*1234567890~
16+
N3*1 SOME BLVD~
17+
N4*CHICAGO*IL*606129998~
18+
DMG*D8*19570111*M~
19+
NM1*PR*2*PAYER*****PI*12345~
20+
N3*1 PAYER WAY~
21+
N4*ST LOUIS*MO*212441850~
22+
REF*2U*W1014~
23+
CLM*1000A*140***19:B:1*Y*A*Y*Y~
24+
HI*ABK:I10~
25+
LX*1~
26+
SV1*HC:99213*140*UN*1***1~
27+
DTP*472*D8*20151124~
28+
HL*3*1*22*0~
29+
SBR*P*18*******12~
30+
NM1*IL*1*BLOGGS*FRED****MI*9876543201~
31+
N3*1 ANOTHER STR~
32+
N4*CHICAGO*IL*606129998~
33+
DMG*D8*19700601*M~
34+
NM1*PR*2*PAYER*****PI*12345~
35+
N3*1 PAYER WAY~
36+
N4*ST LOUIS*MO*212441850~
37+
REF*2U*W1014~
38+
CLM*1001A*140***19:B:1*Y*A*Y*Y~
39+
HI*ABK:I10~
40+
LX*1~
41+
SV1*HC:99213*140*UN*1***1~
42+
DTP*472*D8*20151124~
43+
SE*41*1239~
44+
GE*1*101~
45+
IEA*1*000000101~

tests/test_5010_837I.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import datetime
2+
from decimal import Decimal
3+
import unittest
4+
5+
from tigershark.parsers.M837_5010_X223_A1 import parsed_837
6+
7+
8+
class TestParserX223A1(unittest.TestCase):
9+
def test_financial_information(self):
10+
with open('tests/5010-837-institutional-example.txt') as f:
11+
parsed = parsed_837.unmarshall(f.read().strip())
12+
13+
segments = parsed.segs()
14+
15+
self.assertEqual(len(segments), 92)
16+
self.assertEqual(
17+
[str(x) for x in segments[1].elements],
18+
[
19+
"GS",
20+
"HC",
21+
"XXXXXXX",
22+
"XXXXX",
23+
"20170617",
24+
"1741",
25+
"101",
26+
"X",
27+
"005010X223A2"
28+
]
29+
)
30+
segment_first_nm1 = parsed.descendant("segment", "NM1")[0]
31+
self.assertEqual(
32+
[str(x) for x in segment_first_nm1.elements],
33+
[
34+
"NM1",
35+
"41",
36+
"2",
37+
"JONES HOSPITAL",
38+
"",
39+
"",
40+
"",
41+
"",
42+
"46",
43+
"12345"
44+
]
45+
)

tests/test_5010_837P.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import datetime
2+
from decimal import Decimal
3+
import unittest
4+
5+
from tigershark.parsers.M837_5010_X222_A1 import parsed_837
6+
7+
8+
class TestParserX222A1(unittest.TestCase):
9+
def test_financial_information(self):
10+
with open('tests/5010-837-professional-example.txt') as f:
11+
parsed = parsed_837.unmarshall(f.read().strip())
12+
13+
segments = parsed.segs()
14+
15+
self.assertEqual(len(segments), 45)
16+
self.assertEqual(
17+
[str(x) for x in segments[1].elements],
18+
[
19+
"GS",
20+
"HC",
21+
"XXXXXXX",
22+
"XXXXX",
23+
"20170617",
24+
"1741",
25+
"101",
26+
"X",
27+
"005010X222A1"
28+
]
29+
)
30+
segment_first_nm1 = parsed.descendant("segment", "NM1")[0]
31+
self.assertEqual(
32+
[str(x) for x in segment_first_nm1.elements],
33+
[
34+
"NM1",
35+
"41",
36+
"2",
37+
"SUBMITTER",
38+
"",
39+
"",
40+
"",
41+
"",
42+
"46",
43+
"ABC123"
44+
]
45+
)

tigershark/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
TigerShark - An X12 EDI message parser.
33
"""
44
__all__ = ['X12VersionTuple']
5-
__version__ = "0.3.3"
5+
__version__ = "0.3.4"
66
__authors__ = [
77
"Steven Buss <[email protected]>",
88
"Steven Lott <[email protected]>",
99
"Dave Peticolas <[email protected]>",
10+
"Cloud Cray <[email protected]>",
1011
]
1112

1213
from collections import namedtuple
@@ -97,3 +98,5 @@ def version_string(self):
9798
X12_4010_XXXC = X12VersionTuple.for_4010('XXXC')
9899
X12_5010_X221A1 = X12VersionTuple.for_5010('X221A1')
99100
X12_5010_X279A1 = X12VersionTuple.for_5010('X279A1')
101+
X12_5010_X222A1 = X12VersionTuple.for_5010('X222A1')
102+
X12_5010_X223A1 = X12VersionTuple.for_5010('X223A1')

tigershark/facade/enums/eligibility.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,33 @@
193193
"E26": "Comprehensive Medication Therapy Management Review",
194194
"E27": "Targeted Medication Therapy Management Review",
195195
"E28": "Dietary/Nutritional Services",
196+
"E29": "Technical Cardiac Rehabilitation Services Component",
197+
"E30": "Professional Cardiac Rehabilitation Services Component",
198+
"E31": "Professional Intensive Cardiac Rehabilitation Services Component",
199+
"E32": "Intensive Cardiac Rehabilitation - Technical Component",
200+
"E33": "Intensive Cardiac Rehabilitation",
201+
"E34": "Pulmonary Rehabilitation - Technical Component",
202+
"E35": "Pulmonary Rehabilitation - Professional Component",
203+
"E36": "Convenience Care",
204+
"E37": "Telemedicine",
205+
"E38": "Pharmacist Services",
206+
"E39": "Diabetic Education",
207+
"E40": "Early Intervention",
196208
"EA": "Preventive Services",
197209
"EB": "Specialty Pharmacy",
198210
"EC": "Durable Medical Equipment New",
199211
"ED": "CAT Scan",
200212
"EE": "Ophthalmology",
201213
"EF": "Contact Lenses",
214+
"EO": "Allied Behavioral Analysis Therapy",
215+
"F1": "Medical Coverage",
216+
"F2": "Social Work Coverage",
217+
"F3": "Dental Coverage",
218+
"F4": "Hearing Coverage",
219+
"F5": "Prescription Drug Coverage",
220+
"F6": "Vision Coverage",
221+
"F7": "Orthodontia Coverage",
222+
"F8": "Mental Health Coverage",
202223
"GF": "Generic Prescription Drug - Formulary",
203224
"GN": "Generic Prescription Drug - Non-Formulary",
204225
"GY": "Allergy",
@@ -217,6 +238,22 @@
217238
"UC": "Urgent Care",
218239
}
219240

241+
deprecated_service_type_codes = (
242+
"34",
243+
"BW",
244+
"BX",
245+
"E12",
246+
"E13",
247+
"E24",
248+
"E29",
249+
"E30",
250+
"E31",
251+
"E32",
252+
"E34",
253+
"E35",
254+
"EO",
255+
)
256+
220257
coverage_level = {
221258
"CHD": "Children Only",
222259
"DEP": "Dependents Only",

0 commit comments

Comments
 (0)