stupidedi 1.4.5 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf916335467239d55603c75021717e8db3e7d6706e10a691ad137d1a1014d10b
4
- data.tar.gz: e1fc02d7051de8833f02eac54e310c039436f98670ce1ef0806980e291b4b37b
3
+ metadata.gz: ebd4e29e105a307c2ba6843447bc7320e2a7a88e044c305a237e75e0fe1678c9
4
+ data.tar.gz: d411d0e3288257292a7d9ceaaf0cf267eab1465f8c44f30a353292f0b6c162cf
5
5
  SHA512:
6
- metadata.gz: 559733ce49293713f5e41865da398009485939a28511fff234811dbf864db379ad68bae554b93b1796e4006b7e40e780026b7e02f39ce913f730450f638f7ae4
7
- data.tar.gz: cf25a088db0563d489e7cfcff772e8bc200ca7beff3571a046616f6cab5b50326979846f7f545a5f37ebc2a14e68ca4f277fccf5af720d17ba4432490be0bc73
6
+ metadata.gz: 012bb272db3fe7ea80e68987ac0723212f4259aaca043d6b9a398aacb8b05cf5c77610c9cdb551ff6972ac2cfc0006fb93f918b7be1f6efbd36788f89cbc4e5e
7
+ data.tar.gz: f7ced2d731ea39f026d9e39995c2cce011fa9d9beb55f181baeede454b2719842322917acfd5a0a526d4b5f6a832ba6929ac99da9f62bd2eaef0e7f805c18b13
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Stupidedi
2
- [![Build Status](https://secure.travis-ci.org/irobayna/stupidedi.png?branch=master)](http://travis-ci.org/irobayna/stupidedi) [![GitHub version](https://badge.fury.io/rb/stupidedi.svg)](http://badge.fury.io/gh/irobayna%2Fstupidedi) [![Code Climate](https://codeclimate.com/github/irobayna/stupidedi.png)](https://codeclimate.com/github/irobayna/stupidedi) [![Inline docs](http://inch-ci.org/github/irobayna/stupidedi.png?branch=master)](http://inch-ci.org/github/irobayna/stupidedi)
2
+
3
+ [![Build Status](https://github.com/kputnam/stupidedi/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/kputnam/stupidedi/actions?query=branch%3Amaster) [![GitHub version](https://badge.fury.io/rb/stupidedi.svg)](http://badge.fury.io/gh/irobayna%2Fstupidedi) [![Code Climate](https://codeclimate.com/github/irobayna/stupidedi.png)](https://codeclimate.com/github/irobayna/stupidedi) [![Inline docs](http://inch-ci.org/github/irobayna/stupidedi.png?branch=master)](http://inch-ci.org/github/irobayna/stupidedi)
3
4
 
4
5
  ![Screenshot](https://raw.github.com/irobayna/stupidedi/master/doc/images/edi-pp.png)
5
6
 
@@ -225,6 +225,8 @@ module Stupidedi
225
225
  # Builds a sequence of {Instruction} values that corresponds to the given
226
226
  # sequence of `loop_defs`
227
227
  #
228
+ # @deprecated Use {#interleaved_sequence} instead, which handles mixed
229
+ # SegmentUse and LoopDef children.
228
230
  # @return [Array<Instruction>]
229
231
  def lsequence(loop_defs, offset = 0)
230
232
  instructions = []
@@ -268,6 +270,64 @@ module Stupidedi
268
270
  instructions
269
271
  end
270
272
 
273
+ # Builds a sequence of {Instruction} values that corresponds to a mixed
274
+ # sequence of SegmentUse and LoopDef children (supporting interleaved patterns).
275
+ #
276
+ # @param children [Array<Schema::SegmentUse, Schema::LoopDef>]
277
+ # @param offset [Integer]
278
+ # @param skip_first [Boolean] if true, skip the first child (for non-repeatable entry segments)
279
+ # @return [Array<Instruction>]
280
+ def interleaved_sequence(children, offset = 0, skip_first: false)
281
+ children = children.drop(1) if skip_first
282
+
283
+ instructions = []
284
+ buffer = []
285
+ last_pos = nil
286
+
287
+ children.each do |child|
288
+ current_pos = child.is_a?(Schema::SegmentUse) ? child.position : child.entry_segment_use.position
289
+ is_repeatable = child.is_a?(Schema::SegmentUse) ? child.repeatable? : child.repeatable?
290
+
291
+ unless last_pos.nil? or current_pos == last_pos
292
+ drop_count =
293
+ if buffer.length == 1 and not buffer.first[:repeatable]
294
+ offset
295
+ else
296
+ offset - buffer.length
297
+ end
298
+
299
+ buffer.each do |item|
300
+ instructions << Instruction.new(nil, item[:segment_use], 0, drop_count, item[:push])
301
+ end
302
+
303
+ buffer.clear
304
+ end
305
+
306
+ segment_use = child.is_a?(Schema::SegmentUse) ? child : child.entry_segment_use
307
+ push_state = child.is_a?(Schema::SegmentUse) ? nil : LoopState
308
+
309
+ buffer << { segment_use: segment_use, push: push_state, repeatable: is_repeatable }
310
+ last_pos = current_pos
311
+ offset += 1
312
+ end
313
+
314
+ # Flush the buffer one last time
315
+ unless buffer.empty?
316
+ drop_count =
317
+ if buffer.length == 1 and not buffer.first[:repeatable]
318
+ offset
319
+ else
320
+ offset - buffer.length
321
+ end
322
+
323
+ buffer.each do |item|
324
+ instructions << Instruction.new(nil, item[:segment_use], 0, drop_count, item[:push])
325
+ end
326
+ end
327
+
328
+ instructions
329
+ end
330
+
271
331
  # Builds a sequence of {Instruction} values that corresponds to the given
272
332
  # sequence of `table_defs`
273
333
  #
@@ -65,14 +65,8 @@ module Stupidedi
65
65
  # When first segment is repeatable, then `successors` should include
66
66
  # an {Instruction} for it; but when it's non-repeatable, there should
67
67
  # be no successor instruction for that segment.
68
- is = if loop_def.header_segment_uses.head.repeatable?
69
- sequence(loop_def.header_segment_uses)
70
- else
71
- sequence(loop_def.header_segment_uses.tail)
72
- end
73
-
74
- is.concat(lsequence(loop_def.loop_defs, is.length))
75
- is.concat(sequence(loop_def.trailer_segment_uses, is.length))
68
+ skip_first = !loop_def.entry_segment_use.repeatable?
69
+ interleaved_sequence(loop_def.children, 0, skip_first: skip_first)
76
70
  end
77
71
  end
78
72
  end
@@ -80,14 +80,10 @@ module Stupidedi
80
80
 
81
81
  private
82
82
 
83
- # @return [Array<Instruction]
83
+ # @return [Array<Instruction>]
84
84
  def instructions(table_def)
85
85
  @__instructions ||= Hash.new
86
- @__instructions[table_def] ||= begin
87
- is = sequence(table_def.header_segment_uses)
88
- is.concat(lsequence(table_def.loop_defs, is.length))
89
- is.concat(sequence(table_def.trailer_segment_uses, is.length))
90
- end
86
+ @__instructions[table_def] ||= interleaved_sequence(table_def.children)
91
87
  end
92
88
  end
93
89
  end
@@ -16,14 +16,8 @@ module Stupidedi
16
16
  # @return [RepeatCount]
17
17
  attr_reader :repeat_count
18
18
 
19
- # @return [Array<SegmentUse>]
20
- attr_reader :header_segment_uses
21
-
22
- # @return [Array<SegmentUse>]
23
- attr_reader :trailer_segment_uses
24
-
25
- # @return [Array<LoopDef>]
26
- attr_reader :loop_defs
19
+ # @return [Array<SegmentUse, LoopDef>]
20
+ attr_reader :children
27
21
 
28
22
  # @return [LoopDef, TableDef]
29
23
  attr_reader :parent
@@ -32,16 +26,14 @@ module Stupidedi
32
26
 
33
27
  def_delegators :requirement, :required?, :optional?
34
28
 
35
- def initialize(id, repeat_count, header_segment_uses, loop_defs, trailer_segment_uses, parent)
36
- @id, @repeat_count, @header_segment_uses, @loop_defs, @trailer_segment_uses, @parent =
37
- id, repeat_count, header_segment_uses, loop_defs, trailer_segment_uses, parent
29
+ def initialize(id, repeat_count, children, parent)
30
+ @id, @repeat_count, @children, @parent =
31
+ id, repeat_count, children, parent
38
32
 
39
33
  # Delay re-parenting until the entire definition tree has a root
40
34
  # to prevent unnecessarily copying objects
41
35
  unless parent.nil?
42
- @header_segment_uses = @header_segment_uses.map{|x| x.copy(:parent => self) }
43
- @loop_defs = @loop_defs.map{|x| x.copy(:parent => self) }
44
- @trailer_segment_uses = @trailer_segment_uses.map{|x| x.copy(:parent => self) }
36
+ @children = @children.map{|x| x.copy(:parent => self) }
45
37
  end
46
38
  end
47
39
 
@@ -50,12 +42,35 @@ module Stupidedi
50
42
  LoopDef.new \
51
43
  changes.fetch(:id, @id),
52
44
  changes.fetch(:repeat_count, @repeat_count),
53
- changes.fetch(:header_segment_uses, @header_segment_uses),
54
- changes.fetch(:loop_defs, @loop_defs),
55
- changes.fetch(:trailer_segment_uses, @trailer_segment_uses),
45
+ changes.fetch(:children, @children),
56
46
  changes.fetch(:parent, @parent)
57
47
  end
58
48
 
49
+ # Returns segments before the first LoopDef.
50
+ # @deprecated Use {#children} instead. This method does not include
51
+ # segments that appear between child loops in interleaved structures.
52
+ # @return [Array<SegmentUse>]
53
+ def header_segment_uses
54
+ @children.take_while{|x| x.is_a?(SegmentUse) }
55
+ end
56
+
57
+ # Returns all LoopDef children.
58
+ # @deprecated Use {#children} instead and filter with `select{|x| x.is_a?(LoopDef)}`.
59
+ # @return [Array<LoopDef>]
60
+ def loop_defs
61
+ @children.select{|x| x.is_a?(LoopDef) }
62
+ end
63
+
64
+ # Returns segments after the last LoopDef.
65
+ # @deprecated Use {#children} instead. This method does not include
66
+ # segments that appear between child loops in interleaved structures.
67
+ # @return [Array<SegmentUse>]
68
+ def trailer_segment_uses
69
+ last_loop_idx = @children.rindex{|x| x.is_a?(LoopDef) }
70
+ return [] if last_loop_idx.nil?
71
+ @children.drop(last_loop_idx + 1).select{|x| x.is_a?(SegmentUse) }
72
+ end
73
+
59
74
  # @return [String]
60
75
  def descriptor
61
76
  "loop #{id}"
@@ -68,23 +83,22 @@ module Stupidedi
68
83
  # @see X222 B.1.1.3.11.1 Loop Control Segments
69
84
  # @see X222 B.1.1.3.12.4 Loops of Data Segments Bounded Loops
70
85
  def bounded?
71
- @header_segment_uses.head.definition.id == :LS and
72
- @trailer_segment_uses.last.definition.id == :LE
86
+ first_seg = @children.find{|x| x.is_a?(SegmentUse) }
87
+ last_seg = @children.reverse.find{|x| x.is_a?(SegmentUse) }
88
+ first_seg && last_seg &&
89
+ first_seg.definition.id == :LS &&
90
+ last_seg.definition.id == :LE
73
91
  end
74
92
 
75
93
  # @see X12.59 5.6 HL-initiated Loop
76
94
  def hierarchical?
77
- @header_segment_uses.head.definition.id == :HL
95
+ first_seg = @children.find{|x| x.is_a?(SegmentUse) }
96
+ first_seg && first_seg.definition.id == :HL
78
97
  end
79
98
 
80
99
  # @return [SegmentUse]
81
100
  def entry_segment_use
82
- @header_segment_uses.head
83
- end
84
-
85
- # @return [Array<SegmentUse, LoopDef>]
86
- def children
87
- @header_segment_uses + @loop_defs + @trailer_segment_uses
101
+ @children.find{|x| x.is_a?(SegmentUse) }
88
102
  end
89
103
 
90
104
  # @return [LoopVal]
@@ -98,7 +112,7 @@ module Stupidedi
98
112
 
99
113
  # @return [AbstractSet<CodeList>]
100
114
  def code_lists
101
- children.map(&:code_lists).inject(&:|)
115
+ @children.map(&:code_lists).inject(&:|)
102
116
  end
103
117
 
104
118
  # @return [void]
@@ -106,21 +120,7 @@ module Stupidedi
106
120
  q.text("LoopDef[#{@id}]")
107
121
  q.group(2, "(", ")") do
108
122
  q.breakable ""
109
- @header_segment_uses.each do |e|
110
- unless q.current_group.first?
111
- q.text ","
112
- q.breakable
113
- end
114
- q.pp e
115
- end
116
- @loop_defs.each do |e|
117
- unless q.current_group.first?
118
- q.text ","
119
- q.breakable
120
- end
121
- q.pp e
122
- end
123
- @trailer_segment_uses.each do |e|
123
+ @children.each do |e|
124
124
  unless q.current_group.first?
125
125
  q.text ","
126
126
  q.breakable
@@ -137,35 +137,16 @@ module Stupidedi
137
137
 
138
138
  # @return [LoopDef]
139
139
  def build(id, repeat_count, *children)
140
- header, children = children.split_when{|x| x.is_a?(LoopDef) }
141
- loop_defs, trailer = children.split_when{|x| x.is_a?(SegmentUse) }
142
-
143
- # @todo: Ensure there is at least one SegmentUse in header
144
- if header.empty?
140
+ # Validate: first child must be a SegmentUse
141
+ if children.empty? || !children.head.is_a?(SegmentUse)
145
142
  raise Exceptions::InvalidSchemaError,
146
143
  "first child must be a SegmentUse"
147
- elsif header.head.repeat_count.include?(2)
144
+ elsif children.head.repeat_count.include?(2)
148
145
  raise Exceptions::InvalidSchemaError,
149
146
  "first child must have RepeatCount.bounded(1)"
150
147
  end
151
148
 
152
- trailer.each.with_index do |s, k|
153
- unless s.segment?
154
- if s.respond_to?(:pretty_inspect)
155
- raise Exceptions::InvalidSchemaError,
156
- "arguments after last child LoopDef (#{loop_defs.last.id})
157
- must be segments, but #{k+1} arguments later is not a
158
- SegmentUse: #{s.pretty_inspect}".join
159
- else
160
- raise Exceptions::InvalidSchemaError,
161
- "arguments after last child LoopDef (#{loop_defs.last.id})
162
- must be segments, but #{k+1} arguments later is not a
163
- SegmentUse: #{s.inspect}".join
164
- end
165
- end
166
- end
167
-
168
- new(id, repeat_count, header, loop_defs, trailer, nil)
149
+ new(id, repeat_count, children, nil)
169
150
  end
170
151
 
171
152
  # @endgroup
@@ -7,14 +7,8 @@ module Stupidedi
7
7
  # @return [String]
8
8
  attr_reader :id
9
9
 
10
- # @return [Array<SegmentUse>]
11
- attr_reader :header_segment_uses
12
-
13
- # @return [Array<SegmentUse>]
14
- attr_reader :trailer_segment_uses
15
-
16
- # @return [Array<LoopDef>]
17
- attr_reader :loop_defs
10
+ # @return [Array<SegmentUse, LoopDef>]
11
+ attr_reader :children
18
12
 
19
13
  # @return [TransactionSetDef]
20
14
  attr_reader :parent
@@ -22,16 +16,14 @@ module Stupidedi
22
16
  # @return [Integer]
23
17
  attr_reader :position
24
18
 
25
- def initialize(id, position, header_segment_uses, loop_defs, trailer_segment_uses, parent)
26
- @id, @position, @header_segment_uses, @loop_defs, @trailer_segment_uses, @parent =
27
- id, position, header_segment_uses, loop_defs, trailer_segment_uses, parent
19
+ def initialize(id, position, children, parent)
20
+ @id, @position, @children, @parent =
21
+ id, position, children, parent
28
22
 
29
23
  # Delay re-parenting until the entire definition tree has a root
30
24
  # to prevent unnecessarily copying objects
31
25
  unless parent.nil?
32
- @header_segment_uses = @header_segment_uses.map{|x| x.copy(:parent => self) }
33
- @loop_defs = @loop_defs.map{|x| x.copy(:parent => self) }
34
- @trailer_segment_uses = @trailer_segment_uses.map{|x| x.copy(:parent => self) }
26
+ @children = @children.map{|x| x.copy(:parent => self) }
35
27
  end
36
28
  end
37
29
 
@@ -40,21 +32,44 @@ module Stupidedi
40
32
  TableDef.new \
41
33
  changes.fetch(:id, @id),
42
34
  changes.fetch(:position, @position),
43
- changes.fetch(:header_segment_uses, @header_segment_uses),
44
- changes.fetch(:loop_defs, @loop_defs),
45
- changes.fetch(:trailer_segment_uses, @trailer_segment_uses),
35
+ changes.fetch(:children, @children),
46
36
  changes.fetch(:parent, @parent)
47
37
  end
48
38
 
39
+ # Returns segments before the first LoopDef.
40
+ # @deprecated Use {#children} instead. This method does not include
41
+ # segments that appear between child loops in interleaved structures.
42
+ # @return [Array<SegmentUse>]
43
+ def header_segment_uses
44
+ @children.take_while{|x| x.is_a?(SegmentUse) }
45
+ end
46
+
47
+ # Returns all LoopDef children.
48
+ # @deprecated Use {#children} instead and filter with `select{|x| x.is_a?(LoopDef)}`.
49
+ # @return [Array<LoopDef>]
50
+ def loop_defs
51
+ @children.select{|x| x.is_a?(LoopDef) }
52
+ end
53
+
54
+ # Returns segments after the last LoopDef.
55
+ # @deprecated Use {#children} instead. This method does not include
56
+ # segments that appear between child loops in interleaved structures.
57
+ # @return [Array<SegmentUse>]
58
+ def trailer_segment_uses
59
+ last_loop_idx = @children.rindex{|x| x.is_a?(LoopDef) }
60
+ return [] if last_loop_idx.nil?
61
+ @children.drop(last_loop_idx + 1).select{|x| x.is_a?(SegmentUse) }
62
+ end
63
+
49
64
  # @return [String]
50
65
  def descriptor
51
66
  "table #{id}"
52
67
  end
53
68
 
54
69
  def repeatable?
55
- @header_segment_uses.empty? and
56
- @loop_defs.present? and
57
- @loop_defs.head.repeatable?
70
+ header_segment_uses.empty? and
71
+ loop_defs.present? and
72
+ loop_defs.head.repeatable?
58
73
  end
59
74
 
60
75
  def repeat_count
@@ -71,9 +86,13 @@ module Stupidedi
71
86
 
72
87
  # @return [Array<SegmentUse>]
73
88
  def entry_segment_uses
74
- uses = @header_segment_uses \
75
- + @loop_defs.map{|l| l.entry_segment_use } \
76
- + @trailer_segment_uses
89
+ uses = @children.map do |child|
90
+ if child.is_a?(SegmentUse)
91
+ child
92
+ else
93
+ child.entry_segment_use
94
+ end
95
+ end
77
96
 
78
97
  # Up to and including the first required segment
79
98
  suffix = uses.drop_while(&:optional?)
@@ -88,11 +107,6 @@ module Stupidedi
88
107
  end
89
108
  end
90
109
 
91
- # @return [Array<SegmentUse, LoopDef>]
92
- def children
93
- @header_segment_uses + @loop_defs + @trailer_segment_uses
94
- end
95
-
96
110
  # @return [Values::TableVal]
97
111
  def empty
98
112
  Values::TableVal.new(self, [])
@@ -104,7 +118,7 @@ module Stupidedi
104
118
 
105
119
  # @return [AbstractSet<CodeList>]
106
120
  def code_lists
107
- children.map(&:code_lists).inject(&:|)
121
+ @children.map(&:code_lists).inject(&:|)
108
122
  end
109
123
 
110
124
  # @return [void]
@@ -112,21 +126,7 @@ module Stupidedi
112
126
  q.text("TableDef[#{@id}]")
113
127
  q.group(2, "(", ")") do
114
128
  q.breakable ""
115
- @header_segment_uses.each do |e|
116
- unless q.current_group.first?
117
- q.text ","
118
- q.breakable
119
- end
120
- q.pp e
121
- end
122
- @loop_defs.each do |e|
123
- unless q.current_group.first?
124
- q.text ","
125
- q.breakable
126
- end
127
- q.pp e
128
- end
129
- @trailer_segment_uses.each do |e|
129
+ @children.each do |e|
130
130
  unless q.current_group.first?
131
131
  q.text ","
132
132
  q.breakable
@@ -148,9 +148,7 @@ module Stupidedi
148
148
  "first argument to TableDef.header must be a String but got #{id.inspect}"
149
149
  end
150
150
 
151
- header, children = children.split_when{|x| x.is_a?(LoopDef) }
152
- loop_defs, trailer = children.split_when{|x| x.is_a?(SegmentUse) }
153
- new(id, 1, header, loop_defs, trailer, nil)
151
+ new(id, 1, children, nil)
154
152
  end
155
153
 
156
154
  # @return [TableDef]
@@ -160,9 +158,7 @@ module Stupidedi
160
158
  "first argument to TableDef.detail must be a String but got #{id.inspect}"
161
159
  end
162
160
 
163
- header, children = children.split_when{|x| x.is_a?(LoopDef) }
164
- loop_defs, trailer = children.split_when{|x| x.is_a?(SegmentUse) }
165
- new(id, 2, header, loop_defs, trailer, nil)
161
+ new(id, 2, children, nil)
166
162
  end
167
163
 
168
164
  # @return [TableDef]
@@ -172,9 +168,7 @@ module Stupidedi
172
168
  "first argument to TableDef.summary must be a String but got #{id.inspect}"
173
169
  end
174
170
 
175
- header, children = children.split_when{|x| x.is_a?(LoopDef) }
176
- loop_defs, trailer = children.split_when{|x| x.is_a?(SegmentUse) }
177
- new(id, 3, header, loop_defs, trailer, nil)
171
+ new(id, 3, children, nil)
178
172
  end
179
173
 
180
174
  # @endgroup
@@ -148,7 +148,13 @@ module Stupidedi
148
148
  b::Element(e::Situational, "Volume"),
149
149
  b::Element(e::Situational, "Volume Qualifier"),
150
150
  b::Element(e::Situational, "Lading Quantity"),
151
- b::Element(e::Situational, "Packaging Form Code")),
151
+ b::Element(e::Situational, "Packaging Form Code"),
152
+ b::Element(e::Situational, "Dunnage Description"),
153
+ b::Element(e::Situational, "Weight Unit Code"),
154
+ b::Element(e::Situational, "Type of Service Code"),
155
+ b::Element(e::Situational, "Quantity"),
156
+ b::Element(e::Situational, "Packaging Form Code"),
157
+ b::Element(e::Situational, "Yes/No Condition or Response Code")),
152
158
  b::Segment(180, s::L1, "Rate and Charges", r::Situational, d::RepeatCount.bounded(10),
153
159
  b::Element(e::Situational, "Lading Line Item Number"),
154
160
  b::Element(e::Situational, "Freight Rate"),
@@ -452,7 +452,7 @@ module Stupidedi
452
452
  b::Segment(2600, s::HD, "Health Coverage", r::Situational, d::RepeatCount.bounded(1),
453
453
  b::Element(e::Required, "Maintenance Type Code", b::Values("001", "002", "021", "024", "025", "026", "030", "032")),
454
454
  b::Element(e::NotUsed, "Maintenance Reason Code"),
455
- b::Element(e::Required, "Insurance Line Code", b::Values("AC", "ADD", "AG", "AH", "AJ", "AK", "DCP", "DEN", "EPO", "FAC", "HE", "HLT", "HMO", "LTC", "LTD", "MM", "MOD", "PDG", "POS", "PPO", "PRA", "STD", "UR", "VIS")),
455
+ b::Element(e::Required, "Insurance Line Code", b::Values("AC", "ADD", "AG", "AH", "AJ", "AK", "DCP", "DEN", "EPO", "FAC", "HE", "HLT", "HMO", "LTC", "LTD", "LIF", "MM", "MOD", "PDG", "POS", "PPO", "PRA", "STD", "UR", "VIS")),
456
456
  b::Element(e::Situational, "Plan Coverage Description"),
457
457
  b::Element(e::Situational, "Coverage Level Code", b::Values("CHD", "DEP", "E1D", "E2D", "E3D", "E5D", "E6D", "E7D", "E8D", "E9D", "ECH", "EMP", "ESP", "FAM", "IND", "SPC", "SPO", "TWO")),
458
458
  b::Element(e::NotUsed, "Count"),
@@ -198,7 +198,7 @@ module Stupidedi
198
198
  b::Element(e::NotUsed, "REFERENCE IDENTIFIER")),
199
199
  b::Segment(1800, s::REF, "Claim Identifier for Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(1),
200
200
  b::Element(e::Required, "Reference Identification Qualifier", b::Values("D9")),
201
- b::Element(e::Required, "Value Added Network Trace Number", b::MaxLength(20)),
201
+ b::Element(e::Required, "Value Added Network Trace Number", b::MaxLength(50)),
202
202
  b::Element(e::NotUsed, "Description"),
203
203
  b::Element(e::NotUsed, "REFERENCE IDENTIFIER")),
204
204
  b::Segment(1800, s::REF, "Medical Record Number", r::Situational, d::RepeatCount.bounded(1),
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module TransactionSets
4
+ module FiftyTen
5
+ module Standards
6
+ b = Builder
7
+ d = Schema
8
+ r = SegmentReqs
9
+ s = SegmentDefs
10
+
11
+ # 317 Delivery/Pickup Order
12
+ #
13
+ # This transaction set demonstrates interleaved segments and loops:
14
+ # Loop N1 is followed by segments G62, N9, TD5, then Loop L0.
15
+ #
16
+ SO317 = b.build("SO", "317", "Delivery/Pickup Order",
17
+ d::TableDef.header("Heading",
18
+ s::ST .use(100, r::Mandatory, d::RepeatCount.bounded(1)),
19
+ d::LoopDef.build("N1", d::RepeatCount.bounded(10),
20
+ s::N1 .use(200, r::Mandatory, d::RepeatCount.bounded(1)),
21
+ s::N2 .use(300, r::Optional, d::RepeatCount.bounded(1)),
22
+ s::N3 .use(400, r::Optional, d::RepeatCount.bounded(1)),
23
+ s::N4 .use(500, r::Optional, d::RepeatCount.bounded(1)),
24
+ s::G61.use(600, r::Optional, d::RepeatCount.bounded(1))),
25
+ # These segments appear AFTER Loop N1 but BEFORE Loop L0
26
+ # This is the interleaved pattern that was previously unsupported
27
+ s::G62.use(800, r::Mandatory, d::RepeatCount.bounded(1)),
28
+ s::N9 .use(900, r::Mandatory, d::RepeatCount.bounded(1)),
29
+ s::TD5.use(1000, r::Mandatory, d::RepeatCount.bounded(1)),
30
+ d::LoopDef.build("L0", d::RepeatCount.bounded(9999),
31
+ s::L0.use(1100, r::Mandatory, d::RepeatCount.bounded(1)),
32
+ s::L5.use(1200, r::Optional, d::RepeatCount.bounded(1)),
33
+ s::H1.use(1300, r::Optional, d::RepeatCount.bounded(1))),
34
+ s::SE .use(1400, r::Mandatory, d::RepeatCount.bounded(1))))
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -16,6 +16,7 @@ module Stupidedi
16
16
  autoload :HR276, "stupidedi/transaction_sets/005010/standards/HR276"
17
17
  autoload :HS270, "stupidedi/transaction_sets/005010/standards/HS270"
18
18
  autoload :RA820, "stupidedi/transaction_sets/005010/standards/RA820"
19
+ autoload :SO317, "stupidedi/transaction_sets/005010/standards/SO317"
19
20
  end
20
21
  end
21
22
  end
@@ -54,7 +54,7 @@ module Stupidedi
54
54
  "RD" => "Ramp to Door",
55
55
  "RE" => "Ramp to Ramp",
56
56
  "RR" => "Roll-on Roll-off"))
57
- E58 = t:: R.new(:E58 , "Charge" , 1, 12)
57
+ E58 = t:: Nn.new(:E58 , "Charge" , 1, 12, 2)
58
58
  E59 = t::AN.new(:E59 , "Freight Class Code" , 2, 5)
59
59
  E60 = t:: R.new(:E60 , "Freight Rate" , 1, 9)
60
60
  E61 = t::AN.new(:E61 , "Free-Form Message" , 1, 30)
@@ -4878,6 +4878,7 @@ module Stupidedi
4878
4878
  s::CodeList.build(
4879
4879
  "T" => "Transportation Data Coordinating Committee (TDCC)",
4880
4880
  "X" => "Accredited Standards Committee X12"))
4881
+ E458 = t::AN.new(:E458, "Dunnage Description" , 2, 25)
4881
4882
  E460 = t::ID.new(:E460 , "Shipment Weight Code" , 1, 1)
4882
4883
  E472 = t::AN.new(:E472 , "Link Sequence Number" , 6, 6)
4883
4884
  E473 = t::ID.new(:E473 , "Order Status Code" , 1, 1,
@@ -5140,7 +5141,7 @@ module Stupidedi
5140
5141
  "1" => "Current Transaction Trace Numbers",
5141
5142
  "2" => "Referenced Transaction Trace Numbers"))
5142
5143
  E499 = t::AN.new(:E499 , "Condition Value" , 1, 10)
5143
- E501 = t::ID.new(:E501 , "Customes Document Handling Code" , 2, 2)
5144
+ E501 = t::ID.new(:E501 , "Customs Documentation Handling Code" , 2, 2)
5144
5145
  E506 = t::ID.new(:E506 , "DFI Identification Number Qualifier" , 2, 2,
5145
5146
  s::CodeList.build(
5146
5147
  "01" => s::CodeList.external("4"),
@@ -5400,9 +5401,57 @@ module Stupidedi
5400
5401
  E610 = t::Nn.new(:E610 , "Amount" , 1, 15, 2)
5401
5402
  E623 = t::ID.new(:E623 , "Time Code" , 2, 2,
5402
5403
  s::CodeList.build(
5403
- "LT" => "Local Time (Preferred Usage - Explain in detail)",
5404
+ "01" => "Equivalent to ISO P01",
5405
+ "02" => "Equivalent to ISO P02",
5406
+ "03" => "Equivalent to ISO P03",
5407
+ "04" => "Equivalent to ISO P04",
5408
+ "05" => "Equivalent to ISO P05",
5409
+ "06" => "Equivalent to ISO P06",
5410
+ "07" => "Equivalent to ISO P07",
5411
+ "08" => "Equivalent to ISO P08",
5412
+ "09" => "Equivalent to ISO P09",
5413
+ "10" => "Equivalent to ISO P10",
5414
+ "11" => "Equivalent to ISO P11",
5415
+ "12" => "Equivalent to ISO P12",
5416
+ "13" => "Equivalent to ISO M12",
5417
+ "14" => "Equivalent to ISO M11",
5418
+ "15" => "Equivalent to ISO M10",
5419
+ "16" => "Equivalent to ISO M09",
5420
+ "17" => "Equivalent to ISO M08",
5421
+ "18" => "Equivalent to ISO M07",
5422
+ "19" => "Equivalent to ISO M06",
5423
+ "20" => "Equivalent to ISO M05",
5424
+ "21" => "Equivalent to ISO M04",
5425
+ "22" => "Equivalent to ISO M03",
5426
+ "23" => "Equivalent to ISO M02",
5427
+ "24" => "Equivalent to ISO M01",
5428
+ "AD" => "Alaska Daylight Time",
5429
+ "AS" => "Alaska Standard Time",
5430
+ "AT" => "Alaska Time",
5431
+ "CD" => "Central Daylight Time",
5432
+ "CS" => "Central Standard Time",
5433
+ "CT" => "Central Time",
5434
+ "ED" => "Eastern Daylight Time",
5435
+ "ES" => "Eastern Standard Time",
5436
+ "ET" => "Eastern Time",
5437
+ "GM" => "Greenwich Mean Time",
5438
+ "HD" => "Hawaii-Aleutian Daylight Time",
5439
+ "HS" => "Hawaii-Aleutian Standard Time",
5440
+ "HT" => "Hawaii-Aleutian Time",
5441
+ "LT" => "Local Time",
5442
+ "MD" => "Mountain Daylight Time",
5443
+ "MS" => "Mountain Standard Time",
5404
5444
  "MT" => "Mountain Time",
5405
- "CT" => "Central Time"))
5445
+ "ND" => "Newfoundland Daylight Time",
5446
+ "NS" => "Newfoundland Standard Time",
5447
+ "NT" => "Newfoundland Time",
5448
+ "PD" => "Pacific Daylight Time",
5449
+ "PS" => "Pacific Standard Time",
5450
+ "PT" => "Pacific Time",
5451
+ "TD" => "Atlantic Daylight Time",
5452
+ "TS" => "Atlantic Standard Time",
5453
+ "TT" => "Atlantic Time",
5454
+ "UT" => "Universal Time Coordinate"))
5406
5455
  E625 = t::ID.new(:E625 , "COD Method of Payment Code" , 1, 1,
5407
5456
  s::CodeList.build(
5408
5457
  "1" => "Certified or Cashier's Check Only",
@@ -8,7 +8,7 @@ module Stupidedi
8
8
  r = ElementReqs
9
9
 
10
10
  C3 = s::SegmentDef.build(:C3, "Currency",
11
- "To Specify the currency being used in the transaction set",
11
+ "To specify the currency being used in the transaction set",
12
12
  e::E100 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
13
13
  e::E280 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
14
14
  e::E100 .simple_use(r::Optional, s::RepeatCount.bounded(1)))
@@ -7,10 +7,9 @@ module Stupidedi
7
7
  e = ElementDefs
8
8
  r = ElementReqs
9
9
 
10
- L0 = s::SegmentDef.build(:L0, "Line Item - Quantity and Weight",
11
- "To specify quantity, weight, volume, and type of service for a line
12
- item including applicable 'quantity/rate-as' data",
13
- e::E213 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
10
+ L0 = s::SegmentDef.build(:L0, "Line Item - Quantity and Weight",
11
+ "To specify quantity, weight, volume, and type of service for a line item including applicable 'quantity/rate-as' data",
12
+ e::E213 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
14
13
  e::E220 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
14
  e::E221 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
15
  e::E81 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
@@ -19,11 +18,19 @@ module Stupidedi
19
18
  e::E184 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
20
19
  e::E80 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
21
20
  e::E211 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
22
- SyntaxNotes::P.build(2, 3),
21
+ e::E458 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
22
+ e::E188 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
23
+ e::E56 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
24
+ e::E380 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
25
+ e::E211 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
26
+ e::E1073.simple_use(r::Relational, s::RepeatCount.bounded(1)),
23
27
  SyntaxNotes::P.build(2, 3),
24
28
  SyntaxNotes::P.build(4, 5),
25
29
  SyntaxNotes::P.build(6, 7),
26
- SyntaxNotes::P.build(8, 9))
30
+ SyntaxNotes::P.build(8, 9),
31
+ SyntaxNotes::C.build(11, 4),
32
+ SyntaxNotes::P.build(13, 15)
33
+ )
27
34
  end
28
35
  end
29
36
  end
@@ -7,21 +7,23 @@ module Stupidedi
7
7
  e = ElementDefs
8
8
  r = ElementReqs
9
9
 
10
- OID = s::SegmentDef.build(:OID, "Order identification",
11
- "",
12
- e::E127 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
13
- e::E324 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
14
- e::E355 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
- e::E380 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
- e::E188 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
17
- e::E81 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
18
- e::E184 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
19
- e::E183 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
10
+ OID = s::SegmentDef.build(:OID, "Order Identification Detail",
11
+ "To specify order identification detail",
12
+ e::E127 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 30
13
+ e::E324 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 22
14
+ e::E127 .simple_use(r::Optional, s::RepeatCount.bounded(1)), # Min 30
15
+ e::E355 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 2
16
+ e::E380 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 15
17
+ e::E188 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 1
18
+ e::E81 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 10
19
+ e::E184 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 1
20
+ e::E183 .simple_use(r::Relational, s::RepeatCount.bounded(1)), # Min 8
20
21
  SyntaxNotes::R.build(1, 2),
21
22
  SyntaxNotes::C.build(3, 2),
22
23
  SyntaxNotes::P.build(4, 5),
23
24
  SyntaxNotes::P.build(6, 7),
24
- SyntaxNotes::P.build(8, 9))
25
+ SyntaxNotes::P.build(8, 9)
26
+ )
25
27
  end
26
28
  end
27
29
  end
@@ -9,10 +9,16 @@ module Stupidedi
9
9
 
10
10
  E2 = t::Nn.new(:E2 , "Number of Accepted Transaction Sets" , 1, 6, 0)
11
11
  E19 = t::AN.new(:E19 , "City Name" , 2, 30)
12
+ E22 = t::AN.new(:E22 , "Commodity Code" , 1, 30)
13
+ E23 = t::ID.new(:E23 , "Commodity Code Qualifier" , 1, 1)
12
14
  E26 = t::ID.new(:E26 , "Country Code" , 2, 3,
13
15
  s::CodeList.external("5"))
14
16
  E28 = t::Nn.new(:E28 , "Group Control Number" , 1, 9, 0)
17
+ E56 = t::ID.new(:E56 , "Type of Service Code" , 2, 2)
15
18
  E61 = t::AN.new(:E61 , "Free-form Information" , 1, 30)
19
+ E62 = t::AN.new(:E62 , "Hazardous Material Code" , 4, 10)
20
+ E63 = t::AN.new(:E63 , "Hazardous Material Contact" , 1, 24)
21
+ E64 = t::AN.new(:E64 , "Hazardous Material Description" , 2, 30)
16
22
  E65 = t:: R.new(:E65 , "Height" , 1, 8)
17
23
  E66 = t::ID.new(:E66 , "Identification Code Qualifier" , 1, 2,
18
24
  s::CodeList.build(
@@ -56,7 +62,13 @@ module Stupidedi
56
62
  "XX" => s::CodeList.external("537"),
57
63
  "ZZ" => "Mutually Defined"))
58
64
  E67 = t::AN.new(:E67 , "Identification Code" , 2, 80)
65
+ E77 = t::Nn.new(:E77 , "Flashpoint Temperature" , 1, 3, 0)
66
+ E79 = t::AN.new(:E79 , "Lading Description" , 1, 50)
67
+ E80 = t::Nn.new(:E80 , "Lading Quantity" , 1, 7, 0)
59
68
  E81 = t:: R.new(:E81 , "Weight" , 1, 10)
69
+ E87 = t::AN.new(:E87 , "Marks and Numbers" , 1, 48)
70
+ E88 = t::ID.new(:E88 , "Marks and Numbers Qualifier" , 1, 2)
71
+ E91 = t::ID.new(:E91 , "Transportation Method/Type Code" , 1, 2)
60
72
  E93 = t::AN.new(:E93 , "Name" , 1, 60)
61
73
  E96 = t::Nn.new(:E96 , "Number of Included Segments" , 1, 10, 0)
62
74
  E97 = t::Nn.new(:E97 , "Number of Transaction Sets Included" , 1, 6, 0)
@@ -344,6 +356,7 @@ module Stupidedi
344
356
  "ZZ" => "Mutually Defined"))
345
357
  E100 = t::ID.new(:E100 , "Currency Code" , 3, 3,
346
358
  s::CodeList.external("5"))
359
+ E103 = t::AN.new(:E103 , "Packaging Code" , 3, 5)
347
360
  E107 = t::ID.new(:E107 , "Payment Method Type Code" , 1, 2)
348
361
  E116 = t::ID.new(:E116 , "Postal Code" , 3, 15,
349
362
  s::CodeList.external("51"))
@@ -496,6 +509,7 @@ module Stupidedi
496
509
  "ZH" => "Carrier Assigned Reference Number",
497
510
  "ZX" => "County Code",
498
511
  "ZZ" => "Mutually Defined"))
512
+ E133 = t::ID.new(:E133 , "Routing Sequence Code" , 1, 2)
499
513
  E142 = t::AN.new(:E142 , "Application's Sender Code" , 2, 15)
500
514
  E143 = t::ID.new(:E143 , "Transaction Set Identifier Number" , 3, 3,
501
515
  # http://www.x12.org/x12org/docs/editransactions.pdf
@@ -833,7 +847,20 @@ module Stupidedi
833
847
  E156 = t::ID.new(:E156 , "State or Province Code" , 2, 2,
834
848
  s::CodeList.external("22"))
835
849
  E166 = t::AN.new(:E166 , "Address Information" , 1, 55)
850
+ E176 = t::ID.new(:E176 , "Time Qualifier" , 1, 2)
851
+ E183 = t:: R.new(:E183 , "Volume" , 1, 8)
852
+ E184 = t::ID.new(:E184 , "Volume Unit Qualifier" , 1, 1)
853
+ E187 = t::ID.new(:E187 , "Weight Qualifier" , 1, 2)
854
+ E188 = t::ID.new(:E188 , "Weight Unit Code" , 1, 1)
855
+ E200 = t::AN.new(:E200 , "Hazardous Materials Page" , 1, 6)
856
+ E208 = t::ID.new(:E208 , "Hazardous Material Code Qualifier" , 1, 1)
857
+ E209 = t::AN.new(:E209 , "Hazardous Material Class Code" , 1, 4)
858
+ E211 = t::ID.new(:E211 , "Packaging Form Code" , 3, 3)
836
859
  E212 = t:: R.new(:E212 , "Unit Price" , 1, 17)
860
+ E213 = t::Nn.new(:E213 , "Lading Line Item Number" , 1, 3, 0)
861
+ E220 = t:: R.new(:E220 , "Billed/Rated-as Quantity" , 1, 11)
862
+ E221 = t::ID.new(:E221 , "Billed/Rated-as Qualifier" , 2, 2)
863
+ E254 = t::ID.new(:E254 , "Packing Group Code" , 1, 3)
837
864
  E234 = t::AN.new(:E234 , "Product/Service ID" , 1, 48)
838
865
  E235 = t::ID.new(:E235 , "Product/Service ID Qualifier" , 2, 2,
839
866
  s::CodeList.build(
@@ -869,6 +896,7 @@ module Stupidedi
869
896
  "WK" => s::CodeList.external("843"),
870
897
  "ZZ" => "Mutually Defined"))
871
898
  E236 = t::ID.new(:E236 , "Price Identifier Code" , 3, 3)
899
+ E284 = t::ID.new(:E284 , "Service Level Code" , 2, 2)
872
900
  E280 = t:: R.new(:E280 , "Exchange Rate" , 4, 10)
873
901
  E289 = t::Nn.new(:E289 , "Multiple Price Quantity" , 1, 2, 0)
874
902
  E305 = t::ID.new(:E305 , "Transaction Handling Code" , 1, 2,
@@ -991,6 +1019,7 @@ module Stupidedi
991
1019
  "RP" => "Responsible Person",
992
1020
  "PQ" => "Parent or Guardian",
993
1021
  "SK" => "School Clerk"))
1022
+ E368 = t::ID.new(:E368 , "Shipment/Order Status Code" , 2, 2)
994
1023
  E373 = t::DT.new(:E373 , "Date" , 8, 8)
995
1024
  E374 = t::ID.new(:E374 , "Date/Time Qualifier" , 3, 3,
996
1025
  s::CodeList.build(
@@ -1102,6 +1131,7 @@ module Stupidedi
1102
1131
  "AFC" => "Medicare Part D Coverage Effective Date",
1103
1132
  "AFD" => "Medicare Part D Termination Date"))
1104
1133
  E380 = t:: R.new(:E380 , "Quantity" , 1, 15)
1134
+ E387 = t::AN.new(:E387 , "Routing" , 1, 35)
1105
1135
  E426 = t::ID.new(:E426 , "Adjustment Reason Code" , 2, 2,
1106
1136
  s::CodeList.build(
1107
1137
  "50" => "Late Charge",
@@ -1146,7 +1176,9 @@ module Stupidedi
1146
1176
  "WO" => "Overpayment Recovery",
1147
1177
  "WU" => "Unspecified Recovery"))
1148
1178
  E429 = t::AN.new(:E429 , "Check Number" , 1, 16)
1179
+ E432 = t::ID.new(:E432 , "Date Qualifier" , 2, 2)
1149
1180
  E443 = t::AN.new(:E443 , "Contract Inquiry Reference" , 1, 20)
1181
+ E458 = t::AN.new(:E458 , "Dunnage Description" , 2, 25)
1150
1182
  E447 = t::AN.new(:E447 , "Loop Identifier Code" , 1, 4)
1151
1183
  E449 = t::AN.new(:E449 , "Fixed Format Information" , 1, 80)
1152
1184
  E478 = t::ID.new(:E478 , "Credit/Debit Flag Code" , 1, 1,
@@ -1502,6 +1534,7 @@ module Stupidedi
1502
1534
  "Q" => "Quarterly",
1503
1535
  "S" => "Semiannual",
1504
1536
  "U" => "Unknown"))
1537
+ E595 = t::ID.new(:E595 , "Compartment ID Code" , 1, 1)
1505
1538
  E609 = t::Nn.new(:E609 , "Count" , 1, 9, 0)
1506
1539
  E615 = t::ID.new(:E615 , "Time Period Qualifier" , 1, 2,
1507
1540
  s::CodeList.build(
@@ -1823,6 +1856,9 @@ module Stupidedi
1823
1856
  E723 = t::ID.new(:E723 , "Data Element Syntax Error Code" , 1, 3)
1824
1857
  E724 = t::AN.new(:E724 , "Copy of Bad Data Element" , 1, 99)
1825
1858
  E725 = t::Nn.new(:E725 , "Data Element Reference Number" , 1, 4, 0)
1859
+ E731 = t::ID.new(:E731 , "Transit Direction Code" , 2, 2)
1860
+ E732 = t::ID.new(:E732 , "Transit Time Direction Qualifier" , 2, 2)
1861
+ E733 = t:: R.new(:E733 , "Transit Time" , 1, 4)
1826
1862
  E734 = t::AN.new(:E734 , "Hierarchical Parent ID Number" , 1, 12)
1827
1863
  E735 = t::ID.new(:E735 , "Hierarchical Level Code" , 1, 2,
1828
1864
  s::CodeList.build(
@@ -2362,6 +2398,7 @@ module Stupidedi
2362
2398
  "HE" => "Hearing",
2363
2399
  "HLT" => "Health",
2364
2400
  "HMO" => "Health Maintenance Organization",
2401
+ "LIF" => "Life",
2365
2402
  "LTC" => "Long-Term Care",
2366
2403
  "LTD" => "Long-Term Disability",
2367
2404
  "MM" => "Major Medical",
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FiftyTen
5
+ module SegmentDefs
6
+ s = Schema
7
+ e = ElementDefs
8
+ r = ElementReqs
9
+
10
+ G61 = s::SegmentDef.build(:G61, "Contact",
11
+ "To identify a person or office to whom communications should be directed",
12
+ e::E366.simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
13
+ e::E93 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
14
+ e::E365.simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
+ e::E364.simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
+ e::E443.simple_use(r::Optional, s::RepeatCount.bounded(1)),
17
+ SyntaxNotes::P.build(3, 4))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FiftyTen
5
+ module SegmentDefs
6
+ s = Schema
7
+ e = ElementDefs
8
+ r = ElementReqs
9
+
10
+ G62 = s::SegmentDef.build(:G62, "Date/Time",
11
+ "To specify pertinent dates and times",
12
+ e::E432.simple_use(r::Relational, s::RepeatCount.bounded(1)),
13
+ e::E373.simple_use(r::Relational, s::RepeatCount.bounded(1)),
14
+ e::E176.simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
+ e::E337.simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
+ e::E623.simple_use(r::Optional, s::RepeatCount.bounded(1)),
17
+ SyntaxNotes::R.build(1, 3),
18
+ SyntaxNotes::P.build(1, 2),
19
+ SyntaxNotes::P.build(3, 4))
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FiftyTen
5
+ module SegmentDefs
6
+ s = Schema
7
+ e = ElementDefs
8
+ r = ElementReqs
9
+
10
+ H1 = s::SegmentDef.build(:H1, "Hazardous Material",
11
+ "To specify information relating to hazardous materials",
12
+ e::E62 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
13
+ e::E209.simple_use(r::Optional, s::RepeatCount.bounded(1)),
14
+ e::E208.simple_use(r::Optional, s::RepeatCount.bounded(1)),
15
+ e::E64 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
16
+ e::E63 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
17
+ e::E200.simple_use(r::Optional, s::RepeatCount.bounded(1)),
18
+ e::E77 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
19
+ e::E355.simple_use(r::Relational, s::RepeatCount.bounded(1)),
20
+ e::E254.simple_use(r::Optional, s::RepeatCount.bounded(1)),
21
+ SyntaxNotes::P.build(7, 8))
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FiftyTen
5
+ module SegmentDefs
6
+ s = Schema
7
+ e = ElementDefs
8
+ r = ElementReqs
9
+
10
+ L0 = s::SegmentDef.build(:L0, "Line Item - Quantity and Weight",
11
+ "To specify quantity, weight, volume, and type of service for a line item",
12
+ e::E213 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
13
+ e::E220 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
14
+ e::E221 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
+ e::E81 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
+ e::E187 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
17
+ e::E183 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
18
+ e::E184 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
19
+ e::E80 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
20
+ e::E211 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
21
+ e::E458 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
22
+ e::E188 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
23
+ e::E56 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
24
+ e::E380 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
25
+ e::E211 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
26
+ e::E1073.simple_use(r::Relational, s::RepeatCount.bounded(1)),
27
+ SyntaxNotes::P.build(2, 3),
28
+ SyntaxNotes::P.build(4, 5),
29
+ SyntaxNotes::P.build(6, 7),
30
+ SyntaxNotes::P.build(8, 9),
31
+ SyntaxNotes::C.build(11, 4),
32
+ SyntaxNotes::P.build(13, 15))
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FiftyTen
5
+ module SegmentDefs
6
+ s = Schema
7
+ e = ElementDefs
8
+ r = ElementReqs
9
+
10
+ L5 = s::SegmentDef.build(:L5, "Description, Marks and Numbers",
11
+ "To specify the line item in terms of description, quantity, packaging, and marks and numbers",
12
+ e::E213.simple_use(r::Optional, s::RepeatCount.bounded(1)),
13
+ e::E79 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
14
+ e::E22 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
+ e::E23 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
+ e::E103.simple_use(r::Optional, s::RepeatCount.bounded(1)),
17
+ e::E87 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
18
+ e::E88 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
19
+ e::E23 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
20
+ e::E22 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
21
+ e::E595.simple_use(r::Optional, s::RepeatCount.bounded(1)),
22
+ SyntaxNotes::P.build(3, 4),
23
+ SyntaxNotes::C.build(7, 6),
24
+ SyntaxNotes::P.build(8, 9))
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module Versions
4
+ module FiftyTen
5
+ module SegmentDefs
6
+ s = Schema
7
+ e = ElementDefs
8
+ r = ElementReqs
9
+
10
+ TD5 = s::SegmentDef.build(:TD5, "Carrier Details (Routing Sequence/Transit Time)",
11
+ "To specify the carrier and sequence of routing",
12
+ e::E133.simple_use(r::Optional, s::RepeatCount.bounded(1)),
13
+ e::E66 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
14
+ e::E67 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
15
+ e::E91 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
16
+ e::E387.simple_use(r::Relational, s::RepeatCount.bounded(1)),
17
+ e::E368.simple_use(r::Relational, s::RepeatCount.bounded(1)),
18
+ e::E309.simple_use(r::Optional, s::RepeatCount.bounded(1)),
19
+ e::E310.simple_use(r::Relational, s::RepeatCount.bounded(1)),
20
+ e::E731.simple_use(r::Optional, s::RepeatCount.bounded(1)),
21
+ e::E732.simple_use(r::Optional, s::RepeatCount.bounded(1)),
22
+ e::E733.simple_use(r::Relational, s::RepeatCount.bounded(1)),
23
+ e::E284.simple_use(r::Relational, s::RepeatCount.bounded(1)),
24
+ e::E284.simple_use(r::Relational, s::RepeatCount.bounded(1)),
25
+ e::E284.simple_use(r::Optional, s::RepeatCount.bounded(1)),
26
+ e::E26 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
27
+ SyntaxNotes::R.build(2, 4, 5, 6, 12),
28
+ SyntaxNotes::C.build(2, 3),
29
+ SyntaxNotes::C.build(7, 8),
30
+ SyntaxNotes::C.build(10, 11),
31
+ SyntaxNotes::C.build(13, 12),
32
+ SyntaxNotes::C.build(14, 13),
33
+ SyntaxNotes::C.build(15, 12))
34
+ end
35
+ end
36
+ end
37
+ end
@@ -58,11 +58,14 @@ module Stupidedi
58
58
  autoload :FRM, "stupidedi/versions/005010/segment_defs/FRM"
59
59
  autoload :FSA, "stupidedi/versions/005010/segment_defs/FSA"
60
60
  autoload :G53, "stupidedi/versions/005010/segment_defs/G53"
61
+ autoload :G61, "stupidedi/versions/005010/segment_defs/G61"
62
+ autoload :G62, "stupidedi/versions/005010/segment_defs/G62"
61
63
  autoload :GE, "stupidedi/versions/005010/segment_defs/GE"
62
64
  autoload :GS, "stupidedi/versions/005010/segment_defs/GS"
63
65
  autoload :HCP, "stupidedi/versions/005010/segment_defs/HCP"
64
66
  autoload :HCR, "stupidedi/versions/005010/segment_defs/HCR"
65
67
  autoload :HD, "stupidedi/versions/005010/segment_defs/HD"
68
+ autoload :H1, "stupidedi/versions/005010/segment_defs/H1"
66
69
  autoload :HI, "stupidedi/versions/005010/segment_defs/HI"
67
70
  autoload :HL, "stupidedi/versions/005010/segment_defs/HL"
68
71
  autoload :HLH, "stupidedi/versions/005010/segment_defs/HLH"
@@ -80,6 +83,8 @@ module Stupidedi
80
83
  autoload :INV, "stupidedi/versions/005010/segment_defs/INV"
81
84
  autoload :IT1, "stupidedi/versions/005010/segment_defs/IT1"
82
85
  autoload :K3, "stupidedi/versions/005010/segment_defs/K3"
86
+ autoload :L0, "stupidedi/versions/005010/segment_defs/L0"
87
+ autoload :L5, "stupidedi/versions/005010/segment_defs/L5"
83
88
  autoload :LC, "stupidedi/versions/005010/segment_defs/LC"
84
89
  autoload :LE, "stupidedi/versions/005010/segment_defs/LE"
85
90
  autoload :LIN, "stupidedi/versions/005010/segment_defs/LIN"
@@ -141,6 +146,7 @@ module Stupidedi
141
146
  autoload :SV7, "stupidedi/versions/005010/segment_defs/SV7"
142
147
  autoload :SVC, "stupidedi/versions/005010/segment_defs/SVC"
143
148
  autoload :SVD, "stupidedi/versions/005010/segment_defs/SVD"
149
+ autoload :TD5, "stupidedi/versions/005010/segment_defs/TD5"
144
150
  autoload :TOO, "stupidedi/versions/005010/segment_defs/TOO"
145
151
  autoload :TRN, "stupidedi/versions/005010/segment_defs/TRN"
146
152
  autoload :TS2, "stupidedi/versions/005010/segment_defs/TS2"
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stupidedi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Putnam
8
- - Isi Robayna
9
- autorequire:
10
8
  bindir: bin
11
9
  cert_chain: []
12
- date: 2024-06-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
13
11
  dependencies:
14
12
  - !ruby/object:Gem::Dependency
15
13
  name: term-ansicolor
@@ -39,11 +37,39 @@ dependencies:
39
37
  - - "~>"
40
38
  - !ruby/object:Gem::Version
41
39
  version: 1.2.1
40
+ - !ruby/object:Gem::Dependency
41
+ name: bigdecimal
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: ostruct
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
42
68
  description: Ruby API for parsing and generating ASC X12 EDI transactions
43
69
  email: putnam.kyle@gmail.com
44
70
  executables:
45
- - edi-pp
46
71
  - edi-ed
72
+ - edi-pp
47
73
  extensions: []
48
74
  extra_rdoc_files: []
49
75
  files:
@@ -320,6 +346,7 @@ files:
320
346
  - lib/stupidedi/transaction_sets/005010/standards/HR276.rb
321
347
  - lib/stupidedi/transaction_sets/005010/standards/HS270.rb
322
348
  - lib/stupidedi/transaction_sets/005010/standards/RA820.rb
349
+ - lib/stupidedi/transaction_sets/005010/standards/SO317.rb
323
350
  - lib/stupidedi/transaction_sets/builder.rb
324
351
  - lib/stupidedi/transaction_sets/builder/dsl.rb
325
352
  - lib/stupidedi/transaction_sets/common.rb
@@ -936,8 +963,11 @@ files:
936
963
  - lib/stupidedi/versions/005010/segment_defs/FRM.rb
937
964
  - lib/stupidedi/versions/005010/segment_defs/FSA.rb
938
965
  - lib/stupidedi/versions/005010/segment_defs/G53.rb
966
+ - lib/stupidedi/versions/005010/segment_defs/G61.rb
967
+ - lib/stupidedi/versions/005010/segment_defs/G62.rb
939
968
  - lib/stupidedi/versions/005010/segment_defs/GE.rb
940
969
  - lib/stupidedi/versions/005010/segment_defs/GS.rb
970
+ - lib/stupidedi/versions/005010/segment_defs/H1.rb
941
971
  - lib/stupidedi/versions/005010/segment_defs/HCP.rb
942
972
  - lib/stupidedi/versions/005010/segment_defs/HCR.rb
943
973
  - lib/stupidedi/versions/005010/segment_defs/HD.rb
@@ -956,6 +986,8 @@ files:
956
986
  - lib/stupidedi/versions/005010/segment_defs/INV.rb
957
987
  - lib/stupidedi/versions/005010/segment_defs/IT1.rb
958
988
  - lib/stupidedi/versions/005010/segment_defs/K3.rb
989
+ - lib/stupidedi/versions/005010/segment_defs/L0.rb
990
+ - lib/stupidedi/versions/005010/segment_defs/L5.rb
959
991
  - lib/stupidedi/versions/005010/segment_defs/LC.rb
960
992
  - lib/stupidedi/versions/005010/segment_defs/LE.rb
961
993
  - lib/stupidedi/versions/005010/segment_defs/LIN.rb
@@ -1017,6 +1049,7 @@ files:
1017
1049
  - lib/stupidedi/versions/005010/segment_defs/SV7.rb
1018
1050
  - lib/stupidedi/versions/005010/segment_defs/SVC.rb
1019
1051
  - lib/stupidedi/versions/005010/segment_defs/SVD.rb
1052
+ - lib/stupidedi/versions/005010/segment_defs/TD5.rb
1020
1053
  - lib/stupidedi/versions/005010/segment_defs/TOO.rb
1021
1054
  - lib/stupidedi/versions/005010/segment_defs/TRN.rb
1022
1055
  - lib/stupidedi/versions/005010/segment_defs/TS2.rb
@@ -1058,7 +1091,6 @@ homepage: https://github.com/kputnam/stupidedi
1058
1091
  licenses:
1059
1092
  - BSD-3-Clause
1060
1093
  metadata: {}
1061
- post_install_message:
1062
1094
  rdoc_options: []
1063
1095
  require_paths:
1064
1096
  - lib
@@ -1066,15 +1098,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
1066
1098
  requirements:
1067
1099
  - - ">="
1068
1100
  - !ruby/object:Gem::Version
1069
- version: '0'
1101
+ version: '3.2'
1070
1102
  required_rubygems_version: !ruby/object:Gem::Requirement
1071
1103
  requirements:
1072
1104
  - - ">="
1073
1105
  - !ruby/object:Gem::Version
1074
1106
  version: '0'
1075
1107
  requirements: []
1076
- rubygems_version: 3.4.6
1077
- signing_key:
1108
+ rubygems_version: 4.0.10
1078
1109
  specification_version: 4
1079
1110
  summary: Parse, generate, validate ASC X12 EDI
1080
1111
  test_files: []