hippo_eyeDoc 0.0.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.
Files changed (284) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +124 -0
  3. data/Gemfile +10 -0
  4. data/Guardfile +14 -0
  5. data/LICENSE +24 -0
  6. data/README.md +385 -0
  7. data/Rakefile +12 -0
  8. data/hippo_eyeDoc.gemspec +25 -0
  9. data/lib/hippo_eyeDoc.rb +15 -0
  10. data/lib/hippo_eyeDoc/code_lists.rb +10 -0
  11. data/lib/hippo_eyeDoc/code_lists/claim_adjustment_reason_codes.rb +2252 -0
  12. data/lib/hippo_eyeDoc/code_lists/claim_status_category_codes.rb +376 -0
  13. data/lib/hippo_eyeDoc/code_lists/claim_status_codes.rb +5456 -0
  14. data/lib/hippo_eyeDoc/code_lists/remittance_advice_remark_codes.rb +6280 -0
  15. data/lib/hippo_eyeDoc/code_lists/service_type_codes.rb +1299 -0
  16. data/lib/hippo_eyeDoc/code_lists/taxonomy_codes.rb +9224 -0
  17. data/lib/hippo_eyeDoc/exceptions.rb +10 -0
  18. data/lib/hippo_eyeDoc/field.rb +149 -0
  19. data/lib/hippo_eyeDoc/outputters.rb +4 -0
  20. data/lib/hippo_eyeDoc/outputters/html.rb +39 -0
  21. data/lib/hippo_eyeDoc/outputters/paper_claim.rb +7 -0
  22. data/lib/hippo_eyeDoc/outputters/pdf.rb +18 -0
  23. data/lib/hippo_eyeDoc/outputters/pretty_string.rb +45 -0
  24. data/lib/hippo_eyeDoc/parser.rb +70 -0
  25. data/lib/hippo_eyeDoc/parser/segment.rb +35 -0
  26. data/lib/hippo_eyeDoc/parser/transaction_set.rb +45 -0
  27. data/lib/hippo_eyeDoc/segments.rb +111 -0
  28. data/lib/hippo_eyeDoc/segments/AAA.rb +39 -0
  29. data/lib/hippo_eyeDoc/segments/AK1.rb +31 -0
  30. data/lib/hippo_eyeDoc/segments/AK2.rb +31 -0
  31. data/lib/hippo_eyeDoc/segments/AK3.rb +39 -0
  32. data/lib/hippo_eyeDoc/segments/AK4.rb +59 -0
  33. data/lib/hippo_eyeDoc/segments/AK5.rb +55 -0
  34. data/lib/hippo_eyeDoc/segments/AK9.rb +79 -0
  35. data/lib/hippo_eyeDoc/segments/AMT.rb +31 -0
  36. data/lib/hippo_eyeDoc/segments/BHT.rb +55 -0
  37. data/lib/hippo_eyeDoc/segments/BPR.rb +175 -0
  38. data/lib/hippo_eyeDoc/segments/CAS.rb +159 -0
  39. data/lib/hippo_eyeDoc/segments/CL1.rb +39 -0
  40. data/lib/hippo_eyeDoc/segments/CLM.rb +223 -0
  41. data/lib/hippo_eyeDoc/segments/CLP.rb +119 -0
  42. data/lib/hippo_eyeDoc/segments/CN1.rb +55 -0
  43. data/lib/hippo_eyeDoc/segments/CR1.rb +87 -0
  44. data/lib/hippo_eyeDoc/segments/CR2.rb +103 -0
  45. data/lib/hippo_eyeDoc/segments/CR3.rb +47 -0
  46. data/lib/hippo_eyeDoc/segments/CR4.rb +239 -0
  47. data/lib/hippo_eyeDoc/segments/CR5.rb +151 -0
  48. data/lib/hippo_eyeDoc/segments/CR6.rb +175 -0
  49. data/lib/hippo_eyeDoc/segments/CR7.rb +31 -0
  50. data/lib/hippo_eyeDoc/segments/CR8.rb +79 -0
  51. data/lib/hippo_eyeDoc/segments/CRC.rb +63 -0
  52. data/lib/hippo_eyeDoc/segments/CTP.rb +211 -0
  53. data/lib/hippo_eyeDoc/segments/CTX.rb +99 -0
  54. data/lib/hippo_eyeDoc/segments/CUR.rb +175 -0
  55. data/lib/hippo_eyeDoc/segments/DMG.rb +115 -0
  56. data/lib/hippo_eyeDoc/segments/DN1.rb +39 -0
  57. data/lib/hippo_eyeDoc/segments/DN2.rb +55 -0
  58. data/lib/hippo_eyeDoc/segments/DSB.rb +71 -0
  59. data/lib/hippo_eyeDoc/segments/DTM.rb +55 -0
  60. data/lib/hippo_eyeDoc/segments/DTP.rb +31 -0
  61. data/lib/hippo_eyeDoc/segments/EB.rb +207 -0
  62. data/lib/hippo_eyeDoc/segments/EM.rb +63 -0
  63. data/lib/hippo_eyeDoc/segments/EQ.rb +135 -0
  64. data/lib/hippo_eyeDoc/segments/FRM.rb +47 -0
  65. data/lib/hippo_eyeDoc/segments/GE.rb +23 -0
  66. data/lib/hippo_eyeDoc/segments/GS.rb +71 -0
  67. data/lib/hippo_eyeDoc/segments/HCP.rb +127 -0
  68. data/lib/hippo_eyeDoc/segments/HI.rb +919 -0
  69. data/lib/hippo_eyeDoc/segments/HL.rb +44 -0
  70. data/lib/hippo_eyeDoc/segments/HSD.rb +71 -0
  71. data/lib/hippo_eyeDoc/segments/IEA.rb +23 -0
  72. data/lib/hippo_eyeDoc/segments/III.rb +195 -0
  73. data/lib/hippo_eyeDoc/segments/IK3.rb +39 -0
  74. data/lib/hippo_eyeDoc/segments/IK4.rb +59 -0
  75. data/lib/hippo_eyeDoc/segments/IK5.rb +55 -0
  76. data/lib/hippo_eyeDoc/segments/IMM.rb +55 -0
  77. data/lib/hippo_eyeDoc/segments/INS.rb +171 -0
  78. data/lib/hippo_eyeDoc/segments/ISA.rb +136 -0
  79. data/lib/hippo_eyeDoc/segments/K3.rb +147 -0
  80. data/lib/hippo_eyeDoc/segments/LE.rb +15 -0
  81. data/lib/hippo_eyeDoc/segments/LIN.rb +255 -0
  82. data/lib/hippo_eyeDoc/segments/LQ.rb +23 -0
  83. data/lib/hippo_eyeDoc/segments/LS.rb +15 -0
  84. data/lib/hippo_eyeDoc/segments/LX.rb +20 -0
  85. data/lib/hippo_eyeDoc/segments/MEA.rb +219 -0
  86. data/lib/hippo_eyeDoc/segments/MIA.rb +199 -0
  87. data/lib/hippo_eyeDoc/segments/MOA.rb +79 -0
  88. data/lib/hippo_eyeDoc/segments/MPI.rb +63 -0
  89. data/lib/hippo_eyeDoc/segments/MSG.rb +31 -0
  90. data/lib/hippo_eyeDoc/segments/N1.rb +55 -0
  91. data/lib/hippo_eyeDoc/segments/N2.rb +23 -0
  92. data/lib/hippo_eyeDoc/segments/N3.rb +23 -0
  93. data/lib/hippo_eyeDoc/segments/N4.rb +63 -0
  94. data/lib/hippo_eyeDoc/segments/NM1.rb +103 -0
  95. data/lib/hippo_eyeDoc/segments/NTE.rb +23 -0
  96. data/lib/hippo_eyeDoc/segments/OI.rb +55 -0
  97. data/lib/hippo_eyeDoc/segments/PAT.rb +79 -0
  98. data/lib/hippo_eyeDoc/segments/PCT.rb +23 -0
  99. data/lib/hippo_eyeDoc/segments/PDP.rb +31 -0
  100. data/lib/hippo_eyeDoc/segments/PDR.rb +39 -0
  101. data/lib/hippo_eyeDoc/segments/PER.rb +79 -0
  102. data/lib/hippo_eyeDoc/segments/PID.rb +79 -0
  103. data/lib/hippo_eyeDoc/segments/PKD.rb +47 -0
  104. data/lib/hippo_eyeDoc/segments/PLB.rb +191 -0
  105. data/lib/hippo_eyeDoc/segments/PRV.rb +75 -0
  106. data/lib/hippo_eyeDoc/segments/PS1.rb +31 -0
  107. data/lib/hippo_eyeDoc/segments/PWK.rb +115 -0
  108. data/lib/hippo_eyeDoc/segments/QTY.rb +155 -0
  109. data/lib/hippo_eyeDoc/segments/RDM.rb +135 -0
  110. data/lib/hippo_eyeDoc/segments/REF.rb +83 -0
  111. data/lib/hippo_eyeDoc/segments/SBR.rb +79 -0
  112. data/lib/hippo_eyeDoc/segments/SD1.rb +71 -0
  113. data/lib/hippo_eyeDoc/segments/SE.rb +23 -0
  114. data/lib/hippo_eyeDoc/segments/ST.rb +31 -0
  115. data/lib/hippo_eyeDoc/segments/STC.rb +187 -0
  116. data/lib/hippo_eyeDoc/segments/SV1.rb +263 -0
  117. data/lib/hippo_eyeDoc/segments/SV2.rb +147 -0
  118. data/lib/hippo_eyeDoc/segments/SV3.rb +219 -0
  119. data/lib/hippo_eyeDoc/segments/SV4.rb +211 -0
  120. data/lib/hippo_eyeDoc/segments/SV5.rb +123 -0
  121. data/lib/hippo_eyeDoc/segments/SV6.rb +151 -0
  122. data/lib/hippo_eyeDoc/segments/SV7.rb +55 -0
  123. data/lib/hippo_eyeDoc/segments/SVC.rb +183 -0
  124. data/lib/hippo_eyeDoc/segments/SVD.rb +115 -0
  125. data/lib/hippo_eyeDoc/segments/TA1.rb +46 -0
  126. data/lib/hippo_eyeDoc/segments/TOO.rb +67 -0
  127. data/lib/hippo_eyeDoc/segments/TRN.rb +39 -0
  128. data/lib/hippo_eyeDoc/segments/TS2.rb +159 -0
  129. data/lib/hippo_eyeDoc/segments/TS3.rb +199 -0
  130. data/lib/hippo_eyeDoc/segments/UR.rb +23 -0
  131. data/lib/hippo_eyeDoc/segments/VEH.rb +159 -0
  132. data/lib/hippo_eyeDoc/segments/base.rb +190 -0
  133. data/lib/hippo_eyeDoc/separator.rb +79 -0
  134. data/lib/hippo_eyeDoc/transaction_sets.rb +16 -0
  135. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270.rb +15 -0
  136. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000A.rb +43 -0
  137. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000B.rb +42 -0
  138. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000C.rb +52 -0
  139. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000D.rb +41 -0
  140. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100A.rb +21 -0
  141. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100B.rb +55 -0
  142. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100C.rb +97 -0
  143. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100D.rb +0 -0
  144. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2110C.rb +67 -0
  145. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2110D.rb +47 -0
  146. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/base.rb +47 -0
  147. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271.rb +19 -0
  148. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000A.rb +55 -0
  149. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000B.rb +43 -0
  150. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000C.rb +52 -0
  151. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000D.rb +41 -0
  152. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100A.rb +43 -0
  153. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100B.rb +67 -0
  154. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100C.rb +124 -0
  155. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100D.rb +124 -0
  156. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2110C.rb +98 -0
  157. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2110D.rb +98 -0
  158. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2115C.rb +16 -0
  159. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2115D.rb +16 -0
  160. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2120C.rb +54 -0
  161. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2120D.rb +54 -0
  162. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/base.rb +47 -0
  163. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276.rb +19 -0
  164. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000A.rb +32 -0
  165. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000B.rb +32 -0
  166. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000C.rb +32 -0
  167. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000D.rb +52 -0
  168. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000E.rb +50 -0
  169. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100A.rb +21 -0
  170. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100B.rb +21 -0
  171. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100C.rb +21 -0
  172. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100D.rb +21 -0
  173. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100E.rb +20 -0
  174. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2200D.rb +117 -0
  175. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2200E.rb +117 -0
  176. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2210D.rb +37 -0
  177. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2210E.rb +37 -0
  178. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/base.rb +90 -0
  179. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277.rb +22 -0
  180. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000A.rb +42 -0
  181. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000B.rb +42 -0
  182. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000C.rb +52 -0
  183. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000D.rb +41 -0
  184. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000E.rb +40 -0
  185. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100A.rb +21 -0
  186. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100B.rb +21 -0
  187. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100C.rb +21 -0
  188. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100D.rb +21 -0
  189. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100E.rb +20 -0
  190. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200A.rb +41 -0
  191. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200B.rb +69 -0
  192. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200C.rb +79 -0
  193. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200D.rb +77 -0
  194. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200E.rb +104 -0
  195. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2220D.rb +57 -0
  196. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2220E.rb +44 -0
  197. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/base.rb +70 -0
  198. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835.rb +10 -0
  199. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L1000A.rb +74 -0
  200. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L1000B.rb +54 -0
  201. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2000.rb +41 -0
  202. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2100.rb +213 -0
  203. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2110.rb +106 -0
  204. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/base.rb +122 -0
  205. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837.rb +43 -0
  206. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L1000A.rb +32 -0
  207. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L1000B.rb +21 -0
  208. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000A.rb +88 -0
  209. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000B.rb +87 -0
  210. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000C.rb +54 -0
  211. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AA.rb +65 -0
  212. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AB.rb +34 -0
  213. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AC.rb +55 -0
  214. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010BA.rb +76 -0
  215. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010BB.rb +55 -0
  216. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010CA.rb +76 -0
  217. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2300.rb +570 -0
  218. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310A.rb +30 -0
  219. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310B.rb +41 -0
  220. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310C.rb +55 -0
  221. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310D.rb +30 -0
  222. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310E.rb +34 -0
  223. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310F.rb +34 -0
  224. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2320.rb +157 -0
  225. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330A.rb +45 -0
  226. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330B.rb +96 -0
  227. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330C.rb +30 -0
  228. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330D.rb +30 -0
  229. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330E.rb +30 -0
  230. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330F.rb +30 -0
  231. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330G.rb +30 -0
  232. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2400.rb +537 -0
  233. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2410.rb +36 -0
  234. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420A.rb +41 -0
  235. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420B.rb +30 -0
  236. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420C.rb +44 -0
  237. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420D.rb +30 -0
  238. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420E.rb +55 -0
  239. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420F.rb +30 -0
  240. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420G.rb +34 -0
  241. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420H.rb +34 -0
  242. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2430.rb +47 -0
  243. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2440.rb +26 -0
  244. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/base.rb +71 -0
  245. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997.rb +7 -0
  246. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/L2000.rb +36 -0
  247. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/L2100.rb +29 -0
  248. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/base.rb +49 -0
  249. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999.rb +8 -0
  250. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2000 - AK2.rb +30 -0
  251. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2000AK2.rb +36 -0
  252. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2100 - AK2.rb +37 -0
  253. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2100AK2.rb +43 -0
  254. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2110 - AK2.rb +23 -0
  255. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2110AK2.rb +26 -0
  256. data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/base.rb +49 -0
  257. data/lib/hippo_eyeDoc/transaction_sets/base.rb +236 -0
  258. data/lib/hippo_eyeDoc/transaction_sets/component.rb +96 -0
  259. data/lib/hippo_eyeDoc/transaction_sets/repeating_component.rb +48 -0
  260. data/lib/hippo_eyeDoc/utilities.rb +37 -0
  261. data/lib/hippo_eyeDoc/version.rb +3 -0
  262. data/samples/005010X221A1_business_scenario_1.edi +1 -0
  263. data/samples/005010X221A1_tmhp_example.edi +1 -0
  264. data/samples/005010X222A1_anesthesia.edi +1 -0
  265. data/samples/005010X222A1_commercial_health_insurance.edi +1 -0
  266. data/samples/005010X231A1_01.edi +11 -0
  267. data/samples/005010X231A1_02.edi +11 -0
  268. data/samples/200823.EDI +22 -0
  269. data/samples/837_L2000A_01.edi +1 -0
  270. data/samples/837_L2000A_02.edi +1 -0
  271. data/samples/parse_277.rb +127 -0
  272. data/samples/parse_999.rb +122 -0
  273. data/samples/sample835.html +1 -0
  274. data/samples/sample835.pretty_string +28 -0
  275. data/samples/sample837.html +1 -0
  276. data/test/test_helper.rb +155 -0
  277. data/test/test_hipaa_835.rb +229 -0
  278. data/test/test_hipaa_837.rb +596 -0
  279. data/test/test_html_outputter.rb +22 -0
  280. data/test/test_parser.rb +138 -0
  281. data/test/test_pretty_string_outputter.rb +33 -0
  282. data/test/test_segments_base.rb +201 -0
  283. data/test/test_transaction_sets_base.rb +122 -0
  284. metadata +356 -0
@@ -0,0 +1 @@
1
+ <fieldset class="hippo-transaction-set"><legend>HIPAA_835::Base</legend><span class="hippo-segment-name">Transaction Set Header</span><span class="hippo-segment-data">ST*835*1234~</span><br/><span class="hippo-segment-name">Financial Information</span><span class="hippo-segment-data">BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456*1512345678**01*999988880*DA*98765*20020913~</span><br/><span class="hippo-segment-name">Reassociation Trace Number</span><span class="hippo-segment-data">TRN*1*12345*1512345678~</span><br/><span class="hippo-segment-name">Production Date</span><span class="hippo-segment-data">DTM*405*20020916~</span><br/><fieldset class="hippo-component"><legend>HIPAA_835::L1000A - Payer Identification</legend><span class="hippo-segment-name">Payer Identification</span><span class="hippo-segment-data">N1*PR*INSURANCE COMPANY OF TIMBUCKTU~</span><br/><span class="hippo-segment-name">Payer Address</span><span class="hippo-segment-data">N3*1 MAIN STREET~</span><br/><span class="hippo-segment-name">Payer City, State, ZIP Code</span><span class="hippo-segment-data">N4*TIMBUCKTU*AK*89111~</span><br/><span class="hippo-segment-name">Additional Payer Identification</span><span class="hippo-segment-data">REF*2U*999~</span><br/></fieldset><fieldset class="hippo-component"><legend>HIPAA_835::L1000B - Payee Identification</legend><span class="hippo-segment-name">Payee Identification</span><span class="hippo-segment-data">N1*PE*REGIONAL HOPE HOSPITAL*XX*6543210903~</span><br/></fieldset><fieldset class="hippo-component"><legend>HIPAA_835::L2000 - Header Number</legend><span class="hippo-segment-name">Header Number</span><span class="hippo-segment-data">LX*110212~</span><br/><span class="hippo-segment-name">Provider Summary Information</span><span class="hippo-segment-data">TS3*6543210903*11*20021231*1*211366.97****138018.4**73348.57~</span><br/><span class="hippo-segment-name">Provider Supplemental Summary Information</span><span class="hippo-segment-data">TS2*2178.45*1919.71**56.82*197.69*4.23~</span><br/><fieldset class="hippo-component"><legend>HIPAA_835::L2100 - Claim Payment Information</legend><span class="hippo-segment-name">Claim Payment Information</span><span class="hippo-segment-data">CLP*666123*1*211366.97*138018.4**MA*1999999444444*11*1~</span><br/><span class="hippo-segment-name">Claim Adjustment</span><span class="hippo-segment-data">CAS*CO*45*73348.57~</span><br/><span class="hippo-segment-name">Patient Name</span><span class="hippo-segment-data">NM1*QC*1*JONES*SAM*O***HN*666666666A~</span><br/><span class="hippo-segment-name">Inpatient Adjudication Information</span><span class="hippo-segment-data">MIA*0***138018.4~</span><br/><span class="hippo-segment-name">Statement From or To Date</span><span class="hippo-segment-data">DTM*232*20020816~DTM*233*20020824~</span><br/><span class="hippo-segment-name">Claim Supplemental Information Quantity</span><span class="hippo-segment-data">QTY*CA*8~</span><br/></fieldset><span class="hippo-segment-name">Header Number</span><span class="hippo-segment-data">LX*130212~</span><br/><span class="hippo-segment-name">Provider Summary Information</span><span class="hippo-segment-data">TS3*6543210909*13*19961231*1*15000****11980.33**3019.67~</span><br/><fieldset class="hippo-component"><legend>HIPAA_835::L2100 - Claim Payment Information</legend><span class="hippo-segment-name">Claim Payment Information</span><span class="hippo-segment-data">CLP*777777*1*15000*11980.33**MB*1999999444445*13*1~</span><br/><span class="hippo-segment-name">Claim Adjustment</span><span class="hippo-segment-data">CAS*CO*45*3019.67~</span><br/><span class="hippo-segment-name">Patient Name</span><span class="hippo-segment-data">NM1*QC*1*BORDER*LIZ*E***HN*996669999B~</span><br/><span class="hippo-segment-name">Outpatient Adjudication Information</span><span class="hippo-segment-data">MOA***MA02~</span><br/><span class="hippo-segment-name">Statement From or To Date</span><span class="hippo-segment-data">DTM*232*20020512~</span><br/></fieldset></fieldset><span class="hippo-segment-name">Provider Adjustment</span><span class="hippo-segment-data">PLB*6543210903*20021231*CV:CP*-1.27~</span><br/><span class="hippo-segment-name">Transaction Set Trailer</span><span class="hippo-segment-data">SE*28*1234~</span><br/></fieldset>
@@ -0,0 +1,28 @@
1
+ ST*835*1234~
2
+ BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456*1512345678**01*999988880*DA*98765*20020913~
3
+ TRN*1*12345*1512345678~
4
+ DTM*405*20020916~
5
+ N1*PR*INSURANCE COMPANY OF TIMBUCKTU~
6
+ N3*1 MAIN STREET~
7
+ N4*TIMBUCKTU*AK*89111~
8
+ REF*2U*999~
9
+ N1*PE*REGIONAL HOPE HOSPITAL*XX*6543210903~
10
+ LX*110212~
11
+ TS3*6543210903*11*20021231*1*211366.97****138018.4**73348.57~
12
+ TS2*2178.45*1919.71**56.82*197.69*4.23~
13
+ CLP*666123*1*211366.97*138018.4**MA*1999999444444*11*1~
14
+ CAS*CO*45*73348.57~
15
+ NM1*QC*1*JONES*SAM*O***HN*666666666A~
16
+ MIA*0***138018.4~
17
+ DTM*232*20020816~
18
+ DTM*233*20020824~
19
+ QTY*CA*8~
20
+ LX*130212~
21
+ TS3*6543210909*13*19961231*1*15000****11980.33**3019.67~
22
+ CLP*777777*1*15000*11980.33**MB*1999999444445*13*1~
23
+ CAS*CO*45*3019.67~
24
+ NM1*QC*1*BORDER*LIZ*E***HN*996669999B~
25
+ MOA***MA02~
26
+ DTM*232*20020512~
27
+ PLB*6543210903*20021231*CV:CP*-1.27~
28
+ SE*28*1234~
@@ -0,0 +1 @@
1
+ <fieldset class="hippo-transaction-set"><legend>HIPAA_835::Base</legend><span class="hippo-segment-name">Transaction Set Header</span><span class="hippo-segment-data">ST*835*1234~</span><br/><span class="hippo-segment-name">Financial Information</span><span class="hippo-segment-data">BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456*1512345678**01*999988880*DA*98765*20020913~</span><br/><span class="hippo-segment-name">Reassociation Trace Number</span><span class="hippo-segment-data">TRN*1*12345*1512345678~</span><br/><span class="hippo-segment-name">Production Date</span><span class="hippo-segment-data">DTM*405*20020916~</span><br/><fieldset class="hippo-component"><legend>HIPAA_835::L1000A - Payer Identification</legend><span class="hippo-segment-name">Payer Identification</span><span class="hippo-segment-data">N1*PR*INSURANCE COMPANY OF TIMBUCKTU~</span><br/><span class="hippo-segment-name">Payer Address</span><span class="hippo-segment-data">N3*1 MAIN STREET~</span><br/><span class="hippo-segment-name">Payer City, State, ZIP Code</span><span class="hippo-segment-data">N4*TIMBUCKTU*AK*89111~</span><br/><span class="hippo-segment-name">Additional Payer Identification</span><span class="hippo-segment-data">REF*2U*999~</span><br/></fieldset><fieldset class="hippo-component"><legend>HIPAA_835::L1000B - Payee Identification</legend><span class="hippo-segment-name">Payee Identification</span><span class="hippo-segment-data">N1*PE*REGIONAL HOPE HOSPITAL*XX*6543210903~</span><br/></fieldset><fieldset class="hippo-component"><legend>HIPAA_835::L2000 - Header Number</legend><span class="hippo-segment-name">Header Number</span><span class="hippo-segment-data">LX*110212~</span><br/><span class="hippo-segment-name">Provider Summary Information</span><span class="hippo-segment-data">TS3*6543210903*11*20021231*1*211366.97****138018.4**73348.57~</span><br/><span class="hippo-segment-name">Provider Supplemental Summary Information</span><span class="hippo-segment-data">TS2*2178.45*1919.71**56.82*197.69*4.23~</span><br/><fieldset class="hippo-component"><legend>HIPAA_835::L2100 - Claim Payment Information</legend><span class="hippo-segment-name">Claim Payment Information</span><span class="hippo-segment-data">CLP*666123*1*211366.97*138018.4**MA*1999999444444*11*1~</span><br/><span class="hippo-segment-name">Claim Adjustment</span><span class="hippo-segment-data">CAS*CO*45*73348.57~</span><br/><span class="hippo-segment-name">Patient Name</span><span class="hippo-segment-data">NM1*QC*1*JONES*SAM*O***HN*666666666A~</span><br/><span class="hippo-segment-name">Inpatient Adjudication Information</span><span class="hippo-segment-data">MIA*0***138018.4~</span><br/><span class="hippo-segment-name">Statement From or To Date</span><span class="hippo-segment-data">DTM*232*20020816~DTM*233*20020824~</span><br/><span class="hippo-segment-name">Claim Supplemental Information Quantity</span><span class="hippo-segment-data">QTY*CA*8~</span><br/></fieldset><span class="hippo-segment-name">Header Number</span><span class="hippo-segment-data">LX*130212~</span><br/><span class="hippo-segment-name">Provider Summary Information</span><span class="hippo-segment-data">TS3*6543210909*13*19961231*1*15000****11980.33**3019.67~</span><br/><fieldset class="hippo-component"><legend>HIPAA_835::L2100 - Claim Payment Information</legend><span class="hippo-segment-name">Claim Payment Information</span><span class="hippo-segment-data">CLP*777777*1*15000*11980.33**MB*1999999444445*13*1~</span><br/><span class="hippo-segment-name">Claim Adjustment</span><span class="hippo-segment-data">CAS*CO*45*3019.67~</span><br/><span class="hippo-segment-name">Patient Name</span><span class="hippo-segment-data">NM1*QC*1*BORDER*LIZ*E***HN*996669999B~</span><br/><span class="hippo-segment-name">Outpatient Adjudication Information</span><span class="hippo-segment-data">MOA***MA02~</span><br/><span class="hippo-segment-name">Statement From or To Date</span><span class="hippo-segment-data">DTM*232*20020512~</span><br/></fieldset></fieldset><span class="hippo-segment-name">Provider Adjustment</span><span class="hippo-segment-data">PLB*6543210903*20021231*CV:CP*-1.27~</span><br/><span class="hippo-segment-name">Transaction Set Trailer</span><span class="hippo-segment-data">SE*28*1234~</span><br/></fieldset>
@@ -0,0 +1,155 @@
1
+ require 'rubygems'
2
+ gem 'minitest'
3
+ require 'minitest/autorun'
4
+ require 'pp'
5
+ require 'pry'
6
+
7
+ require File.expand_path(File.join('..','lib','hippo_eyeDoc'), File.dirname(__FILE__))
8
+
9
+ module Hippo_eyeDoc::Segments
10
+ class TSS < Hippo_eyeDoc::Segments::Base
11
+ segment_identifier 'TSS'
12
+
13
+ field :name => 'Field1'
14
+ field :name => 'Field2'
15
+ field :name => 'Field3'
16
+ field :name => 'Field4'
17
+ field :name => 'CommonName'
18
+ field :name => 'CommonName'
19
+ field :name => 'DateField', :datatype => :date
20
+ field :name => 'TimeField', :datatype => :time
21
+ field :name => 'IntegerField', :datatype => :integer
22
+ field :name => 'DecimalField', :datatype => :decimal
23
+ end
24
+
25
+ class TCS < Hippo_eyeDoc::Segments::Base
26
+ segment_identifier 'TCS'
27
+
28
+ composite_field 'CompositeField' do
29
+ field :name => 'Field1'
30
+ field :name => 'Field2'
31
+ field :name => 'Field3'
32
+ field :name => 'CompositeCommonName'
33
+ end
34
+
35
+ composite_field 'CompositeField' do
36
+ field :name => 'Field4'
37
+ field :name => 'Field5'
38
+ field :name => 'Field6'
39
+ field :name => 'CompositeCommonName'
40
+ end
41
+
42
+ field :name => 'Field7'
43
+ end
44
+ end
45
+
46
+ module Hippo_eyeDoc::TransactionSets
47
+ module Test
48
+ class L0001 < Hippo_eyeDoc::TransactionSets::Base
49
+ loop_name 'L0001'
50
+
51
+ segment Hippo_eyeDoc::Segments::TSS,
52
+ :name => 'Test Simple Segment #1',
53
+ :minimum => 1,
54
+ :maximum => 1,
55
+ :position => 50
56
+ end
57
+
58
+ class L0002 < Hippo_eyeDoc::TransactionSets::Base
59
+ loop_name 'L0002'
60
+
61
+ segment Hippo_eyeDoc::Segments::TCS,
62
+ :name => 'Test Compound Segment #4',
63
+ :minimum => 1,
64
+ :maximum => 1,
65
+ :position => 100,
66
+ :identified_by => {
67
+ 'Field7' => ['Preset Field 7', 'Foo2']
68
+ }
69
+
70
+ segment Hippo_eyeDoc::Segments::TSS,
71
+ :name => 'Test Simple Segment #5',
72
+ :minimum => 1,
73
+ :maximum => 1,
74
+ :position => 50,
75
+ :identified_by => {
76
+ 'TSS01' => 'Last Segment'
77
+ }
78
+ end
79
+
80
+ class L0004 < Hippo_eyeDoc::TransactionSets::Base
81
+ loop_name 'L0004'
82
+
83
+ segment Hippo_eyeDoc::Segments::TSS,
84
+ :name => 'Indicator of Child Location',
85
+ :identified_by => {'TSS01' => ['HAS CHILD LOOP','HAS NO CHILD LOOP']}
86
+
87
+ loop Hippo_eyeDoc::TransactionSets::Test::L0001,
88
+ :name => 'Test Sub-Loop L0001',
89
+ :identified_by => {
90
+ 'TSS.TSS01' => 'Multiple Parents',
91
+ },
92
+ :parent_context_conditions => {
93
+ 'TSS.TSS01' => 'HAS NO CHILD LOOP'
94
+ }
95
+
96
+ segment Hippo_eyeDoc::Segments::TSS,
97
+ :name => 'Indicator of Child Location',
98
+ :identified_by => {'TSS01' => 'Multiple Parents'}
99
+
100
+ end
101
+
102
+ class Base < Hippo_eyeDoc::TransactionSets::Base
103
+
104
+ segment Hippo_eyeDoc::Segments::ST,
105
+ :identified_by => {
106
+ 'ST01' => 'Test'
107
+ }
108
+
109
+ segment Hippo_eyeDoc::Segments::TSS,
110
+ :name => 'Test Simple Segment #1',
111
+ :minimum => 1,
112
+ :maximum => 5,
113
+ :position => 50,
114
+ :identified_by => {
115
+ 'TSS01' => 'Blah'
116
+ }
117
+
118
+ segment Hippo_eyeDoc::Segments::TCS,
119
+ :name => 'Test Compound Segment #2',
120
+ :minimum => 1,
121
+ :maximum => 1,
122
+ :position => 100,
123
+ :identified_by => {
124
+ 'Field7' => 'Preset Field 7'
125
+ }
126
+
127
+ segment Hippo_eyeDoc::Segments::TSS,
128
+ :name => 'Test Simple Segment #3',
129
+ :minimum => 1,
130
+ :maximum => 1,
131
+ :position => 50,
132
+ :identified_by => {
133
+ 'TSS01' => 'Last Standalone Segment'
134
+ }
135
+
136
+ loop Hippo_eyeDoc::TransactionSets::Test::L0001,
137
+ :name => 'Test Sub-Loop',
138
+ :identified_by => {
139
+ 'TSS.TSS01' => 'Foo'
140
+ }
141
+
142
+ loop Hippo_eyeDoc::TransactionSets::Test::L0002,
143
+ :name => 'Test Sub-Loop',
144
+ :maximum => 5,
145
+ :identified_by => {
146
+ 'TCS.Field7' => 'Foo2'
147
+ }
148
+
149
+ segment Hippo_eyeDoc::Segments::SE,
150
+ :identified_by => {
151
+ 'SE02' => 'Test'
152
+ }
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,229 @@
1
+ require File.expand_path('test_helper', File.dirname(__FILE__))
2
+
3
+ class TestHIPAA835 < MiniTest::Unit::TestCase
4
+
5
+ def test_business_scenario_1
6
+ =begin
7
+
8
+ Dollars and data are being sent together through the banking system to pay
9
+ Medicare Part A institutional claims.
10
+
11
+ This scenario depicts the use of the ANSI ASC X12 835 in a governmental
12
+ institutional environment. The electronic transmission of funds request
13
+ and the remittance detail are contained within this single 835. In this
14
+ scenario, one or more Depository Financial Institutions is involved in
15
+ transferring information from the sender to the receiver.
16
+
17
+ The following assumptions pertain to scenario one:
18
+ • The dollars move using the ACH network from the Bank of Payorea,
19
+ ABA# 999999992, account number 123456 to the Bank of No Return,
20
+ ABA# 999988880, checking account number 98765. The money moves on
21
+ September 13, 2002.
22
+ • The Insurance Company of Timbucktu, Federal tax ID # 512345678 and
23
+ Medicare Intermediary ID# 999, is paying Regional Hope Hospital, National
24
+ Provider Number 6543210903. This is for one inpatient and one outpatient claim.
25
+ • For the inpatient claim, the patient’s name is Sam O. Jones. The Health
26
+ Insurance Claim Number is 666-66-6666A. The Claim Submitter’s Identifier is
27
+ 666123. The date of the hospitalization was August 16, 2002 to August 24, 2002.
28
+ Total charges reported are $211,366.97. Paid amount is $138,018.40. There is
29
+ no patient responsibility. Contractual adjustment is $73,348.57. No service
30
+ line detail is provided.
31
+ • For the outpatient claim, the patient’s name is Liz E. Border, Health
32
+ Insurance Claim Number 996-66-9999B. The Claim Submitter’s Identifier is
33
+ 777777. The date of service is May 12, 2002. Total charges reported are
34
+ $15,000. Paid amount is $11,980.33. Contractual adjustment is $3,019.67.
35
+ There is no service line information.
36
+ • There is a Capital Pass Through Amount (CV) payment to the provider for $1.27.
37
+
38
+ =end
39
+
40
+ ts = Hippo_eyeDoc::TransactionSets::HIPAA_835::Base.new
41
+
42
+ ts.ST do |st|
43
+ st.TransactionSetControlNumber = '1234'
44
+ end
45
+
46
+ ts.BPR do |bpr|
47
+ bpr.TransactionHandlingCode = 'C'
48
+ bpr.MonetaryAmount = '150000'
49
+ bpr.CreditDebitFlagCode = 'C'
50
+ bpr.PaymentMethodCode = 'ACH'
51
+ bpr.PaymentFormatCode = 'CTX'
52
+ bpr.DfiIdNumberQualifier = '01'
53
+ bpr.DfiIdentificationNumber = '999999992'
54
+ bpr.AccountNumberQualifier = 'DA'
55
+ bpr.AccountNumber = '123456'
56
+ bpr.OriginatingCompanyIdentifier = '1512345678'
57
+ bpr.DfiIdNumberQualifier_02 = '01'
58
+ bpr.DfiIdentificationNumber_02 = '999988880'
59
+ bpr.AccountNumberQualifier_02 = 'DA'
60
+ bpr.AccountNumber_02 = '98765'
61
+ bpr.Date = '20020913'
62
+ end
63
+
64
+ ts.TRN do |trn|
65
+ trn.ReferenceIdentification = '12345'
66
+ trn.OriginatingCompanyIdentifier = '1512345678'
67
+ end
68
+
69
+ ts.DTM.Date = '20020916'
70
+
71
+ ts.L1000A do |l1000a|
72
+ l1000a.N1.Name = 'INSURANCE COMPANY OF TIMBUCKTU'
73
+ l1000a.N3.AddressInformation = '1 MAIN STREET'
74
+
75
+ l1000a.N4 do |n4|
76
+ n4.CityName = 'TIMBUCKTU'
77
+ n4.StateOrProvinceCode = 'AK'
78
+ n4.PostalCode = '89111'
79
+ end
80
+
81
+ l1000a.REF do |ref|
82
+ ref.ReferenceIdentificationQualifier = '2U'
83
+ ref.ReferenceIdentification = '999'
84
+ end
85
+ end
86
+
87
+ ts.L1000B do |l1000b|
88
+ l1000b.N1 do |n1|
89
+ n1.Name = 'REGIONAL HOPE HOSPITAL'
90
+ n1.IdentificationCodeQualifier = 'XX'
91
+ n1.IdentificationCode = '6543210903'
92
+ end
93
+ end
94
+
95
+ ts.L2000.build do |l2000|
96
+ l2000.LX.LX01 = '110212'
97
+
98
+ l2000.TS3 do |ts3|
99
+ ts3.ReferenceIdentification = '6543210903'
100
+ ts3.FacilityCodeValue = '11'
101
+ ts3.Date = '20021231'
102
+ ts3.Quantity = '1'
103
+ ts3.MonetaryAmount_01 = '211366.97'
104
+ ts3.MonetaryAmount_05 = '138018.4'
105
+ ts3.MonetaryAmount_07 = '73348.57'
106
+ end
107
+
108
+ l2000.TS2 do |ts2|
109
+ ts2.MonetaryAmount_01 = '2178.45'
110
+ ts2.MonetaryAmount_02 = '1919.71'
111
+ ts2.MonetaryAmount_04 = '56.82'
112
+ ts2.MonetaryAmount_05 = '197.69'
113
+ ts2.MonetaryAmount_06 = '4.23'
114
+ end
115
+
116
+ l2000.L2100.build do |l2100|
117
+ l2100.CLP do |clp|
118
+ clp.ClaimSubmitterSIdentifier = '666123'
119
+ clp.ClaimStatusCode = '1'
120
+ clp.MonetaryAmount_01 = '211366.97'
121
+ clp.MonetaryAmount_02 = '138018.4'
122
+ clp.ClaimFilingIndicatorCode = 'MA'
123
+ clp.ReferenceIdentification = '1999999444444'
124
+ clp.FacilityCodeValue = '11'
125
+ clp.ClaimFrequencyTypeCode = '1'
126
+ end
127
+
128
+ l2100.CAS.build do |cas|
129
+ cas.ClaimAdjustmentGroupCode = 'CO'
130
+ cas.ClaimAdjustmentReasonCode = '45'
131
+ cas.MonetaryAmount = '73348.57'
132
+ end
133
+
134
+ l2100.NM1 do |nm1|
135
+ nm1.NameLastOrOrganizationName = 'JONES'
136
+ nm1.NameFirst = 'SAM'
137
+ nm1.NameMiddle = 'O'
138
+ nm1.IdentificationCodeQualifier = 'HN'
139
+ nm1.IdentificationCode = '666666666A'
140
+ end
141
+
142
+ l2100.MIA do |mia|
143
+ mia.Quantity = '0'
144
+ mia.MonetaryAmount_02 = '138018.4'
145
+ end
146
+
147
+ l2100.DTM_01.build do |dtm|
148
+ dtm.DateTimeQualifier = '232'
149
+ dtm.Date = '20020816'
150
+ end
151
+
152
+ l2100.DTM_01.build do |dtm|
153
+ dtm.DateTimeQualifier = '233'
154
+ dtm.Date = '20020824'
155
+ end
156
+
157
+ l2100.QTY do |qty|
158
+ qty.QuantityQualifier = 'CA'
159
+ qty.Quantity = '8'
160
+ end
161
+ end
162
+ end
163
+
164
+ ts.L2000.build do |l2000|
165
+ l2000.LX.LX01 = '130212'
166
+
167
+ l2000.TS3 do |ts3|
168
+ ts3.ReferenceIdentification = '6543210909'
169
+ ts3.FacilityCodeValue = '13'
170
+ ts3.Date = '19961231'
171
+ ts3.Quantity = '1'
172
+ ts3.MonetaryAmount_01 = '15000'
173
+ ts3.MonetaryAmount_05 = '11980.33'
174
+ ts3.MonetaryAmount_07 = '3019.67'
175
+ end
176
+
177
+ l2000.L2100.build do |l2100|
178
+ l2100.CLP do |clp|
179
+ clp.ClaimSubmitterSIdentifier = '777777'
180
+ clp.ClaimStatusCode = '1'
181
+ clp.MonetaryAmount_01 = '15000'
182
+ clp.MonetaryAmount_02 = '11980.33'
183
+ clp.ClaimFilingIndicatorCode = 'MB'
184
+ clp.ReferenceIdentification = '1999999444445'
185
+ clp.FacilityCodeValue = '13'
186
+ clp.ClaimFrequencyTypeCode = '1'
187
+ end
188
+
189
+ l2100.CAS.build do |cas|
190
+ cas.ClaimAdjustmentGroupCode = 'CO'
191
+ cas.ClaimAdjustmentReasonCode = '45'
192
+ cas.MonetaryAmount = '3019.67'
193
+ end
194
+
195
+ l2100.NM1 do |nm1|
196
+ nm1.NameLastOrOrganizationName = 'BORDER'
197
+ nm1.NameFirst = 'LIZ'
198
+ nm1.NameMiddle = 'E'
199
+ nm1.IdentificationCodeQualifier = 'HN'
200
+ nm1.IdentificationCode = '996669999B'
201
+ end
202
+
203
+ l2100.MOA do |moa|
204
+ moa.ReferenceIdentification = 'MA02'
205
+ end
206
+
207
+ l2100.DTM_01.build do |dtm|
208
+ dtm.DateTimeQualifier = '232'
209
+ dtm.Date = '20020512'
210
+ end
211
+ end
212
+ end
213
+
214
+ ts.PLB do |plb|
215
+ plb.ReferenceIdentification_01 = '6543210903'
216
+ plb.Date = '20021231'
217
+ plb.AdjustmentReasonCode = 'CV'
218
+ plb.ReferenceIdentification_02 = 'CP'
219
+ plb.MonetaryAmount = '-1.27'
220
+ end
221
+
222
+ ts.SE.TransactionSetControlNumber = ts.ST.TransactionSetControlNumber
223
+ ts.SE.NumberOfIncludedSegments = ts.segment_count
224
+
225
+ provided_answer = File.read('samples/005010X221A1_business_scenario_1.edi')
226
+
227
+ assert_equal provided_answer.chomp, ts.to_s
228
+ end
229
+ end
@@ -0,0 +1,596 @@
1
+ require File.expand_path('test_helper', File.dirname(__FILE__))
2
+
3
+ class TestHIPAA837 < MiniTest::Unit::TestCase
4
+
5
+ def test_commercial_health_insurance
6
+ =begin
7
+ This example file is based on the Commercial Health Insurance example (3.1.1) published in the 5010X222A1 TR3.
8
+
9
+ Patient is a different person than the Subscriber. Payer is commercial health insurance company.
10
+
11
+ SUBSCRIBER: Jane Smith
12
+ PATIENT ADDRESS:236 N. Main St., Miami, Fl, 33413
13
+ TELEPHONE NUMBER: 305-555-1111
14
+ SEX: F
15
+ DOB: 05/01/43
16
+ EMPLOYER: ACME Inc.
17
+ GROUP #: 2222-SJ
18
+ KEY INSURANCE COMPANY ID #: JS00111223333
19
+
20
+ PATIENT: Ted Smith
21
+ PATIENT ADDRESS:236 N. Main St., Miami, Fl, 33413
22
+ TELEPHONE NUMBER: 305-555-1111
23
+ SEX: M
24
+ DOB: 05/01/73
25
+ KEY INSURANCE COMPANY ID #: JS01111223333
26
+
27
+ DESTINATION PAYER: Key Insurance Company
28
+ PAYER ADDRESS: 3333 Ocean St. South Miami, FL 33000
29
+ PAYER ID: 999996666
30
+
31
+ SUBMITTER: Premier Billing Service
32
+ EDI#: TGJ23
33
+ CONTACT PERSON AND PHONE NUMBER: JERRY, 305-555-2222 ext. 231
34
+
35
+ RECEIVER: Key Insurance Company
36
+ EDI #:66783JJT
37
+
38
+ BILLING PROVIDER: Dr. Ben Kildare,
39
+ ADDRESS: 234 Seaway St, Miami, FL, 33111
40
+ NPI: 9876543210
41
+ TIN: 587654321
42
+ KEY INSURANCE COMPANY PROVIDER ID #: KA6663
43
+ Taxonomy Code: 203BF0100Y
44
+
45
+ PAY-TO PROVIDER: Kildare Associates,
46
+ PROVIDER ADDRESS: 2345 Ocean Blvd, Miami, Fl 33111
47
+ RENDERING PROVIDER: Dr. Ben Kildare
48
+
49
+ PATIENT ACCOUNT NUMBER: 2-646-3774
50
+ CASE: Patient has sore throat.
51
+
52
+ INITIAL VISIT: DOS=10/03/06. POS=Office
53
+ SERVICES: Office visit, intermediate service, established patient, throat culture.
54
+ CHARGES: Office first visit = $40.00, Lab test for strep = $15.00
55
+
56
+ FOLLOW-UP VISIT: DOS=10/10/06 POS=Office
57
+ Antibiotics didn’t work (pain continues).
58
+ SERVICES: Office visit, intermediate service, established patient, mono screening.
59
+ CHARGES: Follow-up visit = $35.00, lab test for mono = $10.00.
60
+
61
+ TOTAL CHARGES: $100.00.
62
+ ELECTRONIC ROUTE: Billing provider (sender), to VAN to Key Insurance Company (receiver).
63
+ VAN claim identification number = 17312345600006351.
64
+
65
+ =end
66
+
67
+ ts = Hippo_eyeDoc::TransactionSets::HIPAA_837::Base.new
68
+
69
+ ts.ST do |st|
70
+ st.TransactionSetControlNumber = '0021'
71
+ st.ImplementationConventionReference = '005010X222A1'
72
+ end
73
+
74
+ ts.BHT do |bht|
75
+ bht.TransactionSetPurposeCode = '00'
76
+ bht.ReferenceIdentification = '244579'
77
+ bht.Date = '20061015'
78
+ bht.Time = '1023'
79
+ bht.TransactionTypeCode = 'CH'
80
+ end
81
+
82
+ ts.L1000A do |l1000a|
83
+ l1000a.NM1 do |nm1|
84
+ nm1.EntityTypeQualifier = '2'
85
+ nm1.NameLastOrOrganizationName = 'PREMIER BILLING SERVICE'
86
+ nm1.IdentificationCode = 'TGJ23'
87
+ end
88
+
89
+ l1000a.PER do |per|
90
+ per.Name = 'JERRY'
91
+ per.CommunicationNumberQualifier_01 = 'TE'
92
+ per.CommunicationNumber_01 = '3055552222'
93
+ per.CommunicationNumberQualifier_02 = 'EX'
94
+ per.CommunicationNumber_02 = '231'
95
+ end
96
+ end
97
+
98
+ ts.L1000B do |l1000b|
99
+ l1000b.NM1 do |nm1|
100
+ nm1.EntityTypeQualifier = '2'
101
+ nm1.NameLastOrOrganizationName = 'KEY INSURANCE COMPANY'
102
+ nm1.IdentificationCode = '66783JJT'
103
+ end
104
+ end
105
+
106
+ ts.L2000A do |l2000a|
107
+ l2000a.HL do |hl|
108
+ hl.HL01 = ts.increment('HL')
109
+ hl.HL04 = 1
110
+ end
111
+
112
+ l2000a.PRV do |prv|
113
+ prv.ReferenceIdentification = '203BF0100Y'
114
+ end
115
+
116
+ l2000a.L2010AA do |l2010aa|
117
+
118
+ l2010aa.NM1 do |nm1|
119
+ nm1.EntityTypeQualifier = '2'
120
+ nm1.NameLastOrOrganizationName = 'BEN KILDARE SERVICE'
121
+ nm1.IdentificationCodeQualifier = 'XX'
122
+ nm1.IdentificationCode = '9876543210'
123
+ end
124
+
125
+ l2010aa.N3 do |n3|
126
+ n3.AddressInformation = '234 SEAWAY ST'
127
+ end
128
+
129
+ l2010aa.N4 do |n4|
130
+ n4.CityName = 'MIAMI'
131
+ n4.StateOrProvinceCode = 'FL'
132
+ n4.PostalCode = '33111'
133
+ end
134
+
135
+ l2010aa.REF do |ref|
136
+ ref.ReferenceIdentificationQualifier = 'EI'
137
+ ref.ReferenceIdentification = '587654321'
138
+ end
139
+ end
140
+
141
+ l2000a.L2010AB do |l2010ab|
142
+ l2010ab.NM1 do |nm1|
143
+ nm1.EntityTypeQualifier = '2'
144
+ end
145
+
146
+ l2010ab.N3 do |n3|
147
+ n3.AddressInformation = '2345 OCEAN BLVD'
148
+ end
149
+
150
+ l2010ab.N4 do |n4|
151
+ n4.CityName = 'MIAMI'
152
+ n4.StateOrProvinceCode = 'FL'
153
+ n4.PostalCode = '33111'
154
+ end
155
+ end
156
+
157
+ l2000a.L2000B do |l2000b|
158
+ l2000b.HL do |hl|
159
+ hl.HL01 = ts.increment('HL')
160
+ hl.HL02 = l2000a.HL.HL01
161
+ hl.HL04 = 1
162
+ end
163
+
164
+ l2000b.SBR do |sbr|
165
+ sbr.PayerResponsibilitySequenceNumberCode = 'P'
166
+ sbr.ReferenceIdentification = '2222-SJ'
167
+ sbr.ClaimFilingIndicatorCode = 'CI'
168
+ end
169
+
170
+ l2000b.L2010BA do |l2010ba|
171
+ l2010ba.NM1 do |nm1|
172
+ nm1.EntityTypeQualifier = '1'
173
+ nm1.NameLastOrOrganizationName = 'SMITH'
174
+ nm1.NameFirst = 'JANE'
175
+ nm1.IdentificationCodeQualifier = 'MI'
176
+ nm1.IdentificationCode = 'JS00111223333'
177
+ end
178
+
179
+ l2010ba.DMG do |dmg|
180
+ dmg.DateTimePeriod = '19430501'
181
+ dmg.GenderCode = 'F'
182
+ end
183
+ end
184
+
185
+ l2000b.L2010BB do |l2010bb|
186
+ l2010bb.NM1 do |nm1|
187
+ nm1.EntityTypeQualifier = '2'
188
+ nm1.NameLastOrOrganizationName = 'KEY INSURANCE COMPANY'
189
+ nm1.IdentificationCodeQualifier = 'PI'
190
+ nm1.IdentificationCode = '999996666'
191
+ end
192
+
193
+ # second ref segment in L2010BB
194
+ l2010bb.REF_02 do |ref|
195
+ ref.ReferenceIdentificationQualifier = 'G2'
196
+ ref.ReferenceIdentification = 'KA6663'
197
+ end
198
+ end
199
+
200
+ l2000b.L2000C do |l2000c|
201
+ l2000c.HL do |hl|
202
+ hl.HL01 = ts.increment('HL')
203
+ hl.HL02 = l2000b.HL.HL01
204
+ hl.HL04 = 0
205
+ end
206
+
207
+ l2000c.PAT do |pat|
208
+ pat.IndividualRelationshipCode = '19'
209
+ end
210
+
211
+ l2000c.L2010CA do |l2010ca|
212
+ l2010ca.NM1 do |nm1|
213
+ nm1.NameLastOrOrganizationName = 'SMITH'
214
+ nm1.NameFirst = 'TED'
215
+ end
216
+
217
+ l2010ca.N3 do |n3|
218
+ n3.AddressInformation = '236 N MAIN ST'
219
+ end
220
+
221
+ l2010ca.N4 do |n4|
222
+ n4.CityName = 'MIAMI'
223
+ n4.StateOrProvinceCode = 'FL'
224
+ n4.PostalCode = '33413'
225
+ end
226
+
227
+ l2010ca.DMG do |dmg|
228
+ dmg.DateTimePeriod = '19730501'
229
+ dmg.GenderCode = 'M'
230
+ end
231
+ end
232
+
233
+ l2000c.L2300 do |l2300|
234
+ l2300.CLM do |clm|
235
+ clm.ClaimSubmitterSIdentifier = '26463774'
236
+ clm.MonetaryAmount = '100'
237
+ clm.FacilityCodeValue = '11'
238
+ clm.FacilityCodeQualifier = 'B'
239
+ clm.ClaimFrequencyTypeCode = '1'
240
+ clm.YesNoConditionOrResponseCode = 'Y'
241
+ clm.ProviderAcceptAssignmentCode = 'A'
242
+ clm.YesNoConditionOrResponseCode_02 = 'Y'
243
+ clm.ReleaseOfInformationCode = 'I'
244
+ end
245
+
246
+ l2300.REF_11 do |ref| #('Claim Identifier For Transmission Intermediaries') do |ref|
247
+ ref.ReferenceIdentification = '17312345600006351'
248
+ end
249
+
250
+ l2300.HI do |hi|
251
+ hi.CodeListQualifierCode_01 = 'BK'
252
+ hi.IndustryCode_01 = '0340'
253
+
254
+ hi.CodeListQualifierCode_02 = 'BF'
255
+ hi.IndustryCode_03 = 'V7389'
256
+ end
257
+
258
+ l2300.L2400.build do |l2400|
259
+ l2400.LX.LX01 = l2300.increment('LX')
260
+
261
+ l2400.SV1 do |sv1|
262
+ sv1.ProductServiceIdQualifier = 'HC'
263
+ sv1.ProductServiceId = '99213'
264
+ sv1.MonetaryAmount = '40'
265
+ sv1.UnitOrBasisForMeasurementCode = 'UN'
266
+ sv1.Quantity = '1'
267
+ sv1.DiagnosisCodePointer = 1
268
+ end
269
+
270
+ l2400.DTP('Date - Service Date') do |dtp|
271
+ dtp.DateTimePeriodFormatQualifier = 'D8'
272
+ dtp.DateTimePeriod = '20061003'
273
+ end
274
+ end
275
+
276
+ l2300.L2400.build do |l2400|
277
+ l2400.LX.LX01 = l2300.increment('LX')
278
+
279
+ l2400.SV1 do |sv1|
280
+ sv1.ProductServiceIdQualifier = 'HC'
281
+ sv1.ProductServiceId = '87070'
282
+ sv1.MonetaryAmount = '15'
283
+ sv1.UnitOrBasisForMeasurementCode = 'UN'
284
+ sv1.Quantity = '1'
285
+ sv1.DiagnosisCodePointer = 1
286
+ end
287
+
288
+ l2400.DTP('Date - Service Date') do |dtp|
289
+ dtp.DateTimePeriodFormatQualifier = 'D8'
290
+ dtp.DateTimePeriod = '20061003'
291
+ end
292
+ end
293
+
294
+ l2300.L2400.build do |l2400|
295
+ l2400.LX.LX01 = l2300.increment('LX')
296
+
297
+ l2400.SV1 do |sv1|
298
+ sv1.ProductServiceIdQualifier = 'HC'
299
+ sv1.ProductServiceId = '99214'
300
+ sv1.MonetaryAmount = '35'
301
+ sv1.UnitOrBasisForMeasurementCode = 'UN'
302
+ sv1.Quantity = '1'
303
+ sv1.DiagnosisCodePointer = 2
304
+ end
305
+
306
+ l2400.DTP('Date - Service Date') do |dtp|
307
+ dtp.DateTimePeriodFormatQualifier = 'D8'
308
+ dtp.DateTimePeriod = '20061010'
309
+ end
310
+ end
311
+
312
+ l2300.L2400.build do |l2400|
313
+ l2400.LX.LX01 = l2300.increment('LX')
314
+
315
+ l2400.SV1 do |sv1|
316
+ sv1.ProductServiceIdQualifier = 'HC'
317
+ sv1.ProductServiceId = '86663'
318
+ sv1.MonetaryAmount = '10'
319
+ sv1.UnitOrBasisForMeasurementCode = 'UN'
320
+ sv1.Quantity = '1'
321
+ sv1.DiagnosisCodePointer = 2
322
+ end
323
+
324
+ l2400.DTP('Date - Service Date') do |dtp|
325
+ dtp.DateTimePeriodFormatQualifier = 'D8'
326
+ dtp.DateTimePeriod = '20061010'
327
+ end
328
+ end
329
+ end
330
+ end
331
+ end
332
+ end
333
+
334
+
335
+ ts.SE do |se|
336
+ se.TransactionSetControlNumber = ts.ST.TransactionSetControlNumber
337
+ end
338
+
339
+ ts.SE.NumberOfIncludedSegments = ts.segment_count
340
+
341
+ published_answer = File.read('samples/005010X222A1_commercial_health_insurance.edi')
342
+ assert_equal published_answer.chomp, ts.to_s
343
+ end
344
+
345
+ def test_anesthesia
346
+ =begin
347
+ Patient is the same as the subscriber. Payer is Medicare.
348
+ Encounter is billed directly to Medicare.
349
+
350
+ SUBSCRIBER/PATIENT: Margaret Jones
351
+ ADDRESS: 123 Rainbow Road, Nashville, TN 37232
352
+ TELEPHONE: 615-555-1212
353
+ SEX: F
354
+ DOB: 03/03/1974
355
+ EMPLOYER: ACME Inc.
356
+ SUBSCRIBER #: 123456789A
357
+
358
+ SECONDARY COVERAGE
359
+
360
+ DESTINATION PAYER: ABC Payer
361
+ PAYER ADDRESS: P.O. Box 1465, Nashville, TN, 37232
362
+ PAYER ORGANIZATION ID: 05440
363
+
364
+ RECEIVER: ABC Payer
365
+ EDI #: 05440
366
+
367
+ BILLING PROVIDER/SENDER: Provider Medical Group
368
+ ADDRESS: 1234 West End Ave, Nashville, TN, 37232
369
+ NPI#: 2366554859
370
+ TIN: 756473826
371
+ EDI #: N305
372
+ CONTACT PERSON AND PHONE NUMBER: Nina, 615-555-1212 ext.911
373
+
374
+ RENDERING PROVIDER: Dr. Jacob E. Townsend/Anesthesiologist
375
+ NPI: 5678912345
376
+ MEDICARE PROVIDER ID#: 9741234
377
+ PLACE OF SERVICE: Provider OP Hospital
378
+ PLACE OF SERVICE ADDRESS: 345 Main Drive, Nashville, TN,37232
379
+ PLACE OF SERVICE ID#: 43294867
380
+
381
+ PATIENT ACCOUNT NUMBER: 543211230
382
+ CASE: Laser Eye Surgery.
383
+
384
+ VISIT: DOS=1/12/2005 POS=Outpatient Hospital
385
+ SERVICES: Anesthesia for the Laser Eye Surgery
386
+ CHARGES: Anesthesia, 61 minutes = $827.00
387
+ CONCURRENCY: 2 cases
388
+ PHYSICAL STATUS: Normal
389
+ PATIENT CONTROL #: 153829140
390
+ MEDICAL RECORD ID #: 006653794
391
+
392
+ TOTAL CHARGES: $827.00
393
+
394
+ ELECTRONIC ROUTE: Billing Provider (sender) to ABC PAYER direct
395
+ =end
396
+
397
+ ts = Hippo_eyeDoc::TransactionSets::HIPAA_837::Base.new
398
+
399
+ ts.ST.TransactionSetControlNumber = '0001'
400
+ ts.ST.ImplementationConventionReference = '005010X222A1'
401
+
402
+ ts.BHT do |bht|
403
+ bht.TransactionSetPurposeCode = '00'
404
+ bht.ReferenceIdentification = '0123'
405
+ bht.Date = '20050117'
406
+ bht.Time = '1023'
407
+ bht.TransactionTypeCode = 'CH'
408
+ end
409
+
410
+ ts.L1000A do |l1000a|
411
+ l1000a.NM1 do |nm1|
412
+ nm1.EntityTypeQualifier = '2'
413
+ nm1.NameLastOrOrganizationName = 'PROVIDER MEDICAL GROUP'
414
+ nm1.IdentificationCode = 'N305'
415
+ end
416
+
417
+ l1000a.PER do |per|
418
+ per.Name = 'NINA'
419
+ per.CommunicationNumberQualifier_01 = 'TE'
420
+ per.CommunicationNumber_01 = '6155551212'
421
+ per.CommunicationNumberQualifier_02 = 'EX'
422
+ per.CommunicationNumber_02 = '911'
423
+ end
424
+ end
425
+
426
+ ts.L1000B do |l1000b|
427
+ l1000b.NM1 do |nm1|
428
+ nm1.EntityTypeQualifier = '2'
429
+ nm1.NameLastOrOrganizationName = 'ABC PAYER'
430
+ nm1.IdentificationCode = '05440'
431
+ end
432
+ end
433
+
434
+ ts.L2000A.build do |l2000a|
435
+ l2000a.HL do |hl|
436
+ hl.HL01 = ts.increment('HL')
437
+ hl.HL04 = 1
438
+ end
439
+
440
+ l2000a.L2010AA do |l2010aa|
441
+
442
+ l2010aa.NM1 do |nm1|
443
+ nm1.EntityTypeQualifier = '2'
444
+ nm1.NameLastOrOrganizationName = 'PROVIDER MEDICAL GROUP'
445
+ nm1.IdentificationCodeQualifier = 'XX'
446
+ nm1.IdentificationCode = '2366554859'
447
+ end
448
+
449
+ l2010aa.N3 do |n3|
450
+ n3.AddressInformation = '1234 WEST END AVE'
451
+ end
452
+
453
+ l2010aa.N4 do |n4|
454
+ n4.CityName = 'NASHVILLE'
455
+ n4.StateOrProvinceCode = 'TN'
456
+ n4.PostalCode = '37232'
457
+ end
458
+
459
+ l2010aa.REF do |ref|
460
+ ref.ReferenceIdentificationQualifier = 'EI'
461
+ ref.ReferenceIdentification = '756473826'
462
+ end
463
+ end
464
+
465
+ l2000a.L2000B.build do |l2000b|
466
+ l2000b.HL do |hl|
467
+ hl.HL01 = ts.increment('HL')
468
+ hl.HL02 = l2000a.HL.HL01
469
+ hl.HL04 = 0
470
+ end
471
+
472
+ l2000b.SBR do |sbr|
473
+ sbr.PayerResponsibilitySequenceNumberCode = 'P'
474
+ sbr.IndividualRelationshipCode = '18'
475
+ sbr.ClaimFilingIndicatorCode = 'MB'
476
+ end
477
+
478
+ l2000b.L2010BA do |l2010ba|
479
+ l2010ba.NM1 do |nm1|
480
+ nm1.EntityTypeQualifier = '1'
481
+ nm1.NameLastOrOrganizationName = 'JONES'
482
+ nm1.NameFirst = 'MARGARET'
483
+ nm1.IdentificationCodeQualifier = 'MI'
484
+ nm1.IdentificationCode = '123456789A'
485
+ end
486
+
487
+ l2010ba.N3.AddressInformation = '123 RAINBOW ROAD'
488
+
489
+ l2010ba.N4 do |n4|
490
+ n4.CityName = 'NASHVILLE'
491
+ n4.StateOrProvinceCode = 'TN'
492
+ n4.PostalCode = '37232'
493
+ end
494
+
495
+ l2010ba.DMG do |dmg|
496
+ dmg.DateTimePeriod = '19740303'
497
+ dmg.GenderCode = 'F'
498
+ end
499
+ end
500
+
501
+ l2000b.L2010BB do |l2010bb|
502
+ l2010bb.NM1 do |nm1|
503
+ nm1.EntityTypeQualifier = '2'
504
+ nm1.NameLastOrOrganizationName = 'ABC PAYER'
505
+ nm1.IdentificationCodeQualifier = 'PI'
506
+ nm1.IdentificationCode = '05440'
507
+ end
508
+ end
509
+
510
+ l2000b.L2300.build do |l2300|
511
+ l2300.CLM do |clm|
512
+ clm.ClaimSubmitterSIdentifier = '153829140'
513
+ clm.MonetaryAmount = '827'
514
+ clm.FacilityCodeValue = '22'
515
+ clm.FacilityCodeQualifier = 'B'
516
+ clm.ClaimFrequencyTypeCode = '1'
517
+ clm.YesNoConditionOrResponseCode = 'Y'
518
+ clm.ProviderAcceptAssignmentCode = 'A'
519
+ clm.YesNoConditionOrResponseCode_02 = 'Y'
520
+ clm.ReleaseOfInformationCode = 'Y'
521
+ end
522
+
523
+ l2300.HI do |hi|
524
+ hi.CodeListQualifierCode_01 = 'BK'
525
+ hi.IndustryCode_01 = '36616'
526
+ end
527
+
528
+ l2300.L2310B do |l2310b|
529
+ l2310b.NM1 do |nm1|
530
+ nm1.EntityTypeQualifier = '1'
531
+ nm1.NameLastOrOrganizationName = 'TOWNSEND'
532
+ nm1.NameFirst = 'JACOB'
533
+ nm1.NameMiddle = 'E'
534
+ nm1.IdentificationCodeQualifier = 'XX'
535
+ nm1.IdentificationCode = '5678912345'
536
+ end
537
+
538
+ l2310b.PRV do |prv|
539
+ prv.ReferenceIdentificationQualifier = 'ZZ'
540
+ prv.ReferenceIdentification = '207L00000X'
541
+ end
542
+ end
543
+
544
+ l2300.L2310C do |l2310c|
545
+ l2310c.NM1 do |nm1|
546
+ nm1.EntityTypeQualifier = '2'
547
+ nm1.NameLastOrOrganizationName = 'PROVIDER OP HOSP'
548
+ nm1.IdentificationCodeQualifier = 'XX'
549
+ nm1.IdentificationCode = '432198765'
550
+ end
551
+
552
+ l2310c.N3.AddressInformation = '345 MAIN DRIVE'
553
+
554
+ l2310c.N4 do |n4|
555
+ n4.CityName = 'NASHVILLE'
556
+ n4.StateOrProvinceCode = 'TN'
557
+ n4.PostalCode = '37232'
558
+ end
559
+ end
560
+
561
+ l2300.L2400.build do |l2400|
562
+ l2400.LX.LX01 = l2300.increment('LX')
563
+
564
+ l2400.SV1 do |sv1|
565
+ sv1.ProductServiceIdQualifier = 'HC'
566
+ sv1.ProductServiceId = '00142'
567
+ sv1.ProcedureModifier_01 = 'QK'
568
+ sv1.ProcedureModifier_02 = 'QS'
569
+ sv1.ProcedureModifier_03 = 'P1'
570
+ sv1.MonetaryAmount = '827'
571
+ sv1.UnitOrBasisForMeasurementCode = 'MJ'
572
+ sv1.Quantity = '61'
573
+ sv1.DiagnosisCodePointer = 1
574
+ end
575
+
576
+ l2400.DTP('Date - Service Date') do |dtp|
577
+ dtp.DateTimePeriodFormatQualifier = 'D8'
578
+ dtp.DateTimePeriod = '20050112'
579
+ end
580
+ end
581
+ end
582
+ end
583
+ end
584
+
585
+
586
+ ts.SE do |se|
587
+ se.TransactionSetControlNumber = ts.ST.TransactionSetControlNumber
588
+ end
589
+
590
+ ts.SE.NumberOfIncludedSegments = ts.segment_count
591
+
592
+ published_answer = File.read('samples/005010X222A1_anesthesia.edi')
593
+ assert_equal published_answer.chomp, ts.to_s
594
+
595
+ end
596
+ end