hippo 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -5
- data/README.md +10 -5
- data/lib/hippo/parser.rb +19 -9
- data/lib/hippo/transaction_sets/HIPAA_276/L2000A.rb +7 -3
- data/lib/hippo/transaction_sets/HIPAA_276/L2000B.rb +7 -3
- data/lib/hippo/transaction_sets/HIPAA_276/L2000C.rb +7 -3
- data/lib/hippo/transaction_sets/HIPAA_276/L2000D.rb +15 -8
- data/lib/hippo/transaction_sets/HIPAA_276/L2000E.rb +12 -7
- data/lib/hippo/transaction_sets/HIPAA_276/L2100A.rb +3 -2
- data/lib/hippo/transaction_sets/HIPAA_276/L2100B.rb +2 -1
- data/lib/hippo/transaction_sets/HIPAA_276/L2100C.rb +4 -2
- data/lib/hippo/transaction_sets/HIPAA_276/L2100D.rb +4 -2
- data/lib/hippo/transaction_sets/HIPAA_276/L2100E.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_276/L2200D.rb +13 -12
- data/lib/hippo/transaction_sets/HIPAA_276/L2200E.rb +13 -12
- data/lib/hippo/transaction_sets/HIPAA_276/L2210D.rb +4 -3
- data/lib/hippo/transaction_sets/HIPAA_276/L2210E.rb +4 -3
- data/lib/hippo/transaction_sets/HIPAA_276/base.rb +31 -27
- data/lib/hippo/transaction_sets/HIPAA_277/L2000A.rb +11 -4
- data/lib/hippo/transaction_sets/HIPAA_277/L2000B.rb +13 -6
- data/lib/hippo/transaction_sets/HIPAA_277/L2000C.rb +13 -6
- data/lib/hippo/transaction_sets/HIPAA_277/L2000D.rb +12 -6
- data/lib/hippo/transaction_sets/HIPAA_277/L2000E.rb +11 -6
- data/lib/hippo/transaction_sets/HIPAA_277/L2100A.rb +4 -2
- data/lib/hippo/transaction_sets/HIPAA_277/L2100B.rb +2 -1
- data/lib/hippo/transaction_sets/HIPAA_277/L2100C.rb +4 -2
- data/lib/hippo/transaction_sets/HIPAA_277/L2100D.rb +3 -2
- data/lib/hippo/transaction_sets/HIPAA_277/L2100E.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_277/L2200A.rb +3 -3
- data/lib/hippo/transaction_sets/HIPAA_277/L2200B.rb +10 -7
- data/lib/hippo/transaction_sets/HIPAA_277/L2200C.rb +14 -8
- data/lib/hippo/transaction_sets/HIPAA_277/L2200D.rb +13 -9
- data/lib/hippo/transaction_sets/HIPAA_277/L2200E.rb +12 -11
- data/lib/hippo/transaction_sets/HIPAA_277/L2220D.rb +7 -6
- data/lib/hippo/transaction_sets/HIPAA_277/L2220E.rb +5 -4
- data/lib/hippo/transaction_sets/HIPAA_277/base.rb +23 -20
- data/lib/hippo/transaction_sets/HIPAA_835/L1000A.rb +9 -6
- data/lib/hippo/transaction_sets/HIPAA_835/L1000B.rb +12 -5
- data/lib/hippo/transaction_sets/HIPAA_835/L2000.rb +6 -2
- data/lib/hippo/transaction_sets/HIPAA_835/L2100.rb +55 -24
- data/lib/hippo/transaction_sets/HIPAA_835/L2110.rb +30 -9
- data/lib/hippo/transaction_sets/HIPAA_835/base.rb +23 -13
- data/lib/hippo/transaction_sets/HIPAA_837/L1000A.rb +5 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L1000B.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_837/L2000A.rb +30 -9
- data/lib/hippo/transaction_sets/HIPAA_837/L2000B.rb +42 -7
- data/lib/hippo/transaction_sets/HIPAA_837/L2000C.rb +17 -5
- data/lib/hippo/transaction_sets/HIPAA_837/L2010AA.rb +14 -6
- data/lib/hippo/transaction_sets/HIPAA_837/L2010AB.rb +3 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2010AC.rb +8 -4
- data/lib/hippo/transaction_sets/HIPAA_837/L2010BA.rb +9 -7
- data/lib/hippo/transaction_sets/HIPAA_837/L2010BB.rb +11 -4
- data/lib/hippo/transaction_sets/HIPAA_837/L2010CA.rb +10 -6
- data/lib/hippo/transaction_sets/HIPAA_837/L2300.rb +116 -56
- data/lib/hippo/transaction_sets/HIPAA_837/L2310A.rb +6 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2310B.rb +8 -4
- data/lib/hippo/transaction_sets/HIPAA_837/L2310C.rb +6 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L2310D.rb +5 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2310E.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_837/L2310F.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_837/L2320.rb +54 -19
- data/lib/hippo/transaction_sets/HIPAA_837/L2330A.rb +5 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L2330B.rb +12 -8
- data/lib/hippo/transaction_sets/HIPAA_837/L2330C.rb +6 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2330D.rb +7 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L2330E.rb +5 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2330F.rb +5 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2330G.rb +7 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L2400.rb +122 -60
- data/lib/hippo/transaction_sets/HIPAA_837/L2410.rb +8 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2420A.rb +8 -4
- data/lib/hippo/transaction_sets/HIPAA_837/L2420B.rb +7 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L2420C.rb +5 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2420D.rb +5 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2420E.rb +8 -4
- data/lib/hippo/transaction_sets/HIPAA_837/L2420F.rb +6 -2
- data/lib/hippo/transaction_sets/HIPAA_837/L2420G.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_837/L2420H.rb +1 -1
- data/lib/hippo/transaction_sets/HIPAA_837/L2430.rb +6 -3
- data/lib/hippo/transaction_sets/HIPAA_837/L2440.rb +4 -1
- data/lib/hippo/transaction_sets/HIPAA_837/base.rb +23 -32
- data/lib/hippo/transaction_sets/HIPAA_999/L2000AK2.rb +9 -3
- data/lib/hippo/transaction_sets/HIPAA_999/L2100AK2.rb +9 -3
- data/lib/hippo/transaction_sets/HIPAA_999/L2110AK2.rb +4 -1
- data/lib/hippo/transaction_sets/HIPAA_999/base.rb +6 -3
- data/lib/hippo/transaction_sets/base.rb +87 -72
- data/lib/hippo/transaction_sets/component.rb +80 -0
- data/lib/hippo/transaction_sets/repeating_component.rb +30 -0
- data/lib/hippo/transaction_sets.rb +8 -6
- data/lib/hippo/version.rb +1 -1
- data/samples/005010X221A1_business_scenario_1.edi +1 -0
- data/samples/005010X221A1_tmhp_example.edi +1 -0
- data/samples/005010X222A1_anesthesia.edi +1 -0
- data/samples/005010X222A1_commercial_health_insurance.edi +1 -0
- data/test/test_helper.rb +6 -6
- data/test/test_hipaa_835.rb +229 -0
- data/test/test_hipaa_837.rb +263 -63
- data/test/test_parser.rb +26 -0
- data/test/test_segments_base.rb +1 -1
- data/test/test_transaction_sets_base.rb +21 -1
- metadata +17 -16
- data/bin/demo_270.rb +0 -280
- data/bin/demo_276.rb +0 -296
- data/bin/demo_835.rb +0 -170
- data/lib/hippo/samples/835.edi +0 -88
- data/lib/hippo/samples/sample_835_with.rb +0 -272
- data/lib/hippo/samples/sample_parsed.rb +0 -1162
@@ -0,0 +1,229 @@
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class TestHIPAA835 < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
def test_business_scenario_1
|
6
|
+
=begin
|
7
|
+
|
8
|
+
Dollars and data are being sent together through the banking system to pay
|
9
|
+
Medicare Part A institutional claims.
|
10
|
+
|
11
|
+
This scenario depicts the use of the ANSI ASC X12 835 in a governmental
|
12
|
+
institutional environment. The electronic transmission of funds request
|
13
|
+
and the remittance detail are contained within this single 835. In this
|
14
|
+
scenario, one or more Depository Financial Institutions is involved in
|
15
|
+
transferring information from the sender to the receiver.
|
16
|
+
|
17
|
+
The following assumptions pertain to scenario one:
|
18
|
+
• The dollars move using the ACH network from the Bank of Payorea,
|
19
|
+
ABA# 999999992, account number 123456 to the Bank of No Return,
|
20
|
+
ABA# 999988880, checking account number 98765. The money moves on
|
21
|
+
September 13, 2002.
|
22
|
+
• The Insurance Company of Timbucktu, Federal tax ID # 512345678 and
|
23
|
+
Medicare Intermediary ID# 999, is paying Regional Hope Hospital, National
|
24
|
+
Provider Number 6543210903. This is for one inpatient and one outpatient claim.
|
25
|
+
• For the inpatient claim, the patient’s name is Sam O. Jones. The Health
|
26
|
+
Insurance Claim Number is 666-66-6666A. The Claim Submitter’s Identifier is
|
27
|
+
666123. The date of the hospitalization was August 16, 2002 to August 24, 2002.
|
28
|
+
Total charges reported are $211,366.97. Paid amount is $138,018.40. There is
|
29
|
+
no patient responsibility. Contractual adjustment is $73,348.57. No service
|
30
|
+
line detail is provided.
|
31
|
+
• For the outpatient claim, the patient’s name is Liz E. Border, Health
|
32
|
+
Insurance Claim Number 996-66-9999B. The Claim Submitter’s Identifier is
|
33
|
+
777777. The date of service is May 12, 2002. Total charges reported are
|
34
|
+
$15,000. Paid amount is $11,980.33. Contractual adjustment is $3,019.67.
|
35
|
+
There is no service line information.
|
36
|
+
• There is a Capital Pass Through Amount (CV) payment to the provider for $1.27.
|
37
|
+
|
38
|
+
=end
|
39
|
+
|
40
|
+
ts = Hippo::TransactionSets::HIPAA_835::Base.new
|
41
|
+
|
42
|
+
ts.ST do |st|
|
43
|
+
st.TransactionSetControlNumber = '1234'
|
44
|
+
end
|
45
|
+
|
46
|
+
ts.BPR do |bpr|
|
47
|
+
bpr.TransactionHandlingCode = 'C'
|
48
|
+
bpr.MonetaryAmount = '150000'
|
49
|
+
bpr.CreditDebitFlagCode = 'C'
|
50
|
+
bpr.PaymentMethodCode = 'ACH'
|
51
|
+
bpr.PaymentFormatCode = 'CTX'
|
52
|
+
bpr.DfiIdNumberQualifier = '01'
|
53
|
+
bpr.DfiIdentificationNumber = '999999992'
|
54
|
+
bpr.AccountNumberQualifier = 'DA'
|
55
|
+
bpr.AccountNumber = '123456'
|
56
|
+
bpr.OriginatingCompanyIdentifier = '1512345678'
|
57
|
+
bpr.DfiIdNumberQualifier_02 = '01'
|
58
|
+
bpr.DfiIdentificationNumber_02 = '999988880'
|
59
|
+
bpr.AccountNumberQualifier_02 = 'DA'
|
60
|
+
bpr.AccountNumber_02 = '98765'
|
61
|
+
bpr.Date = '20020913'
|
62
|
+
end
|
63
|
+
|
64
|
+
ts.TRN do |trn|
|
65
|
+
trn.ReferenceIdentification = '12345'
|
66
|
+
trn.OriginatingCompanyIdentifier = '1512345678'
|
67
|
+
end
|
68
|
+
|
69
|
+
ts.DTM.Date = '20020916'
|
70
|
+
|
71
|
+
ts.L1000A do |l1000a|
|
72
|
+
l1000a.N1.Name = 'INSURANCE COMPANY OF TIMBUCKTU'
|
73
|
+
l1000a.N3.AddressInformation = '1 MAIN STREET'
|
74
|
+
|
75
|
+
l1000a.N4 do |n4|
|
76
|
+
n4.CityName = 'TIMBUCKTU'
|
77
|
+
n4.StateOrProvinceCode = 'AK'
|
78
|
+
n4.PostalCode = '89111'
|
79
|
+
end
|
80
|
+
|
81
|
+
l1000a.REF do |ref|
|
82
|
+
ref.ReferenceIdentificationQualifier = '2U'
|
83
|
+
ref.ReferenceIdentification = '999'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
ts.L1000B do |l1000b|
|
88
|
+
l1000b.N1 do |n1|
|
89
|
+
n1.Name = 'REGIONAL HOPE HOSPITAL'
|
90
|
+
n1.IdentificationCodeQualifier = 'XX'
|
91
|
+
n1.IdentificationCode = '6543210903'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
ts.L2000.build do |l2000|
|
96
|
+
l2000.LX.LX01 = '110212'
|
97
|
+
|
98
|
+
l2000.TS3 do |ts3|
|
99
|
+
ts3.ReferenceIdentification = '6543210903'
|
100
|
+
ts3.FacilityCodeValue = '11'
|
101
|
+
ts3.Date = '20021231'
|
102
|
+
ts3.Quantity = '1'
|
103
|
+
ts3.MonetaryAmount_01 = '211366.97'
|
104
|
+
ts3.MonetaryAmount_05 = '138018.4'
|
105
|
+
ts3.MonetaryAmount_07 = '73348.57'
|
106
|
+
end
|
107
|
+
|
108
|
+
l2000.TS2 do |ts2|
|
109
|
+
ts2.MonetaryAmount_01 = '2178.45'
|
110
|
+
ts2.MonetaryAmount_02 = '1919.71'
|
111
|
+
ts2.MonetaryAmount_04 = '56.82'
|
112
|
+
ts2.MonetaryAmount_05 = '197.69'
|
113
|
+
ts2.MonetaryAmount_06 = '4.23'
|
114
|
+
end
|
115
|
+
|
116
|
+
l2000.L2100.build do |l2100|
|
117
|
+
l2100.CLP do |clp|
|
118
|
+
clp.ClaimSubmitterSIdentifier = '666123'
|
119
|
+
clp.ClaimStatusCode = '1'
|
120
|
+
clp.MonetaryAmount_01 = '211366.97'
|
121
|
+
clp.MonetaryAmount_02 = '138018.4'
|
122
|
+
clp.ClaimFilingIndicatorCode = 'MA'
|
123
|
+
clp.ReferenceIdentification = '1999999444444'
|
124
|
+
clp.FacilityCodeValue = '11'
|
125
|
+
clp.ClaimFrequencyTypeCode = '1'
|
126
|
+
end
|
127
|
+
|
128
|
+
l2100.CAS.build do |cas|
|
129
|
+
cas.ClaimAdjustmentGroupCode = 'CO'
|
130
|
+
cas.ClaimAdjustmentReasonCode = '45'
|
131
|
+
cas.MonetaryAmount = '73348.57'
|
132
|
+
end
|
133
|
+
|
134
|
+
l2100.NM1 do |nm1|
|
135
|
+
nm1.NameLastOrOrganizationName = 'JONES'
|
136
|
+
nm1.NameFirst = 'SAM'
|
137
|
+
nm1.NameMiddle = 'O'
|
138
|
+
nm1.IdentificationCodeQualifier = 'HN'
|
139
|
+
nm1.IdentificationCode = '666666666A'
|
140
|
+
end
|
141
|
+
|
142
|
+
l2100.MIA do |mia|
|
143
|
+
mia.Quantity = '0'
|
144
|
+
mia.MonetaryAmount_02 = '138018.4'
|
145
|
+
end
|
146
|
+
|
147
|
+
l2100.DTM_01.build do |dtm|
|
148
|
+
dtm.DateTimeQualifier = '232'
|
149
|
+
dtm.Date = '20020816'
|
150
|
+
end
|
151
|
+
|
152
|
+
l2100.DTM_01.build do |dtm|
|
153
|
+
dtm.DateTimeQualifier = '233'
|
154
|
+
dtm.Date = '20020824'
|
155
|
+
end
|
156
|
+
|
157
|
+
l2100.QTY do |qty|
|
158
|
+
qty.QuantityQualifier = 'CA'
|
159
|
+
qty.Quantity = '8'
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
ts.L2000.build do |l2000|
|
165
|
+
l2000.LX.LX01 = '130212'
|
166
|
+
|
167
|
+
l2000.TS3 do |ts3|
|
168
|
+
ts3.ReferenceIdentification = '6543210909'
|
169
|
+
ts3.FacilityCodeValue = '13'
|
170
|
+
ts3.Date = '19961231'
|
171
|
+
ts3.Quantity = '1'
|
172
|
+
ts3.MonetaryAmount_01 = '15000'
|
173
|
+
ts3.MonetaryAmount_05 = '11980.33'
|
174
|
+
ts3.MonetaryAmount_07 = '3019.67'
|
175
|
+
end
|
176
|
+
|
177
|
+
l2000.L2100.build do |l2100|
|
178
|
+
l2100.CLP do |clp|
|
179
|
+
clp.ClaimSubmitterSIdentifier = '777777'
|
180
|
+
clp.ClaimStatusCode = '1'
|
181
|
+
clp.MonetaryAmount_01 = '15000'
|
182
|
+
clp.MonetaryAmount_02 = '11980.33'
|
183
|
+
clp.ClaimFilingIndicatorCode = 'MB'
|
184
|
+
clp.ReferenceIdentification = '1999999444445'
|
185
|
+
clp.FacilityCodeValue = '13'
|
186
|
+
clp.ClaimFrequencyTypeCode = '1'
|
187
|
+
end
|
188
|
+
|
189
|
+
l2100.CAS.build do |cas|
|
190
|
+
cas.ClaimAdjustmentGroupCode = 'CO'
|
191
|
+
cas.ClaimAdjustmentReasonCode = '45'
|
192
|
+
cas.MonetaryAmount = '3019.67'
|
193
|
+
end
|
194
|
+
|
195
|
+
l2100.NM1 do |nm1|
|
196
|
+
nm1.NameLastOrOrganizationName = 'BORDER'
|
197
|
+
nm1.NameFirst = 'LIZ'
|
198
|
+
nm1.NameMiddle = 'E'
|
199
|
+
nm1.IdentificationCodeQualifier = 'HN'
|
200
|
+
nm1.IdentificationCode = '996669999B'
|
201
|
+
end
|
202
|
+
|
203
|
+
l2100.MOA do |moa|
|
204
|
+
moa.ReferenceIdentification = 'MA02'
|
205
|
+
end
|
206
|
+
|
207
|
+
l2100.DTM_01.build do |dtm|
|
208
|
+
dtm.DateTimeQualifier = '232'
|
209
|
+
dtm.Date = '20020512'
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
ts.PLB do |plb|
|
215
|
+
plb.ReferenceIdentification_01 = '6543210903'
|
216
|
+
plb.Date = '20021231'
|
217
|
+
plb.AdjustmentReasonCode = 'CV'
|
218
|
+
plb.ReferenceIdentification_02 = 'CP'
|
219
|
+
plb.MonetaryAmount = '-1.27'
|
220
|
+
end
|
221
|
+
|
222
|
+
ts.SE.TransactionSetControlNumber = ts.ST.TransactionSetControlNumber
|
223
|
+
ts.SE.NumberOfIncludedSegments = ts.segment_count
|
224
|
+
|
225
|
+
provided_answer = File.read('samples/005010X221A1_business_scenario_1.edi')
|
226
|
+
|
227
|
+
assert_equal provided_answer.chomp, ts.to_s
|
228
|
+
end
|
229
|
+
end
|
data/test/test_hipaa_837.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require_relative 'test_helper'
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
4
2
|
|
5
3
|
class TestHIPAA837 < MiniTest::Unit::TestCase
|
6
4
|
|
@@ -107,7 +105,7 @@ VAN claim identification number = 17312345600006351.
|
|
107
105
|
|
108
106
|
ts.L2000A do |l2000a|
|
109
107
|
l2000a.HL do |hl|
|
110
|
-
hl.HL01 =
|
108
|
+
hl.HL01 = ts.increment('HL')
|
111
109
|
hl.HL04 = 1
|
112
110
|
end
|
113
111
|
|
@@ -156,9 +154,9 @@ VAN claim identification number = 17312345600006351.
|
|
156
154
|
end
|
157
155
|
end
|
158
156
|
|
159
|
-
|
157
|
+
l2000a.L2000B do |l2000b|
|
160
158
|
l2000b.HL do |hl|
|
161
|
-
hl.HL01 =
|
159
|
+
hl.HL01 = ts.increment('HL')
|
162
160
|
hl.HL02 = l2000a.HL.HL01
|
163
161
|
hl.HL04 = 1
|
164
162
|
end
|
@@ -199,9 +197,9 @@ VAN claim identification number = 17312345600006351.
|
|
199
197
|
end
|
200
198
|
end
|
201
199
|
|
202
|
-
|
200
|
+
l2000b.L2000C do |l2000c|
|
203
201
|
l2000c.HL do |hl|
|
204
|
-
hl.HL01 =
|
202
|
+
hl.HL01 = ts.increment('HL')
|
205
203
|
hl.HL02 = l2000b.HL.HL01
|
206
204
|
hl.HL04 = 0
|
207
205
|
end
|
@@ -258,7 +256,7 @@ VAN claim identification number = 17312345600006351.
|
|
258
256
|
end
|
259
257
|
|
260
258
|
l2300.L2400.build do |l2400|
|
261
|
-
l2400.LX.LX01 =
|
259
|
+
l2400.LX.LX01 = l2300.increment('LX')
|
262
260
|
|
263
261
|
l2400.SV1 do |sv1|
|
264
262
|
sv1.ProductServiceIdQualifier = 'HC'
|
@@ -276,7 +274,7 @@ VAN claim identification number = 17312345600006351.
|
|
276
274
|
end
|
277
275
|
|
278
276
|
l2300.L2400.build do |l2400|
|
279
|
-
l2400.LX.LX01 =
|
277
|
+
l2400.LX.LX01 = l2300.increment('LX')
|
280
278
|
|
281
279
|
l2400.SV1 do |sv1|
|
282
280
|
sv1.ProductServiceIdQualifier = 'HC'
|
@@ -294,7 +292,7 @@ VAN claim identification number = 17312345600006351.
|
|
294
292
|
end
|
295
293
|
|
296
294
|
l2300.L2400.build do |l2400|
|
297
|
-
l2400.LX.LX01 =
|
295
|
+
l2400.LX.LX01 = l2300.increment('LX')
|
298
296
|
|
299
297
|
l2400.SV1 do |sv1|
|
300
298
|
sv1.ProductServiceIdQualifier = 'HC'
|
@@ -312,7 +310,7 @@ VAN claim identification number = 17312345600006351.
|
|
312
310
|
end
|
313
311
|
|
314
312
|
l2300.L2400.build do |l2400|
|
315
|
-
l2400.LX.LX01 =
|
313
|
+
l2400.LX.LX01 = l2300.increment('LX')
|
316
314
|
|
317
315
|
l2400.SV1 do |sv1|
|
318
316
|
sv1.ProductServiceIdQualifier = 'HC'
|
@@ -340,57 +338,259 @@ VAN claim identification number = 17312345600006351.
|
|
340
338
|
|
341
339
|
ts.SE.NumberOfIncludedSegments = ts.segment_count
|
342
340
|
|
343
|
-
published_answer =
|
344
|
-
|
345
|
-
BHT*0019*00*244579*20061015*1023*CH~
|
346
|
-
NM1*41*2*PREMIER BILLING SERVICE*****46*TGJ23~
|
347
|
-
PER*IC*JERRY*TE*3055552222*EX*231~
|
348
|
-
NM1*40*2*KEY INSURANCE COMPANY*****46*66783JJT~
|
349
|
-
HL*1**20*1~
|
350
|
-
PRV*BI*PXC*203BF0100Y~
|
351
|
-
NM1*85*2*BEN KILDARE SERVICE*****XX*9876543210~
|
352
|
-
N3*234 SEAWAY ST~
|
353
|
-
N4*MIAMI*FL*33111~
|
354
|
-
REF*EI*587654321~
|
355
|
-
NM1*87*2~
|
356
|
-
N3*2345 OCEAN BLVD~
|
357
|
-
N4*MIAMI*FL*33111~
|
358
|
-
HL*2*1*22*1~
|
359
|
-
SBR*P**2222-SJ******CI~
|
360
|
-
NM1*IL*1*SMITH*JANE****MI*JS00111223333~
|
361
|
-
DMG*D8*19430501*F~
|
362
|
-
NM1*PR*2*KEY INSURANCE COMPANY*****PI*999996666~
|
363
|
-
REF*G2*KA6663~
|
364
|
-
HL*3*2*23*0~
|
365
|
-
PAT*19~
|
366
|
-
NM1*QC*1*SMITH*TED~
|
367
|
-
N3*236 N MAIN ST~
|
368
|
-
N4*MIAMI*FL*33413~
|
369
|
-
DMG*D8*19730501*M~
|
370
|
-
CLM*26463774*100***11:B:1*Y*A*Y*I~
|
371
|
-
REF*D9*17312345600006351~
|
372
|
-
HI*BK:0340*BF:V7389~
|
373
|
-
LX*1~
|
374
|
-
SV1*HC:99213*40*UN*1***1~
|
375
|
-
DTP*472*D8*20061003~
|
376
|
-
LX*2~
|
377
|
-
SV1*HC:87070*15*UN*1***1~
|
378
|
-
DTP*472*D8*20061003~
|
379
|
-
LX*3~
|
380
|
-
SV1*HC:99214*35*UN*1***2~
|
381
|
-
DTP*472*D8*20061010~
|
382
|
-
LX*4~
|
383
|
-
SV1*HC:86663*10*UN*1***2~
|
384
|
-
DTP*472*D8*20061010~
|
385
|
-
SE*42*0021~
|
386
|
-
EOF
|
387
|
-
|
388
|
-
assert_equal published_answer, ts.to_s.split('~').join("~\n") + "~\n"
|
389
|
-
|
390
|
-
#* not printing LX segments for each service line
|
391
|
-
#* HL parent/child references wrong
|
392
|
-
#* HL total segments counts should only be counting direct children
|
393
|
-
|
341
|
+
published_answer = File.read('samples/005010X222A1_commercial_health_insurance.edi')
|
342
|
+
assert_equal published_answer.chomp, ts.to_s
|
394
343
|
end
|
395
344
|
|
345
|
+
def test_anesthesia
|
346
|
+
=begin
|
347
|
+
Patient is the same as the subscriber. Payer is Medicare.
|
348
|
+
Encounter is billed directly to Medicare.
|
349
|
+
|
350
|
+
SUBSCRIBER/PATIENT: Margaret Jones
|
351
|
+
ADDRESS: 123 Rainbow Road, Nashville, TN 37232
|
352
|
+
TELEPHONE: 615-555-1212
|
353
|
+
SEX: F
|
354
|
+
DOB: 03/03/1974
|
355
|
+
EMPLOYER: ACME Inc.
|
356
|
+
SUBSCRIBER #: 123456789A
|
357
|
+
|
358
|
+
SECONDARY COVERAGE
|
359
|
+
|
360
|
+
DESTINATION PAYER: ABC Payer
|
361
|
+
PAYER ADDRESS: P.O. Box 1465, Nashville, TN, 37232
|
362
|
+
PAYER ORGANIZATION ID: 05440
|
363
|
+
|
364
|
+
RECEIVER: ABC Payer
|
365
|
+
EDI #: 05440
|
366
|
+
|
367
|
+
BILLING PROVIDER/SENDER: Provider Medical Group
|
368
|
+
ADDRESS: 1234 West End Ave, Nashville, TN, 37232
|
369
|
+
NPI#: 2366554859
|
370
|
+
TIN: 756473826
|
371
|
+
EDI #: N305
|
372
|
+
CONTACT PERSON AND PHONE NUMBER: Nina, 615-555-1212 ext.911
|
373
|
+
|
374
|
+
RENDERING PROVIDER: Dr. Jacob E. Townsend/Anesthesiologist
|
375
|
+
NPI: 5678912345
|
376
|
+
MEDICARE PROVIDER ID#: 9741234
|
377
|
+
PLACE OF SERVICE: Provider OP Hospital
|
378
|
+
PLACE OF SERVICE ADDRESS: 345 Main Drive, Nashville, TN,37232
|
379
|
+
PLACE OF SERVICE ID#: 43294867
|
380
|
+
|
381
|
+
PATIENT ACCOUNT NUMBER: 543211230
|
382
|
+
CASE: Laser Eye Surgery.
|
383
|
+
|
384
|
+
VISIT: DOS=1/12/2005 POS=Outpatient Hospital
|
385
|
+
SERVICES: Anesthesia for the Laser Eye Surgery
|
386
|
+
CHARGES: Anesthesia, 61 minutes = $827.00
|
387
|
+
CONCURRENCY: 2 cases
|
388
|
+
PHYSICAL STATUS: Normal
|
389
|
+
PATIENT CONTROL #: 153829140
|
390
|
+
MEDICAL RECORD ID #: 006653794
|
391
|
+
|
392
|
+
TOTAL CHARGES: $827.00
|
393
|
+
|
394
|
+
ELECTRONIC ROUTE: Billing Provider (sender) to ABC PAYER direct
|
395
|
+
=end
|
396
|
+
|
397
|
+
ts = Hippo::TransactionSets::HIPAA_837::Base.new
|
398
|
+
|
399
|
+
ts.ST.TransactionSetControlNumber = '0001'
|
400
|
+
ts.ST.ImplementationConventionReference = '005010X222A1'
|
401
|
+
|
402
|
+
ts.BHT do |bht|
|
403
|
+
bht.TransactionSetPurposeCode = '00'
|
404
|
+
bht.ReferenceIdentification = '0123'
|
405
|
+
bht.Date = '20050117'
|
406
|
+
bht.Time = '1023'
|
407
|
+
bht.TransactionTypeCode = 'CH'
|
408
|
+
end
|
409
|
+
|
410
|
+
ts.L1000A do |l1000a|
|
411
|
+
l1000a.NM1 do |nm1|
|
412
|
+
nm1.EntityTypeQualifier = '2'
|
413
|
+
nm1.NameLastOrOrganizationName = 'PROVIDER MEDICAL GROUP'
|
414
|
+
nm1.IdentificationCode = 'N305'
|
415
|
+
end
|
416
|
+
|
417
|
+
l1000a.PER do |per|
|
418
|
+
per.Name = 'NINA'
|
419
|
+
per.CommunicationNumberQualifier_01 = 'TE'
|
420
|
+
per.CommunicationNumber_01 = '6155551212'
|
421
|
+
per.CommunicationNumberQualifier_02 = 'EX'
|
422
|
+
per.CommunicationNumber_02 = '911'
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
ts.L1000B do |l1000b|
|
427
|
+
l1000b.NM1 do |nm1|
|
428
|
+
nm1.EntityTypeQualifier = '2'
|
429
|
+
nm1.NameLastOrOrganizationName = 'ABC PAYER'
|
430
|
+
nm1.IdentificationCode = '05440'
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
ts.L2000A.build do |l2000a|
|
435
|
+
l2000a.HL do |hl|
|
436
|
+
hl.HL01 = ts.increment('HL')
|
437
|
+
hl.HL04 = 1
|
438
|
+
end
|
439
|
+
|
440
|
+
l2000a.L2010AA do |l2010aa|
|
441
|
+
|
442
|
+
l2010aa.NM1 do |nm1|
|
443
|
+
nm1.EntityTypeQualifier = '2'
|
444
|
+
nm1.NameLastOrOrganizationName = 'PROVIDER MEDICAL GROUP'
|
445
|
+
nm1.IdentificationCodeQualifier = 'XX'
|
446
|
+
nm1.IdentificationCode = '2366554859'
|
447
|
+
end
|
448
|
+
|
449
|
+
l2010aa.N3 do |n3|
|
450
|
+
n3.AddressInformation = '1234 WEST END AVE'
|
451
|
+
end
|
452
|
+
|
453
|
+
l2010aa.N4 do |n4|
|
454
|
+
n4.CityName = 'NASHVILLE'
|
455
|
+
n4.StateOrProvinceCode = 'TN'
|
456
|
+
n4.PostalCode = '37232'
|
457
|
+
end
|
458
|
+
|
459
|
+
l2010aa.REF do |ref|
|
460
|
+
ref.ReferenceIdentificationQualifier = 'EI'
|
461
|
+
ref.ReferenceIdentification = '756473826'
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
l2000a.L2000B.build do |l2000b|
|
466
|
+
l2000b.HL do |hl|
|
467
|
+
hl.HL01 = ts.increment('HL')
|
468
|
+
hl.HL02 = l2000a.HL.HL01
|
469
|
+
hl.HL04 = 0
|
470
|
+
end
|
471
|
+
|
472
|
+
l2000b.SBR do |sbr|
|
473
|
+
sbr.PayerResponsibilitySequenceNumberCode = 'P'
|
474
|
+
sbr.IndividualRelationshipCode = '18'
|
475
|
+
sbr.ClaimFilingIndicatorCode = 'MB'
|
476
|
+
end
|
477
|
+
|
478
|
+
l2000b.L2010BA do |l2010ba|
|
479
|
+
l2010ba.NM1 do |nm1|
|
480
|
+
nm1.EntityTypeQualifier = '1'
|
481
|
+
nm1.NameLastOrOrganizationName = 'JONES'
|
482
|
+
nm1.NameFirst = 'MARGARET'
|
483
|
+
nm1.IdentificationCodeQualifier = 'MI'
|
484
|
+
nm1.IdentificationCode = '123456789A'
|
485
|
+
end
|
486
|
+
|
487
|
+
l2010ba.N3.AddressInformation = '123 RAINBOW ROAD'
|
488
|
+
|
489
|
+
l2010ba.N4 do |n4|
|
490
|
+
n4.CityName = 'NASHVILLE'
|
491
|
+
n4.StateOrProvinceCode = 'TN'
|
492
|
+
n4.PostalCode = '37232'
|
493
|
+
end
|
494
|
+
|
495
|
+
l2010ba.DMG do |dmg|
|
496
|
+
dmg.DateTimePeriod = '19740303'
|
497
|
+
dmg.GenderCode = 'F'
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
l2000b.L2010BB do |l2010bb|
|
502
|
+
l2010bb.NM1 do |nm1|
|
503
|
+
nm1.EntityTypeQualifier = '2'
|
504
|
+
nm1.NameLastOrOrganizationName = 'ABC PAYER'
|
505
|
+
nm1.IdentificationCodeQualifier = 'PI'
|
506
|
+
nm1.IdentificationCode = '05440'
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
l2000b.L2300.build do |l2300|
|
511
|
+
l2300.CLM do |clm|
|
512
|
+
clm.ClaimSubmitterSIdentifier = '153829140'
|
513
|
+
clm.MonetaryAmount = '827'
|
514
|
+
clm.FacilityCodeValue = '22'
|
515
|
+
clm.FacilityCodeQualifier = 'B'
|
516
|
+
clm.ClaimFrequencyTypeCode = '1'
|
517
|
+
clm.YesNoConditionOrResponseCode = 'Y'
|
518
|
+
clm.ProviderAcceptAssignmentCode = 'A'
|
519
|
+
clm.YesNoConditionOrResponseCode_02 = 'Y'
|
520
|
+
clm.ReleaseOfInformationCode = 'Y'
|
521
|
+
end
|
522
|
+
|
523
|
+
l2300.HI do |hi|
|
524
|
+
hi.CodeListQualifierCode_01 = 'BK'
|
525
|
+
hi.IndustryCode_01 = '36616'
|
526
|
+
end
|
527
|
+
|
528
|
+
l2300.L2310B do |l2310b|
|
529
|
+
l2310b.NM1 do |nm1|
|
530
|
+
nm1.EntityTypeQualifier = '1'
|
531
|
+
nm1.NameLastOrOrganizationName = 'TOWNSEND'
|
532
|
+
nm1.NameFirst = 'JACOB'
|
533
|
+
nm1.NameMiddle = 'E'
|
534
|
+
nm1.IdentificationCodeQualifier = 'XX'
|
535
|
+
nm1.IdentificationCode = '5678912345'
|
536
|
+
end
|
537
|
+
|
538
|
+
l2310b.PRV do |prv|
|
539
|
+
prv.ReferenceIdentificationQualifier = 'ZZ'
|
540
|
+
prv.ReferenceIdentification = '207L00000X'
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
l2300.L2310C do |l2310c|
|
545
|
+
l2310c.NM1 do |nm1|
|
546
|
+
nm1.EntityTypeQualifier = '2'
|
547
|
+
nm1.NameLastOrOrganizationName = 'PROVIDER OP HOSP'
|
548
|
+
nm1.IdentificationCodeQualifier = 'XX'
|
549
|
+
nm1.IdentificationCode = '432198765'
|
550
|
+
end
|
551
|
+
|
552
|
+
l2310c.N3.AddressInformation = '345 MAIN DRIVE'
|
553
|
+
|
554
|
+
l2310c.N4 do |n4|
|
555
|
+
n4.CityName = 'NASHVILLE'
|
556
|
+
n4.StateOrProvinceCode = 'TN'
|
557
|
+
n4.PostalCode = '37232'
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
l2300.L2400.build do |l2400|
|
562
|
+
l2400.LX.LX01 = l2300.increment('LX')
|
563
|
+
|
564
|
+
l2400.SV1 do |sv1|
|
565
|
+
sv1.ProductServiceIdQualifier = 'HC'
|
566
|
+
sv1.ProductServiceId = '00142'
|
567
|
+
sv1.ProcedureModifier_01 = 'QK'
|
568
|
+
sv1.ProcedureModifier_02 = 'QS'
|
569
|
+
sv1.ProcedureModifier_03 = 'P1'
|
570
|
+
sv1.MonetaryAmount = '827'
|
571
|
+
sv1.UnitOrBasisForMeasurementCode = 'MJ'
|
572
|
+
sv1.Quantity = '61'
|
573
|
+
sv1.DiagnosisCodePointer = 1
|
574
|
+
end
|
575
|
+
|
576
|
+
l2400.DTP('Date - Service Date') do |dtp|
|
577
|
+
dtp.DateTimePeriodFormatQualifier = 'D8'
|
578
|
+
dtp.DateTimePeriod = '20050112'
|
579
|
+
end
|
580
|
+
end
|
581
|
+
end
|
582
|
+
end
|
583
|
+
end
|
584
|
+
|
585
|
+
|
586
|
+
ts.SE do |se|
|
587
|
+
se.TransactionSetControlNumber = ts.ST.TransactionSetControlNumber
|
588
|
+
end
|
589
|
+
|
590
|
+
ts.SE.NumberOfIncludedSegments = ts.segment_count
|
591
|
+
|
592
|
+
published_answer = File.read('samples/005010X222A1_anesthesia.edi')
|
593
|
+
assert_equal published_answer.chomp, ts.to_s
|
594
|
+
|
595
|
+
end
|
396
596
|
end
|
data/test/test_parser.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
class TestParser < MiniTest::Unit::TestCase
|
4
|
+
def test_populate_segments_returns_array_of_segments
|
5
|
+
parser = Hippo::Parser.new
|
6
|
+
parser.read_file('samples/005010X221A1_business_scenario_1.edi')
|
7
|
+
parser.populate_segments
|
8
|
+
|
9
|
+
assert_instance_of Array, parser.segments
|
10
|
+
|
11
|
+
parser.segments.each do |segment|
|
12
|
+
assert_kind_of Hippo::Segments::Base, segment
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_parse_returns_array_of_transaction_sets
|
17
|
+
parser = Hippo::Parser.new
|
18
|
+
transaction_sets = parser.parse('samples/005010X221A1_business_scenario_1.edi')
|
19
|
+
|
20
|
+
assert_instance_of Array, transaction_sets
|
21
|
+
|
22
|
+
transaction_sets.each do |ts|
|
23
|
+
assert_kind_of Hippo::TransactionSets::Base, ts
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/test/test_segments_base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
class TestTransactionSetBase < MiniTest::Unit::TestCase
|
4
4
|
def test_preset_values_are_set
|
@@ -82,4 +82,24 @@ class TestTransactionSetBase < MiniTest::Unit::TestCase
|
|
82
82
|
|
83
83
|
assert_equal 'TSS*Blah*Bar*Baz~TCS*Blah*:::CNBlah*Preset Field 7~TSS*Last Segment*Boo~TSS*Foo*SubBar~TCS*:SubBarBlah**Foo2~TSS*Last Segment*SubBarRepeater~', ts.to_s
|
84
84
|
end
|
85
|
+
|
86
|
+
def test_intializing_with_segment_array_populates_transaction_set
|
87
|
+
tss = Hippo::Segments::TestSimpleSegment.new
|
88
|
+
tss.TSS01 = 'Blah'
|
89
|
+
|
90
|
+
tcs = Hippo::Segments::TestCompoundSegment.new
|
91
|
+
tcs.Field7 = 'Preset Field 7'
|
92
|
+
|
93
|
+
tss2 = Hippo::Segments::TestSimpleSegment.new
|
94
|
+
tss2.TSS01 = 'Last Segment'
|
95
|
+
|
96
|
+
# start L0001 segments
|
97
|
+
tss3 = Hippo::Segments::TestSimpleSegment.new
|
98
|
+
tss3.TSS01 = 'Foo'
|
99
|
+
|
100
|
+
segment_array = [tss, tcs, tss2, tss3]
|
101
|
+
|
102
|
+
assert_equal segment_array.map(&:to_s).join, Hippo::TransactionSets::Test::Base.new(:segments => segment_array).to_s
|
103
|
+
assert_empty segment_array
|
104
|
+
end
|
85
105
|
end
|