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
@@ -110,8 +110,8 @@ module Stupidedi
110
110
 
111
111
  # ComponentElementUses
112
112
  component_index = "00"
113
- component_uses = e_arguments.zip(u.definition.component_uses).map do |e, c|
114
- c_tag, c_requirement, c_name, c_arguments = e
113
+ component_uses = e_arguments.zip(u.definition.component_uses).map do |e1, c|
114
+ c_tag, c_requirement, c_name, c_arguments = e1
115
115
  # component_index.succ!
116
116
  component_index = component_index.succ
117
117
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stupidedi
4
- VERSION = "1.2.17"
4
+ VERSION = "1.2.18"
5
5
  end
@@ -4048,6 +4048,10 @@ module Stupidedi
4048
4048
  E205 = t::Nn.new(:E205 , "Dunnage" , 1, 6, 0)
4049
4049
  E206 = t::AN.new(:E206 , "Equipment Initial" , 1, 4)
4050
4050
  E207 = t::AN.new(:E207 , "Equipment Number" , 1, 10)
4051
+ E208 = t::ID.new(:E208 , "Hazardous Material Code Qualifier" , 1, 1,
4052
+ s::CodeList.build(
4053
+ "D" => "Hazardous Material Code Qualifier"))
4054
+ E209 = t::ID.new(:E209 , "Hazardous Material Class Code Description", 3, 3)
4051
4055
  E211 = t::ID.new(:E215 , "Packaging Form Code" , 3, 3)
4052
4056
  E212 = t:: R.new(:E212 , "Unit Price" , 1, 17)
4053
4057
  E213 = t::Nn.new(:E213 , "Lading Line Item Number" , 1, 3, 0)
@@ -6288,7 +6292,8 @@ module Stupidedi
6288
6292
  "I" => "Item",
6289
6293
  "S" => "Shipment",
6290
6294
  "T" => "Shipping Tare",
6291
- "P" => "Pack"))
6295
+ "P" => "Pack",
6296
+ "O" => "Order"))
6292
6297
 
6293
6298
  E736 = t::ID.new(:E736 , "Hierarchical Child Code" , 1, 1,
6294
6299
  s::CodeList.build(
@@ -291,6 +291,7 @@ module Stupidedi
291
291
  second = object.to_s.slice(4, 2).try{|ss| ss.to_d unless ss.blank? }
292
292
 
293
293
  if decimal = object.to_s.slice(6..-1)
294
+ decimal = 0 if decimal.empty?
294
295
  second += "0.#{decimal}".to_d
295
296
  end
296
297
 
@@ -37,6 +37,9 @@ module Stupidedi
37
37
  autoload :BEG,
38
38
  "stupidedi/versions/functional_groups/004010/segment_defs/BEG"
39
39
 
40
+ autoload :BAK,
41
+ "stupidedi/versions/functional_groups/004010/segment_defs/BAK"
42
+
40
43
  autoload :BPR,
41
44
  "stupidedi/versions/functional_groups/004010/segment_defs/BPR"
42
45
 
@@ -201,6 +204,9 @@ module Stupidedi
201
204
  autoload :PER,
202
205
  "stupidedi/versions/functional_groups/004010/segment_defs/PER"
203
206
 
207
+ autoload :PRF,
208
+ "stupidedi/versions/functional_groups/004010/segment_defs/PRF"
209
+
204
210
  autoload :PID,
205
211
  "stupidedi/versions/functional_groups/004010/segment_defs/PID"
206
212
 
@@ -234,6 +240,9 @@ module Stupidedi
234
240
  autoload :TD3,
235
241
  "stupidedi/versions/functional_groups/004010/segment_defs/TD3"
236
242
 
243
+ autoload :TD4,
244
+ "stupidedi/versions/functional_groups/004010/segment_defs/TD4"
245
+
237
246
  autoload :TRN,
238
247
  "stupidedi/versions/functional_groups/004010/segment_defs/TRN"
239
248
 
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FunctionalGroups
5
+ module FortyTen
6
+ module SegmentDefs
7
+
8
+ s = Schema
9
+ e = ElementDefs
10
+ r = ElementReqs
11
+
12
+ BAK = s::SegmentDef.build(:BAK, "Beginning Segment for Purchase Order Acknowledgment",
13
+ "To indicate the beginning of the Purchase Order Acknowledgment Transaction Set and transmit identifying numbers and dates",
14
+ e::E353 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
15
+ e::E587 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
16
+ e::E324 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
17
+ e::E373 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
18
+ e::E367 .simple_use(r::Optional, s::RepeatCount.bounded(1)))
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FunctionalGroups
5
+ module FortyTen
6
+ module SegmentDefs
7
+
8
+ s = Schema
9
+ e = ElementDefs
10
+ r = ElementReqs
11
+
12
+ PRF = s::SegmentDef.build(:PRF, "Purchase Order Reference",
13
+ "To provide reference to a specific purchase order",
14
+ e::E324 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)))
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FunctionalGroups
5
+ module FortyTen
6
+ module SegmentDefs
7
+
8
+ s = Schema
9
+ e = ElementDefs
10
+ r = ElementReqs
11
+
12
+ # Definition might be outdated, working from ANSI X12 2001 specification
13
+
14
+ TD4 = s::SegmentDef.build(:TD4, "Carrier Details (Special Handling, or Hazardous Materials, or Both)",
15
+ "To specify transportation special handling requirements, or hazardous materials information, or both",
16
+ e::E152 .simple_use(r::Mandatory, s::RepeatCount.bounded(2)),
17
+ e::E208 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
18
+ e::E209 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
19
+ e::E352 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
20
+ e::E1073.simple_use(r::Mandatory, s::RepeatCount.bounded(1)))
21
+
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -14,8 +14,8 @@ module Stupidedi
14
14
  e::E133.simple_use(r::Optional, s::RepeatCount.bounded(1)),
15
15
  e::E66 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
16
16
  e::E67 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
17
- e::E91 .simple_use(r::Relational, s::RepeatCount.bounded(1)))
18
-
17
+ e::E91 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
18
+ e::E387.simple_use(r::Relational, s::RepeatCount.bounded(1)))
19
19
  end
20
20
  end
21
21
  end
@@ -185,7 +185,7 @@ module Stupidedi
185
185
  "3L" => "Branch Identifier",
186
186
  "4A" => "Personal Identification Number (PIN)",
187
187
  "4N" => "Special Payment Reference Number",
188
- "49" => "Family Unit Number",
188
+ "49" => "Family Unit Number",
189
189
  "60" => "Account Suffix Code",
190
190
  "6M" => "Application Number",
191
191
  "6O" => "Cross Reference Number",
@@ -196,7 +196,7 @@ module Stupidedi
196
196
  "9C" => "Adjusted Repriced Claim Reference Number",
197
197
  "9D" => "Adjusted Repriced Line Item Reference Number",
198
198
  "9F" => "Referral Number",
199
- "9K" => "Servicer",
199
+ "9K" => "Servicer",
200
200
  "9V" => "Payment Category",
201
201
  "9X" => "Account Category",
202
202
  "ABB" => "Personal ID Number",
@@ -236,7 +236,7 @@ module Stupidedi
236
236
  "G1" => "Prior Authorization Number",
237
237
  "G2" => "Provider Commercial Number",
238
238
  "G3" => "Predetermination of Benefits Identification Number",
239
- "GH" => "Identification Card Serial Number",
239
+ "GH" => "Identification Card Serial Number",
240
240
  "G4" => "Peer Review Organization (PRO) Approval Number",
241
241
  "GE" => "Geographic Number",
242
242
  "HI" => s::CodeList.external("121"),
@@ -284,6 +284,7 @@ module Stupidedi
284
284
  s::CodeList.build(
285
285
  "270" => "Eligibility, Coverage, or Benefit Inquiry",
286
286
  "271" => "Eligibility, Coverage, or Benefit Information",
287
+ "276" => "Health Care Claim Status Request",
287
288
  "277" => "Health Care Information Status Notification",
288
289
  "834" => "Benefit Enrollment and Maintenance",
289
290
  "835" => "Health Care Claim Payment/Advice",
@@ -653,6 +654,7 @@ module Stupidedi
653
654
  "N8" => "Miscellaneous Taxes",
654
655
  "NL" => "Negative Ledger Balance",
655
656
  "P3" => "Premium Amount",
657
+ "T3" => "Total Submitted Charges",
656
658
  "PB" => "Billed Amount",
657
659
  "R" => "Spend Down",
658
660
  "T" => "Tax",
@@ -1226,6 +1228,7 @@ module Stupidedi
1226
1228
  E954 = t:: R.new(:E954 , "Percentage as Decimal" , 1, 10)
1227
1229
  E1005 = t::ID.new(:E1005, "Hierarchical Structure Code" , 4, 4,
1228
1230
  s::CodeList.build(
1231
+ "0010" => "Information Source, Information Receiver, Provider of Service, Subscriber, Dependent",
1229
1232
  "0019" => "Information Source, Subscriber, Dependent",
1230
1233
  "0022" => "Information Source, Information Receiver, Subscriber, Dependent",
1231
1234
  "0085" => "Information Source, Information Receiver, Provider of Service, Patient"))
@@ -0,0 +1,94 @@
1
+ require "spec_helper"
2
+ using Stupidedi::Refinements
3
+
4
+ describe "X091A1-HP835" do
5
+ include NavigationMatchers
6
+ let(:parser) { Fixtures.file("X091A1-HP835/1-good.txt") }
7
+
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 => nil,
21
+ :segment => "~"
22
+ )
23
+ end
24
+
25
+ it 'knows iea position' do
26
+ expect(iea.node.position.line).to eq(1)
27
+ expect(iea.node.position.column).to eq(606)
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 BPR TRN REF N1 N3 N4 REF PER N1
36
+ REF LX CLP CAS NM1 PLB SE GE IEA))
37
+ end
38
+
39
+ it 'is correct' do
40
+ expect(isa).to have_distance(20).to(parser)
41
+ expect(isa).to have_structure(
42
+ Ss(X(:ST),
43
+ R(:ISA), # No more ISAs
44
+ S(:GS, "HP", "MADE UP CLEARING HOUSE", "611358935", "20130508", nil, "3063") =>
45
+ Ss(R(:GS), # No more GSs
46
+ S(:ST) =>
47
+ Ss(R(:ST), # No more STs
48
+ S(:BPR, nil, nil) =>
49
+ Ss(S(:TRN),
50
+ S(:N1, "PR"),
51
+ S(:N1, "PE"),
52
+ S(:LX, "1"),
53
+ S(:PLB),
54
+ S(:SE),
55
+ S(:GE),
56
+ S(:IEA)),
57
+ S(:TRN, "1", "74122910359") =>
58
+ Ss(X(:BPR)),
59
+
60
+ # 1000A PAYER IDENTIFICATION
61
+ S(:N1, "PR", "MADE UP HEALTH CENTER") =>
62
+ Ss(S(:N3, "123 FAKE ST."),
63
+ S(:N4),
64
+ S(:REF, "2U", "80214"),
65
+ S(:SE),
66
+ S(:GE),
67
+ S(:IEA)),
68
+
69
+ # 1000B PAYEE IDENTIFICATION
70
+ S(:N1, "PE", nil, "XX", "1386672277") =>
71
+ Ss(S(:REF, "TJ"),
72
+ S(:SE),
73
+ S(:GE),
74
+ S(:IEA)),
75
+
76
+ # 2000 HEADER NUMBER
77
+ S(:LX, "1") =>
78
+ Ss(
79
+ S(:CLP) =>
80
+ Ss(S(:CAS, "PI", 23, "157.39"),
81
+ S(:NM1, "QC", nil, "DOE"))),
82
+
83
+ S(:PLB, "341491692") =>
84
+ Ss(S(:SE, 17, '0001'),
85
+ S(:GE, 1, 3063),
86
+ S(:IEA, 1, 3063)),
87
+
88
+ S(:SE) => Ss(S(:GE),
89
+ S(:IEA))),
90
+ S(:GE) => Ss(S(:IEA)),
91
+ S(:IEA) => Ss())))
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,152 @@
1
+ require "spec_helper"
2
+ using Stupidedi::Refinements
3
+
4
+ describe "X212-HR276" do
5
+ include NavigationMatchers
6
+
7
+ describe "parser" do
8
+ let(:parser) { Fixtures.file("X212-HR276/1-good.txt") }
9
+
10
+ describe "parser" do
11
+ let(:iea) { parser.segment.fetch }
12
+
13
+ it 'is deterministic' do
14
+ expect(parser).to be_deterministic
15
+ expect(parser).to be_last
16
+ end
17
+
18
+ it 'knows iea position' do
19
+ end
20
+
21
+ it 'infers separators' do
22
+ expect(parser).to have_separators(
23
+ :element => "*",
24
+ :component => ":",
25
+ :repetition => "^",
26
+ :segment => "~"
27
+ )
28
+ end
29
+ end
30
+
31
+ describe "structure" do
32
+ let(:isa) { parser.parent.fetch }
33
+
34
+ it 'has defined sequence' do
35
+ expect(parser).to have_sequence(%w(
36
+ ISA GS ST BHT HL NM1 HL NM1 HL NM1 HL DMG NM1 TRN REF REF AMT DTP HL DMG NM1 TRN
37
+ REF REF AMT DTP HL NM1 HL NM1 HL DMG NM1 TRN REF SVC DTP SE GE IEA
38
+ ))
39
+ end
40
+
41
+ it 'is correct' do
42
+ expect(isa).to have_distance(39).to(parser)
43
+ # ISA*00*..........*01*SECRET....*ZZ*SUBMITTERS.ID..*ZZ*RECEIVERS.ID...*030101*1253*^*00501*000000905*1*T*:~
44
+ # GS*HR*SENDER CODE*RECEIVER CODE*19991231*0802*1*X*005010X212~
45
+ expect(isa).to have_structure(
46
+ Ss(X(:ST),
47
+ R(:ISA),
48
+ # GS*HR*SENDER CODE*RECEIVER CODE*19991231*0802*1*X*005010X212~
49
+ S(:GS, "HR", "SENDER CODE", "RECEIVER CODE", "19991231", nil, "1", "X", "005010X212") =>
50
+ Ss(R(:GS),
51
+ # ST*276*0001*005010X212~
52
+ S(:ST, "276", "0001", "005010X212") =>
53
+ Ss(R(:ST),
54
+ # BHT*0010*13*ABC276XXX*20050915*1425~
55
+ # 1425 is not set since it leads to NoMethodError, need to investigate
56
+ S(:BHT, "0010", "13", "ABC276XXX", "20050915", nil),
57
+ # HL*1**20*1~
58
+ S(:HL, "1"),
59
+ S(:HL, "2"),
60
+ S(:HL, "3"),
61
+ S(:HL, "4"),
62
+ S(:HL, "5"),
63
+ S(:HL, "6"),
64
+ S(:HL, "7"),
65
+ S(:HL, "8"),
66
+ S(:HL, "1", nil, "20", "1") => Ss(
67
+ # NM1*PR*2*ABC INSURANCE*****PI*12345~
68
+ S(:NM1, "PR", "2", "ABC INSURANCE", nil, nil, nil, nil, "PI", "12345"),
69
+ X(:BHT)),
70
+ # HL*2*1*21*1~
71
+ S(:HL, "2", "1", "21","1") => Ss(
72
+ # NM1*41*2*XYZ SERVICE*****46*X67E~
73
+ S(:NM1, "41", "2", "XYZ SERVICE", nil, nil, nil, nil, "46", "X67E"),
74
+ X(:BHT)),
75
+ # HL*3*2*19*1~
76
+ S(:HL, "3", "2", "19", "1") => Ss(
77
+ # NM1*1P*2*HOME HOSPITAL*****XX*1666666668~
78
+ S(:NM1, "1P", "2", "HOME HOSPITAL", nil, nil, nil, nil, "XX", "1666666668"),
79
+ X(:BHT)),
80
+ # HL*4*3*22*0~
81
+ S(:HL, "4", "3", "22", "0") => Ss(
82
+ # DMG*D8*19301210*M~
83
+ S(:DMG, "D8", "19301210", "M"),
84
+ # NM1*IL*1*SMITH*FRED****MI*123456789A~
85
+ { S(:NM1, "IL", "1", "SMITH", "FRED", nil, nil, nil, "MI", "123456789A") => Ss(
86
+ # TRN*1*ABCXYZ1~
87
+ S(:TRN, "1", "ABCXYZ1") => Ss(
88
+ # REF*BLT*111~
89
+ S(:REF, "BLT", "111"),
90
+ # REF*EJ*SM123456~
91
+ S(:REF, "EJ", "SM123456"),
92
+ # AMT*T3*8513.88~
93
+ S(:AMT, "T3", "8513.88"),
94
+ # DTP*472*RD8*20050831-20050906~
95
+ S(:DTP, "472", "RD8", "20050831-20050906")))},
96
+ X(:BHT)),
97
+ # HL*5*3*22*0~
98
+ S(:HL, "5", "3", "22", "0") => Ss({
99
+ # NM1*IL*1*JONES*MARY****MI*234567890A~
100
+ S(:NM1, "IL", "1", "JONES", "MARY", nil, nil, nil, "MI", "234567890A") => Ss(
101
+ # TRN*1*ABCXYZ2~
102
+ S(:TRN, "1", "ABCXYZ2") => Ss(
103
+ # REF*BLT*111~
104
+ S(:REF, "BLT", "111"),
105
+ # REF*EJ*JO234567~
106
+ S(:REF, "EJ", "JO234567"),
107
+ # AMT*T3*7599~
108
+ S(:AMT, "T3", "7599"),
109
+ # DTP*472*RD8*20050731-20050809~
110
+ S(:DTP, "472", "RD8", "20050731-20050809"))
111
+ )},
112
+ # DMG*D8*19301115*F~
113
+ S(:DMG, "D8", "19301115", "F"),
114
+ X(:BHT)),
115
+ # HL*6*2*19*1~
116
+ S(:HL, "6", "2", "19", "1") => Ss(
117
+ # NM1*1P*2*HOME HOSPITAL PHYSICIANS*****XX*1666666668~
118
+ S(:NM1, "1P", "2", "HOME HOSPITAL PHYSICIANS", nil, nil, nil, nil, "XX", "1666666668"),
119
+ X(:BHT)),
120
+ # HL*7*6*22*1~
121
+ S(:HL, "7", "6", "22", "1") => Ss(
122
+ # NM1*IL*1*MANN*JOHN****MI*345678901~
123
+ S(:NM1, "IL", "1", "MANN", "JOHN", nil, nil, nil, "MI", "345678901"),
124
+ X(:BHT)),
125
+ # HL*8*7*23~
126
+ S(:HL, "8", "7", "23") => Ss({
127
+ # NM1*QC*1*MANN*JOSEPH~
128
+ S(:NM1, "QC", "1", "MANN", "JOSEPH") => Ss(
129
+ # TRN*1*ABCXYZ3~
130
+ S(:TRN, "1", "ABCXYZ3") => Ss({
131
+ # REF*EJ*MA345678~
132
+ S(:REF, "EJ", "MA345678") => Ss(
133
+ # SVC*HC:99203*150*****1~
134
+ C(:SVC, "HC:99203", "150", nil, nil, nil, nil, nil, "1")
135
+ )
136
+ },
137
+ # DTP*472*D8*20050501~
138
+ S(:DTP, "472", "D8", "20050501"))
139
+ )},
140
+ # DMG*D8*19951101*M~
141
+ S(:DMG, "D8", "19951101", "M"),
142
+ X(:BHT)),
143
+ ),
144
+ # GE*1*1~
145
+ S(:GE) => Ss(S(:IEA)),
146
+ # IEA*1*000000905~
147
+ S(:IEA) => Ss()))
148
+ )
149
+ end
150
+ end
151
+ end
152
+ end