PD_x12 1.3.2 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -34,6 +34,8 @@ Or install it yourself as:
34
34
 
35
35
  $ gem install PD_x12
36
36
 
37
+ To initialize in Rails 3.2 application, in your config/initializers directory, create a file called x12.rb and add the line: require 'x12' to it.
38
+
37
39
  ## Documentation
38
40
  ### Wiki Page: https://github.com/mjpete3/x12/wiki
39
41
 
@@ -54,6 +56,10 @@ The authors of the project were inspired by the following works:
54
56
 
55
57
 
56
58
  # Change Log
59
+ 1/26/13 - relesase 1.3.6
60
+ * changed the referencing of the misc directory so that local copies of the xml definitions are not required
61
+ * added an init.rb file in the root
62
+
57
63
  12/2/12 - release 1.3.2
58
64
  * Added the 835 transaction
59
65
 
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'x12'
data/lib/x12.rb CHANGED
@@ -39,4 +39,5 @@ require 'x12/parser'
39
39
  module X12
40
40
  EMPTY = Empty.new()
41
41
  TEST_REPEAT = 100
42
+
42
43
  end
@@ -194,6 +194,7 @@ module X12
194
194
  self.nodes.find{|i| i.has_content?}
195
195
  end
196
196
 
197
+
197
198
  # Adds a repeat to a segment or loop. Returns a new segment/loop or self if empty.
198
199
  def repeat
199
200
  res = if self.has_content? # Do not repeat an empty segment
@@ -73,6 +73,14 @@ module X12
73
73
  ''
74
74
  end
75
75
  end # render
76
+
77
+
78
+ def each
79
+ res = self.to_a
80
+ 0.upto(res.length - 1) do |x|
81
+ yield res[x]
82
+ end
83
+ end
76
84
 
77
85
  end # Loop
78
86
  end # X12
@@ -56,18 +56,14 @@ module X12
56
56
 
57
57
  # Deal with Microsoft devices
58
58
  # get the current working directory
59
- @dir_name = Dir.pwd + "/misc/"
60
- file_name = @dir_name + file_name
61
-
62
-
63
59
  base_name = File.basename(file_name, '.xml')
64
60
  if MS_DEVICES.find{|i| i == base_name}
65
61
  file_name = File.join(File.dirname, "#{base_name}_.xml")
66
62
  end
67
- #puts "Reading definition from #{file_name}"
68
-
63
+ file_location = File.join(File.dirname(__FILE__), "../../misc", file_name)
64
+
69
65
  # Read and parse the definition
70
- str = File.open(file_name, 'r').read
66
+ str = File.open(file_location, 'r').read
71
67
  #@dir_name = File.dirname(File.expand_path(file_name)) # to look up other files if needed
72
68
  @x12_definition = X12::XMLDefinitions.new(str)
73
69
 
@@ -1,3 +1,3 @@
1
1
  module X12
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.11"
3
3
  end
@@ -35,16 +35,20 @@ module X12
35
35
  # Parse definitions out of XML file
36
36
  def initialize(str)
37
37
  doc = REXML::Document.new(str)
38
- definitions = doc.root.name =~ /^Definition$/i ? doc.root.elements.to_a : [doc.root]
38
+ definitions = doc.root.name =~ /^Definition$/i ? doc.root.elements.to_a : [doc.root]
39
+
39
40
  definitions.each { |element|
40
41
  #puts element.name
41
42
  syntax_element = case element.name
42
- when /table/i then parse_table(element)
43
- when /segment/i then parse_segment(element)
44
- when /composite/i then parse_composite(element)
45
- when /loop/i then parse_loop(element)
43
+ when /table/i
44
+ parse_table(element)
45
+ when /segment/i
46
+ parse_segment(element)
47
+ when /composite/i
48
+ parse_composite(element)
49
+ when /loop/i
50
+ parse_loop(element)
46
51
  end
47
-
48
52
  self[syntax_element.class] ||= {}
49
53
  self[syntax_element.class][syntax_element.name]=syntax_element
50
54
  }
@@ -54,10 +58,14 @@ module X12
54
58
 
55
59
  def parse_boolean(s)
56
60
  return case s
57
- when nil then false
58
- when "" then false
59
- when /(^y(es)?$)|(^t(rue)?$)|(^1$)/i then true
60
- when /(^no?$)|(^f(alse)?$)|(^0$)/i then false
61
+ when nil
62
+ false
63
+ when ""
64
+ false
65
+ when /(^y(es)?$)|(^t(rue)?$)|(^1$)/i
66
+ true
67
+ when /(^no?$)|(^f(alse)?$)|(^0$)/i
68
+ false
61
69
  else
62
70
  nil
63
71
  end # case
@@ -65,12 +73,18 @@ module X12
65
73
 
66
74
  def parse_type(s)
67
75
  return case s
68
- when nil then 'string'
69
- when /^C.+$/ then s
70
- when /^i(nt(eger)?)?$/i then 'int'
71
- when /^l(ong)?$/i then 'long'
72
- when /^d(ouble)?$/i then 'double'
73
- when /^s(tr(ing)?)?$/i then 'string'
76
+ when nil
77
+ 'string'
78
+ when /^C.+$/
79
+ s
80
+ when /^i(nt(eger)?)?$/i
81
+ 'int'
82
+ when /^l(ong)?$/i
83
+ 'long'
84
+ when /^d(ouble)?$/i
85
+ 'double'
86
+ when /^s(tr(ing)?)?$/i
87
+ 'string'
74
88
  else
75
89
  nil
76
90
  end # case
@@ -146,8 +160,10 @@ module X12
146
160
 
147
161
  components = e.elements.to_a.inject([]){|r, element|
148
162
  r << case element.name
149
- when /loop/i then parse_loop(element)
150
- when /segment/i then parse_segment(element)
163
+ when /loop/i
164
+ parse_loop(element)
165
+ when /segment/i
166
+ parse_segment(element)
151
167
  else
152
168
  throw Exception.new("Cannot recognize syntax for: #{element.inspect} in loop #{e.inspect}")
153
169
  end # case
@@ -41,205 +41,209 @@
41
41
  <Segment name="HL" max="1" required="y" comment="Billing provider hierarchical level"/>
42
42
  <Segment name="PRV" max="1" required="n" comment="Billing provider specialty information"/>
43
43
  <Segment name="CUR" max="1" required="n" comment="Foreign currency information"/>
44
- </Loop>
45
- <Loop name="L2010AA" required="y">
46
- <Segment name="NM1" max="1" required="y" comment="Billing provider name"/>
47
- <Segment name="N3" max="1" required="y" comment="Billing provider address"/>
48
- <Segment name="N4" max="1" required="y" comment="Billing provider city/state/zip code"/>
49
- <Segment name="REF" max="1" required="y" comment="Billing provider tax id"/>
50
- <Segment name="REF" max="2" required="n" comment="Billing provider upin/license information"/>
51
- <Segment name="PER" max="2" required="n" comment="Billing provider contact information"/>
52
- </Loop>
53
- <Loop name="L2010AB" max="1" required="n">
54
- <Segment name="NM1" max="1" required="y" comment="Pay-to address name"/>
55
- <Segment name="N3" max="1" required="y" comment="Pay-to provider address"/>
56
- <Segment name="N4" max="1" required="y" comment="Pay-to provider city/state/zip code"/>
57
- </Loop>
58
- <Loop name="L2010AC" max="1" required="n">
59
- <Segment name="NM1" max="1" required="y" comment="Pay-to plan name"/>
60
- <Segment name="N3" max="1" required="y" comment="Pay-to plan address"/>
61
- <Segment name="N4" max="1" required="y" comment="Pay-to plan city/state/zip code"/>
62
- <Segment name="REF" max="1" required="n" comment="Pay-to plan secondary id"/>
63
- <Segment name="REF" max="1" required="y" comment="Pay-to plan tax id"/>
64
- </Loop>
65
- <Loop name="L2000B" required="y">
66
- <Segment name="HL" max="1" required="y" comment="Subscriber heiarchical level"/>
67
- <Segment name="SBR" max="1" required="y" comment="subscriber information"/>
68
- <Segment name="PAT" max="1" required="n" comment="Patient information"/>
69
- </Loop>
70
- <Loop name="L2010BA" max="1" required="y">
71
- <Segment name="NM1" max="1" required="y" comment="Subscriber name"/>
72
- <Segment name="N3" max="1" required="n" comment="Subscriber address"/>
73
- <Segment name="N4" max="1" required="n" comment="Subscriber city/state/zip"/>
74
- <Segment name="DMG" max="1" required="n" comment="Subscriber demographic information"/>
75
- <Segment name="REF" max="2" required="n"/>
76
- <Segment name="PER" max="1" required="n" comment="Property and casualty subscriber contact information"/>
77
- </Loop>
78
- <Loop name="L2010BB" max="1" required="y">
79
- <Segment name="NM1" max="1" required="y" comment="Payer name"/>
80
- <Segment name="N3" max="1" required="n" comment="Payer address"/>
81
- <Segment name="N4" max="1" required="n" comment="Payer city/state/zip code"/>
82
- <Segment name="REF" max="5" required="n" />
83
- </Loop>
84
- <Loop name="L2000C" required="n">
85
- <Segment name="HL" required="n" comment="Patient heirarchical level"/>
86
- <Segment name="PAT" required="y" comment="Patient information"/>
87
- </Loop>
88
- <Loop name="L2010CA" max="1" required="n">
89
- <Segment name="NM1" max="1" required="y" comment="Patient name"/>
90
- <Segment name="N3" max="1" required="y" comment="Patient address"/>
91
- <Segment name="N4" max="1" required="y" comment="Patient city/state/zip"/>
92
- <Segment name="DMG" max="1" required="y" comment="Patient demographic information"/>
93
- <Segment name="REF" max="1" required="n" comment="Property and casualty claim number"/>
94
- <Segment name="PER" max="1" required="n" comment="Property and casualty subscriber contact information"/>
95
- </Loop>
96
- <Loop name="L2300" max="100" required="y">
97
- <Segment name="CLM" max="1" required="y" comment="Claim information"/>
98
- <Segment name="DTP" max="16" required="n" comment="Claim Dates. Up to 16 different dates can be set for a 837p" />
99
- <Segment name="PWK" max="10" required="n" comment="Claim supplemental information" />
100
- <Segment name="CN1" max="1" required="n" comment="Contract information" />
101
- <Segment name="AMT" max="1" required="n" comment="Patient amount paid" />
102
- <Segment name="REF" max="14" required="n" comment="Claim References. Up to 14 different claim references can be set for a 837p" />
103
- <Segment name="K3" max="10" required="n" comment="File information" />
104
- <Segment name="NTE" max="1" required="n" comment="Claim note" />
105
- <Segment name="CR1" max="1" required="n" comment="Ambulance transport information" />
106
- <Segment name="CR2" max="1" required="n" comment="Spinal manipulation service information" />
107
- <Segment name="CRC" max="8" required="n" comment="Code Category. Up to 8 different CRC categories can be set for an 837p" />
108
- <Segment name="HI" max="1" required="y" comment="Healthcare diagnostic code" />
109
- <Segment name="HI" max="1" required="n" comment="Anesthesia related procedure code" />
110
- <Segment name="HI" max="2" required="n" comment="Condition information" />
111
- <Segment name="HCP" max="1" required="n" comment="Claim pricing / repricing information" />
112
- </Loop>
113
- <Loop name="L2310A" max="2" required="n">
114
- <Segment name="NM1" max="1" required="y" comment="Referring provider name"/>
115
- <Segment name="REF" max="3" required="n" comment="Referring provider secondary id"/>
116
- </Loop>
117
- <Loop name="L2310B" max="1" required="n">
118
- <Segment name="NM1" max="1" required="n" comment="Rendering provider name"/>
119
- <Segment name="PRV" max="1" required="n" comment="Rendering provider specialty information"/>
120
- <Segment name="REF" max="4" required="n" comment="Rendering provider secondary id"/>
121
- </Loop>
122
- <Loop name="L2310C" required="n">
123
- <Segment name="NM1" max="1" required="y" comment="Service facility location"/>
124
- <Segment name="N3" max="1" required="y" comment="Service facility address"/>
125
- <Segment name="N4" max="1" required="y" comment="Service facility city/state/zip"/>
126
- <Segment name="REF" max="3" required="n" comment="Service facility location secondary id"/>
127
- <Segment name="PER" max="1" required="y" comment="Service facility contact information"/>
128
- </Loop>
129
- <Loop name="L2310D" max="1" required="n">
130
- <Segment name="NM1" max="1" required="n" comment="Supervising provider name"/>
131
- <Segment name="REF" max="4" required="n" comment="Supervising provider secondary id"/>
132
- </Loop>
133
- <Loop name="L2310E" max="1" required="n">
134
- <Segment name="NM1" max="1" required="y" comment="Ambulance pick up location"/>
135
- <Segment name="N3" max="1" required="y" comment="Ambulance pick up address"/>
136
- <Segment name="N4" max="1" required="y" comment="Ambulance pick up city/state/zip"/>
137
- </Loop>
138
- <Loop name="L2310F" max="1" required="n">
139
- <Segment name="NM1" max="1" required="y" comment="Ambulance dropoff location"/>
140
- <Segment name="N3" max="1" required="y" comment="Ambulance dropoff address"/>
141
- <Segment name="N4" max="1" required="y" comment="Ambulance dropoff city/state/zip"/>
142
- </Loop>
143
- <Loop name="L2320" max="10" required="n">
144
- <Segment name="SBR" max="1" required="n" comment="Other subscriber information" />
145
- <Segment name="CAS" max="5" required="n" comment="Claim level adjustment" />
146
- <Segment name="AMT" max="3" required="n" comment="Claim level adjustment amounts" />
147
- <Segment name="OI" max="1" required="y" comment="Other insurance coverage information" />
148
- <Segment name="MOA" max="1" required="n" comment="Medicare outpatient adjudication information" />
149
- </Loop>
150
- <Loop name="L2330A" max="1" required="n">
151
- <Segment name="NM1" max="1" required="y" comment="Other subscriber name"/>
152
- <Segment name="N3" max="1" required="n" comment="Other subscriber address"/>
153
- <Segment name="N4" max="1" required="y" comment="Other subscriber city/state/zip"/>
154
- <Segment name="REF" max="1" required="n" comment="Other subscriber location secondary id"/>
155
- </Loop>
156
- <Loop name="L2330B" max="1" required="n">
157
- <Segment name="NM1" max="1" required="y" comment="Other payer name" />
158
- <Segment name="N3" max="1" required="n" comment="Other payer address"/>
159
- <Segment name="N4" max="1" required="y" comment="Other payer city/state/zip"/>
160
- <Segment name="DTP" max="1" required="n" comment="Date - claim check or remittance date" />
161
- <Segment name="REF" max="6" required="n" comment="Other reference information. Up to 6 different references can be associated to an 837p" />
162
- </Loop>
163
- <Loop name="L2330CDEFG" max="6" required="n" comment="Loops 2330C through 2330G combined for inbound transactions, application needs to determine the correct loop being provided.">
164
- <Segment name="NM1" max="1" required="y" comment="Name" />
165
- <Segment name="REF" max="3" required="y" comment="Secondary id"/>
166
- </Loop>
167
- <Loop name="L2400" max="50" required="y">
168
- <Segment name="LX" max="1" required="y" comment="Service line" />
169
- <Segment name="SV1" max="1" required="y" comment="Professional service" />
170
- <Segment name="SV5" max="1" required="n" comment="Durable medical equipment service" />
171
- <Segment name="PWK" max="10" required="n" comment="Line supplemental informtion" />
172
- <Segment name="PWK" max="1" required="n" comment="Durable medical equipment certificate of medical necessity indicator" />
173
- <Segment name="CR1" max="1" required="n" comment="Ambulance transport information" />
174
- <Segment name="CR3" max="1" required="n" comment="Durable medical equipment certification" />
175
- <Segment name="CRC" max="3" required="n" comment="Ambulance certification" />
176
- <Segment name="CRC" max="1" required="n" comment="Hospice employee indicator" />
177
- <Segment name="CRC" max="1" required="n" comment="Condition indicator durable medical equipment" />
178
- <Segment name="DTP" max="1" required="y" comment="Date - service date; qualifier=472" />
179
- <Segment name="DTP" max="9" required="n" />
180
- <Segment name="QTY" max="1" required="n" comment="Ambulance patient count; qualifier=PT" />
181
- <Segment name="QTY" max="1" required="n" comment="Obstetric Anesthesia additional units; qualifier=FL" />
182
- <Segment name="MEA" max="5" required="n" comment="Test Results" />
183
- <Segment name="CN1" max="1" required="n" comment="Contract information" />
184
- <Segment name="REF" max="17" required="n" />
185
- <Segment name="AMT" max="2" required="n" />
186
- <Segment name="K3" max="10" required="n" comment="File information" />
187
- <Segment name="NTE" max="2" required="n" />
188
- <Segment name="PS1" max="1" required="n" comment="Purchasd service information" />
189
- <Segment name="HCP" max="1" required="n" comment="Line pricing/repricing information" />
190
- </Loop>
191
- <Loop name="L2410" max="1" required="n" >
192
- <Segment name="LIN" max="1" required="n" comment="Drug identification" />
193
- <Segment name="CTP" max="1" required="y" comment="Drug pricing" />
194
- <Segment name="REF" max="1" required="n" comment="Prescription or compound drug association number" />
195
- </Loop>
196
- <Loop name="L2420A" max="1" required="n" >
197
- <Segment name="NM1" max="1" required="n" comment="Rendering provider name" />
198
- <Segment name="PRV" max="1" required="n" comment="Rendering provider specialty information" />
199
- <Segment name="REF" max="20" required="n" comment="Rendering provider secondary id" />
200
- </Loop>
201
- <Loop name="L2420B" max="1" required="n" >
202
- <Segment name="NM1" max="1" required="n" comment="Purchased service provider name" />
203
- <Segment name="REF" max="20" required="n" comment="Purchased service provider secondary id" />
204
- </Loop>
205
- <Loop name="L2420C" max="1" required="n" >
206
- <Segment name="NM1" max="1" required="n" comment="Service facility location name" />
207
- <Segment name="N3" max="1" required="y" comment="Service facility location address" />
208
- <Segment name="N4" max="1" required="y" comment="Service facility location city/state/zip" />
209
- <Segment name="REF" max="3" required="n" comment="Service facility location secondary id" />
210
- </Loop>
211
- <Loop name="L2420D" max="1" required="n">
212
- <Segment name="NM1" max="1" required="n" comment="Supervising provider name" />
213
- <Segment name="REF" max="20" required="n" comment="Supervising provider secondary id" />
214
- </Loop>
215
- <Loop name="L2420E" required="n">
216
- <Segment name="NM1" max="1" required="n" comment="Ordering provider name" />
217
- <Segment name="N3" max="1" required="n" comment="Ordering provider address" />
218
- <Segment name="N4" max="1" required="y" comment="Ordering provider city/state/zip" />
219
- <Segment name="REF" max="20" required="n" comment="Ordering provider secondary id" />
220
- <Segment name="PER" max="1" required="n" comment="Ordering provider contact information" />
221
- </Loop>
222
- <Loop name="L2420F" max="2" required="n">
223
- <Segment name="NM1" max="1" required="n" comment="Refering provider name" />
224
- <Segment name="REF" max="20" required="n" comment="Refering provider secondary id" />
225
- </Loop>
226
- <Loop name="L2420G" max="1" required="n">
227
- <Segment name="NM1" max="1" required="n" comment="Ambulance pickup information" />
228
- <Segment name="N3" max="1" required="y" comment="Ambulance pickup address" />
229
- <Segment name="N4" max="1" required="y" comment="Ambulance pickup city/state/zip" />
230
- </Loop>
231
- <Loop name="L2420H" max="1" required="n">
232
- <Segment name="NM1" max="1" required="n" comment="Ambulance dropoff information" />
233
- <Segment name="N3" max="1" required="y" comment="Ambulance dropoff address" />
234
- <Segment name="N4" max="1" required="y" comment="Ambulance dropoff city/state/zip" />
235
- </Loop>
236
- <Loop name="L2430" max="15" required="n">
237
- <Segment name="SVD" max="1" required="n" comment="Line adjudication information" />
238
- <Segment name="CAS" max="5" required="n" comment="Line adjustment" />
239
- <Segment name="DTP" max="1" required="y" comment="Line check or remittance date" />
240
- <Segment name="AMT" max="1" required="n" comment="Remaining patient liability" />
241
- <Segment name="LQ" max="1" required="n" comment="Form identification code" />
242
- <Segment name="FRM" max="99" required="n" comment="Supporting documentation" />
44
+ <Loop name="L2010AA" max="1" required="y">
45
+ <Segment name="NM1" max="1" required="y" comment="Billing provider name"/>
46
+ <Segment name="N3" max="1" required="y" comment="Billing provider address"/>
47
+ <Segment name="N4" max="1" required="y" comment="Billing provider city/state/zip code"/>
48
+ <Segment name="REF" max="1" required="y" comment="Billing provider tax id"/>
49
+ <Segment name="REF" max="2" required="n" comment="Billing provider upin/license information"/>
50
+ <Segment name="PER" max="2" required="n" comment="Billing provider contact information"/>
51
+ </Loop>
52
+ <Loop name="L2010AB" max="1" required="n">
53
+ <Segment name="NM1" max="1" required="y" comment="Pay-to address name"/>
54
+ <Segment name="N3" max="1" required="y" comment="Pay-to provider address"/>
55
+ <Segment name="N4" max="1" required="y" comment="Pay-to provider city/state/zip code"/>
56
+ </Loop>
57
+ <Loop name="L2010AC" max="1" required="n">
58
+ <Segment name="NM1" max="1" required="y" comment="Pay-to plan name"/>
59
+ <Segment name="N3" max="1" required="y" comment="Pay-to plan address"/>
60
+ <Segment name="N4" max="1" required="y" comment="Pay-to plan city/state/zip code"/>
61
+ <Segment name="REF" max="1" required="n" comment="Pay-to plan secondary id"/>
62
+ <Segment name="REF" max="1" required="y" comment="Pay-to plan tax id"/>
63
+ </Loop>
64
+
65
+ <Loop name="L2000B" required="y">
66
+ <Segment name="HL" max="1" required="y" comment="Subscriber heiarchical level"/>
67
+ <Segment name="SBR" max="1" required="y" comment="subscriber information"/>
68
+ <Segment name="PAT" max="1" required="n" comment="Patient information"/>
69
+
70
+ <Loop name="L2010BA" max="1" required="y">
71
+ <Segment name="NM1" max="1" required="y" comment="Subscriber name"/>
72
+ <Segment name="N3" max="1" required="n" comment="Subscriber address"/>
73
+ <Segment name="N4" max="1" required="n" comment="Subscriber city/state/zip"/>
74
+ <Segment name="DMG" max="1" required="n" comment="Subscriber demographic information"/>
75
+ <Segment name="REF" max="2" required="n"/>
76
+ <Segment name="PER" max="1" required="n" comment="Property and casualty subscriber contact information"/>
77
+ </Loop>
78
+ <Loop name="L2010BB" max="1" required="y">
79
+ <Segment name="NM1" max="1" required="y" comment="Payer name"/>
80
+ <Segment name="N3" max="1" required="n" comment="Payer address"/>
81
+ <Segment name="N4" max="1" required="n" comment="Payer city/state/zip code"/>
82
+ <Segment name="REF" max="5" required="n" />
83
+ </Loop>
84
+
85
+ <Loop name="L2000C" required="n">
86
+ <Segment name="HL" required="y" comment="Patient heirarchical level"/>
87
+ <Segment name="PAT" required="y" comment="Patient information"/>
88
+ <Loop name="L2010CA" max="1" required="n">
89
+ <Segment name="NM1" max="1" required="y" comment="Patient name"/>
90
+ <Segment name="N3" max="1" required="y" comment="Patient address"/>
91
+ <Segment name="N4" max="1" required="y" comment="Patient city/state/zip"/>
92
+ <Segment name="DMG" max="1" required="y" comment="Patient demographic information"/>
93
+ <Segment name="REF" max="1" required="n" comment="Property and casualty claim number"/>
94
+ <Segment name="PER" max="1" required="n" comment="Property and casualty subscriber contact information"/>
95
+ </Loop>
96
+ </Loop>
97
+ <Loop name="L2300" max="100" required="y">
98
+ <Segment name="CLM" max="1" required="y" comment="Claim information"/>
99
+ <Segment name="DTP" max="16" required="n" comment="Claim Dates. Up to 16 different dates can be set for a 837p" />
100
+ <Segment name="PWK" max="10" required="n" comment="Claim supplemental information" />
101
+ <Segment name="CN1" max="1" required="n" comment="Contract information" />
102
+ <Segment name="AMT" max="1" required="n" comment="Patient amount paid" />
103
+ <Segment name="REF" max="14" required="n" comment="Claim References. Up to 14 different claim references can be set for a 837p" />
104
+ <Segment name="K3" max="10" required="n" comment="File information" />
105
+ <Segment name="NTE" max="1" required="n" comment="Claim note" />
106
+ <Segment name="CR1" max="1" required="n" comment="Ambulance transport information" />
107
+ <Segment name="CR2" max="1" required="n" comment="Spinal manipulation service information" />
108
+ <Segment name="CRC" max="8" required="n" comment="Code Category. Up to 8 different CRC categories can be set for an 837p" />
109
+ <Segment name="HI" max="1" required="y" comment="Healthcare diagnostic code" />
110
+ <Segment name="HI" max="1" required="n" comment="Anesthesia related procedure code" />
111
+ <Segment name="HI" max="2" required="n" comment="Condition information" />
112
+ <Segment name="HCP" max="1" required="n" comment="Claim pricing / repricing information" />
113
+
114
+ <Loop name="L2310A" max="1" required="n">
115
+ <Segment name="NM1" max="1" required="y" comment="Referring provider name"/>
116
+ <Segment name="REF" max="3" required="n" comment="Referring provider secondary id"/>
117
+ </Loop>
118
+ <Loop name="L2310B" max="1" required="n">
119
+ <Segment name="NM1" max="1" required="n" comment="Rendering provider name"/>
120
+ <Segment name="PRV" max="1" required="n" comment="Rendering provider specialty information"/>
121
+ <Segment name="REF" max="4" required="n" comment="Rendering provider secondary id"/>
122
+ </Loop>
123
+ <Loop name="L2310C" required="n">
124
+ <Segment name="NM1" max="1" required="y" comment="Service facility location"/>
125
+ <Segment name="N3" max="1" required="y" comment="Service facility address"/>
126
+ <Segment name="N4" max="1" required="y" comment="Service facility city/state/zip"/>
127
+ <Segment name="REF" max="3" required="n" comment="Service facility location secondary id"/>
128
+ <Segment name="PER" max="1" required="y" comment="Service facility contact information"/>
129
+ </Loop>
130
+ <Loop name="L2310D" max="1" required="n">
131
+ <Segment name="NM1" max="1" required="n" comment="Supervising provider name"/>
132
+ <Segment name="REF" max="4" required="n" comment="Supervising provider secondary id"/>
133
+ </Loop>
134
+ <Loop name="L2310E" max="1" required="n">
135
+ <Segment name="NM1" max="1" required="y" comment="Ambulance pick up location"/>
136
+ <Segment name="N3" max="1" required="y" comment="Ambulance pick up address"/>
137
+ <Segment name="N4" max="1" required="y" comment="Ambulance pick up city/state/zip"/>
138
+ </Loop>
139
+ <Loop name="L2310F" max="1" required="n">
140
+ <Segment name="NM1" max="1" required="y" comment="Ambulance dropoff location"/>
141
+ <Segment name="N3" max="1" required="y" comment="Ambulance dropoff address"/>
142
+ <Segment name="N4" max="1" required="y" comment="Ambulance dropoff city/state/zip"/>
143
+ </Loop>
144
+ <Loop name="L2320" max="10" required="n">
145
+ <Segment name="SBR" max="1" required="n" comment="Other subscriber information" />
146
+ <Segment name="CAS" max="5" required="n" comment="Claim level adjustment" />
147
+ <Segment name="AMT" max="3" required="n" comment="Claim level adjustment amounts" />
148
+ <Segment name="OI" max="1" required="y" comment="Other insurance coverage information" />
149
+ <Segment name="MOA" max="1" required="n" comment="Medicare outpatient adjudication information" />
150
+ </Loop>
151
+ <Loop name="L2330A" max="1" required="n">
152
+ <Segment name="NM1" max="1" required="y" comment="Other subscriber name"/>
153
+ <Segment name="N3" max="1" required="n" comment="Other subscriber address"/>
154
+ <Segment name="N4" max="1" required="y" comment="Other subscriber city/state/zip"/>
155
+ <Segment name="REF" max="1" required="n" comment="Other subscriber location secondary id"/>
156
+ </Loop>
157
+ <Loop name="L2330B" max="1" required="n">
158
+ <Segment name="NM1" max="1" required="y" comment="Other payer name" />
159
+ <Segment name="N3" max="1" required="n" comment="Other payer address"/>
160
+ <Segment name="N4" max="1" required="y" comment="Other payer city/state/zip"/>
161
+ <Segment name="DTP" max="1" required="n" comment="Date - claim check or remittance date" />
162
+ <Segment name="REF" max="6" required="n" comment="Other reference information. Up to 6 different references can be associated to an 837p" />
163
+ </Loop>
164
+ <Loop name="L2330CDEFG" max="6" required="n" comment="Loops 2330C through 2330G combined for inbound transactions, application needs to determine the correct loop being provided.">
165
+ <Segment name="NM1" max="1" required="y" comment="Name" />
166
+ <Segment name="REF" max="3" required="y" comment="Secondary id"/>
167
+ </Loop>
168
+ <Loop name="L2400" max="50" required="y">
169
+ <Segment name="LX" max="1" required="y" comment="Service line" />
170
+ <Segment name="SV1" max="1" required="y" comment="Professional service" />
171
+ <Segment name="SV5" max="1" required="n" comment="Durable medical equipment service" />
172
+ <Segment name="PWK" max="10" required="n" comment="Line supplemental informtion" />
173
+ <Segment name="PWK" max="1" required="n" comment="Durable medical equipment certificate of medical necessity indicator" />
174
+ <Segment name="CR1" max="1" required="n" comment="Ambulance transport information" />
175
+ <Segment name="CR3" max="1" required="n" comment="Durable medical equipment certification" />
176
+ <Segment name="CRC" max="3" required="n" comment="Ambulance certification" />
177
+ <Segment name="CRC" max="1" required="n" comment="Hospice employee indicator" />
178
+ <Segment name="CRC" max="1" required="n" comment="Condition indicator durable medical equipment" />
179
+ <Segment name="DTP" max="1" required="y" comment="Date - service date; qualifier=472" />
180
+ <Segment name="DTP" max="9" required="n" />
181
+ <Segment name="QTY" max="1" required="n" comment="Ambulance patient count; qualifier=PT" />
182
+ <Segment name="QTY" max="1" required="n" comment="Obstetric Anesthesia additional units; qualifier=FL" />
183
+ <Segment name="MEA" max="5" required="n" comment="Test Results" />
184
+ <Segment name="CN1" max="1" required="n" comment="Contract information" />
185
+ <Segment name="REF" max="17" required="n" />
186
+ <Segment name="AMT" max="2" required="n" />
187
+ <Segment name="K3" max="10" required="n" comment="File information" />
188
+ <Segment name="NTE" max="2" required="n" />
189
+ <Segment name="PS1" max="1" required="n" comment="Purchasd service information" />
190
+ <Segment name="HCP" max="1" required="n" comment="Line pricing/repricing information" />
191
+ </Loop>
192
+ <Loop name="L2410" max="1" required="n" >
193
+ <Segment name="LIN" max="1" required="n" comment="Drug identification" />
194
+ <Segment name="CTP" max="1" required="y" comment="Drug pricing" />
195
+ <Segment name="REF" max="1" required="n" comment="Prescription or compound drug association number" />
196
+ </Loop>
197
+ <Loop name="L2420A" max="1" required="n" >
198
+ <Segment name="NM1" max="1" required="n" comment="Rendering provider name" />
199
+ <Segment name="PRV" max="1" required="n" comment="Rendering provider specialty information" />
200
+ <Segment name="REF" max="20" required="n" comment="Rendering provider secondary id" />
201
+ </Loop>
202
+ <Loop name="L2420B" max="1" required="n" >
203
+ <Segment name="NM1" max="1" required="n" comment="Purchased service provider name" />
204
+ <Segment name="REF" max="20" required="n" comment="Purchased service provider secondary id" />
205
+ </Loop>
206
+ <Loop name="L2420C" max="1" required="n" >
207
+ <Segment name="NM1" max="1" required="n" comment="Service facility location name" />
208
+ <Segment name="N3" max="1" required="y" comment="Service facility location address" />
209
+ <Segment name="N4" max="1" required="y" comment="Service facility location city/state/zip" />
210
+ <Segment name="REF" max="3" required="n" comment="Service facility location secondary id" />
211
+ </Loop>
212
+ <Loop name="L2420D" max="1" required="n">
213
+ <Segment name="NM1" max="1" required="n" comment="Supervising provider name" />
214
+ <Segment name="REF" max="20" required="n" comment="Supervising provider secondary id" />
215
+ </Loop>
216
+ <Loop name="L2420E" required="n">
217
+ <Segment name="NM1" max="1" required="n" comment="Ordering provider name" />
218
+ <Segment name="N3" max="1" required="n" comment="Ordering provider address" />
219
+ <Segment name="N4" max="1" required="y" comment="Ordering provider city/state/zip" />
220
+ <Segment name="REF" max="20" required="n" comment="Ordering provider secondary id" />
221
+ <Segment name="PER" max="1" required="n" comment="Ordering provider contact information" />
222
+ </Loop>
223
+ <Loop name="L2420F" max="2" required="n">
224
+ <Segment name="NM1" max="1" required="n" comment="Refering provider name" />
225
+ <Segment name="REF" max="20" required="n" comment="Refering provider secondary id" />
226
+ </Loop>
227
+ <Loop name="L2420G" max="1" required="n">
228
+ <Segment name="NM1" max="1" required="n" comment="Ambulance pickup information" />
229
+ <Segment name="N3" max="1" required="y" comment="Ambulance pickup address" />
230
+ <Segment name="N4" max="1" required="y" comment="Ambulance pickup city/state/zip" />
231
+ </Loop>
232
+ <Loop name="L2420H" max="1" required="n">
233
+ <Segment name="NM1" max="1" required="n" comment="Ambulance dropoff information" />
234
+ <Segment name="N3" max="1" required="y" comment="Ambulance dropoff address" />
235
+ <Segment name="N4" max="1" required="y" comment="Ambulance dropoff city/state/zip" />
236
+ </Loop>
237
+ <Loop name="L2430" max="15" required="n">
238
+ <Segment name="SVD" max="1" required="n" comment="Line adjudication information" />
239
+ <Segment name="CAS" max="5" required="n" comment="Line adjustment" />
240
+ <Segment name="DTP" max="1" required="y" comment="Line check or remittance date" />
241
+ <Segment name="AMT" max="1" required="n" comment="Remaining patient liability" />
242
+ <Segment name="LQ" max="1" required="n" comment="Form identification code" />
243
+ <Segment name="FRM" max="99" required="n" comment="Supporting documentation" />
244
+ </Loop>
245
+ </Loop>
246
+ </Loop>
243
247
  </Loop>
244
248
  <Segment name="SE" required="y" />
245
249
  </Loop>