stupidedi 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5e080861131d80249323ffec350d123592f73008c7b43e34d87837db694d4e5
4
- data.tar.gz: 3f6d12d6f8eb1c19ec1604fdba94594d3967e5542b689f0fe1641b97475c208e
3
+ metadata.gz: 1ebce60d52d11cc5d750be833dedaa9c143becc4bebfe15a4d4a91c7934ad08b
4
+ data.tar.gz: aea17d716ff7be4f11ddb26e1142edfb5a42d7be8ff33bf9faa0ad8a55cf6411
5
5
  SHA512:
6
- metadata.gz: 4f62e1f97213d006b35e57791b52e67878e00281ca42a05d31693b51b478a292430b14e7b448f39dfd82275b25a9f91def9b6aa8ec78a3216b8b75660fd76f0e
7
- data.tar.gz: 22308ea222c936701e4156b410e6e0422969eacb549c8644b770c4f773c9ea52b89b7ea23ea9a65b65e47ba59bad67f173f38046333b9540714e974a0a434eec
6
+ metadata.gz: 0fb54dce8ae28fd125456dbd0d82aea49c8623b99d364b689853bd4567ff8284815241b5d223f695f9fe79e20fd72d6db4850f7be6b560c820c81dccd1588c8a
7
+ data.tar.gz: c9da5e9c52cbbd801b02a5d8aebf466c83fccfe8902ab6e91c538fc48ecb0f0868899d21b0f67216274227e9b1b16a9e3dae03bd11a53b4b63f31f4664dfed3c
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  * [GitHub project](http://github.com/irobayna/stupidedi)
8
8
  * [Human Documentation](https://github.com/irobayna/stupidedi/tree/master/doc)
9
- * [API Documentation](http://rubydoc.info/github/irobayna/stupidedi/master/frames)
9
+ * [API Documentation](http://rubydoc.info/github/kputnam/stupidedi/master/frames)
10
10
 
11
11
  Stupidedi is a high-quality library for parsing, generating, validating,
12
12
  and manipulating ASC X12 EDI documents. Very roughly, it's jQuery for
data/bin/edi-obfuscate CHANGED
@@ -60,7 +60,7 @@ def main(argv)
60
60
  end
61
61
  end.compact
62
62
 
63
- puts token.copy(element_toks: element_toks).to_s(delims)
63
+ puts token.copy(element_toks: element_toks).to_x12(delims)
64
64
  else
65
65
  raise "unknown segment: #{token.id}" if strict
66
66
  next
@@ -106,6 +106,7 @@ module Stupidedi
106
106
  x.register("005010", "FA", "999") { Stupidedi::TransactionSets::FiftyTen::Standards::FA999 }
107
107
  x.register("005010", "RA", "820") { Stupidedi::TransactionSets::FiftyTen::Standards::RA820 }
108
108
  x.register("005010X212", "HR", "276") { Stupidedi::TransactionSets::FiftyTen::Implementations::X212::HR276 }
109
+ x.register("005010X212", "HN", "277") { Stupidedi::TransactionSets::FiftyTen::Implementations::X212::HN277 }
109
110
  x.register("005010X214", "HN", "277") { Stupidedi::TransactionSets::FiftyTen::Implementations::X214::HN277 }
110
111
  x.register("005010X220", "BE", "834") { Stupidedi::TransactionSets::FiftyTen::Implementations::X220::BE834 }
111
112
  x.register("005010X221", "HP", "835") { Stupidedi::TransactionSets::FiftyTen::Implementations::X221::HP835 }
@@ -156,7 +156,7 @@ module Stupidedi
156
156
  end
157
157
  end
158
158
 
159
- st.find!(:ST)
159
+ st_.find!(:ST)
160
160
  end
161
161
  end
162
162
 
@@ -138,11 +138,11 @@ module Stupidedi
138
138
  # A: Accepted
139
139
  # E: Accepted, but errors were found
140
140
  # P: Partially accepted, at least one transaction set was rejected
141
- # R: Rejecetd
141
+ # R: Rejected
142
142
  #
143
- # 1: Funcitonal group not supported
143
+ # 1: Functional group not supported
144
144
  # 2: Functional group version not supported
145
- # 3: Funcitonal group trailer missing
145
+ # 3: Functional group trailer missing
146
146
  # 4: Group control number in the functional group header and trailer do not agree
147
147
  # 5: Number of included transaction sets does not match actual count
148
148
  # 6: Group control number violates syntax
@@ -14,7 +14,7 @@ module Stupidedi
14
14
  "02" => "EDX Communications ID",
15
15
  "03" => "Additional Data Identification",
16
16
  "04" => "Rail Communication ID",
17
- "05" => "Deparment of Defense (DoD) Communication Identifier",
17
+ "05" => "Department of Defense (DoD) Communication Identifier",
18
18
  "06" => "United States Federal Government Communication Identifier"))
19
19
  I02 = c::SpecialAN.new(:I02, "Authorization Information", 10, 10)
20
20
  I03 = t::ID.new(:I03, "Security Information Qualifier", 2, 2,
@@ -34,7 +34,7 @@ module Stupidedi
34
34
  "10" => s::CodeList.external("350"),
35
35
  "11" => "DEA (Drug Enforcement Administration)",
36
36
  "12" => "Phone (Telephone Companies)",
37
- "13" => "UCS Code (The UCS Code is a Code Used for UCS Transmissions; it includes the Area Code and Telephone Number of a Modem; it Does Not Include Punctation, Blanks, or Access Code)",
37
+ "13" => "UCS Code (The UCS Code is a Code Used for UCS Transmissions; it includes the Area Code and Telephone Number of a Modem; it Does Not Include Punctuation, Blanks, or the Access Code)",
38
38
  "14" => "Duns Plus Suffix",
39
39
  "15" => "Petroleum Accountants Society of Canada Company Code",
40
40
  "16" => "Duns Number With 4-Character Suffix",
@@ -52,7 +52,7 @@ module Stupidedi
52
52
  "28" => "Fiscal Intermediary Identification Number as assigned by Health Care Financing Administration (HCFA)",
53
53
  "29" => "Medicare Provider and Supplier Identification Number as assigned by Health Care Financing Administration (HCFA)",
54
54
  "30" => "US Federal Tax Identification Number",
55
- "31" => "Jurisdiction Identification Number Plus 4 as assigned by the Interational Association of Industrial Accident Boards and Commissions (IAIABC)",
55
+ "31" => "Jurisdiction Identification Number Plus 4 as assigned by the International Association of Industrial Accident Boards and Commissions (IAIABC)",
56
56
  "32" => "US Federal Employer Identification Number (FEIN)",
57
57
  "33" => "National Association of Insurance Commissioners Company Code (NAIC)",
58
58
  "34" => "Medicaid Provider and Supplier Identification Number as assigned by individual State Medicaid Agencies in conjunction with Health Care Financing Administration (HCFA)",
@@ -136,8 +136,11 @@ module Stupidedi
136
136
  elsif zipper.node.composite?
137
137
  if zipper.node.blank?
138
138
  if zipper.node.usage.required?
139
+ # GH-194: Normally the position of a composit element is the
140
+ # position of it's first child; but an empty composit element
141
+ # doesn't have children. So the closest position is of the parent
139
142
  raise Exceptions::ParseError,
140
- "required element #{zipper.node.descriptor} is blank at #{zipper.node.position.inspect}"
143
+ "required #{zipper.node.descriptor} is blank at #{zipper.parent.node.position.inspect}"
141
144
  end
142
145
  elsif zipper.node.usage.forbidden?
143
146
  raise Exceptions::ParseError,
@@ -10,6 +10,15 @@ module Stupidedi
10
10
 
11
11
  def_delegators :definition, :code_lists
12
12
 
13
+ # @return [Symbol]
14
+ abstract :id
15
+
16
+ # @return [String]
17
+ abstract :name
18
+
19
+ # @return [String]
20
+ abstract :description
21
+
13
22
  # @return [ElementReq]
14
23
  abstract :requirement
15
24
 
@@ -7,6 +7,8 @@ module Stupidedi
7
7
  # @return [SimpleElementDef]
8
8
  attr_reader :definition
9
9
 
10
+ def_delegators :definition, :id, :name, :description
11
+
10
12
  # @return [ElementReq]
11
13
  attr_reader :requirement
12
14
 
@@ -7,7 +7,7 @@ module Stupidedi
7
7
  # @return [CompositeElementDef]
8
8
  attr_reader :definition
9
9
 
10
- def_delegators :definition, :id
10
+ def_delegators :definition, :id, :name, :description
11
11
 
12
12
  # @return [ElementReq]
13
13
  attr_reader :requirement
@@ -38,6 +38,11 @@ module Stupidedi
38
38
  changes.fetch(:parent, @parent)
39
39
  end
40
40
 
41
+ def descriptor
42
+ n = parent.element_uses.index{|u| u.eql?(self) } + 1
43
+ "element #{parent.id}#{"%02d" % n} #{definition.name}".strip
44
+ end
45
+
41
46
  def repeatable?
42
47
  @repeat_count.try{|r| r.include?(2) }
43
48
  end
@@ -17,11 +17,15 @@ module Stupidedi
17
17
  # @return [SegmentDef]
18
18
  attr_reader :definition
19
19
 
20
+ def_delegators :definition, :id, :name, :descriptor, :code_lists
21
+
20
22
  # @see X222 B.1.1.3.12.6 Data Segment Requirement Designators
21
23
  #
22
24
  # @return [SegmentReq]
23
25
  attr_reader :requirement
24
26
 
27
+ def_delegators :requirement, :required?, :optional?
28
+
25
29
  # @see X222 B.1.3.12.3 Repeated Occurrences of Single Data Segments
26
30
  # @see X222 B.1.3.12.8 Data Segment Occurrence
27
31
  #
@@ -31,10 +35,6 @@ module Stupidedi
31
35
  # @return [LoopDef, TableDef]
32
36
  attr_reader :parent
33
37
 
34
- def_delegators :definition, :descriptor, :id, :name, :code_lists
35
-
36
- def_delegators :requirement, :required?, :optional?
37
-
38
38
  def initialize(definition, position, requirement, repeat_count, parent)
39
39
  @definition, @position, @requirement, @repeat_count, @parent =
40
40
  definition, position, requirement, repeat_count, parent
@@ -7,6 +7,8 @@ module Stupidedi
7
7
  # @return [SimpleElementDef]
8
8
  attr_reader :definition
9
9
 
10
+ def_delegators :definition, :id, :name, :description
11
+
10
12
  # @return [ElementReq]
11
13
  attr_reader :requirement
12
14
 
@@ -16,6 +16,7 @@ module Stupidedi
16
16
 
17
17
  module X212
18
18
  autoload :HR276, "stupidedi/transaction_sets/005010/implementations/X212-HR276"
19
+ autoload :HN277, "stupidedi/transaction_sets/005010/implementations/X212-HN277"
19
20
  end
20
21
 
21
22
  module X214
@@ -0,0 +1,552 @@
1
+ # frozen_string_literal: true
2
+ module Stupidedi
3
+ module TransactionSets
4
+ module FiftyTen
5
+ module Implementations
6
+ module X212
7
+ b = Builder
8
+ d = Schema
9
+ r = SegmentReqs
10
+ e = ElementReqs
11
+ s = SegmentDefs
12
+
13
+ HN277 = Builder::Dsl.build("HN", "277", "Health Care Information Status Notification") do
14
+ entity_values = %w[
15
+ 03 13 17 1e 1g 1h 1i 1o 1p 1q 1r 1s 1t 1u 1v 1w 1x 1y 1z 28 2a 2b
16
+ 2d 2e 2i 2k 2p 2q 2s 2z 30 36 3a 3c 3d 3e 3f 3g 3h 3i 3j 3k 3l 3m 3n 3o 3p 3q
17
+ 3r 3s 3t 3u 3v 3w 3x 3y 3z 40 43 44 4a 4b 4c 4d 4e 4f 4g 4h 4i 4j 4l 4m 4n 4o
18
+ 4p 4q 4r 4s 4u 4v 4w 4x 4y 4z 5a 5b 5c 5d 5e 5f 5g 5h 5i 5j 5k 5l
19
+ 5m 5n 5o 5p 5q 5r 5s 5t 5u 5v 5w 5x 5y 5z 61 6a 6b 6c 6d 6e 6f 6g 6h 6i 6j 6k
20
+ 6l 6n 6o 6p 6q 6r 6s 6u 6v 6w 6x 6y 71 72 73 74 77 7c 80 82 84 85 87 95 ck cz
21
+ d2 dd dj dk dn do dq e1 e2 e7 e9 fa fd fe g0 g3 gb gb gi gj gk gm gy hf hh i3
22
+ ij il in li lr mr msc ob od ox p0 p2 p3 p4 p5 p7 prp pt pv pw qa qb qc qd qe qh qk
23
+ ql qn qo qs qv qy rc rw s4 sep sj su t4 tl tq tt ttp tu uh x3 x4 x5 zz
24
+ ].map(&:upcase)
25
+ table_header("1 - Header") do
26
+ segment(100, s::ST, "Transaction Set Header", r::Required, d::RepeatCount.bounded(1)) do
27
+ element(e::Required, "Transaction Set Identifier Code", b::Values("277"))
28
+ element(e::Required, "Transaction Set Control Number")
29
+ element(e::Required, "Version, Release, or Industry Identifier", b::Values("005010X212"))
30
+ end
31
+ segment(200, s::BHT, "Beginning of Hierarchical Transaction", r::Required, d::RepeatCount.bounded(1)) do
32
+ element(e::Required, "Hierarchical Structure Code", b::Values("0010"))
33
+ element(e::Required, "Transaction Set Purpose Code", b::Values("08"))
34
+ element(e::Required, "Originator Application Transaction Identifier", b::MaxLength(30))
35
+ element(e::Required, "Transaction Set Creation Date")
36
+ element(e::Required, "Transaction Set Creation Time")
37
+ element(e::Required, "Transaction Type Code", b::Values("DG"))
38
+ end
39
+ end
40
+
41
+ table_detail("2 - Information Source Detail") do
42
+ loop_("2000A INFORMATION SOURCE LEVEL", d::RepeatCount.unbounded) do
43
+ segment(100, s::HL, "Information Source Level", r::Required, d::RepeatCount.bounded(1)) do
44
+ element(e::Required, "Hierarchical ID Number")
45
+ element(e::NotUsed, "Hierarchical Parent ID Number")
46
+ element(e::Required, "Hierarchical Level Code", values("20"))
47
+ element(e::Required, "Hierachical Child Code", values("1"))
48
+ end
49
+ # positions on page 100
50
+ loop_("2100A INFORMATION SOURCE NAME", d::RepeatCount.bounded(1)) do
51
+ segment(500, s::NM1, "Information Source Name", r::Required, d::RepeatCount.bounded(1)) do
52
+ element(e::Required, "Entity Identifier Code", values("PR"))
53
+ element(e::Required, "Entity Type Qualifier", values("2"))
54
+ element(e::Required, "Payer Name")
55
+ element(e::NotUsed, "Name First")
56
+ element(e::NotUsed, "Name Middle")
57
+ element(e::NotUsed, "Name Prefix")
58
+ element(e::NotUsed, "Name Suffix")
59
+ element(e::Required, "Identification Code Qualifier", values("PI", "XV"))
60
+ element(e::Required, "Payer Identifier")
61
+ element(e::NotUsed, "Entity Relationship Code")
62
+ element(e::NotUsed, "Entity Identifier Code")
63
+ element(e::NotUsed, "Name Last or Organization Name")
64
+ end
65
+ segment(800, s::PER, "Administrative Communications Contact", r::Situational, d::RepeatCount.bounded(1)) do
66
+ element(e::Required, "Concat Function Code", values("IC"))
67
+ element(e::Situational, "Payer Contact Name")
68
+ element(e::Required, "Communication Number Qualifier", values("ED", "EM", "FX", "TE"))
69
+ element(e::Required, "Payer Contact Communication Number")
70
+ element(e::Required, "Communication Number Qualifier", values("ED", "EM", "FX", "TE"))
71
+ element(e::Required, "Payer Contact Communication Number")
72
+ element(e::Required, "Communication Number Qualifier", values("ED", "EM", "FX", "TE"))
73
+ element(e::Required, "Payer Contact Communication Number")
74
+ element(e::NotUsed, "Contact Inquiry Reference")
75
+ end
76
+ end
77
+ end
78
+ end
79
+ table_detail("2 - Information Receiver Detail") do
80
+ loop_("2000B INFORMATION RECEIVER LEVEL", d::RepeatCount.unbounded) do
81
+ segment(100, s::HL, "Information Receiver Level", r::Required, d::RepeatCount.bounded(1)) do
82
+ element(e::Required, "Hierarchical ID Number")
83
+ element(e::Required, "Hierarchical Parent ID Number")
84
+ element(e::Required, "Hierarchical Level Code", b::Values("21"))
85
+ element(e::Required, "Hierachical Child Code", b::Values("0", "1"))
86
+ end # segment Information Receiver Level
87
+
88
+ loop_("2100B INFORMATION RECEIVER NAME", d::RepeatCount.bounded(2)) do
89
+ segment(500, s::NM1, "Information Receiver Name", r::Required, d::RepeatCount.bounded(1)) do
90
+ element(e::Required, "Entity Identifier Code", b::Values("41"))
91
+ element(e::Required, "Entity Type Qualifier", b::Values("1", "2"))
92
+ element(e::Situational, "Information Receiver Last or Organizational Name")
93
+ element(e::Situational, "Information Receiver First Name")
94
+ element(e::Situational, "Information Receiver Middle Name")
95
+ element(e::NotUsed, "Name Prefix")
96
+ element(e::NotUsed, "Name Suffix")
97
+ element(e::Required, "Identification Code Qualifier", b::Values("46"))
98
+ element(e::Required, "Information Receiver Identification Number")
99
+ element(e::NotUsed, "Entity Relationship Code")
100
+ element(e::NotUsed, "Entity Identifier Code")
101
+ element(e::NotUsed, "Name Last or Organization Name")
102
+ end # Segment Information Receiver Name
103
+ end # Loop information Receiver Name
104
+ loop_("2200B INFORMATION RECEIVER TRACE IDENTIFIER", d::RepeatCount.bounded(1)) do
105
+ segment(900, s::TRN, "Information Receiver Trace Identifier", r::Situational, d::RepeatCount.bounded(1)) do
106
+ element(e::Required, "Trace Type Code", b::Values("2"))
107
+ element(e::Required, "Claim Transaction Batch Number")
108
+ element(e::NotUsed, "Originating Company Identifier")
109
+ element(e::NotUsed, "Reference Identification")
110
+ end # Segment Information Receiever Application Trace Ident
111
+ segment(1000, s::STC, "Information Receiver Status Information", r::Required, d::RepeatCount.unbounded) do
112
+ composite(e::Required, "HEALTH CARE CLAIM STATUS") do
113
+ element(e::Required, "Status Code")
114
+ element(e::Required, "Health Care Claim Status Code")
115
+ element(e::Situational, "Entity Identifier Code", b::Values("41", "AY", "PR"))
116
+ element(e::NotUsed, "Code List Qualifier Code")
117
+ end # composite value
118
+ element(e::Required, "Status Information Effective Date")
119
+ element(e::NotUsed, "Action Code")
120
+ element(e::NotUsed, "Monetary Amount")
121
+ element(e::NotUsed, "Monetary Amount")
122
+ element(e::NotUsed, "Date")
123
+ element(e::NotUsed, "Payment Method Code")
124
+ element(e::NotUsed, "Date")
125
+ element(e::NotUsed, "Check Number")
126
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
127
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
128
+ element(e::Required, "Status Code") # @todo: CodeSource.external("508")
129
+ element(e::Situational, "Entity Identifier Qualifier", b::Values("41", "AY", "PR"))
130
+ element(e::NotUsed, "Code List Qualifier Code")
131
+ end # composite value
132
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
133
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
134
+ element(e::Required, "Status Code") # @todo: CodeSource.external("508")
135
+ element(e::Situational, "Entity Identifier Qualifier", b::Values("41", "AY", "PR"))
136
+ element(e::NotUsed, "Code List Qualifier Code")
137
+ end # composite value
138
+ element(e::NotUsed, "Free-form Message Text")
139
+ end # Segment information receiver status information
140
+ end # loop Information Receiver Trace Identifier
141
+ end # loop Information Receiver Level
142
+ end # Table 2 - Information Receiver Detail
143
+ table_detail("2 - Service Provider Detail") do
144
+ loop_("2000C Service Provider Level", d::RepeatCount.unbounded) do
145
+ segment(100, s::HL, "Service Provider Level", r::Situational, d::RepeatCount.bounded(1)) do
146
+ element(e::Required, "Hierarchical ID Number")
147
+ element(e::Required, "Hierarchical Parent ID Number")
148
+ element(e::Required, "Hierarchical Level Code", b::Values("19"))
149
+ element(e::Required, "Hierachical Child Code", b::Values("0", "1"))
150
+ end # Segment 100 Service Provider Level
151
+ loop_("2100C PROVIDER NAME", d::RepeatCount.bounded(2)) do
152
+ segment(500, s::NM1, "Provider Name", r::Required, d::RepeatCount.bounded(1)) do
153
+ element(e::Required, "Entity Identifier Code", b::Values("1P"))
154
+ element(e::Required, "Entity Type Qualifier", b::Values("1", "2"))
155
+ element(e::Situational, "Provider Last or Organization Name")
156
+ element(e::Situational, "Provider First Name")
157
+ element(e::Situational, "Provider Middle Name")
158
+ element(e::NotUsed, "Name Prefix")
159
+ element(e::Situational, "Provider Name Suffix")
160
+ element(
161
+ e::Required, "Identification Code Qualifier",
162
+ b::Values("FI", "SV", "XX")
163
+ )
164
+ element(e::Required, "Provider Identifier")
165
+ element(e::NotUsed, "Entity Relationship Code")
166
+ element(e::NotUsed, "Entity Identifier Code")
167
+ element(e::NotUsed, "Name Last or Organization Name")
168
+ end # Segment/NM1 - Provider Name
169
+ end # Loop/2100C - Provider Name
170
+ loop_("2200C PROVIDER OF SERVICE TRACE IDENTIFIER", d::RepeatCount.bounded(1)) do
171
+ segment(900, s::TRN, "Provider of Service Trace Identifier", r::Situational, d::RepeatCount.bounded(1)) do
172
+ element(e::Required, "Trace Type Code", values("1"))
173
+ element(e::Required, "Provider of Service INformation Trace Identifier")
174
+ element(e::NotUsed, "Originating Company Identifier")
175
+ element(e::NotUsed, "Reference Identification")
176
+ end # Segment/TRN - Provider of Service Trance Information
177
+ segment(1000, s::STC, "Provider Status Information", r::Required, d::RepeatCount.unbounded) do
178
+ composite(e::Required, "HEALTH CARE CLAIM STATUS") do
179
+ element(e::Required, "Health Care Claim Status Category Code")
180
+ element(e::Required, "Status Code")
181
+ element(e::Situational, "Entity Identifier Code", b::Values("1P"))
182
+ element(e::NotUsed, "Code List Qualifier Code")
183
+ end # composite value
184
+ element(e::Required, "Status Information Effective Date")
185
+ element(e::NotUsed, "Action Code")
186
+ element(e::NotUsed, "Monetary Amount")
187
+ element(e::NotUsed, "Monetary Amount")
188
+ element(e::NotUsed, "Date")
189
+ element(e::NotUsed, "Payment Method Code")
190
+ element(e::NotUsed, "Date")
191
+ element(e::NotUsed, "Check Number")
192
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
193
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
194
+ element(e::Required, "Health Care Claim Status Code") # @todo: CodeSource.external("508")
195
+ element(e::Situational, "Entity Identifier Qualifier", b::Values("1P"))
196
+ element(e::NotUsed, "Code List Qualifier Code")
197
+ end # composite value
198
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
199
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
200
+ element(e::Required, "Health Care Claim Status Code") # @todo: CodeSource.external("508")
201
+ element(e::Situational, "Entity Identifier Qualifier", b::Values("1P"))
202
+ element(e::NotUsed, "Code List Qualifier Code")
203
+ end # composite value
204
+ element(e::NotUsed, "Free-form Message Text")
205
+ end # Segment/STC - Provider Status Information
206
+ end # Loop/2200C - Provider of Service Trace Identifier
207
+ end # Loop/2000C Service Provider Level
208
+ end # Table/2 - Service Provider Detail
209
+ table_detail("2 - Subscriber Detail") do
210
+ loop_("2000D SUBSCRIBER LEVEL", d::RepeatCount.unbounded) do
211
+ segment(100, s::HL, "Subscriber Level", r::Situational, d::RepeatCount.bounded(1)) do
212
+ element(e::Required, "Hierarchical ID Number")
213
+ element(e::Required, "Hierarchical Parent ID Number")
214
+ element(e::Required, "Hierarchical Level Code", values("22"))
215
+ element(e::Required, "Hierachical Child Code", values("0", "1"))
216
+ end # Segment/HL - Subscriber Level
217
+
218
+ loop_("2100D SUBSCRIBER NAME", d::RepeatCount.bounded(1)) do
219
+ segment(500, s::NM1, "Subscriber Name", r::Required, d::RepeatCount.bounded(1)) do
220
+ element(e::Required, "Entity Identifier Code", values("IL"))
221
+ element(e::Required, "Entity Type Qualifier", values("1", "2"))
222
+ element(e::Required, "Subscriber Last Name")
223
+ element(e::Situational, "Subscriber First Name")
224
+ element(e::Situational, "Subscriber Middle Name or Initial")
225
+ element(e::NotUsed, "Name Prefix")
226
+ element(e::Situational, "Subscriber Name Suffix")
227
+ element(e::Required, "Identification Code Qualifier", values("24", "II", "MI"))
228
+ element(e::Required, "Subscriber Identifier")
229
+ element(e::NotUsed, "Entity Relationship Code")
230
+ element(e::NotUsed, "Entity Identifier Code")
231
+ element(e::NotUsed, "Name Last or Organization Name")
232
+ end # Segment/NM1 - Subscriber Name
233
+ end # Loop/2100D - Subscriber name
234
+ loop_("2200D CLAIM STATUS TRACKING NUMBER", d::RepeatCount.unbounded) do
235
+ segment(900, s::TRN, "Claim Status Tracking Number", r::Situational, d::RepeatCount.bounded(1)) do
236
+ element(e::Required, "Trace Type Code", values("2"))
237
+ element(e::Required, "Referenced Transaction Trace Number")
238
+ element(e::NotUsed, "Originating Company Identifier")
239
+ element(e::NotUsed, "Reference Identification")
240
+ end # Segment/TRN - Claim Status Tracking Number
241
+ segment(1000, s::STC, "Claim Level Status Information", r::Required, d::RepeatCount.unbounded) do
242
+ composite(e::Required, "HEALTH CARE CLAIM STATUS") do
243
+ element(e::Required, "Health Care Claim Status Category Code")
244
+ element(e::Required, "Health Care Claim Status Code")
245
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
246
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
247
+ end # Composite/Health care claim status
248
+ element(e::Required, "Status Information Effective Date")
249
+ element(e::NotUsed, "Action Code")
250
+ element(e::Situational, "Total Claim Charge Amount")
251
+ element(e::Situational, "Claim Payment Amount")
252
+ element(e::Situational, "Adjudication Finalized Date")
253
+ element(e::NotUsed, "Payment Method Code")
254
+ element(e::Situational, "Remittance Date")
255
+ element(e::Situational, "Remittance Trace Number")
256
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
257
+ element(e::Required, "Health Care Claim Status Category Code")
258
+ element(e::Required, "Health Care Claim Status Code")
259
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
260
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
261
+ end # Composite/Health Care Claim Status
262
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
263
+ element(e::Required, "Health Care Claim Status Category Code")
264
+ element(e::Required, "Health Care Claim Status Code")
265
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
266
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
267
+ end # Composite/Health Care Claim Status
268
+ element(e::NotUsed, "Free Form Message Text")
269
+ end # Segment/STC - Claim Level Status Information
270
+ segment(1100, s::REF, "Payer Claim Control Number", r::Situational, d::RepeatCount.bounded(1)) do
271
+ element(e::Required, "Reference Identification Qualifier", values("1K"))
272
+ element(e::Required, "Payer Claim Control Number")
273
+ element(e::NotUsed, "Description")
274
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
275
+ end # Segment/REF - Payer Claim Control Number
276
+ segment(1100, s::REF, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1)) do
277
+ element(e::Required, "Reference Identification Qualifier", values("BLT"))
278
+ element(e::Required, "Bill Type Identifier")
279
+ element(e::NotUsed, "Description")
280
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
281
+ end # Segment/REF - Institutional Bill Type Identification
282
+ segment(1100, s::REF, "Patient Control Number", r::Situational, d::RepeatCount.bounded(1)) do
283
+ element(e::Required, "Reference Identification Qualifier", values("EJ"))
284
+ element(e::Required, "Patient Control Number")
285
+ element(e::NotUsed, "Description")
286
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
287
+ end # Segment/REF - Patient Control Number
288
+ segment(1100, s::REF, "Pharmacy Prescription Number", r::Situational, d::RepeatCount.bounded(1)) do
289
+ element(e::Required, "Reference Identification Qualifier", values("XZ"))
290
+ element(e::Required, "Pharmacy Prescription Number")
291
+ element(e::NotUsed, "Description")
292
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
293
+ end # Segment/REF - Pharmacy Prescription Number
294
+ segment(1100, s::REF, "Voucher Identifier", r::Situational, d::RepeatCount.bounded(1)) do
295
+ element(e::Required, "Reference Identification Qualifier", values("VV"))
296
+ element(e::Required, "Voucher Identifier")
297
+ element(e::NotUsed, "Description")
298
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
299
+ end # Segment/REF - Voucher Identifier
300
+ segment(1100, s::REF, "Claim Identifier Number for Clearinghous and Other Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(1)) do
301
+ element(e::Required, "Reference Identification Qualifier", values("D9"))
302
+ element(e::Required, "Clearinghouse Trace Number")
303
+ element(e::NotUsed, "Description")
304
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
305
+ end # Segment/REF - Claim Identifier Number for Clearinghouses and...
306
+ segment(1200, s::DTP, "Claim Level Service Date", r::Situational, d::RepeatCount.bounded(1)) do
307
+ element(e::Required, "Date Time Qualifier", values("472"))
308
+ element(e::Required, "Date Time Period Format Qualifier", values("D8", "RD8"))
309
+ element(e::Required, "Claim Service Period")
310
+ end # Segment/DTP - Claim Level Service Date
311
+
312
+ loop_("2220D SERVICE LINE INFORMATION", d::RepeatCount.unbounded) do
313
+ segment(1800, s::SVC, "Service Line Information", r::Situational, d::RepeatCount.bounded(1)) do
314
+ composite(e::Required, "COMPOSITE MEDICAL PROCEDURE IDENTIFIER") do
315
+ element(e::Required, "Product or Service ID Qualifier", values("AD", "ER", "HC", "HP", "IV", "NU", "WK"))
316
+ element(e::Required, "Procedure Code")
317
+ element(e::Situational, "Procedure Modifier")
318
+ element(e::Situational, "Procedure Modifier")
319
+ element(e::Situational, "Procedure Modifier")
320
+ element(e::Situational, "Procedure Modifier")
321
+ element(e::NotUsed, "Description")
322
+ element(e::NotUsed, "Product/Service ID")
323
+ end # composite/medical procedure identifier
324
+ element(e::Required, "Line Item Charge Amount")
325
+ element(e::Required, "Line Item Payment Amount")
326
+ element(e::Situational, "Revenue Code")
327
+ element(e::NotUsed, "Quantity")
328
+ element(e::NotUsed, "COMPOSITE MEDICAL PROCEDURE IDENTIFIER")
329
+ element(e::Required, "Units of Service Count")
330
+ end # Segment/SVC - Service Line Information
331
+
332
+ segment(1900, s::STC, "Service Line Level Status Information", r::Required, d::RepeatCount.unbounded) do
333
+ composite(e::Required, "HEALTH CARE CLAIM STATUS") do
334
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
335
+ element(e::Required, "Health Care Claim Status Code") # @todo: CodeSource.external("508")
336
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
337
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
338
+ end # composite/ health care claim status
339
+ element(e::Required, "Statue Information Effective Date")
340
+ element(e::NotUsed, "Action Code")
341
+ element(e::NotUsed, "Monetary Amount")
342
+ element(e::NotUsed, "Monetary Amount")
343
+ element(e::NotUsed, "Date")
344
+ element(e::NotUsed, "Payment Method Code")
345
+ element(e::NotUsed, "Date")
346
+ element(e::NotUsed, "Check Number")
347
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
348
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
349
+ element(e::Required, "Health Care Claim Status Code") # @todo: CodeSource.external("508")
350
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
351
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
352
+ end # composite/Health care claims
353
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
354
+ element(e::Required, "Health Care Claim Status Category Code")
355
+ element(e::Required, "Health Care Claim Status Code")
356
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
357
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
358
+ end # composite/Health care claim status
359
+ element(e::NotUsed, "Free Form Message Text")
360
+ end # Segment/STC - Service Line Level Information
361
+ segment(2000, s::REF, "Service Line Item Identification", r::Situational, d::RepeatCount.bounded(1)) do
362
+ element(e::Required, "Reference Identification Qualifier", values("FJ"))
363
+ element(e::Required, "Line Item Control Number")
364
+ element(e::NotUsed, "Description")
365
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
366
+ end # Segment/REF - Service Line item Identification
367
+ segment(2100, s::DTP, "Service Line Date", r::Required, d::RepeatCount.bounded(1)) do
368
+ element(e::Required, "Date Time Qualifier", values("472"))
369
+ element(e::Required, "Date Time Period Format Qualifier", values("D8", "RD8"))
370
+ element(e::Required, "Service Line Date")
371
+ end # Segment/DTP - Service Line Date
372
+ end # Loop/2220D - Service Line Information
373
+ end # Loop/2200D - Claim Status Tracking Number
374
+ end # Loop/2000D - Subscriber Level
375
+ end # Table/2 - Subscriber Detail
376
+ table_detail("2 - Dependent Detail") do
377
+ loop_("2000E DEPENDENT LEVEL", d::RepeatCount.unbounded) do
378
+ segment(100, s::HL, "Dependent Level", r::Situational, d::RepeatCount.bounded(1)) do
379
+ element(e::Required, "Hierarchical ID Number")
380
+ element(e::Required, "Hierarchical Parent ID Number")
381
+ element(e::Required, "Hierarchical Level Code", values("23"))
382
+ element(e::NotUsed, "Hierachical Child Code")
383
+ end # Segment/HL - Dependent Level
384
+
385
+ loop_("2100E DEPENDENT NAME", d::RepeatCount.bounded(1)) do
386
+ segment(500, s::NM1, "Dependent Name", r::Required, d::RepeatCount.bounded(1)) do
387
+ element(e::Required, "Entity Identifier Code", values("QC"))
388
+ element(e::Required, "Entity Type Qualifier", values("1"))
389
+ element(e::Required, "Patient Last Name")
390
+ element(e::Situational, "Patient First Name")
391
+ element(e::Situational, "Patient Last Name")
392
+ element(e::NotUsed, "Name Prefix")
393
+ element(e::Situational, "Patient Name Suffix")
394
+ element(e::NotUsed, "Identification Code Qualifier")
395
+ element(e::NotUsed, "Subscriber Identification Number")
396
+ element(e::NotUsed, "Entity Relationship Code")
397
+ element(e::NotUsed, "Entity Identifier Code")
398
+ element(e::NotUsed, "Name Last or Organization Name")
399
+ end # Segment/NM1 - Dependent Name
400
+ end # Loop/2100D - Subscriber name
401
+ loop_("2200E CLAIM STATUS TRACKING NUMBER", d::RepeatCount.unbounded) do
402
+ segment(900, s::TRN, "Claim Status Tracking Number", r::Required, d::RepeatCount.bounded(1)) do
403
+ element(e::Required, "Trace Type Code", values("2"))
404
+ element(e::Required, "Reference Transaction Trace Number")
405
+ element(e::NotUsed, "Originating Company Identifier")
406
+ element(e::NotUsed, "Reference Identification")
407
+ end # Segment/TRN - Claim Status Tracking Number
408
+ segment(1000, s::STC, "Claim Level Status Information", r::Required, d::RepeatCount.unbounded) do
409
+ composite(e::Required, "HEALTH CARE CLAIM STATUS") do
410
+ element(e::Required, "Health Care Claim Status Category Code")
411
+ element(e::Required, "Status Code")
412
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
413
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
414
+ end # Composite/Health care claim status
415
+ element(e::Required, "Status Information Effective Date")
416
+ element(e::NotUsed, "Action Code")
417
+ element(e::Situational, "Total Claim Charge Amount")
418
+ element(e::Situational, "Claim Payment Amount")
419
+ element(e::Situational, "Adjudication Finalized Date")
420
+ element(e::NotUsed, "Payment Method Code")
421
+ element(e::Situational, "Remittance Date")
422
+ element(e::Situational, "Remittance Trace Number")
423
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
424
+ element(e::Required, "Health Care Claim Status Category Code")
425
+ element(e::Required, "Health Care Claim Status Code")
426
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
427
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
428
+ end # Composite/Health Care Claim Status
429
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
430
+ element(e::Required, "Health Care Claim Status Category Code")
431
+ element(e::Required, "Health Care Claim Status Code")
432
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
433
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
434
+ end # Composite/Health Care Claim Status
435
+ element(e::NotUsed, "Free Form Message Text")
436
+ end # Segment/STC - Claim Level Status Information
437
+ segment(1100, s::REF, "Payer Claim Control Number", r::Situational, d::RepeatCount.bounded(1)) do
438
+ element(e::Required, "Reference Identification Qualifier", values("1K"))
439
+ element(e::Required, "Payer Claim Control Number")
440
+ element(e::NotUsed, "Description")
441
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
442
+ end # Segment/REF - Payer Claim Control Number
443
+ segment(1100, s::REF, "Institutional Bill Type Identification", r::Situational, d::RepeatCount.bounded(1)) do
444
+ element(e::Required, "Reference Identification Qualifier", values("BLT"))
445
+ element(e::Required, "Institutional Bill Type Identification")
446
+ element(e::NotUsed, "Description")
447
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
448
+ end # Segment/REF - Institutional Bill Type Identification
449
+ segment(1100, s::REF, "Patient Control Number", r::Situational, d::RepeatCount.bounded(1)) do
450
+ element(e::Required, "Reference Identification Qualifier", values("EJ"))
451
+ element(e::Required, "Patient Control Number")
452
+ element(e::NotUsed, "Description")
453
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
454
+ end # Segment/REF - Patient Control Number
455
+ segment(1100, s::REF, "Pharmacy Prescription Number", r::Situational, d::RepeatCount.bounded(1)) do
456
+ element(e::Required, "Reference Identification Qualifier", values("XZ"))
457
+ element(e::Required, "Pharmacy Prescription Number")
458
+ element(e::NotUsed, "Description")
459
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
460
+ end # Segment/REF - Pharmacy Prescription Number
461
+ segment(1100, s::REF, "Voucher Identifier", r::Situational, d::RepeatCount.bounded(1)) do
462
+ element(e::Required, "Reference Identification Qualifier", values("VV"))
463
+ element(e::Required, "Pharmacy Prescription Number")
464
+ element(e::NotUsed, "Description")
465
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
466
+ end # Segment/REF - Voucher Identifier
467
+ segment(1100, s::REF, "Claim Identifier Number for Clearinghous and Other Transmission Intermediaries", r::Situational, d::RepeatCount.bounded(3)) do
468
+ element(e::Required, "Reference Identification Qualifier", values("D9"))
469
+ element(e::Required, "Clearinghouse Trace Number")
470
+ element(e::NotUsed, "Description")
471
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
472
+ end # Segment/REF - Claim Identifier Number for Clearinghouses and...
473
+ segment(1200, s::DTP, "Claim Level Service Date", r::Situational, d::RepeatCount.bounded(1)) do
474
+ element(e::Required, "Date Time Qualifier", values("472"))
475
+ element(e::Required, "Date Time Period Format Qualifier", values("D8", "RD8"))
476
+ element(e::Required, "Claim Service Period")
477
+ end # Segment/DTP - Claim Level Service Date
478
+
479
+ loop_("2220E SERVICE LINE INFORMATION", d::RepeatCount.unbounded) do
480
+ segment(1800, s::SVC, "Service Line Information", r::Situational, d::RepeatCount.bounded(1)) do
481
+ composite(e::Required, "COMPOSITE MEDICAL PROCEDURE IDENTIFIER") do
482
+ element(e::Required, "Product or Service ID Qualifier", values("AD", "ER", "HC", "HP", "IV", "NU", "WK"))
483
+ element(e::Required, "Procedure Code")
484
+ element(e::Situational, "Procedure Modifier")
485
+ element(e::Situational, "Procedure Modifier")
486
+ element(e::Situational, "Procedure Modifier")
487
+ element(e::Situational, "Procedure Modifier")
488
+ element(e::NotUsed, "Description")
489
+ element(e::NotUsed, "Product/Service ID")
490
+ end # composite/medical procedure identifier
491
+ element(e::Required, "Line Item Charge Amount")
492
+ element(e::Required, "Line Item Payment Amount")
493
+ element(e::Situational, "Revenue Code")
494
+ element(e::NotUsed, "Quantity")
495
+ element(e::NotUsed, "COMPOSITE MEDICAL PROCEDURE IDENTIFIER")
496
+ element(e::Required, "Units of Service Count")
497
+ end # Segment/SVC - Service Line Information
498
+ segment(1900, s::STC, "Service Line Level Status Information", r::Required, d::RepeatCount.unbounded) do
499
+ composite(e::Required, "HEALTH CARE CLAIM STATUS") do
500
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
501
+ element(e::Required, "Status Code") # @todo: CodeSource.external("508")
502
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
503
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
504
+ end # composite/ health care claim status
505
+ element(e::Required, "Status Information Effective Date")
506
+ element(e::NotUsed, "Action Code")
507
+ element(e::NotUsed, "Monetary Amount")
508
+ element(e::NotUsed, "Monetary Amount")
509
+ element(e::NotUsed, "Date")
510
+ element(e::NotUsed, "Payment Method Code")
511
+ element(e::NotUsed, "Date")
512
+ element(e::NotUsed, "Check Number")
513
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
514
+ element(e::Required, "Health Care Claim Status Category Code") # @todo: CodeSource.external("507")
515
+ element(e::Required, "Status Code") # @todo: CodeSource.external("508")
516
+
517
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
518
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
519
+ end # composite/Health care claims
520
+ composite(e::Situational, "HEALTH CARE CLAIM STATUS") do
521
+ element(e::Required, "Health Care Claim Status Category Code")
522
+ element(e::Required, "Health Care Claim Status Code")
523
+ element(e::Situational, "Entity Identifier Code", values(*entity_values))
524
+ element(e::Situational, "Code List Qualifier Code", values("RX"))
525
+ end # composite/Health care claim status
526
+ element(e::NotUsed, "Free Form Message Text")
527
+ end # Segment/STC - Service Line Level Information
528
+ segment(2000, s::REF, "Service Line Item Identification", r::Situational, d::RepeatCount.bounded(1)) do
529
+ element(e::Required, "Reference Identification Qualifier", values("FJ"))
530
+ element(e::Required, "Line Item Control Number")
531
+ element(e::NotUsed, "Description")
532
+ element(e::NotUsed, "REFERENCE IDENTIFIER")
533
+ end # Segment/REF - Service Line item Identification
534
+ segment(2100, s::DTP, "Service Line Date", r::Required, d::RepeatCount.bounded(1)) do
535
+ element(e::Required, "Date Time Qualifier", values("472"))
536
+ element(e::Required, "Date Time Period Format Qualifier", values("D8", "RD8"))
537
+ element(e::Required, "Service Line Date")
538
+ end # Segment/DTP - Service Line Date
539
+ end # Loop/2220D - Service Line Information
540
+ end # Loop/2200D - Claim Status Tracking Number
541
+ end # Loop/2000E - Subscriber Level
542
+ segment(2700, s::SE, "Transaction Set Trailer", r::Required, d::RepeatCount.bounded(1)) do
543
+ element(e::Required, "Transaction Segment Count")
544
+ element(e::Required, "Transaction Set Control Number")
545
+ end
546
+ end # Table/2 - Dependent Detail
547
+ end
548
+ end
549
+ end
550
+ end
551
+ end
552
+ end