stupidedi 1.2.17 → 1.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/edi-pp +1 -1
  4. data/lib/stupidedi/config.rb +3 -0
  5. data/lib/stupidedi/contrib/004010/guides.rb +1 -0
  6. data/lib/stupidedi/contrib/004010/transaction_set_defs.rb +3 -0
  7. data/lib/stupidedi/contrib/004010/transaction_set_defs/PR855.rb +35 -0
  8. data/lib/stupidedi/contrib/004010/transaction_set_defs/SH856.rb +26 -12
  9. data/lib/stupidedi/guides/005010.rb +4 -0
  10. data/lib/stupidedi/guides/005010/X212-HR276.rb +387 -0
  11. data/lib/stupidedi/guides/005010/guide_builder.rb +2 -2
  12. data/lib/stupidedi/version.rb +1 -1
  13. data/lib/stupidedi/versions/functional_groups/004010/element_defs.rb +6 -1
  14. data/lib/stupidedi/versions/functional_groups/004010/element_types/time_val.rb +1 -0
  15. data/lib/stupidedi/versions/functional_groups/004010/segment_defs.rb +9 -0
  16. data/lib/stupidedi/versions/functional_groups/004010/segment_defs/BAK.rb +24 -0
  17. data/lib/stupidedi/versions/functional_groups/004010/segment_defs/PRF.rb +20 -0
  18. data/lib/stupidedi/versions/functional_groups/004010/segment_defs/TD4.rb +26 -0
  19. data/lib/stupidedi/versions/functional_groups/004010/segment_defs/TD5.rb +2 -2
  20. data/lib/stupidedi/versions/functional_groups/005010/element_defs.rb +6 -3
  21. data/spec/examples/integration/parsing/005010/X091A1-HP835.example +94 -0
  22. data/spec/examples/integration/parsing/005010/X212-HR276.example +152 -0
  23. data/spec/examples/integration/parsing/005010/X221-HP835.example +386 -0
  24. data/spec/examples/integration/parsing/005010/X222-HC837.example +257 -0
  25. data/spec/fixtures/PR855/1-good-v4010.txt +11 -0
  26. data/spec/fixtures/PR855/2-good-v4010.txt +17 -0
  27. data/spec/fixtures/SH856/2-good.txt +31 -0
  28. data/spec/support/matchers/navigation_matchers.rb +0 -1
  29. metadata +17 -3
  30. data/spec/examples/integration/parsing.example +0 -674
@@ -0,0 +1,386 @@
1
+ require "spec_helper"
2
+ using Stupidedi::Refinements
3
+
4
+ describe "X221-HP835" do
5
+ include NavigationMatchers
6
+
7
+ let(:parser) { Fixtures.file("X221-HP835/1-good.txt") }
8
+
9
+ context 'parser' do
10
+ let(:iea) { parser.segment.fetch }
11
+
12
+ it 'is deterministic' do
13
+ expect(parser).to be_deterministic
14
+ expect(parser).to be_last
15
+ end
16
+
17
+ it 'knows iea position' do
18
+ expect(iea.node.position.line).to eq(40)
19
+ expect(iea.node.position.column).to eq(1)
20
+ end
21
+
22
+ it 'infers separators' do
23
+ expect(parser).to have_separators(
24
+ :element => "+",
25
+ :component => ">",
26
+ :repetition => "~",
27
+ :segment => "\r"
28
+ )
29
+ end
30
+ end
31
+
32
+ context 'structure' do
33
+ let(:isa) { parser.parent.fetch }
34
+
35
+ it 'has defined sequence' do
36
+ expect(parser).to have_sequence(%w(ISA GS ST BPR TRN DTM N1 N3 N4 REF REF
37
+ N1 REF LX TS3 TS2 CLP CAS NM1 MIA DTM DTM AMT QTY LX TS3 CLP CAS
38
+ NM1 MOA DTM AMT PLB SE GE IEA))
39
+ end
40
+
41
+ it 'is correct' do
42
+ expect(isa).to have_distance(35).to(parser)
43
+ # See matchers/navigation_matchers.rb
44
+ #
45
+ # Ss: list of segment matchers
46
+ # C: composite element
47
+ #
48
+ # S: the segment might be reachable, and /is/ reachable
49
+ # R: the segment might be reachable, but didn't occur
50
+ # X: the segment would never be reachable
51
+ #
52
+ expect(isa).to have_structure(
53
+ Ss(X(:ST),
54
+ R(:ISA), # No more ISAs
55
+ S(:GS, "HP", nil, nil, "19991231", nil, 1) =>
56
+ Ss(R(:GS), # No more GSs
57
+ S(:ST) =>
58
+ Ss(R(:ST), # No more STs
59
+ S(:BPR, nil, 150000) =>
60
+ Ss(S(:TRN),
61
+ S(:DTM),
62
+ S(:N1, "PR"),
63
+ S(:N1, "PE"),
64
+ S(:LX, "110212"),
65
+ S(:LX, "130212"),
66
+ S(:PLB),
67
+ S(:SE),
68
+ S(:GE),
69
+ S(:IEA)),
70
+ S(:TRN, "1", "12345") =>
71
+ Ss(X(:BPR)),
72
+
73
+ S(:DTM, "405", Date.civil(2002, 9, 13)) =>
74
+ Ss(X(:TRN)),
75
+
76
+ # 1000A PAYER IDENTIFICATION
77
+ S(:N1, "PR", "INSURANCE COMPANY OF TIMBUCKTU") =>
78
+ Ss(S(:N3, "1 MAIN STREET"),
79
+ S(:N4),
80
+ S(:REF, "2U", "999"),
81
+ S(:REF, "NF", "12345"),
82
+ S(:SE),
83
+ S(:GE),
84
+ S(:IEA)),
85
+
86
+ # 1000B PAYEE IDENTIFICATION
87
+ S(:N1, "PE", nil, "XX", "1232343560") =>
88
+ Ss(S(:REF, "TJ"),
89
+ S(:SE),
90
+ S(:GE),
91
+ S(:IEA)),
92
+
93
+ # 2000 HEADER NUMBER
94
+ S(:LX, "110212") =>
95
+ Ss(S(:LX, "130212"),
96
+ S(:TS3),
97
+ S(:TS2),
98
+ S(:CLP) =>
99
+ Ss(S(:CAS, "CO", 45, "73348.57"),
100
+ S(:NM1, "QC", nil, "JONES"),
101
+ S(:MIA, 0, nil, nil, "138018.4".to_d),
102
+ S(:DTM, "232", "20020816"),
103
+ S(:DTM, "233", "20020824"),
104
+ S(:AMT, "AU", 150000),
105
+ S(:QTY, "CA", 8))),
106
+
107
+ # 2000 HEADER NUMBER
108
+ S(:LX, "130212") =>
109
+ Ss(R(:LX, "110212"),
110
+ S(:TS3, "6543210909", "13", "1996/12/31", 1, 15000),
111
+ S(:CLP, "777777") =>
112
+ Ss(S(:CAS, "CO", "45", "3019.67"),
113
+ S(:NM1, "QC"),
114
+ S(:MOA, nil, nil, "MA02"),
115
+ S(:DTM, "232", "2002-05-12"),
116
+ S(:AMT, "AU", 17000))),
117
+
118
+ S(:PLB, "6543210903") =>
119
+ Ss(S(:SE, 32, 1234),
120
+ S(:GE, 1, 1),
121
+ S(:IEA, 1, 905)),
122
+ S(:PLB, nil, "20021231") =>
123
+ Ss(S(:SE, "32", "1234"),
124
+ S(:GE, "1", "1"),
125
+ S(:IEA, "1", "905")),
126
+ S(:PLB, nil, nil, C("CV", "CP")) => Ss(),
127
+ S(:PLB, nil, nil, nil, "-1.27") => Ss(),
128
+
129
+ S(:SE) => Ss(S(:GE),
130
+ S(:IEA))),
131
+ S(:GE) => Ss(S(:IEA)),
132
+ S(:IEA) => Ss())))
133
+ end
134
+
135
+ context 'with issues in Table 3 (Summary)' do
136
+ context 'with missing PLB' do
137
+ let(:parser) { Fixtures.file("X221-HP835/2-good.txt") }
138
+
139
+ it 'is handled' do
140
+ expect(parser).to be_deterministic
141
+
142
+ parser.parent.tap do |isa|
143
+ expect(isa).to have_structure(
144
+ Ss(X(:SE),
145
+ X(:PLB),
146
+ S(:GS, "HP", nil, nil, "19991231", nil, 1) =>
147
+ Ss(X(:SE),
148
+ X(:PLB),
149
+ S(:ST) =>
150
+ Ss(R(:PLB),
151
+ S(:LX) =>
152
+ Ss(S(:SE),
153
+ R(:PLB)),
154
+ S(:SE) =>
155
+ Ss(X(:PLB),
156
+ X(:SE))))))
157
+ end
158
+ end
159
+ end
160
+
161
+ context 'with single PLB' do
162
+ let(:parser) { Fixtures.file("X221-HP835/1-good.txt") }
163
+
164
+ it 'is handled' do
165
+ expect(parser).to be_deterministic
166
+
167
+ parser = Fixtures.file("X221-HP835/1-good.txt")
168
+ expect(parser).to be_deterministic
169
+
170
+ parser.parent.tap do |isa|
171
+ expect(isa).to have_structure(
172
+ Ss(X(:SE),
173
+ X(:PLB),
174
+ S(:GS, "HP", nil, nil, "19991231", nil, 1) =>
175
+ Ss(X(:SE),
176
+ X(:PLB),
177
+ S(:ST) =>
178
+ Ss(S(:LX) =>
179
+ Ss(S(:SE),
180
+ S(:PLB)),
181
+ S(:SE) =>
182
+ Ss(X(:PLB),
183
+ X(:SE)),
184
+ S(:PLB) =>
185
+ Ss(R(:PLB), # only one PLB
186
+ S(:SE))))))
187
+ end
188
+ end
189
+ end
190
+
191
+ context 'with multiple PLBs' do
192
+ let(:parser) { Fixtures.file("X221-HP835/3a-good.txt") }
193
+ it 'is handled' do
194
+ expect(parser).to be_deterministic
195
+
196
+ parser.parent.tap do |isa|
197
+ expect(isa).to have_structure(
198
+ Ss(X(:SE),
199
+ X(:PLB),
200
+ S(:GS, "HP", nil, nil, "19991231", nil, 1) =>
201
+ Ss(X(:SE),
202
+ X(:PLB),
203
+ S(:ST) =>
204
+ Ss(S(:LX) =>
205
+ Ss(S(:SE),
206
+ S(:PLB),
207
+ S(:PLB, "9876543210"),
208
+ S(:PLB, "0123456789")),
209
+ S(:SE) =>
210
+ Ss(X(:PLB),
211
+ X(:SE)),
212
+ S(:PLB) =>
213
+ Ss(S(:PLB),
214
+ S(:PLB, "0123456789"),
215
+ R(:PLB, "9876543210"),
216
+ S(:SE)),
217
+ S(:PLB, "0123456789") =>
218
+ Ss(R(:PLB, "0123456789"),
219
+ R(:PLB, "9876543210"),
220
+ S(:SE)),
221
+ S(:PLB, "9876543210") =>
222
+ Ss(R(:PLB, "9876543210"),
223
+ S(:PLB, "0123456789"),
224
+ S(:SE))))))
225
+ end
226
+ end
227
+ end
228
+
229
+ context 'with table level permutations' do
230
+ # # 837
231
+ # Table 2A
232
+ # 2000A HL*..*..*20
233
+ # Table 2B
234
+ # 2000B HL*..*..*22
235
+ # Table 2C
236
+ # 2000C HL*..*..*23
237
+ let(:dsl) do
238
+ c = Stupidedi::Config.hipaa
239
+ b = Stupidedi::Builder::BuilderDsl.build(c, false)
240
+ b.ISA("00", nil, "01", "SECRET", "ZZ", "SUBMITTER", "ZZ", "RECEIVER", Time.now.utc,
241
+ Time.now.utc, nil, "00501", 123456789, "1", "T", nil)
242
+ b. GS("HP", "SENDER", "RECEIVER", Time.now.utc, Time.now.utc, 1, "X", "005010X222")
243
+ b. ST("837", "0001", b.default)
244
+ b.BHT("0019", "00", "46X2A6", Time.now.utc, Time.now.utc, "CH")
245
+ b.NM1("41", "2", "TERRIBLE BILLING", nil, nil, nil, nil, "46", "X82BJJ")
246
+ b.PER("IC", nil, "TE", "5551212")
247
+ b.NM1("40", "2", "TERRIBLE INSURAN", nil, nil, nil, nil, "46", "3057XK")
248
+
249
+ b # return BuilderDsl instance
250
+ end
251
+
252
+ it "in HL*..*..20, HL*..*..*22, HL*..*..*23 are handled" do
253
+ ss = [["1", nil, "20", "1"],
254
+ ["2", nil, "20", "1"],
255
+ ["3", "1", "22", "1"],
256
+ ["4", "2", "22", "1"],
257
+ ["5", "3", "23", "0"],
258
+ ["6", "4", "23", "0"]]
259
+
260
+ ss.permutation do |p|
261
+ b = dsl.dup
262
+ p.each{|es| b.send(:HL, *es) }
263
+
264
+ m = b.machine.first.flatmap{|x| x.sequence(:GS, :ST) }
265
+
266
+ expect(m.map{|x| x.count(:HL, nil, nil, "20") }).to be_success(2)
267
+ expect(m.map{|x| x.count(:HL, nil, nil, "22") }).to be_success(2)
268
+ expect(m.map{|x| x.count(:HL, nil, nil, "23") }).to be_success(2)
269
+
270
+ expect(m.map{|x| x.count(:HL) }).to be_success(6)
271
+
272
+ expect(m.flatmap{|x| x.sequence(:HL) }.
273
+ map{|x| x.count(:HL) }).to be_success(5)
274
+
275
+ expect(m.flatmap{|x| x.sequence(:HL, :HL) }.
276
+ map{|x| x.count(:HL) }).to be_success(4)
277
+
278
+ expect(m.flatmap{|x| x.sequence(:HL, :HL, :HL) }.
279
+ map{|x| x.count(:HL) }).to be_success(3)
280
+
281
+ expect(m.flatmap{|x| x.sequence(:HL, :HL, :HL, :HL) }.
282
+ map{|x| x.count(:HL) }).to be_success(2)
283
+
284
+ expect(m.flatmap{|x| x.sequence(:HL, :HL, :HL, :HL, :HL) }.
285
+ map{|x| x.count(:HL) }).to be_success(1)
286
+
287
+ expect(m.flatmap{|x| x.sequence(:HL, :HL, :HL, :HL, :HL, :HL) }.
288
+ map{|x| x.count(:HL) }).to be_success(0)
289
+ end if ss.respond_to?(:permutation)
290
+ end
291
+ end
292
+
293
+ context 'with loop-level permutations' do
294
+ # 837
295
+ # Table 1
296
+ # 1000A NM1*41
297
+ # 1000B NM1*40
298
+ let(:dsl) do
299
+ c = Stupidedi::Config.hipaa
300
+ b = Stupidedi::Builder::BuilderDsl.build(c, false)
301
+ b.ISA("00", nil, "01", "SECRET", "ZZ", "SUBMITTER", "ZZ", "RECEIVER", Time.now.utc,
302
+ Time.now.utc, nil, "00501", 123456789, "1", "T", nil)
303
+ b. GS("HP", "SENDER", "RECEIVER", Time.now.utc, Time.now.utc, 1, "X", "005010X222")
304
+ b. ST("837", "0001", b.default)
305
+ b.BHT("0019", "00", "46X2A6", Time.now.utc, Time.now.utc, "CH")
306
+
307
+ b # return BuilderDsl instance
308
+ end
309
+
310
+ specify "in NM1*41, NM1*40 is handled" do
311
+ ss = [["41", "2", "TERRIBLE BILLING", nil, nil, nil, nil, "46", "X82BJJ"],
312
+ ["40", "2", "TERRIBLE INSURAN", nil, nil, nil, nil, "46", "3057XK"]]
313
+
314
+ ss.permutation do |p|
315
+ b = dsl.dup
316
+ p.each{|es| b.send(:NM1, *es) }
317
+
318
+ m = b.machine.parent
319
+ expect(m.map{|x| x.count(:NM1) }).to be_success(2)
320
+
321
+ expect(m.flatmap{|x| x.sequence(:NM1) }.
322
+ map{|x| x.count(:NM1) }).to be_success(1)
323
+
324
+ expect(m.flatmap{|x| x.sequence(:NM1, :NM1) }.
325
+ map{|x| x.count(:NM1) }).to be_success(0)
326
+ end if ss.respond_to?(:permutation)
327
+ end
328
+ end
329
+
330
+ context 'with segment-level permutations' do
331
+ # 835
332
+ # Table 1
333
+ # 1000A N1*PR
334
+ # PER*CX
335
+ # PER*BL
336
+ # PER*IC
337
+ let(:dsl) do
338
+ c = Stupidedi::Config.hipaa
339
+ b = Stupidedi::Builder::BuilderDsl.build(c)
340
+ b.ISA("00", nil, "01", "SECRET", "ZZ", "SUBMITTER", "ZZ", "RECEIVER", Time.now.utc,
341
+ Time.now.utc, nil, "00501", 123456789, "1", "T", nil)
342
+ b. GS("HP", "SENDER", "RECEIVER", Time.now.utc, Time.now.utc, 1, "X", "005010X221")
343
+ b. ST("835", "0001")
344
+ b.BPR("C", 150000, "C", "ACH", "CTX", "01", "999999992", "DA", "123456", "1512345678", nil, "01",
345
+ "999988880", "DA", "98765", "20020913")
346
+ b.TRN("1", "12345", "1512345678")
347
+ b.DTM("405", Time.now.utc)
348
+ b. N1("PR", "INSURANCE COMPANY OF TIMBUCKTU")
349
+ b. N3("1 MAIN STREET")
350
+ b. N4("TIMBUCKTU", "AK", "99501")
351
+ b.REF("2U", "999")
352
+ b.REF("NF", "12345")
353
+
354
+ b # return BuilderDsl instance
355
+ end
356
+
357
+ specify "in PER*IC, PER*BL, PER*CX is handled" do
358
+ ss = [["IC", nil, "UR", "WEBSITE.COM"],
359
+ ["BL", "COMPUTER PAT"],
360
+ ["BL", "COMPUTER SAM"],
361
+ ["CX", "BUSINESS KIM"]]
362
+
363
+ ss.permutation do |p|
364
+ b = dsl.dup
365
+ p.each{|es| b.send(:PER, *es) }
366
+
367
+ m = b.machine.parent
368
+ expect(m.map{|x| x.count(:PER) }).to be_success(4)
369
+
370
+ expect(m.flatmap{|x| x.sequence(:PER) }.
371
+ map{|x| x.count(:PER) }).to be_success(3)
372
+
373
+ expect(m.flatmap{|x| x.sequence(:PER, :PER) }.
374
+ map{|x| x.count(:PER) }).to be_success(2)
375
+
376
+ expect(m.flatmap{|x| x.sequence(:PER, :PER, :PER) }.
377
+ map{|x| x.count(:PER) }).to be_success(1)
378
+
379
+ expect(m.flatmap{|x| x.sequence(:PER, :PER, :PER, :PER) }.
380
+ map{|x| x.count(:PER) }).to be_success(0)
381
+ end if ss.respond_to?(:permutation)
382
+ end
383
+ end
384
+ end
385
+ end
386
+ end
@@ -0,0 +1,257 @@
1
+ require "spec_helper"
2
+ using Stupidedi::Refinements
3
+
4
+ describe "X222-HC837" do
5
+ include NavigationMatchers
6
+
7
+ let(:parser) { Fixtures.file("X222-HC837/1-good.txt") }
8
+ context 'parser' do
9
+ let(:iea) { parser.segment.fetch }
10
+
11
+ it 'is deterministic' do
12
+ expect(parser).to be_deterministic
13
+ expect(parser).to be_last
14
+ end
15
+
16
+ it 'infers separators' do
17
+ expect(parser).to have_separators(
18
+ :element => "*",
19
+ :component => ":",
20
+ :repetition => "^",
21
+ :segment => "~"
22
+ )
23
+ end
24
+
25
+ it 'knows iea position' do
26
+ expect(iea.node.position.line).to eq(53)
27
+ expect(iea.node.position.column).to eq(1)
28
+ end
29
+ end
30
+
31
+ context 'structure' do
32
+ let(:isa) { parser.parent.fetch }
33
+
34
+ it 'has defined sequence' do
35
+ expect(parser).to have_sequence(%w(ISA GS ST BHT NM1 PER NM1 HL PRV NM1 N3 N4
36
+ REF NM1 N3 N4 HL SBR NM1 N3 N4 DMG NM1 N4 REF HL PAT NM1 N3 N4 DMG CLM
37
+ REF HI LX SV1 DTP LX SV1 DTP LX SV1 DTP LX SV1 DTP SE GE IEA))
38
+ end
39
+
40
+ it 'is correct' do
41
+ # Should have 49 total segments in the parse tree
42
+ expect(isa).to have_distance(48).to(parser)
43
+
44
+ # See matchers/navigation_matchers.rb
45
+ #
46
+ # Ss: list of segment matchers
47
+ # C: composite element
48
+ #
49
+ # S: the segment might be reachable, and /is/ reachable
50
+ # R: the segment might be reachable, but didn't occur
51
+ # X: the segment would never be reachable
52
+ #
53
+ expect(isa).to have_structure(
54
+ Ss(X(:ST),
55
+ R(:ISA), # No more ISAs
56
+ S(:GS, "HC", nil, nil, nil, nil, 1) =>
57
+ Ss(R(:GS), # No more GSs
58
+ S(:ST) =>
59
+ Ss(R(:ST), # No more STs
60
+ X(:PRV),
61
+ X(:NM1, "85"),
62
+ X(:NM1, "87"),
63
+ X(:SBR),
64
+ X(:NM1, "IL"),
65
+ X(:NM1, "PR"),
66
+ S(:BHT) =>
67
+ Ss(S(:NM1, "41"),
68
+ S(:NM1, "40"),
69
+ S(:HL, "1"),
70
+ S(:HL, "2"),
71
+ S(:HL, "3"),
72
+ S(:SE),
73
+ S(:GE),
74
+ S(:IEA)),
75
+ # 1000A SUBMITTER NAME
76
+ S(:NM1, "41") =>
77
+ Ss(S(:PER),
78
+ S(:NM1, "40"),
79
+ S(:HL, "1"),
80
+ S(:HL, "2"),
81
+ S(:HL, "3"),
82
+ S(:SE),
83
+ S(:GE),
84
+ S(:IEA)),
85
+ # 1000B RECEIVER NAME
86
+ S(:NM1, "40") =>
87
+ Ss(S(:HL, "1"),
88
+ S(:HL, "2"),
89
+ S(:HL, "3"),
90
+ S(:SE),
91
+ S(:GE),
92
+ S(:IEA)),
93
+ # 2000A BILLING PROVIDER HIERARCHICAL LEVEL
94
+ S(:HL, "1") =>
95
+ Ss(S(:PRV) =>
96
+ Ss(S(:NM1, "85"),
97
+ S(:NM1, "87"),
98
+ S(:HL, "2"),
99
+ S(:HL, "3"),
100
+ S(:SE),
101
+ S(:GE),
102
+ S(:IEA)),
103
+ # 2010AA BILLING PROVIDER NAME
104
+ S(:NM1, "85") =>
105
+ Ss(S(:NM1, "87") => Ss(),
106
+ S(:N3) => Ss(S(:N4),
107
+ S(:REF, "EI"),
108
+ S(:NM1, "87")),
109
+ S(:N4) => Ss(S(:REF, "EI"),
110
+ S(:NM1, "87")),
111
+ S(:REF, "EI") => Ss(S(:NM1, "87")),
112
+ S(:SE) => Ss(),
113
+ S(:GE) => Ss(),
114
+ S(:IEA) => Ss()),
115
+ # 2010AB PAY-TO ADDRESS NAME
116
+ S(:NM1, "87") =>
117
+ Ss(S(:N3) => Ss(S(:N4),
118
+ S(:HL, "2")),
119
+ S(:N4) => Ss(S(:HL, "2")),
120
+ S(:SE) => Ss(),
121
+ S(:GE) => Ss(),
122
+ S(:IEA) => Ss()),
123
+ S(:HL, "2") => Ss(),
124
+ S(:HL, "3") => Ss(),
125
+ S(:SE) => Ss(),
126
+ S(:GE) => Ss(),
127
+ S(:IEA) => Ss()),
128
+ # 2000B SUBSCRIBER HIERARCHICAL LEVEL
129
+ S(:HL, "2") =>
130
+ Ss(S(:SBR) =>
131
+ Ss(S(:NM1, "IL"),
132
+ S(:NM1, "PR"),
133
+ S(:HL, "3"),
134
+ S(:SE),
135
+ S(:GE),
136
+ S(:IEA)),
137
+ # 2010BA SUBSCRIBER NAME
138
+ S(:NM1, "IL") =>
139
+ Ss(S(:N3) => Ss(S(:N4),
140
+ S(:DMG),
141
+ S(:NM1, "PR"),
142
+ S(:HL, "3")),
143
+ S(:N4) => Ss(S(:DMG),
144
+ S(:NM1, "PR"),
145
+ S(:HL, "3")),
146
+ S(:DMG) => Ss(S(:NM1, "PR"),
147
+ S(:HL, "3")),
148
+ S(:SE) => Ss(),
149
+ S(:GE) => Ss(),
150
+ S(:IEA) => Ss()),
151
+ # 2010BB PAYER NAME
152
+ S(:NM1, "PR") =>
153
+ Ss(S(:N4) => Ss(S(:REF, "G2"),
154
+ S(:HL, "3")),
155
+ S(:REF, "G2") => Ss(S(:HL, "3")),
156
+ S(:SE) => Ss(),
157
+ S(:GE) => Ss(),
158
+ S(:IEA) => Ss()),
159
+ S(:HL, "3") => Ss(),
160
+ S(:SE) => Ss(),
161
+ S(:GE) => Ss(),
162
+ S(:IEA) => Ss()),
163
+ # 2000C PATIENT HIERARCHICAL LEVEL
164
+ S(:HL, "3") =>
165
+ Ss(S(:PAT) => Ss(S(:NM1, "QC"),
166
+ S(:CLM),
167
+ S(:SE),
168
+ S(:GE),
169
+ S(:IEA)),
170
+ # 2010CA PATIENT NAME
171
+ S(:NM1, "QC") =>
172
+ Ss(S(:N3) => Ss(S(:N4),
173
+ S(:DMG),
174
+ S(:CLM)),
175
+ S(:N4) => Ss(S(:DMG),
176
+ S(:CLM)),
177
+ S(:DMG) => Ss(S(:CLM)),
178
+ S(:CLM) => Ss(),
179
+ S(:SE) => Ss(),
180
+ S(:GE) => Ss(),
181
+ S(:IEA) => Ss()),
182
+ # 2300 CLAIM INFORMATION
183
+ S(:CLM) =>
184
+ Ss(R(:CLM), # No more CLMs
185
+ S(:REF, "D9"),
186
+ S(:HI, C("BK", "0340"), C("BF", "V7389")),
187
+ # 2400 SERVICE LINE NUMBER
188
+ S(:LX, "1") =>
189
+ Ss(R(:LX, "1"), # No more LX*1's
190
+ S(:LX, "2"),
191
+ S(:LX, "3"),
192
+ S(:LX, "4"),
193
+ S(:SV1, C(nil, "99213")) => Ss(S(:DTP, "472"),
194
+ S(:LX, "2"),
195
+ S(:LX, "3"),
196
+ S(:LX, "4"),
197
+ S(:SE),
198
+ S(:GE),
199
+ S(:IEA)),
200
+ S(:DTP, "472") => Ss(S(:LX, "2"),
201
+ S(:LX, "3"),
202
+ S(:LX, "4"),
203
+ S(:SE),
204
+ S(:GE),
205
+ S(:IEA))),
206
+ # 2400 SERVICE LINE NUMBER
207
+ S(:LX, "2") =>
208
+ Ss(R(:LX, "1"),
209
+ R(:LX, "2"), # No more LX*2's
210
+ S(:LX, "3"),
211
+ S(:LX, "4"),
212
+ S(:SV1, C(nil, "87070")) => Ss(S(:DTP, "472"),
213
+ S(:LX, "3"),
214
+ S(:LX, "4"),
215
+ S(:SE),
216
+ S(:GE),
217
+ S(:IEA)),
218
+ S(:DTP, "472") => Ss(S(:LX, "3"),
219
+ S(:LX, "4"),
220
+ S(:SE),
221
+ S(:GE),
222
+ S(:IEA))),
223
+ # 2400 SERVICE LINE NUMBER
224
+ S(:LX, "3") =>
225
+ Ss(R(:LX, "1"), # No more LX*1's
226
+ R(:LX, "2"), # No more LX*2's
227
+ R(:LX, "3"), # No more LX*3's
228
+ S(:LX, "4"),
229
+ S(:SV1, C(nil, "99214")) => Ss(S(:DTP, "472"),
230
+ S(:LX, "4"),
231
+ S(:SE),
232
+ S(:GE),
233
+ S(:IEA)),
234
+ S(:DTP, "472") => Ss(S(:LX, "4"),
235
+ S(:SE),
236
+ S(:GE),
237
+ S(:IEA))),
238
+ # 2400 SERVICE LINE NUMBER
239
+ S(:LX, "4") =>
240
+ Ss(R(:LX, "1"),
241
+ R(:LX, "2"),
242
+ R(:LX, "3"),
243
+ R(:LX, "4"),
244
+ S(:SV1, C(nil, "86663")) => Ss(S(:DTP, "472"),
245
+ S(:SE),
246
+ S(:GE),
247
+ S(:IEA)),
248
+ S(:DTP, "472") => Ss(S(:SE),
249
+ S(:GE),
250
+ S(:IEA))))),
251
+ S(:SE) => Ss(S(:GE),
252
+ S(:IEA))),
253
+ S(:GE) => Ss(S(:IEA)),
254
+ S(:IEA) => Ss())))
255
+ end
256
+ end
257
+ end