hippo 0.0.4

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.
Files changed (203) hide show
  1. data/.gitignore +6 -0
  2. data/CHANGELOG +9 -0
  3. data/Gemfile +11 -0
  4. data/Guardfile +14 -0
  5. data/README.md +227 -0
  6. data/Rakefile +12 -0
  7. data/bin/demo_270.rb +280 -0
  8. data/bin/demo_276.rb +296 -0
  9. data/bin/demo_835.rb +170 -0
  10. data/hippo.gemspec +24 -0
  11. data/lib/hippo/exceptions.rb +8 -0
  12. data/lib/hippo/field.rb +6 -0
  13. data/lib/hippo/loop.rb +0 -0
  14. data/lib/hippo/parser.rb +92 -0
  15. data/lib/hippo/samples/835.edi +88 -0
  16. data/lib/hippo/samples/sample_835_with.rb +272 -0
  17. data/lib/hippo/samples/sample_parsed.rb +1162 -0
  18. data/lib/hippo/segments/AK1.rb +32 -0
  19. data/lib/hippo/segments/AK2.rb +31 -0
  20. data/lib/hippo/segments/AK9.rb +82 -0
  21. data/lib/hippo/segments/AMT.rb +31 -0
  22. data/lib/hippo/segments/BHT.rb +55 -0
  23. data/lib/hippo/segments/BPR.rb +175 -0
  24. data/lib/hippo/segments/CAS.rb +159 -0
  25. data/lib/hippo/segments/CL1.rb +39 -0
  26. data/lib/hippo/segments/CLM.rb +223 -0
  27. data/lib/hippo/segments/CLP.rb +119 -0
  28. data/lib/hippo/segments/CN1.rb +55 -0
  29. data/lib/hippo/segments/CR1.rb +87 -0
  30. data/lib/hippo/segments/CR2.rb +104 -0
  31. data/lib/hippo/segments/CR3.rb +47 -0
  32. data/lib/hippo/segments/CR4.rb +239 -0
  33. data/lib/hippo/segments/CR5.rb +151 -0
  34. data/lib/hippo/segments/CR6.rb +175 -0
  35. data/lib/hippo/segments/CR7.rb +33 -0
  36. data/lib/hippo/segments/CR8.rb +79 -0
  37. data/lib/hippo/segments/CRC.rb +63 -0
  38. data/lib/hippo/segments/CTP.rb +212 -0
  39. data/lib/hippo/segments/CTX.rb +105 -0
  40. data/lib/hippo/segments/CUR.rb +175 -0
  41. data/lib/hippo/segments/DMG.rb +115 -0
  42. data/lib/hippo/segments/DN1.rb +39 -0
  43. data/lib/hippo/segments/DN2.rb +55 -0
  44. data/lib/hippo/segments/DSB.rb +71 -0
  45. data/lib/hippo/segments/DTM.rb +55 -0
  46. data/lib/hippo/segments/DTP.rb +31 -0
  47. data/lib/hippo/segments/FRM.rb +47 -0
  48. data/lib/hippo/segments/GE.rb +19 -0
  49. data/lib/hippo/segments/GS.rb +52 -0
  50. data/lib/hippo/segments/HCP.rb +127 -0
  51. data/lib/hippo/segments/HI.rb +919 -0
  52. data/lib/hippo/segments/HL.rb +44 -0
  53. data/lib/hippo/segments/HSD.rb +72 -0
  54. data/lib/hippo/segments/IEA.rb +19 -0
  55. data/lib/hippo/segments/IK3.rb +40 -0
  56. data/lib/hippo/segments/IK4.rb +63 -0
  57. data/lib/hippo/segments/IK5.rb +55 -0
  58. data/lib/hippo/segments/IMM.rb +55 -0
  59. data/lib/hippo/segments/ISA.rb +95 -0
  60. data/lib/hippo/segments/K3.rb +147 -0
  61. data/lib/hippo/segments/LIN.rb +255 -0
  62. data/lib/hippo/segments/LQ.rb +23 -0
  63. data/lib/hippo/segments/LX.rb +21 -0
  64. data/lib/hippo/segments/MEA.rb +219 -0
  65. data/lib/hippo/segments/MIA.rb +199 -0
  66. data/lib/hippo/segments/MOA.rb +79 -0
  67. data/lib/hippo/segments/N1.rb +55 -0
  68. data/lib/hippo/segments/N2.rb +23 -0
  69. data/lib/hippo/segments/N3.rb +23 -0
  70. data/lib/hippo/segments/N4.rb +63 -0
  71. data/lib/hippo/segments/NM1.rb +103 -0
  72. data/lib/hippo/segments/NTE.rb +23 -0
  73. data/lib/hippo/segments/OI.rb +55 -0
  74. data/lib/hippo/segments/PAT.rb +79 -0
  75. data/lib/hippo/segments/PER.rb +79 -0
  76. data/lib/hippo/segments/PLB.rb +191 -0
  77. data/lib/hippo/segments/PRV.rb +75 -0
  78. data/lib/hippo/segments/PS1.rb +31 -0
  79. data/lib/hippo/segments/PWK.rb +116 -0
  80. data/lib/hippo/segments/QTY.rb +155 -0
  81. data/lib/hippo/segments/RDM.rb +135 -0
  82. data/lib/hippo/segments/REF.rb +83 -0
  83. data/lib/hippo/segments/SBR.rb +79 -0
  84. data/lib/hippo/segments/SE.rb +24 -0
  85. data/lib/hippo/segments/ST.rb +31 -0
  86. data/lib/hippo/segments/STC.rb +187 -0
  87. data/lib/hippo/segments/SV1.rb +267 -0
  88. data/lib/hippo/segments/SV2.rb +147 -0
  89. data/lib/hippo/segments/SV3.rb +223 -0
  90. data/lib/hippo/segments/SV4.rb +211 -0
  91. data/lib/hippo/segments/SV5.rb +123 -0
  92. data/lib/hippo/segments/SV6.rb +155 -0
  93. data/lib/hippo/segments/SV7.rb +55 -0
  94. data/lib/hippo/segments/SVC.rb +183 -0
  95. data/lib/hippo/segments/SVD.rb +116 -0
  96. data/lib/hippo/segments/TOO.rb +67 -0
  97. data/lib/hippo/segments/TRN.rb +39 -0
  98. data/lib/hippo/segments/TS2.rb +159 -0
  99. data/lib/hippo/segments/TS3.rb +199 -0
  100. data/lib/hippo/segments/UR.rb +23 -0
  101. data/lib/hippo/segments/base.rb +148 -0
  102. data/lib/hippo/segments.rb +85 -0
  103. data/lib/hippo/transaction_sets/HIPAA_276/L2000A.rb +28 -0
  104. data/lib/hippo/transaction_sets/HIPAA_276/L2000B.rb +28 -0
  105. data/lib/hippo/transaction_sets/HIPAA_276/L2000C.rb +28 -0
  106. data/lib/hippo/transaction_sets/HIPAA_276/L2000D.rb +45 -0
  107. data/lib/hippo/transaction_sets/HIPAA_276/L2000E.rb +45 -0
  108. data/lib/hippo/transaction_sets/HIPAA_276/L2100A.rb +20 -0
  109. data/lib/hippo/transaction_sets/HIPAA_276/L2100B.rb +20 -0
  110. data/lib/hippo/transaction_sets/HIPAA_276/L2100C.rb +19 -0
  111. data/lib/hippo/transaction_sets/HIPAA_276/L2100D.rb +19 -0
  112. data/lib/hippo/transaction_sets/HIPAA_276/L2100E.rb +20 -0
  113. data/lib/hippo/transaction_sets/HIPAA_276/L2200D.rb +116 -0
  114. data/lib/hippo/transaction_sets/HIPAA_276/L2200E.rb +116 -0
  115. data/lib/hippo/transaction_sets/HIPAA_276/L2210D.rb +36 -0
  116. data/lib/hippo/transaction_sets/HIPAA_276/L2210E.rb +36 -0
  117. data/lib/hippo/transaction_sets/HIPAA_276/base.rb +86 -0
  118. data/lib/hippo/transaction_sets/HIPAA_276.rb +21 -0
  119. data/lib/hippo/transaction_sets/HIPAA_277/L2000A.rb +35 -0
  120. data/lib/hippo/transaction_sets/HIPAA_277/L2000B.rb +35 -0
  121. data/lib/hippo/transaction_sets/HIPAA_277/L2000C.rb +35 -0
  122. data/lib/hippo/transaction_sets/HIPAA_277/L2000D.rb +35 -0
  123. data/lib/hippo/transaction_sets/HIPAA_277/L2000E.rb +35 -0
  124. data/lib/hippo/transaction_sets/HIPAA_277/L2100A.rb +19 -0
  125. data/lib/hippo/transaction_sets/HIPAA_277/L2100B.rb +20 -0
  126. data/lib/hippo/transaction_sets/HIPAA_277/L2100C.rb +19 -0
  127. data/lib/hippo/transaction_sets/HIPAA_277/L2100D.rb +20 -0
  128. data/lib/hippo/transaction_sets/HIPAA_277/L2100E.rb +20 -0
  129. data/lib/hippo/transaction_sets/HIPAA_277/L2200A.rb +41 -0
  130. data/lib/hippo/transaction_sets/HIPAA_277/L2200B.rb +66 -0
  131. data/lib/hippo/transaction_sets/HIPAA_277/L2200C.rb +73 -0
  132. data/lib/hippo/transaction_sets/HIPAA_277/L2200D.rb +73 -0
  133. data/lib/hippo/transaction_sets/HIPAA_277/L2200E.rb +103 -0
  134. data/lib/hippo/transaction_sets/HIPAA_277/L2220D.rb +56 -0
  135. data/lib/hippo/transaction_sets/HIPAA_277/L2220E.rb +43 -0
  136. data/lib/hippo/transaction_sets/HIPAA_277/base.rb +77 -0
  137. data/lib/hippo/transaction_sets/HIPAA_277.rb +24 -0
  138. data/lib/hippo/transaction_sets/HIPAA_835/L1000A.rb +71 -0
  139. data/lib/hippo/transaction_sets/HIPAA_835/L1000B.rb +47 -0
  140. data/lib/hippo/transaction_sets/HIPAA_835/L2000.rb +37 -0
  141. data/lib/hippo/transaction_sets/HIPAA_835/L2100.rb +182 -0
  142. data/lib/hippo/transaction_sets/HIPAA_835/L2110.rb +85 -0
  143. data/lib/hippo/transaction_sets/HIPAA_835/base.rb +112 -0
  144. data/lib/hippo/transaction_sets/HIPAA_835.rb +12 -0
  145. data/lib/hippo/transaction_sets/HIPAA_837/L1000A.rb +30 -0
  146. data/lib/hippo/transaction_sets/HIPAA_837/L1000B.rb +21 -0
  147. data/lib/hippo/transaction_sets/HIPAA_837/L2000A.rb +65 -0
  148. data/lib/hippo/transaction_sets/HIPAA_837/L2000B.rb +49 -0
  149. data/lib/hippo/transaction_sets/HIPAA_837/L2000C.rb +42 -0
  150. data/lib/hippo/transaction_sets/HIPAA_837/L2010AA.rb +57 -0
  151. data/lib/hippo/transaction_sets/HIPAA_837/L2010AB.rb +33 -0
  152. data/lib/hippo/transaction_sets/HIPAA_837/L2010AC.rb +51 -0
  153. data/lib/hippo/transaction_sets/HIPAA_837/L2010BA.rb +74 -0
  154. data/lib/hippo/transaction_sets/HIPAA_837/L2010BB.rb +48 -0
  155. data/lib/hippo/transaction_sets/HIPAA_837/L2010CA.rb +72 -0
  156. data/lib/hippo/transaction_sets/HIPAA_837/L2300.rb +510 -0
  157. data/lib/hippo/transaction_sets/HIPAA_837/L2310A.rb +26 -0
  158. data/lib/hippo/transaction_sets/HIPAA_837/L2310B.rb +37 -0
  159. data/lib/hippo/transaction_sets/HIPAA_837/L2310C.rb +52 -0
  160. data/lib/hippo/transaction_sets/HIPAA_837/L2310D.rb +27 -0
  161. data/lib/hippo/transaction_sets/HIPAA_837/L2310E.rb +34 -0
  162. data/lib/hippo/transaction_sets/HIPAA_837/L2310F.rb +34 -0
  163. data/lib/hippo/transaction_sets/HIPAA_837/L2320.rb +122 -0
  164. data/lib/hippo/transaction_sets/HIPAA_837/L2330A.rb +43 -0
  165. data/lib/hippo/transaction_sets/HIPAA_837/L2330B.rb +92 -0
  166. data/lib/hippo/transaction_sets/HIPAA_837/L2330C.rb +26 -0
  167. data/lib/hippo/transaction_sets/HIPAA_837/L2330D.rb +26 -0
  168. data/lib/hippo/transaction_sets/HIPAA_837/L2330E.rb +27 -0
  169. data/lib/hippo/transaction_sets/HIPAA_837/L2330F.rb +27 -0
  170. data/lib/hippo/transaction_sets/HIPAA_837/L2330G.rb +26 -0
  171. data/lib/hippo/transaction_sets/HIPAA_837/L2400.rb +475 -0
  172. data/lib/hippo/transaction_sets/HIPAA_837/L2410.rb +30 -0
  173. data/lib/hippo/transaction_sets/HIPAA_837/L2420A.rb +37 -0
  174. data/lib/hippo/transaction_sets/HIPAA_837/L2420B.rb +26 -0
  175. data/lib/hippo/transaction_sets/HIPAA_837/L2420C.rb +41 -0
  176. data/lib/hippo/transaction_sets/HIPAA_837/L2420D.rb +27 -0
  177. data/lib/hippo/transaction_sets/HIPAA_837/L2420E.rb +51 -0
  178. data/lib/hippo/transaction_sets/HIPAA_837/L2420F.rb +26 -0
  179. data/lib/hippo/transaction_sets/HIPAA_837/L2420G.rb +34 -0
  180. data/lib/hippo/transaction_sets/HIPAA_837/L2420H.rb +34 -0
  181. data/lib/hippo/transaction_sets/HIPAA_837/L2430.rb +44 -0
  182. data/lib/hippo/transaction_sets/HIPAA_837/L2440.rb +23 -0
  183. data/lib/hippo/transaction_sets/HIPAA_837/base.rb +81 -0
  184. data/lib/hippo/transaction_sets/HIPAA_837.rb +45 -0
  185. data/lib/hippo/transaction_sets/HIPAA_999/L2000 - AK2.rb +30 -0
  186. data/lib/hippo/transaction_sets/HIPAA_999/L2000AK2.rb +30 -0
  187. data/lib/hippo/transaction_sets/HIPAA_999/L2100 - AK2.rb +37 -0
  188. data/lib/hippo/transaction_sets/HIPAA_999/L2100AK2.rb +37 -0
  189. data/lib/hippo/transaction_sets/HIPAA_999/L2110 - AK2.rb +23 -0
  190. data/lib/hippo/transaction_sets/HIPAA_999/L2110AK2.rb +23 -0
  191. data/lib/hippo/transaction_sets/HIPAA_999/base.rb +46 -0
  192. data/lib/hippo/transaction_sets/HIPAA_999.rb +10 -0
  193. data/lib/hippo/transaction_sets/base.rb +136 -0
  194. data/lib/hippo/transaction_sets.rb +11 -0
  195. data/lib/hippo/version.rb +3 -0
  196. data/lib/hippo.rb +15 -0
  197. data/samples/835_4010.edi +1 -0
  198. data/samples/837_4010A1.edi +1 -0
  199. data/test/test_helper.rb +118 -0
  200. data/test/test_hipaa_837.rb +396 -0
  201. data/test/test_segments_base.rb +106 -0
  202. data/test/test_transaction_sets_base.rb +85 -0
  203. metadata +277 -0
@@ -0,0 +1,26 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ class L2420F < Hippo::TransactionSets::Base
5
+ loop_name 'L2420F' #Referring Provider Name
6
+
7
+ #Referring Provider Name
8
+ segment Hippo::Segments::NM1,
9
+ :name => 'Referring Provider Name',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 5000,
13
+ :defaults => {
14
+ 'NM102' => '1'
15
+ }
16
+
17
+ #Referring Provider Secondary Identification
18
+ segment Hippo::Segments::REF,
19
+ :name => 'Referring Provider Secondary Identification',
20
+ :minimum => 0,
21
+ :maximum => 20,
22
+ :position => 5250
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,34 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ class L2420G < Hippo::TransactionSets::Base
5
+ loop_name 'L2420G' #Ambulance Pick-up Location
6
+
7
+ #Ambulance Pick-up Location
8
+ segment Hippo::Segments::NM1,
9
+ :name => 'Ambulance Pick-up Location',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 5310,
13
+ :defaults => {
14
+ 'NM101' => 'PW',
15
+ 'NM102' => '2'
16
+ }
17
+
18
+ #Ambulance Pick-up Location Address
19
+ segment Hippo::Segments::N3,
20
+ :name => 'Ambulance Pick-up Location Address',
21
+ :minimum => 1,
22
+ :maximum => 1,
23
+ :position => 5340
24
+
25
+ #Ambulance Pick-up Location City, State, ZIP Code
26
+ segment Hippo::Segments::N4,
27
+ :name => 'Ambulance Pick-up Location City, State, ZIP Code',
28
+ :minimum => 1,
29
+ :maximum => 1,
30
+ :position => 5350
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ class L2420H < Hippo::TransactionSets::Base
5
+ loop_name 'L2420H' #Ambulance Drop-off Location
6
+
7
+ #Ambulance Drop-off Location
8
+ segment Hippo::Segments::NM1,
9
+ :name => 'Ambulance Drop-off Location',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 5380,
13
+ :defaults => {
14
+ 'NM101' => '45',
15
+ 'NM102' => '2'
16
+ }
17
+
18
+ #Ambulance Drop-off Location Address
19
+ segment Hippo::Segments::N3,
20
+ :name => 'Ambulance Drop-off Location Address',
21
+ :minimum => 1,
22
+ :maximum => 1,
23
+ :position => 5410
24
+
25
+ #Ambulance Drop-off Location City, State, ZIP Code
26
+ segment Hippo::Segments::N4,
27
+ :name => 'Ambulance Drop-off Location City, State, ZIP Code',
28
+ :minimum => 1,
29
+ :maximum => 1,
30
+ :position => 5420
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,44 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ class L2430 < Hippo::TransactionSets::Base
5
+ loop_name 'L2430' #Line Adjudication Information
6
+
7
+ #Line Adjudication Information
8
+ segment Hippo::Segments::SVD,
9
+ :name => 'Line Adjudication Information',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 5400
13
+
14
+ #Line Adjustment
15
+ segment Hippo::Segments::CAS,
16
+ :name => 'Line Adjustment',
17
+ :minimum => 0,
18
+ :maximum => 5,
19
+ :position => 5450
20
+
21
+ #Line Check or Remittance Date
22
+ segment Hippo::Segments::DTP,
23
+ :name => 'Line Check or Remittance Date',
24
+ :minimum => 1,
25
+ :maximum => 1,
26
+ :position => 5500,
27
+ :defaults => {
28
+ 'DTP01' => '573',
29
+ 'DTP02' => 'D8'
30
+ }
31
+
32
+ #Remaining Patient Liability
33
+ segment Hippo::Segments::AMT,
34
+ :name => 'Remaining Patient Liability',
35
+ :minimum => 0,
36
+ :maximum => 1,
37
+ :position => 5505,
38
+ :defaults => {
39
+ 'AMT01' => 'EAF'
40
+ }
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,23 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ class L2440 < Hippo::TransactionSets::Base
5
+ loop_name 'L2440' #Form Identification Code
6
+
7
+ #Form Identification Code
8
+ segment Hippo::Segments::LQ,
9
+ :name => 'Form Identification Code',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 5510
13
+
14
+ #Supporting Documentation
15
+ segment Hippo::Segments::FRM,
16
+ :name => 'Supporting Documentation',
17
+ :minimum => 1,
18
+ :maximum => 99,
19
+ :position => 5520
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,81 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ class Base < Hippo::TransactionSets::Base
5
+
6
+ #Transaction Set Header
7
+ segment Hippo::Segments::ST,
8
+ :name => 'Transaction Set Header',
9
+ :minimum => 1,
10
+ :maximum => 1,
11
+ :position => 50,
12
+ :defaults => {
13
+ 'ST01' => '837'
14
+ }
15
+
16
+ #Beginning of Hierarchical Transaction
17
+ segment Hippo::Segments::BHT,
18
+ :name => 'Beginning of Hierarchical Transaction',
19
+ :minimum => 1,
20
+ :maximum => 1,
21
+ :position => 100,
22
+ :defaults => {
23
+ 'BHT01' => '0019'
24
+ }
25
+
26
+ #Submitter Name
27
+ loop Hippo::TransactionSets::HIPAA_837::L1000A,
28
+ :name => 'Submitter Name',
29
+ :identified_by => {'NM1.NM101' => '41'},
30
+ :minimum => 1,
31
+ :maximum => 1,
32
+ :position => 200
33
+
34
+ #Receiver Name
35
+ loop Hippo::TransactionSets::HIPAA_837::L1000B,
36
+ :name => 'Receiver Name',
37
+ :identified_by => {'NM1.NM101' => '40'},
38
+ :minimum => 1,
39
+ :maximum => 1,
40
+ :position => 500
41
+
42
+ #Billing Provider Hierarchical Level
43
+ loop Hippo::TransactionSets::HIPAA_837::L2000A,
44
+ :name => 'Billing Provider Hierarchical Level',
45
+ :identified_by => {
46
+ 'HL.HL03' => '20'
47
+ },
48
+ :minimum => 1,
49
+ :maximum => nil,
50
+ :position => 10
51
+
52
+ #Subscriber Hierarchical Level
53
+ loop Hippo::TransactionSets::HIPAA_837::L2000B,
54
+ :name => 'Subscriber Hierarchical Level',
55
+ :identified_by => {
56
+ 'HL.HL03' => '22'
57
+ },
58
+ :minimum => 1,
59
+ :maximum => nil,
60
+ :position => 10
61
+
62
+ #Patient Hierarchical Level
63
+ loop Hippo::TransactionSets::HIPAA_837::L2000C,
64
+ :name => 'Patient Hierarchical Level',
65
+ :identified_by => {
66
+ 'HL.HL03' => '23'
67
+ },
68
+ :minimum => 0,
69
+ :maximum => nil,
70
+ :position => 10
71
+
72
+ #Transaction Set Trailer
73
+ segment Hippo::Segments::SE,
74
+ :name => 'Transaction Set Trailer',
75
+ :minimum => 1,
76
+ :maximum => 1,
77
+ :position => 5550
78
+
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,45 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_837
3
+
4
+ autoload :Base, 'hippo/transaction_sets/HIPAA_837/base'
5
+ autoload :L1000A, 'hippo/transaction_sets/HIPAA_837/L1000A'
6
+ autoload :L1000B, 'hippo/transaction_sets/HIPAA_837/L1000B'
7
+ autoload :L2000A, 'hippo/transaction_sets/HIPAA_837/L2000A'
8
+ autoload :L2000B, 'hippo/transaction_sets/HIPAA_837/L2000B'
9
+ autoload :L2000C, 'hippo/transaction_sets/HIPAA_837/L2000C'
10
+ autoload :L2010AA, 'hippo/transaction_sets/HIPAA_837/L2010AA'
11
+ autoload :L2010AB, 'hippo/transaction_sets/HIPAA_837/L2010AB'
12
+ autoload :L2010AC, 'hippo/transaction_sets/HIPAA_837/L2010AC'
13
+ autoload :L2010BA, 'hippo/transaction_sets/HIPAA_837/L2010BA'
14
+ autoload :L2010BB, 'hippo/transaction_sets/HIPAA_837/L2010BB'
15
+ autoload :L2010CA, 'hippo/transaction_sets/HIPAA_837/L2010CA'
16
+ autoload :L2300, 'hippo/transaction_sets/HIPAA_837/L2300'
17
+ autoload :L2310A, 'hippo/transaction_sets/HIPAA_837/L2310A'
18
+ autoload :L2310B, 'hippo/transaction_sets/HIPAA_837/L2310B'
19
+ autoload :L2310C, 'hippo/transaction_sets/HIPAA_837/L2310C'
20
+ autoload :L2310D, 'hippo/transaction_sets/HIPAA_837/L2310D'
21
+ autoload :L2310E, 'hippo/transaction_sets/HIPAA_837/L2310E'
22
+ autoload :L2310F, 'hippo/transaction_sets/HIPAA_837/L2310F'
23
+ autoload :L2320, 'hippo/transaction_sets/HIPAA_837/L2320'
24
+ autoload :L2330A, 'hippo/transaction_sets/HIPAA_837/L2330A'
25
+ autoload :L2330B, 'hippo/transaction_sets/HIPAA_837/L2330B'
26
+ autoload :L2330C, 'hippo/transaction_sets/HIPAA_837/L2330C'
27
+ autoload :L2330D, 'hippo/transaction_sets/HIPAA_837/L2330D'
28
+ autoload :L2330E, 'hippo/transaction_sets/HIPAA_837/L2330E'
29
+ autoload :L2330F, 'hippo/transaction_sets/HIPAA_837/L2330F'
30
+ autoload :L2330G, 'hippo/transaction_sets/HIPAA_837/L2330G'
31
+ autoload :L2400, 'hippo/transaction_sets/HIPAA_837/L2400'
32
+ autoload :L2410, 'hippo/transaction_sets/HIPAA_837/L2410'
33
+ autoload :L2420A, 'hippo/transaction_sets/HIPAA_837/L2420A'
34
+ autoload :L2420B, 'hippo/transaction_sets/HIPAA_837/L2420B'
35
+ autoload :L2420C, 'hippo/transaction_sets/HIPAA_837/L2420C'
36
+ autoload :L2420D, 'hippo/transaction_sets/HIPAA_837/L2420D'
37
+ autoload :L2420E, 'hippo/transaction_sets/HIPAA_837/L2420E'
38
+ autoload :L2420F, 'hippo/transaction_sets/HIPAA_837/L2420F'
39
+ autoload :L2420G, 'hippo/transaction_sets/HIPAA_837/L2420G'
40
+ autoload :L2420H, 'hippo/transaction_sets/HIPAA_837/L2420H'
41
+ autoload :L2430, 'hippo/transaction_sets/HIPAA_837/L2430'
42
+ autoload :L2440, 'hippo/transaction_sets/HIPAA_837/L2440'
43
+
44
+ end
45
+ end
@@ -0,0 +1,30 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class L2000 - AK2 < Hippo::TransactionSets::Base
5
+ loop_name 'L2000 - AK2' #Transaction Set Response Header
6
+
7
+ #Transaction Set Response Header
8
+ segment Hippo::Segments::AK2,
9
+ :name => 'Transaction Set Response Header',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 300
13
+
14
+ #Error Identification
15
+ loop Hippo::TransactionSets::HIPAA_837::L2100 - AK2,
16
+ :name => 'Error Identification',
17
+ :minimum => 0,
18
+ :maximum => nil,
19
+ :position => 400
20
+
21
+ #Transaction Set Response Trailer
22
+ segment Hippo::Segments::IK5,
23
+ :name => 'Transaction Set Response Trailer',
24
+ :minimum => 1,
25
+ :maximum => 1,
26
+ :position => 800
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class L2000AK2 < Hippo::TransactionSets::Base
5
+ loop_name 'L2000AK2' #Transaction Set Response Header
6
+
7
+ #Transaction Set Response Header
8
+ segment Hippo::Segments::AK2,
9
+ :name => 'Transaction Set Response Header',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 300
13
+
14
+ #Error Identification
15
+ loop Hippo::TransactionSets::HIPAA_999::L2100AK2,
16
+ :name => 'Error Identification',
17
+ :minimum => 0,
18
+ :maximum => nil,
19
+ :position => 400
20
+
21
+ #Transaction Set Response Trailer
22
+ segment Hippo::Segments::IK5,
23
+ :name => 'Transaction Set Response Trailer',
24
+ :minimum => 1,
25
+ :maximum => 1,
26
+ :position => 800
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,37 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class L2100 - AK2 < Hippo::TransactionSets::Base
5
+ loop_name 'L2100 - AK2' #Error Identification
6
+
7
+ #Error Identification
8
+ segment Hippo::Segments::IK3,
9
+ :name => 'Error Identification',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 400
13
+
14
+ #Segment Context
15
+ segment Hippo::Segments::CTX,
16
+ :name => 'Segment Context',
17
+ :minimum => 0,
18
+ :maximum => 9,
19
+ :position => 500
20
+
21
+ #Business Unit Identifier
22
+ segment Hippo::Segments::CTX,
23
+ :name => 'Business Unit Identifier',
24
+ :minimum => 0,
25
+ :maximum => 1,
26
+ :position => 510
27
+
28
+ #Implementation Data Element Note
29
+ loop Hippo::TransactionSets::HIPAA_837::L2110 - AK2,
30
+ :name => 'Implementation Data Element Note',
31
+ :minimum => 0,
32
+ :maximum => nil,
33
+ :position => 600
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class L2100AK2 < Hippo::TransactionSets::Base
5
+ loop_name 'L2100AK2' #Error Identification
6
+
7
+ #Error Identification
8
+ segment Hippo::Segments::IK3,
9
+ :name => 'Error Identification',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 400
13
+
14
+ #Segment Context
15
+ segment Hippo::Segments::CTX,
16
+ :name => 'Segment Context',
17
+ :minimum => 0,
18
+ :maximum => 9,
19
+ :position => 500
20
+
21
+ #Business Unit Identifier
22
+ segment Hippo::Segments::CTX,
23
+ :name => 'Business Unit Identifier',
24
+ :minimum => 0,
25
+ :maximum => 1,
26
+ :position => 510
27
+
28
+ #Implementation Data Element Note
29
+ loop Hippo::TransactionSets::HIPAA_999::L2110AK2,
30
+ :name => 'Implementation Data Element Note',
31
+ :minimum => 0,
32
+ :maximum => nil,
33
+ :position => 600
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,23 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class L2110 - AK2 < Hippo::TransactionSets::Base
5
+ loop_name 'L2110 - AK2' #Implementation Data Element Note
6
+
7
+ #Implementation Data Element Note
8
+ segment Hippo::Segments::IK4,
9
+ :name => 'Implementation Data Element Note',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 600
13
+
14
+ #Element Context
15
+ segment Hippo::Segments::CTX,
16
+ :name => 'Element Context',
17
+ :minimum => 0,
18
+ :maximum => 10,
19
+ :position => 700
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class L2110AK2 < Hippo::TransactionSets::Base
5
+ loop_name 'L2110AK2' #Implementation Data Element Note
6
+
7
+ #Implementation Data Element Note
8
+ segment Hippo::Segments::IK4,
9
+ :name => 'Implementation Data Element Note',
10
+ :minimum => 0,
11
+ :maximum => 1,
12
+ :position => 600
13
+
14
+ #Element Context
15
+ segment Hippo::Segments::CTX,
16
+ :name => 'Element Context',
17
+ :minimum => 0,
18
+ :maximum => 10,
19
+ :position => 700
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,46 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ class Base < Hippo::TransactionSets::Base
5
+
6
+ #Transaction Set Header
7
+ segment Hippo::Segments::ST,
8
+ :name => 'Transaction Set Header',
9
+ :minimum => 1,
10
+ :maximum => 1,
11
+ :position => 100,
12
+ :defaults => {
13
+ 'ST01' => '999'
14
+ }
15
+
16
+ #Functional Group Response Header
17
+ segment Hippo::Segments::AK1,
18
+ :name => 'Functional Group Response Header',
19
+ :minimum => 1,
20
+ :maximum => 1,
21
+ :position => 200
22
+
23
+ #Transaction Set Response Header
24
+ loop Hippo::TransactionSets::HIPAA_999::L2000AK2,
25
+ :name => 'Transaction Set Response Header',
26
+ :minimum => 0,
27
+ :maximum => nil,
28
+ :position => 300
29
+
30
+ #Functional Group Response Trailer
31
+ segment Hippo::Segments::AK9,
32
+ :name => 'Functional Group Response Trailer',
33
+ :minimum => 1,
34
+ :maximum => 1,
35
+ :position => 900
36
+
37
+ #Transaction Set Trailer
38
+ segment Hippo::Segments::SE,
39
+ :name => 'Transaction Set Trailer',
40
+ :minimum => 1,
41
+ :maximum => 1,
42
+ :position => 1000
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,10 @@
1
+ module Hippo::TransactionSets
2
+ module HIPAA_999
3
+
4
+ autoload :Base, 'hippo/transaction_sets/HIPAA_999/base'
5
+ autoload :L2000AK2, 'hippo/transaction_sets/HIPAA_999/L2000AK2'
6
+ autoload :L2100AK2, 'hippo/transaction_sets/HIPAA_999/L2100AK2'
7
+ autoload :L2110AK2, 'hippo/transaction_sets/HIPAA_999/L2110AK2'
8
+
9
+ end
10
+ end
@@ -0,0 +1,136 @@
1
+ module Hippo::TransactionSets
2
+ class Base
3
+ class << self
4
+ attr_accessor :components, :identifier
5
+
6
+ def components
7
+ @components ||= []
8
+ end
9
+
10
+ def loop_name(id)
11
+ @identifier = id
12
+ end
13
+
14
+ def add_component(klass, options={})
15
+ options[:maximum] ||= 1
16
+
17
+ components << options.merge(:class => klass, :sequence => components.length)
18
+ end
19
+ alias segment add_component
20
+ alias loop add_component
21
+ end
22
+
23
+ attr_accessor :values, :parent
24
+
25
+ def initialize(options = {})
26
+ @parent = options.delete(:parent)
27
+ end
28
+
29
+ def values
30
+ @values ||= {}
31
+ end
32
+
33
+ def segment_count
34
+ values.values.map(&:segment_count).inject(&:+)
35
+ end
36
+
37
+ def to_s
38
+ output = ''
39
+
40
+ values.sort.each do |sequence, component|
41
+ output += component.to_s
42
+ end
43
+
44
+ output
45
+ end
46
+
47
+ def get_component(identifier, sequence = nil)
48
+ if sequence.nil?
49
+ sequence = 0
50
+ else
51
+ sequence = sequence.to_i - 1
52
+ end
53
+
54
+ self.class.components.select do |c|
55
+ c[:class].identifier == identifier
56
+ end[sequence]
57
+ end
58
+
59
+ def populate_component(component, defaults)
60
+ defaults ||= {}
61
+
62
+ defaults.each do |key, value|
63
+ if key =~ /(\w+)\.(.+)/
64
+ next_component, next_component_value = component.send($1.to_sym), {$2 => value}
65
+
66
+ populate_component(next_component, next_component_value)
67
+ else
68
+ component.send((key + '=').to_sym, value)
69
+ end
70
+ end
71
+
72
+ component
73
+ end
74
+
75
+ def initialize_component(component_entry)
76
+ component = component_entry[:class].new :parent => self
77
+
78
+ # iterate through the hash of defaults
79
+ # and assign them to the component before
80
+ # adding to @values
81
+ populate_component(component, component_entry[:defaults])
82
+ populate_component(component, component_entry[:identified_by])
83
+ end
84
+
85
+ def method_missing(method_name, *args)
86
+ component_name, component_sequence = method_name.to_s.split('_')
87
+ component_entry = get_component(component_name, component_sequence)
88
+
89
+ if component_entry.nil?
90
+ raise Hippo::Exceptions::InvalidSegment.new "Invalid segment specified: '#{method_name.to_s}'."
91
+ end
92
+
93
+ if values[component_entry[:sequence]].nil?
94
+
95
+ component = if component_entry[:maximum] > 1
96
+ RepeatingComponent.new(component_entry, self)
97
+ else
98
+ initialize_component(component_entry)
99
+ end
100
+
101
+ values[component_entry[:sequence]] = component
102
+ end
103
+
104
+ yield values[component_entry[:sequence]] if block_given?
105
+ return values[component_entry[:sequence]]
106
+ end
107
+
108
+ class RepeatingComponent < Array
109
+ def initialize(component_entry, parent)
110
+ @component_entry = component_entry
111
+ @parent = parent
112
+ end
113
+
114
+ def build
115
+ self.push(@parent.initialize_component(@component_entry))
116
+
117
+ yield self[-1] if block_given?
118
+ self[-1]
119
+ end
120
+
121
+ def to_s
122
+ self.map(&:to_s).join
123
+ end
124
+
125
+ def segment_count
126
+ self.map(&:segment_count).inject(&:+)
127
+ end
128
+
129
+ def method_missing(method_name, *args, &block)
130
+ build if self.length == 0
131
+
132
+ self.first.send(method_name, *args, &block)
133
+ end
134
+ end
135
+ end
136
+ end