stupidedi 1.4.0 → 1.4.1

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.
@@ -21,7 +21,7 @@ module Stupidedi
21
21
  b::Element(e::Required, "Transaction Set Reference Number", b::MaxLength(50)),
22
22
  b::Element(e::Required, "Transaction Set Creation Date"),
23
23
  b::Element(e::Required, "Transaction Set Creation Time"),
24
- b::Element(e::NotUsed, "Time Zone Code"),
24
+ b::Element(e::Situational, "Time Zone Code"),
25
25
  b::Element(e::Situational, "Original Transaction Set Reference Number"),
26
26
  b::Element(e::NotUsed, "Transaction Type Code"),
27
27
  b::Element(e::Required, "Action Code", b::Values("2", "4", "RX")),
@@ -86,7 +86,7 @@ module Stupidedi
86
86
  b::Element(e::Required, "Member Indicator", b::Values("N", "Y")),
87
87
  b::Element(e::Required, "Individual Relationship Code", b::Values("01", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "23", "24", "25", "26", "31", "38", "53", "60", "D2", "G8", "G9")),
88
88
  b::Element(e::Required, "Maintenance Type Code", b::Values("001", "021", "024", "025", "030")),
89
- b::Element(e::Situational, "Maintenance Reason Code", b::Values("01", "03", "04", "05", "06", "07", "08", "09", "10", "11", "14", "15", "16", "17", "18", "20", "21", "22", "25", "26", "27", "28", "29", "31", "32", "33", "37", "38", "39", "40", "41", "43", "59", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AL", "EC", "XN", "XT")),
89
+ b::Element(e::Situational, "Maintenance Reason Code", b::Values("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "14", "15", "16", "17", "18", "20", "21", "22", "25", "26", "27", "28", "29", "31", "32", "33", "37", "38", "39", "40", "41", "43", "59", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AL", "EC", "XN", "XT")),
90
90
  b::Element(e::Required, "Benefit Status Code", b::Values("A", "C", "S", "T")),
91
91
  b::Element(e::Situational, "MEDICARE STATUS CODE",
92
92
  b::Element(e::Required, "Medicare Plan Code", b::Values("A", "B", "C", "D", "E")),
@@ -92,7 +92,7 @@ module Stupidedi
92
92
  b::Segment(400, s::REF, "Information Receiver Additional Identification", r::Situational, d::RepeatCount.bounded(9),
93
93
  b::Element(e::Required, "Reference Identification Qualifier", b::Values("0B", "1C", "1D", "1J", "4A", "CT", "EL", "EO", "HPI", "JD", "N5", "N7", "Q4", "SY", "TJ")),
94
94
  b::Element(e::Required, "Reference Identification"),
95
- b::Element(e::Situational, "Information Receiver Addtional Identifier State"),
95
+ b::Element(e::Situational, "Information Receiver Additional Identifier State"),
96
96
  b::Element(e::NotUsed, "REFERENCE IDENTIFIER")),
97
97
  b::Segment(850, s::AAA, "Information Receiver Request Validation", r::Situational, d::RepeatCount.bounded(9),
98
98
  b::Element(e::Required, "Valid Request Indicator", b::Values("N", "Y")),
@@ -176,7 +176,7 @@ module Stupidedi
176
176
  b::Element(e::NotUsed, "Industry Code")),
177
177
  b::Segment(1100, s::INS, "Subscriber Relationship", r::Situational, d::RepeatCount.bounded(1),
178
178
  b::Element(e::Required, "Insured Indicator", b::Values("Y")),
179
- b::Element(e::Required, "Individual Relationsihp Code", b::Values("18")),
179
+ b::Element(e::Required, "Individual Relationship Code", b::Values("18")),
180
180
  b::Element(e::Situational, "Maintenance Type Code", b::Values("001")),
181
181
  b::Element(e::Situational, "Maintenance Reason Code", b::Values("25")),
182
182
  b::Element(e::NotUsed, "Benefit Status Code"),
@@ -285,7 +285,7 @@ module Stupidedi
285
285
  b::Element(e::Required, "Information Status Code", b::Values("A", "C", "L", "O", "P", "S", "T")),
286
286
  b::Element(e::Required, "Employment Status Code", b::Values("AE", "AO", "AS", "AT", "AU", "CC", "DD", "HD", "IR", "LX", "PE", "RE", "RM", "RR", "RU")),
287
287
  b::Element(e::Required, "Government Service Affiliation Code", b::Values("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "Q", "R", "S", "U", "W")),
288
- b::Element(e::Situational, "Descrption"),
288
+ b::Element(e::Situational, "Description"),
289
289
  b::Element(e::Situational, "Military Service Rank", b::Values("A1", "A2", "A3", "B1", "B2", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "E1", "F1", "F2", "F3", "F4", "G1", "G4", "L1", "L2", "L3", "L4", "L5", "L6", "M1", "M2", "M3", "M4", "M5", "M6", "P1", "P2", "P3", "P4", "P5", "R1", "R2", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "SA", "SB", "SC", "T1", "V1", "W1")),
290
290
  b::Element(e::Situational, "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
291
291
  b::Element(e::Situational, "Date Time Period")),
@@ -346,8 +346,8 @@ module Stupidedi
346
346
  b::Element(e::NotUsed, "Printer Carriage Control Code"),
347
347
  b::Element(e::NotUsed, "Number")),
348
348
 
349
- d::LoopDef.build("2115C SUBSCRIBER ELEGIBILITY OR BENEFIT ADDITIONAL INFORMATION", d::RepeatCount.bounded(10),
350
- b::Segment(2600, s::III, "Subscriber Elegibility or Benefit Additional Information", r::Situational, d::RepeatCount.bounded(1),
349
+ d::LoopDef.build("2115C SUBSCRIBER ELIGIBILITY OR BENEFIT ADDITIONAL INFORMATION", d::RepeatCount.bounded(10),
350
+ b::Segment(2600, s::III, "Subscriber Eligibility or Benefit Additional Information", r::Situational, d::RepeatCount.bounded(1),
351
351
  b::Element(e::Situational, "Code List Qualifier Code", b::Values("GR", "NI", "ZZ")),
352
352
  b::Element(e::Situational, "Industry Code"),
353
353
  b::Element(e::Situational, "Code Category", b::Values("44")),
@@ -382,7 +382,7 @@ module Stupidedi
382
382
  b::Element(e::Situational, "Benefit Related Entity Name Suffix"),
383
383
  b::Element(e::Situational, "Identification Code Qualifier", b::Values("24", "34", "46", "FA", "FI", "II", "MI", "NI", "PI", "PP", "SV", "XV", "XX")),
384
384
  b::Element(e::Situational, "Identification Code"),
385
- b::Element(e::Situational, "Benefit Related Entity Relationsihp Code", b::Values("01", "02", "27", "41", "48", "65", "72")),
385
+ b::Element(e::Situational, "Benefit Related Entity Relationship Code", b::Values("01", "02", "27", "41", "48", "65", "72")),
386
386
  b::Element(e::NotUsed, "Entity Identifier Code"),
387
387
  b::Element(e::NotUsed, "Name Last or Organization Name")),
388
388
  b::Segment(3600, s::N3, "Subscriber Benefit Related Entity Address", r::Situational, d::RepeatCount.bounded(1),
@@ -445,7 +445,7 @@ module Stupidedi
445
445
  b::Element(e::NotUsed, "Name Last or Organization Name")),
446
446
  b::Segment(400, s::REF, "Dependent Additional Identification", r::Situational, d::RepeatCount.bounded(9),
447
447
  b::Element(e::Required, "Reference Identification Qualifier", b::Values("18", "1L", "49", "6P", "CT", "EA", "EJ", "F6", "GH", "HJ", "IF", "IG", "MRC", "N6", "NQ", "Q4", "SY", "Y4")),
448
- b::Element(e::Required, "Dependent Supplemental Identfier"),
448
+ b::Element(e::Required, "Dependent Supplemental Identifier"),
449
449
  b::Element(e::Situational, "Plan, Group or Plan Network Name"),
450
450
  b::Element(e::NotUsed, "REFERENCE IDENTIFIER")),
451
451
  b::Segment(600, s::N3, "Dependent Address", r::Situational, d::RepeatCount.bounded(1),
@@ -495,7 +495,7 @@ module Stupidedi
495
495
  b::Element(e::NotUsed, "Student Status Code"),
496
496
  b::Element(e::NotUsed, "Yes/No Condition or Response Code"),
497
497
  b::Element(e::NotUsed, "Date Time Period Format Qualifier"),
498
- b::Element(e::NotUsed, "Date TIme Period"),
498
+ b::Element(e::NotUsed, "Date Time Period"),
499
499
  b::Element(e::NotUsed, "Confidentiality Code"),
500
500
  b::Element(e::NotUsed, "City Name"),
501
501
  b::Element(e::NotUsed, "State or Province Code"),
@@ -582,10 +582,10 @@ module Stupidedi
582
582
  b::Element(e::NotUsed, "Version Identifier"),
583
583
  b::Element(e::NotUsed, "Industry Code"),
584
584
  b::Element(e::NotUsed, "Yes/No Condition or Response")),
585
- b::Element(e::NotUsed, "HEALTH CARE CODE INFROMATION"),
586
- b::Element(e::NotUsed, "HEALTH CARE CODE INFROMATION"),
587
- b::Element(e::NotUsed, "HEALTH CARE CODE INFROMATION"),
588
- b::Element(e::NotUsed, "HEALTH CARE CODE INFROMATION")),
585
+ b::Element(e::NotUsed, "HEALTH CARE CODE INFORMATION"),
586
+ b::Element(e::NotUsed, "HEALTH CARE CODE INFORMATION"),
587
+ b::Element(e::NotUsed, "HEALTH CARE CODE INFORMATION"),
588
+ b::Element(e::NotUsed, "HEALTH CARE CODE INFORMATION")),
589
589
  b::Segment(1200, s::DTP, "Dependent Date", r::Situational, d::RepeatCount.bounded(9),
590
590
  b::Element(e::Required, "Date Time Qualifier", b::Values("096", "102", "152", "291", "307", "318", "340", "341", "342", "343", "346", "347", "356", "357", "382", "435", "442", "458", "472", "539", "540", "636", "771")),
591
591
  b::Element(e::Required, "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
@@ -593,7 +593,7 @@ module Stupidedi
593
593
  b::Segment(1275, s::MPI, "Dependent Military Personnel Information", r::Situational, d::RepeatCount.bounded(1),
594
594
  b::Element(e::Required, "Information Status Code", b::Values("A", "C", "L", "O", "P", "S", "T")),
595
595
  b::Element(e::Required, "Employment Status Code", b::Values("AE", "AO", "AS", "AT", "AU", "CC", "DD", "HD", "IR", "LX", "PE", "RE", "RM", "RR", "RU")),
596
- b::Element(e::Required, "Government Service Affilition Code", b::Values("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "Q", "R", "S", "U", "W")),
596
+ b::Element(e::Required, "Government Service Affiliation Code", b::Values("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "Q", "R", "S", "U", "W")),
597
597
  b::Element(e::Situational, "Description"),
598
598
  b::Element(e::Situational, "Military Service Rank", b::Values("A1", "A2", "A3", "B1", "B2", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "E1", "F1", "F2", "F3", "F4", "G1", "G4", "L1", "L2", "L3", "L4", "L5", "L6", "M1", "M2", "M3", "M4", "M5", "M6", "P1", "P2", "P3", "P4", "P5", "R1", "R2", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "SA", "SB", "SC", "T1", "V1", "W1")),
599
599
  b::Element(e::Situational, "Date Time Period Format Qualifier", b::Values("D8", "RD8")),
@@ -357,8 +357,8 @@ module Stupidedi
357
357
  b::Element(e::NotUsed, "Printer Carriage Control Code"),
358
358
  b::Element(e::NotUsed, "Number")),
359
359
 
360
- d::LoopDef.build("2115C SUBSCRIBER ELEGIBILITY OR BENEFIT ADDITIONAL INFORMATION", d::RepeatCount.bounded(10),
361
- b::Segment(2600, s::III, "Subscriber Elegibility or Benefit Additional Information", r::Situational, d::RepeatCount.bounded(1),
360
+ d::LoopDef.build("2115C SUBSCRIBER ELIGIBILITY OR BENEFIT ADDITIONAL INFORMATION", d::RepeatCount.bounded(10),
361
+ b::Segment(2600, s::III, "Subscriber Eligibility or Benefit Additional Information", r::Situational, d::RepeatCount.bounded(1),
362
362
  b::Element(e::Situational, "Code List Qualifier Code", b::Values("GR", "NI", "ZZ")),
363
363
  b::Element(e::Situational, "Industry Code"),
364
364
  b::Element(e::Situational, "Code Category", b::Values("44")),
@@ -7,8 +7,12 @@ module Stupidedi
7
7
  # {Builder} is a simple DSL for construction a transaction set
8
8
  #
9
9
  module Builder
10
+
11
+ autoload :Dsl, "stupidedi/transaction_sets/builder/dsl"
12
+
10
13
  end
11
14
 
15
+
12
16
  class << Builder
13
17
  # @return [Schema::TransactionSetDef]
14
18
  def build(functional_group, id, name, *table_defs)
@@ -150,7 +154,7 @@ module Stupidedi
150
154
  end
151
155
 
152
156
  allowed_values = arguments.select{|x| x.is_a?(Array) and x.head == :Values }
153
-
157
+
154
158
  if allowed_values.length == 1
155
159
  begin
156
160
  changes[:allowed_values] = element_use.allowed_values.replace(allowed_values.head.last)
@@ -0,0 +1,192 @@
1
+ module Stupidedi
2
+ module TransactionSets
3
+ module Builder
4
+ class Dsl
5
+
6
+ ##
7
+ # Build a definition for a given document using DSL-style.
8
+ # DSL style is a bit easier to use than manually building a syntax tree.
9
+ def self.build(shortcode, code, name, &block)
10
+ body = DocumentBodyDSL.new(&block).tables
11
+ Builder.build(shortcode, code, name, *body)
12
+ end
13
+
14
+ private
15
+
16
+ ##
17
+ # Syntax for DSLs in which you can define elements.
18
+ module ElementSyntax
19
+
20
+ ##
21
+ # Define an element within this block
22
+ def element(*args)
23
+ add_element(Builder::Element(*args))
24
+ end
25
+
26
+ ##
27
+ # Define a composite element within this block, using a sub-block for the sub-elements
28
+ def composite(*args, &block)
29
+ subelements = SegmentBodyDSL.new(&block).elements
30
+ add_element(Builder::Element(*(args + subelements)))
31
+ end
32
+
33
+ end
34
+
35
+ ##
36
+ # Syntax for DSLs in which you can define segments.
37
+ module SegmentSyntax
38
+
39
+ def segment(pos, type, name, requirement, repeat, &block)
40
+ elements = SegmentBodyDSL.new(&block).elements
41
+ segment = Builder::Segment(
42
+ pos,
43
+ type,
44
+ name,
45
+ requirement,
46
+ repeat,
47
+ *elements
48
+ )
49
+
50
+ add_segment(segment)
51
+ end
52
+
53
+ end
54
+
55
+ ##
56
+ # Syntax for DSLs in which you can define loops.
57
+ module LoopSyntax
58
+
59
+ ##
60
+ # Define a loop within this block.
61
+ # The underscore is there because "loop" is a ruby keyword.
62
+ def loop_(name, repeat, &block)
63
+ body = LoopBodyDSL.new(&block).elements
64
+ add_loop(Schema::LoopDef.build(name, repeat, *body))
65
+ end
66
+
67
+ end
68
+
69
+ ##
70
+ # Syntax for DSLs in which you can define tables.
71
+ module TableSyntax
72
+
73
+ ##
74
+ # Define a header table within this block.
75
+ def table_header(name, &block)
76
+ add_table(Schema::TableDef.header(name, *get_table_contents(&block)))
77
+ end
78
+
79
+ ##
80
+ # Define a detail table within this block
81
+ def table_detail(name, &block)
82
+ add_table(Schema::TableDef.detail(name, *get_table_contents(&block)))
83
+ end
84
+
85
+ ##
86
+ # Helper method to get the body of a table.
87
+ def get_table_contents(&block)
88
+ TableBodyDSL.new(&block).elements
89
+ end
90
+
91
+ end
92
+
93
+ ##
94
+ # Syntax for DSLs in which you can define values lists.
95
+ module ValuesSyntax
96
+
97
+ def values(*args)
98
+ Builder::Values(*args)
99
+ end
100
+
101
+ end
102
+
103
+ ##
104
+ # A DSL for the body of a loop, which allows defining loops and segments
105
+ class LoopBodyDSL
106
+
107
+ include LoopSyntax
108
+ include SegmentSyntax
109
+
110
+ def initialize(&block)
111
+ @elements = []
112
+ instance_eval(&block)
113
+ end
114
+
115
+ attr_accessor :elements
116
+
117
+ def add_loop(loop_)
118
+ elements << loop_
119
+ end
120
+
121
+ def add_segment(segment)
122
+ elements << segment
123
+ end
124
+
125
+ end
126
+
127
+ ##
128
+ # A DSL for the body of a segment, which allows defining elements and using
129
+ # values lists.
130
+ class SegmentBodyDSL
131
+
132
+ include ElementSyntax
133
+ include ValuesSyntax
134
+
135
+ def initialize(&block)
136
+ @elements = []
137
+ instance_eval(&block)
138
+ end
139
+
140
+ def add_element(e)
141
+ @elements << e
142
+ end
143
+
144
+ attr_accessor :elements
145
+ end
146
+
147
+ ##
148
+ # A DSL for the body of a table, which allows defining segments and loops.
149
+ class TableBodyDSL
150
+
151
+ include LoopSyntax
152
+ include SegmentSyntax
153
+
154
+ def initialize(&block)
155
+ @elements = []
156
+ instance_eval(&block)
157
+ end
158
+
159
+ def add_loop(l)
160
+ @elements << l
161
+ end
162
+
163
+ def add_segment(segment)
164
+ @elements << segment
165
+ end
166
+
167
+ attr_accessor :elements
168
+ end
169
+
170
+ ##
171
+ # A DSL for the body of a document, which allows defining tables.
172
+ class DocumentBodyDSL
173
+
174
+ include TableSyntax
175
+
176
+ def initialize(&block)
177
+ @tables = []
178
+ instance_eval(&block)
179
+ end
180
+
181
+ attr_accessor :tables
182
+
183
+ def add_table(table)
184
+ tables << table
185
+ end
186
+
187
+ end
188
+
189
+ end
190
+ end
191
+ end
192
+ end
@@ -17,8 +17,6 @@ module Stupidedi
17
17
 
18
18
  def_delegators :@usage, :definition, :descriptor
19
19
 
20
- def_delegators "@children.head", :position
21
-
22
20
  def initialize(children, usage)
23
21
  @children, @usage =
24
22
  children, usage
@@ -31,6 +29,15 @@ module Stupidedi
31
29
  changes.fetch(:usage, @usage)
32
30
  end
33
31
 
32
+ def position
33
+ if @children.present?
34
+ @children.head.position
35
+ else
36
+ # GH-194
37
+ "<position unknown>"
38
+ end
39
+ end
40
+
34
41
  # @return false
35
42
  def leaf?
36
43
  false
@@ -86,7 +86,7 @@ module Stupidedi
86
86
 
87
87
  # @return [Boolean]
88
88
  def ==(other)
89
- eql?(other)
89
+ eql?(other) or \
90
90
  (other.definition == definition and
91
91
  other.children == @children)
92
92
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Stupidedi
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.1"
4
4
  end
@@ -64,11 +64,15 @@ module Stupidedi
64
64
  s::CodeList.build(
65
65
  "03" => "Dependent",
66
66
  "13" => "Contracted Service Provider",
67
+ "17" => "Consultant's Office",
68
+ "1E" => "Health Maintenance Organization (HMO)",
67
69
  "1G" => "Oncology Center",
70
+ "1H" => "Kidney Dialysis Unit",
68
71
  "1I" => "Preferred Provider Organization (PPO)",
69
72
  "1O" => "Acute Care Hospital",
70
73
  "1P" => "Provider",
71
74
  "1Q" => "Military Facility",
75
+ "1R" => "University, College or School",
72
76
  "1S" => "Outpatient Surgicenter",
73
77
  "1T" => "Physician, Clinic or Group Practice",
74
78
  "1U" => "Long Term Care Facility",
@@ -77,17 +81,21 @@ module Stupidedi
77
81
  "1X" => "Laboratory",
78
82
  "1Y" => "Retail Pharmacy",
79
83
  "1Z" => "Home Health Care",
84
+ "28" => "Subcontractor",
80
85
  "2A" => "Federal, State, County or City Facility",
81
86
  "2B" => "Third-Party Administrator",
82
87
  "2D" => "Miscellaneous Health Care Facility",
83
88
  "2E" => "Non-Health Care Miscellaneous Facility",
84
89
  "2I" => "Church Operated Facility",
90
+ "2K" => "Partnership",
85
91
  "2J" => "Individial",
86
92
  "2P" => "Public Health Service Facility",
93
+ "2Q" => "Veterans Aadministration Facility",
87
94
  "2S" => "Public Health Service Indian Service Facility",
88
95
  "2T" => "Department of Justice Facility",
89
96
  "2Y" => "General Medical and Surgical Facility",
90
97
  "2Z" => "Hospital Unit of an Institution (Prison Hospital, College Infirmary, etc.)",
98
+ "30" => "Service Supplier",
91
99
  "31" => "Postal Mailing Address",
92
100
  "36" => "Employer",
93
101
  "3A" => "Hospital Unit Within an Institution for the Mentally Retarded",
@@ -111,31 +119,94 @@ module Stupidedi
111
119
  "3S" => "Institution for Mental Retardation",
112
120
  "3T" => "Alcoholism and Other Chemical Dependency Facility",
113
121
  "3U" => "General Inpatient Care for AIDS/ARC Facility",
122
+ "3V" => "AIDS/ARC Unit",
123
+ "3W" => "Specialized Outpatient Program for AIDS/ARC",
124
+ "3X" => "Alcohol/Drug Abuse or Dependency Inpatient Unit",
125
+ "3Y" => "Alcohol/Drug Abuse or Dependency Outpatient Services",
114
126
  "3Z" => "Arthritis Treatment Center",
115
127
  "40" => "Receiver",
116
128
  "41" => "Submitter",
129
+ "43" => "Claimant Authorized Representative",
130
+ "44" => "Data Processing Service Bureau",
117
131
  "45" => "Drop-off Location",
132
+ "4A" => "Birthing Room/LDRP Room",
133
+ "4B" => "Burn Care Unit",
118
134
  "4C" => "Cardiac Catherization Labratory",
119
135
  "4D" => "Open-Heart Surgery Facility",
136
+ "4E" => "Cardiac Intensive Car Unit",
120
137
  "4F" => "Angioplasty Facility",
121
138
  "4G" => "Chronic Obstructive Pulmonary Disease Service Facility",
139
+ "4H" => "Emergency Department",
122
140
  "4I" => "Trauma Center (Certified)",
141
+ "4J" => "Extracorporeal Shock-Wave Lithotripter (ESWL) Unit",
123
142
  "4K" => "Fitness Center",
124
143
  "4L" => "Genetic Counseling/Screening Services",
125
144
  "4M" => "Adult Day Care Program Facility",
145
+ "4N" => "Alzheimer's Diagnostic/assessment Service",
126
146
  "4O" => "Comprehensive Geriatric Assessment Facility",
147
+ "4P" => "Emergency Response (Geriatric) Unit",
148
+ "4Q" => "Geriatric Acute Care Unit",
127
149
  "4R" => "Geriatric Clinics",
128
150
  "4S" => "Respite Care Facility",
151
+ "4U" => "Patient Education Unit",
129
152
  "4V" => "Community Health Promotion Facility",
130
153
  "4W" => "Worksite Health Promotion Facility",
131
154
  "4X" => "Hemodialysis Facility",
155
+ "4Y" => "Home Health Services",
156
+ "4Z" => "Hospice",
157
+ # yes, the lack of commas are in the document
158
+ # yes, this makes me very sad
159
+ "5A" => "Medical Surgical or Other Intensive Care Unit",
132
160
  "5B" => "Hisopathology Laboratory",
161
+ "5C" => "Blood Bank",
162
+ "5D" => "Neonatal Intensive Care Unit",
163
+ "5E" => "Obstetrics Unit",
164
+ "5F" => "Occupational Health Services",
165
+ "5G" => "Organized Outpatient Services",
166
+ "5H" => "Pediatric Acute Inpatient Unit",
167
+ "5I" => "Psychiatric Child/Adolescent Services",
168
+ "5J" => "Psychiatric Consultation-Liaison Services",
169
+ "5K" => "Psychiatric Education Services",
170
+ "5L" => "Psychiatric Emergency Services",
171
+ "5M" => "Psychiatric Geriatric Services",
172
+ "5N" => "Psychiatric Inpatient Unit",
173
+ "5O" => "Psychiatric Outpatient Services",
174
+ "5P" => "Psychiatric Partial Hospitalization Program",
175
+ "5Q" => "Megavoltage Radiation Therapy Unit",
176
+ "5R" => "Radioactive Implants Unit",
133
177
  "5S" => "Therapeutic Radioisotope Facility",
178
+ "5T" => "X-Ray Radiation Therapy Unit",
179
+ "5U" => "CT Scanner Unit",
134
180
  "5V" => "Diagnostic Radioisotope Facility",
135
181
  "5W" => "Magnetic Resonance Imaging (MRI) Facility",
182
+ "5X" => "Ultrasound Unit",
183
+ "5Y" => "Rehabilitation Inpatient Unit",
184
+ "5Z" => "Rehabilitation Outpatient Services",
185
+ "61" => "Performed At",
136
186
  "62" => "Applicant's Employer",
187
+ "6A" => "Reproductive Health Services",
188
+ "6B" => "Skilled Nursing or Other Long-Term Care Unit",
189
+ "6C" => "Single Photon Emission Computerized Tomography (SPECT) Unit",
190
+ "6D" => "Organized Social Work Service Facility",
191
+ "6E" => "Outpatient Social Work Services",
192
+ "6F" => "Emergency Department Social Work Services",
193
+ "6G" => "Sports Medicine Clinic/Services",
194
+ "6H" => "Hospital Auxiliary Unit",
195
+ "6I" => "Patient Representative Services",
196
+ "6J" => "Volunteer Services Department",
197
+ "6K" => "Putpatient Surgery Services",
198
+ "6L" => "Organ/Tissue Transplant Unit",
137
199
  "6M" => "Orthopedic Surgery Facility",
200
+ "6N" => "Occupational Therapy Services",
201
+ "6O" => "Physical Therapy Services",
202
+ "6P" => "Recreational Therapy Services",
203
+ "6Q" => "Respiratory Therapy Services",
204
+ "6R" => "Speech Therapy Services",
205
+ "6S" => "Women's Health Center/Services",
138
206
  "6U" => "Cardiac Rehabilitation Program Facility",
207
+ "6V" => "non-Invasive Cardiac Assessment Services",
208
+ "6W" => "Emergency Medical Technician",
209
+ "6X" => "Disciplinary Contact",
139
210
  "6Y" => "Case Manager",
140
211
  "70" => "Prior Incorrect Insured",
141
212
  "71" => "Attending Physician",
@@ -144,37 +215,60 @@ module Stupidedi
144
215
  "74" => "Corrected Insured",
145
216
  "75" => "Participant",
146
217
  "77" => "Service Location",
218
+ "7C" => "Place of Occurence",
147
219
  "7O" => "Federally Chartered Facility",
148
220
  "80" => "Hospital",
149
221
  "82" => "Rendering Provider",
222
+ "84" => "Subscriber's Employer",
150
223
  "85" => "Billing Provider",
151
224
  "87" => "Pay-to Provider",
152
225
  "8B" => "Primary Residence",
226
+ "95" => "Research Institute",
153
227
  "98" => "Receiver",
154
228
  "9K" => "Key Person",
155
229
  "AG" => "Agent/Agency",
156
230
  "AY" => "Clearinghouse",
157
231
  "BO" => "Broker or Sales Office",
232
+ "CK" => "Pharmacist",
233
+ "CZ" => "Admitting Surgeon",
158
234
  "D0" => "Admitting Physician",
235
+ "D2" => "Commerical Insurer",
159
236
  "DD" => "Assistant Surgeon",
237
+ "DJ" => "Consulting Physician",
160
238
  "DK" => "Ordering Physician",
161
239
  "DN" => "Referring Provider",
162
240
  "DQ" => "Supervising Physician",
241
+ "DO" => "Dependent Name",
242
+ "DQ" => "Supervising Physician",
243
+ # RESTART HERE
163
244
  "E1" => "Person or Other Entity Legally Responsible for a Child",
245
+ "E2" => "Person or Other Entity With Whom a Child Resides",
246
+ "E7" => "Previous Employer",
247
+ "E9" => "Participating Laboratory",
164
248
  "EI" => "Executor of Estate",
165
249
  "EXS" => "Ex-spouse",
166
250
  "EY" => "@todo",
167
251
  "FA" => "Facility",
252
+ "FD" => "Physical Address",
253
+ "FE" => "Mail Address",
168
254
  "FS" => "Final Scheduled Destination",
255
+ "G0" => "Dependent Insured",
169
256
  "G3" => "Clinic",
170
257
  "GB" => "Other Insured",
258
+ "GD" => "Guardian",
259
+ "GI" => "Paramedic",
260
+ "GJ" => "Paramedical Company",
261
+ "GK" => "Previous Insured",
262
+ "GM" => "Spouse Insured",
171
263
  "GP" => "Gateway Provider",
172
264
  "GD" => "Guardian",
173
265
  "GW" => "Group",
266
+ "GY" => "Treatment Facility",
174
267
  "HF" => "Healthcare Professional Shortage Area (HPSA) Facility",
175
268
  "HH" => "Home Health Agency",
176
269
  "HK" => "Subscriber",
177
270
  "I3" => "Independent Physicians Association (IPA)",
271
+ "IJ" => "Injection Point",
178
272
  "IL" => "Insured or Subscriber",
179
273
  "IN" => "Insurer",
180
274
  "J6" => "Power of Attorney",
@@ -183,36 +277,57 @@ module Stupidedi
183
277
  "LR" => "Legal Representative",
184
278
  "M5" => "Migrant Health Clinic",
185
279
  "M8" => "Educational Institution",
280
+ "MR" => "Medical INsurance Carrier",
186
281
  "MSC" => "Mammography Screening Center",
187
282
  "ND" => "Next Destination",
188
283
  "O4" => "Factor",
284
+ "OB" => "Ordered By",
189
285
  "OC" => "Origin Carrier",
190
286
  "OD" => "Doctor of Optometry",
191
287
  "OOP" => "Other Operating Physician",
192
288
  "OX" => "Oxygen Therapy Facility",
193
289
  "P0" => "Patient Facility",
290
+ "P2" => "Primary Insured or Subscriber",
194
291
  "P3" => "Primary Care Provider",
195
292
  "P4" => "Prior Insurance Carrier",
196
293
  "P5" => "Plan Sponsor",
294
+ "P6" => "Third Party Reviewing Preferred Provider Organization (PPO)",
295
+ "P7" => "Third Party Reviewing Preferred Provider Organization (PPO)",
197
296
  "PE" => "Payee",
297
+ "PT" => "Party to Receive Test Report",
198
298
  "PTP" => "Pay-to Plan Name",
199
299
  "PR" => "Payer",
200
300
  "PRP" => "Primary Payer",
301
+ "PV" => "Party performing certification",
201
302
  "PW" => "Pickup Address",
202
303
  "QA" => "Pharmacy",
203
304
  "QB" => "Purchase Service Provider",
204
305
  "QC" => "Patient",
205
306
  "QD" => "Responsible Party",
307
+ "QE" => "Policyholder",
308
+ "QH" => "Physician",
309
+ "QK" => "Managed Care",
310
+ "QL" => "Chiropractor",
206
311
  "QN" => "Dentist",
207
312
  "QM" => "Dialysis Centers",
313
+ "QO" => "Doctor of Osteopathy",
314
+ "QS" => "Podiatrist",
208
315
  "QV" => "Group Practice",
316
+ "QY" => "Medical Doctor",
209
317
  "R3" => "Next Scheduled Destination",
318
+ "RC" => "Receiving Location",
319
+ "RW" => "Rural Health Clinic",
210
320
  "S1" => "Parent",
211
321
  "S3" => "Custodial Parent",
322
+ "S4" => "Skilled Nursing Facility",
212
323
  "SEP" => "Secondary Payer",
213
324
  "SJ" => "Service Provider",
325
+ "SU" => "Suppplier/Manufacturer",
326
+ # Used to identify the geographic location where a patient is transferred or diverted
327
+ "T4" => "Transfer Point",
214
328
  "TL" => "Testing Laboratory",
215
329
  "TP" => "Primary Taxpayer",
330
+ "TQ" => "Third Party Reviewing Organization (TPO)",
216
331
  "TT" => "Transfer To",
217
332
  "TTP" => "Tertiary Payer",
218
333
  "TU" => "Third Party Repricing Organization (TPO)",
@@ -371,6 +486,7 @@ module Stupidedi
371
486
  "T4" => "Signal Code",
372
487
  "TJ" => "Federal Taxpayer's Identification Number",
373
488
  "TV" => s::CodeList.external("224"),
489
+ "VV" => "Voucher",
374
490
  "VY" => "Link Sequence Number",
375
491
  "Y4" => "Agency Claim Number",
376
492
  "WH" => "Master Reference (Link) Number",
@@ -1477,7 +1593,58 @@ module Stupidedi
1477
1593
  "I12" => "Implementation Pattern Match Failure",
1478
1594
  "I13" => "Implementation Dependent 'Not Used' Data Element Present"))
1479
1595
  E623 = t::ID.new(:E623 , "Time Code" , 2, 2,
1480
- s::CodeList.external("94"))
1596
+ s::CodeList.build(
1597
+ "01" => "Equivalent to ISO P01",
1598
+ "02" => "Equivalent to ISO P02",
1599
+ "03" => "Equivalent to ISO P03",
1600
+ "04" => "Equivalent to ISO P04",
1601
+ "05" => "Equivalent to ISO P05",
1602
+ "06" => "Equivalent to ISO P06",
1603
+ "07" => "Equivalent to ISO P07",
1604
+ "08" => "Equivalent to ISO P08",
1605
+ "09" => "Equivalent to ISO P09",
1606
+ "10" => "Equivalent to ISO P10",
1607
+ "11" => "Equivalent to ISO P11",
1608
+ "12" => "Equivalent to ISO P12",
1609
+ "13" => "Equivalent to ISO M12",
1610
+ "14" => "Equivalent to ISO M11",
1611
+ "15" => "Equivalent to ISO M10",
1612
+ "16" => "Equivalent to ISO M09",
1613
+ "17" => "Equivalent to ISO M08",
1614
+ "18" => "Equivalent to ISO M07",
1615
+ "19" => "Equivalent to ISO M06",
1616
+ "20" => "Equivalent to ISO M05",
1617
+ "21" => "Equivalent to ISO M04",
1618
+ "22" => "Equivalent to ISO M03",
1619
+ "23" => "Equivalent to ISO M02",
1620
+ "24" => "Equivalent to ISO M01",
1621
+ "AD" => "Alaska Daylight Time",
1622
+ "AS" => "Alaska Standard Time",
1623
+ "AT" => "Alaska Time",
1624
+ "CD" => "Central Daylight Time",
1625
+ "CS" => "Central Standard Time",
1626
+ "CT" => "Central Time",
1627
+ "ED" => "Eastern Daylight Time",
1628
+ "ES" => "Eastern Standard Time",
1629
+ "ET" => "Eastern Time",
1630
+ "GM" => "Greenwich Mean Time",
1631
+ "HD" => "Hawaii-Aleutian Daylight Time",
1632
+ "HS" => "Hawaii-Aleutian Standard Time",
1633
+ "HT" => "Hawaii-Aleutian Time",
1634
+ "LT" => "Local Time",
1635
+ "MD" => "Mountain Daylight Time",
1636
+ "MS" => "Mountain Standard Time",
1637
+ "MT" => "Mountain Time",
1638
+ "ND" => "Newfoundland Daylight Time",
1639
+ "NS" => "Newfoundland Standard Time",
1640
+ "NT" => "Newfoundland Time",
1641
+ "PD" => "Pacific Daylight Time",
1642
+ "PS" => "Pacific Standard Time",
1643
+ "PT" => "Pacific Time",
1644
+ "TD" => "Atlantic Daylight Time",
1645
+ "TS" => "Atlantic Standard Time",
1646
+ "TT" => "Atlantic Time",
1647
+ "UT" => "Universal Time Coordinate"))
1481
1648
  E628 = t::AN.new(:E628 , "Hierachical ID Number" , 1, 12)
1482
1649
  E639 = t::ID.new(:E639 , "Basis of Unit Price Code" , 2, 2)
1483
1650
  E640 = t::ID.new(:E640 , "Transaction Type Code" , 2, 2,