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,10 @@
1
+ module Hippo_eyeDoc
2
+ module Exceptions
3
+ class Exception < StandardError; end
4
+
5
+ class InvalidValue < Exception; end
6
+ class InvalidField < Exception; end
7
+ class InvalidSegment < Exception; end
8
+ class ParseError < Exception; end
9
+ end
10
+ end
@@ -0,0 +1,149 @@
1
+ require 'date'
2
+ require 'time'
3
+ require 'bigdecimal'
4
+
5
+ module Hippo_eyeDoc
6
+ class Field
7
+ attr_accessor :name, :sequence, :datatype, :options,
8
+ :restrictions, :minimum, :maximum, :required,
9
+ :separator, :composite, :composite_sequence
10
+
11
+ def minimum
12
+ @minimum ||= 0
13
+ end
14
+
15
+ def formatted_value(value)
16
+ return nil if value.nil?
17
+
18
+ case datatype
19
+ when :binary then value
20
+ when :integer then value.to_i
21
+ when :decimal then parse_decimal(value)
22
+ when :date then parse_date(value)
23
+ when :time then parse_time(value)
24
+ else parse_string(value)
25
+ end
26
+ end
27
+
28
+ def string_value(value)
29
+ return '' if value.nil? && !required
30
+
31
+ case datatype
32
+ when :binary then value
33
+ when :integer then value.to_s.rjust(minimum, '0')
34
+ when :decimal then generate_decimal(value)
35
+ when :date then generate_date(value)
36
+ when :time then generate_time(value)
37
+ else generate_string(value)
38
+ end
39
+ end
40
+
41
+ def generate_string(value)
42
+ if required
43
+ value.to_s.ljust(minimum)
44
+ else
45
+ value.to_s
46
+ end
47
+ end
48
+
49
+ def parse_string(value)
50
+ if value.to_s.empty? && !required
51
+ nil
52
+ else
53
+ value.to_s.strip
54
+ end
55
+ end
56
+
57
+ def generate_decimal(value)
58
+ value ||= BigDecimal('0')
59
+
60
+ value.to_s('F').sub(/\.0\z/,'').rjust(minimum, '0')
61
+ end
62
+
63
+ def parse_decimal(value)
64
+ if value == ''
65
+ invalid! if required
66
+ return nil
67
+ end
68
+
69
+ BigDecimal(value.to_s)
70
+ end
71
+
72
+ def generate_time(value)
73
+ value ||= Time.now
74
+
75
+ if maximum == 4 || value.sec == 0
76
+ value.strftime('%H%M')
77
+ else
78
+ value.strftime('%H%M%S')
79
+ end
80
+ end
81
+
82
+ def parse_time(value)
83
+ if value == ''
84
+ invalid! if required
85
+ return nil
86
+ end
87
+
88
+ case value.class.to_s
89
+ when 'Time' then value
90
+ when 'String'
91
+ format = case value
92
+ when /\A\d{4}\z/ then '%H%M'
93
+ when /\A\d{6}\z/ then '%H%M%S'
94
+ when /\A\d{7,8}\z/ then '%H%M%S%N'
95
+ else invalid!
96
+ end
97
+
98
+ Time.strptime(value, format)
99
+ else invalid!
100
+ end
101
+ rescue
102
+ invalid!
103
+ end
104
+
105
+ def generate_date(value)
106
+ value ||= Date.today
107
+
108
+ if value.class.to_s == 'Range'
109
+ "#{value.first.strftime('%Y%m%d')}-#{value.last.strftime('%Y%m%d')}"
110
+ elsif maximum == 6
111
+ value.strftime('%y%m%d')
112
+ else
113
+ value.strftime('%Y%m%d')
114
+ end
115
+ end
116
+
117
+ def parse_date(value)
118
+ if value == ''
119
+ invalid! if required
120
+ return nil
121
+ end
122
+
123
+ case value.class.to_s
124
+ when "Range" then value
125
+ when "Date" then value
126
+ when "Time" then value.to_date
127
+ when "String"
128
+ format = case value
129
+ when /\A\d{6}\z/ then '%y%m%d'
130
+ when /\A\d{8}\z/ then '%Y%m%d'
131
+ when /\A(\d{8})-(\d{8})\z/ then
132
+ return Date.parse($1, '%Y%m%d')..Date.parse($2, '%Y%m%d')
133
+ else
134
+ invalid!
135
+ end
136
+
137
+ Date.parse(value, format)
138
+ else
139
+ invalid! "Invalid datatype(#{value.class}) for date field."
140
+ end
141
+ rescue
142
+ invalid!
143
+ end
144
+
145
+ def invalid!(message = "Invalid value specified for #{self.datatype} field.")
146
+ raise Hippo_eyeDoc::Exceptions::InvalidValue.new message
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,4 @@
1
+ require_relative 'outputters/html'
2
+ require_relative 'outputters/pdf'
3
+ require_relative 'outputters/paper_claim'
4
+ require_relative 'outputters/pretty_string'
@@ -0,0 +1,39 @@
1
+ module Hippo_eyeDoc::Outputters
2
+ module HTML
3
+ module TransactionSet
4
+ def to_html
5
+ output = ''
6
+ initial_call = caller.select{|m| m =~ /#{__FILE__}/}.length == 0
7
+
8
+ if initial_call
9
+ output = %{<fieldset class="hippo-transaction-set"><legend>#{self.class.to_s.sub('Hippo_eyeDoc::TransactionSets::','')}</legend>}
10
+ end
11
+
12
+ values.sort.each do |sequence, component|
13
+ component_definition = self.class.components[sequence]
14
+ if component_definition.klass.ancestors.include?(Hippo_eyeDoc::TransactionSets::Base)
15
+ output += %Q{<fieldset class="hippo-component"><legend>#{component_definition.klass.to_s.sub('Hippo_eyeDoc::TransactionSets::','')} - #{component_definition.options[:name]}</legend>}
16
+ output += component.to_html
17
+ output += '</fieldset>'
18
+ else
19
+ output += %Q{<span class="hippo-segment-name">#{component_definition.options[:name]}</span><span class="hippo-segment-data">#{component.to_s}</span><br/>}
20
+ end
21
+ end
22
+
23
+ output + (initial_call ? '</fieldset>' : '')
24
+ end
25
+ end
26
+
27
+ module RepeatingComponent
28
+ def to_html
29
+ map{|component| component.to_html}.join
30
+ end
31
+ end
32
+
33
+ module Segment
34
+ def to_html
35
+ to_s
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,7 @@
1
+ module Hippo_eyeDoc::Outputters
2
+ module PaperClaim
3
+ def to_claim
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ module Hippo_eyeDoc::Outputters
2
+ module PDF
3
+ module TransactionSet
4
+ def to_pdf
5
+ end
6
+ end
7
+
8
+ module RepeatingComponent
9
+ def to_pdf
10
+ end
11
+ end
12
+
13
+ module Segment
14
+ def to_pdf
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ module Hippo_eyeDoc::Outputters
2
+ module PrettyString
3
+ module TransactionSet
4
+ def pretty_print(pp)
5
+ pp.text to_pretty_string
6
+ end
7
+
8
+ def to_pretty_string(indent_level = 0)
9
+ output = ''
10
+
11
+ values.sort.each do |sequence, component|
12
+ component_definition = self.class.components[sequence]
13
+
14
+ extra_indent = if component_definition.klass.ancestors.include?(Hippo::TransactionSets::Base)
15
+ 2
16
+ elsif sequence == 0
17
+ 0
18
+ else
19
+ 2
20
+ end
21
+
22
+ output += component.to_pretty_string(indent_level + extra_indent)
23
+ end
24
+
25
+ output
26
+ end
27
+ end
28
+
29
+ module RepeatingComponent
30
+ def pretty_print(pp)
31
+ pp.text to_pretty_string
32
+ end
33
+
34
+ def to_pretty_string(indent_level = 0)
35
+ map{|component| component.to_pretty_string(indent_level)}.join
36
+ end
37
+ end
38
+
39
+ module Segment
40
+ def to_pretty_string(indent_level = 0)
41
+ ' ' * indent_level + to_s + "\n"
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,70 @@
1
+ require_relative 'parser/segment'
2
+ require_relative 'parser/transaction_set'
3
+
4
+ module Hippo_eyeDoc
5
+ class Parser
6
+ include Hippo_eyeDoc::Separator
7
+ include TransactionSet
8
+
9
+ def self.parse_file(input)
10
+ parser = new
11
+ parser.parse_string(input)
12
+ end
13
+
14
+ def self.parse_string(input)
15
+ parser = new
16
+ parser.parse_string(input)
17
+ end
18
+
19
+ def initialize
20
+ super
21
+ end
22
+
23
+ def initialize_transaction_set(index)
24
+ {
25
+ :segments => [],
26
+ :ISA => find_first_segment(parsed_segments[0,index + 1], 'ISA', true),
27
+ :GS => find_first_segment(parsed_segments[0,index + 1], 'GS', true),
28
+ :GE => find_first_segment(parsed_segments[index + 1, parsed_segments.length - index + 1], 'GE'),
29
+ :IEA => find_first_segment(parsed_segments[index + 1, parsed_segments.length - index + 1], 'IEA')
30
+ }
31
+ end
32
+
33
+ def parse_transaction_sets
34
+ raw_transaction_sets = []
35
+ inside_transaction = false
36
+
37
+ parsed_segments.each_with_index do |segment, index|
38
+ if segment.identifier == 'ST'
39
+ raw_transaction_sets << initialize_transaction_set(index)
40
+
41
+ inside_transaction = true
42
+ end
43
+
44
+ raw_transaction_sets.last[:segments] << segment if inside_transaction
45
+
46
+ inside_transaction = false if segment.identifier == 'SE'
47
+ end
48
+
49
+ raw_transaction_sets
50
+ end
51
+
52
+ def populate_transaction_sets
53
+ parse_transaction_sets.collect do |transaction|
54
+ transaction_set_id = transaction[:segments].first.ST01
55
+ transaction_set = Hippo_eyeDoc::TransactionSets.constants.select{|c| c.to_s.end_with?(transaction_set_id) }.first
56
+
57
+ Hippo_eyeDoc::TransactionSets.const_get(transaction_set)::Base.new(separators.merge(transaction))
58
+ end
59
+ end
60
+
61
+ def parse_file(filename)
62
+ parse_string(File.read(filename))
63
+ end
64
+
65
+ def parse_string(input)
66
+ read(input)
67
+ populate_transaction_sets
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,35 @@
1
+ module Hippo_eyeDoc
2
+ class Parser
3
+ module Segment
4
+ def parse(input)
5
+ input.gsub!(/[\a\e\f\n\r\t\v]/,'')
6
+ fields = input.split(@field_separator)
7
+
8
+ segment_identifier = fields.shift
9
+
10
+ fields.each_with_index do |value, index|
11
+ field = self.class.fields[index]
12
+
13
+ # if the field is an array that means it is a
14
+ # composite field
15
+ if field.class == Array
16
+ composite_fields = value.split(@composite_separator)
17
+ composite_sequence = field.first.composite_sequence
18
+
19
+ self.values[composite_sequence] = {}
20
+
21
+ composite_fields.each_with_index do |comp_value, comp_index|
22
+ composite_field = field[comp_index]
23
+
24
+ self.values[composite_sequence][composite_field.sequence] = composite_field.formatted_value(comp_value)
25
+ end
26
+ else
27
+ self.values[field.sequence] = field.formatted_value(value)
28
+ end
29
+ end
30
+
31
+ self
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,45 @@
1
+ module Hippo_eyeDoc
2
+ class Parser
3
+ module TransactionSet
4
+ attr_accessor :unparsed_data
5
+
6
+ def initialize(options={})
7
+ super
8
+ end
9
+
10
+ def find_first_segment(segments, identifier, reverse = false)
11
+ segments.reverse! if reverse
12
+
13
+ if index = segments.index{|o| o.identifier == identifier}
14
+ segments[index]
15
+ else
16
+ nil
17
+ end
18
+ end
19
+
20
+ def parsed_segments
21
+ @segments ||= @unparsed_data.split(@segment_separator).collect do |segment_string|
22
+ segment_identifier = segment_string.split(@field_separator).first
23
+ segment = Hippo_eyeDoc::Segments.const_get(segment_identifier.lstrip).new(:parent => self)
24
+
25
+ segment.parse(segment_string)
26
+
27
+ segment.to_s == '' ? nil : segment
28
+ end.compact
29
+ end
30
+
31
+ def read(input = nil)
32
+ input ||= ''
33
+
34
+ @unparsed_data = input.gsub(/[\a\e\f\n\r\t\v]/,'')
35
+ parse_separators(@unparsed_data)
36
+ end
37
+
38
+ def parse(input)
39
+ read(input)
40
+ populate(parsed_segments)
41
+ self
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,111 @@
1
+ require_relative 'segments/base'
2
+
3
+ module Hippo_eyeDoc
4
+ module Segments
5
+ autoload_relative :AAA, 'segments/AAA'
6
+ autoload_relative :AK1, 'segments/AK1'
7
+ autoload_relative :AK2, 'segments/AK2'
8
+ autoload_relative :AK3, 'segments/AK3'
9
+ autoload_relative :AK4, 'segments/AK4'
10
+ autoload_relative :AK5, 'segments/AK5'
11
+ autoload_relative :AK9, 'segments/AK9'
12
+ autoload_relative :AMT, 'segments/AMT'
13
+ autoload_relative :BHT, 'segments/BHT'
14
+ autoload_relative :BPR, 'segments/BPR'
15
+ autoload_relative :CAS, 'segments/CAS'
16
+ autoload_relative :CL1, 'segments/CL1'
17
+ autoload_relative :CLM, 'segments/CLM'
18
+ autoload_relative :CLP, 'segments/CLP'
19
+ autoload_relative :CN1, 'segments/CN1'
20
+ autoload_relative :CR1, 'segments/CR1'
21
+ autoload_relative :CR2, 'segments/CR2'
22
+ autoload_relative :CR3, 'segments/CR3'
23
+ autoload_relative :CR4, 'segments/CR4'
24
+ autoload_relative :CR5, 'segments/CR5'
25
+ autoload_relative :CR6, 'segments/CR6'
26
+ autoload_relative :CR7, 'segments/CR7'
27
+ autoload_relative :CR8, 'segments/CR8'
28
+ autoload_relative :CRC, 'segments/CRC'
29
+ autoload_relative :CTP, 'segments/CTP'
30
+ autoload_relative :CTX, 'segments/CTX'
31
+ autoload_relative :CUR, 'segments/CUR'
32
+ autoload_relative :DMG, 'segments/DMG'
33
+ autoload_relative :DN1, 'segments/DN1'
34
+ autoload_relative :DN2, 'segments/DN2'
35
+ autoload_relative :DSB, 'segments/DSB'
36
+ autoload_relative :DTM, 'segments/DTM'
37
+ autoload_relative :DTP, 'segments/DTP'
38
+ autoload_relative :EB, 'segments/EB'
39
+ autoload_relative :EM, 'segments/EM'
40
+ autoload_relative :EQ, 'segments/EQ'
41
+ autoload_relative :FRM, 'segments/FRM'
42
+ autoload_relative :HCP, 'segments/HCP'
43
+ autoload_relative :HI, 'segments/HI'
44
+ autoload_relative :HL, 'segments/HL'
45
+ autoload_relative :HSD, 'segments/HSD'
46
+ autoload_relative :III, 'segments/III'
47
+ autoload_relative :IK3, 'segments/IK3'
48
+ autoload_relative :IK4, 'segments/IK4'
49
+ autoload_relative :IK5, 'segments/IK5'
50
+ autoload_relative :IMM, 'segments/IMM'
51
+ autoload_relative :INS, 'segments/INS'
52
+ autoload_relative :K3, 'segments/K3'
53
+ autoload_relative :LE, 'segments/LE'
54
+ autoload_relative :LIN, 'segments/LIN'
55
+ autoload_relative :LQ, 'segments/LQ'
56
+ autoload_relative :LS, 'segments/LS'
57
+ autoload_relative :LX, 'segments/LX'
58
+ autoload_relative :MEA, 'segments/MEA'
59
+ autoload_relative :MIA, 'segments/MIA'
60
+ autoload_relative :MOA, 'segments/MOA'
61
+ autoload_relative :MPI, 'segments/MPI'
62
+ autoload_relative :MSG, 'segments/MSG'
63
+ autoload_relative :N1, 'segments/N1'
64
+ autoload_relative :N2, 'segments/N2'
65
+ autoload_relative :N3, 'segments/N3'
66
+ autoload_relative :N4, 'segments/N4'
67
+ autoload_relative :NM1, 'segments/NM1'
68
+ autoload_relative :NTE, 'segments/NTE'
69
+ autoload_relative :OI, 'segments/OI'
70
+ autoload_relative :PAT, 'segments/PAT'
71
+ autoload_relative :PCT, 'segments/PCT'
72
+ autoload_relative :PDP, 'segments/PDP'
73
+ autoload_relative :PDR, 'segments/PDR'
74
+ autoload_relative :PER, 'segments/PER'
75
+ autoload_relative :PID, 'segments/PID'
76
+ autoload_relative :PKD, 'segments/PKD'
77
+ autoload_relative :PLB, 'segments/PLB'
78
+ autoload_relative :PRV, 'segments/PRV'
79
+ autoload_relative :PS1, 'segments/PS1'
80
+ autoload_relative :PWK, 'segments/PWK'
81
+ autoload_relative :QTY, 'segments/QTY'
82
+ autoload_relative :RDM, 'segments/RDM'
83
+ autoload_relative :REF, 'segments/REF'
84
+ autoload_relative :SBR, 'segments/SBR'
85
+ autoload_relative :SD1, 'segments/SD1'
86
+ autoload_relative :SE, 'segments/SE'
87
+ autoload_relative :ST, 'segments/ST'
88
+ autoload_relative :STC, 'segments/STC'
89
+ autoload_relative :SV1, 'segments/SV1'
90
+ autoload_relative :SV2, 'segments/SV2'
91
+ autoload_relative :SV3, 'segments/SV3'
92
+ autoload_relative :SV4, 'segments/SV4'
93
+ autoload_relative :SV5, 'segments/SV5'
94
+ autoload_relative :SV6, 'segments/SV6'
95
+ autoload_relative :SV7, 'segments/SV7'
96
+ autoload_relative :SVC, 'segments/SVC'
97
+ autoload_relative :SVD, 'segments/SVD'
98
+ autoload_relative :TOO, 'segments/TOO'
99
+ autoload_relative :TRN, 'segments/TRN'
100
+ autoload_relative :TS2, 'segments/TS2'
101
+ autoload_relative :TS3, 'segments/TS3'
102
+ autoload_relative :UR, 'segments/UR'
103
+ autoload_relative :VEH, 'segments/VEH'
104
+
105
+ autoload_relative :ISA, 'segments/ISA'
106
+ autoload_relative :GS, 'segments/GS'
107
+ autoload_relative :GE, 'segments/GE'
108
+ autoload_relative :IEA, 'segments/IEA'
109
+ autoload_relative :TA1, 'segments/TA1'
110
+ end
111
+ end