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.
- checksums.yaml +7 -0
- data/CHANGELOG +124 -0
- data/Gemfile +10 -0
- data/Guardfile +14 -0
- data/LICENSE +24 -0
- data/README.md +385 -0
- data/Rakefile +12 -0
- data/hippo_eyeDoc.gemspec +25 -0
- data/lib/hippo_eyeDoc.rb +15 -0
- data/lib/hippo_eyeDoc/code_lists.rb +10 -0
- data/lib/hippo_eyeDoc/code_lists/claim_adjustment_reason_codes.rb +2252 -0
- data/lib/hippo_eyeDoc/code_lists/claim_status_category_codes.rb +376 -0
- data/lib/hippo_eyeDoc/code_lists/claim_status_codes.rb +5456 -0
- data/lib/hippo_eyeDoc/code_lists/remittance_advice_remark_codes.rb +6280 -0
- data/lib/hippo_eyeDoc/code_lists/service_type_codes.rb +1299 -0
- data/lib/hippo_eyeDoc/code_lists/taxonomy_codes.rb +9224 -0
- data/lib/hippo_eyeDoc/exceptions.rb +10 -0
- data/lib/hippo_eyeDoc/field.rb +149 -0
- data/lib/hippo_eyeDoc/outputters.rb +4 -0
- data/lib/hippo_eyeDoc/outputters/html.rb +39 -0
- data/lib/hippo_eyeDoc/outputters/paper_claim.rb +7 -0
- data/lib/hippo_eyeDoc/outputters/pdf.rb +18 -0
- data/lib/hippo_eyeDoc/outputters/pretty_string.rb +45 -0
- data/lib/hippo_eyeDoc/parser.rb +70 -0
- data/lib/hippo_eyeDoc/parser/segment.rb +35 -0
- data/lib/hippo_eyeDoc/parser/transaction_set.rb +45 -0
- data/lib/hippo_eyeDoc/segments.rb +111 -0
- data/lib/hippo_eyeDoc/segments/AAA.rb +39 -0
- data/lib/hippo_eyeDoc/segments/AK1.rb +31 -0
- data/lib/hippo_eyeDoc/segments/AK2.rb +31 -0
- data/lib/hippo_eyeDoc/segments/AK3.rb +39 -0
- data/lib/hippo_eyeDoc/segments/AK4.rb +59 -0
- data/lib/hippo_eyeDoc/segments/AK5.rb +55 -0
- data/lib/hippo_eyeDoc/segments/AK9.rb +79 -0
- data/lib/hippo_eyeDoc/segments/AMT.rb +31 -0
- data/lib/hippo_eyeDoc/segments/BHT.rb +55 -0
- data/lib/hippo_eyeDoc/segments/BPR.rb +175 -0
- data/lib/hippo_eyeDoc/segments/CAS.rb +159 -0
- data/lib/hippo_eyeDoc/segments/CL1.rb +39 -0
- data/lib/hippo_eyeDoc/segments/CLM.rb +223 -0
- data/lib/hippo_eyeDoc/segments/CLP.rb +119 -0
- data/lib/hippo_eyeDoc/segments/CN1.rb +55 -0
- data/lib/hippo_eyeDoc/segments/CR1.rb +87 -0
- data/lib/hippo_eyeDoc/segments/CR2.rb +103 -0
- data/lib/hippo_eyeDoc/segments/CR3.rb +47 -0
- data/lib/hippo_eyeDoc/segments/CR4.rb +239 -0
- data/lib/hippo_eyeDoc/segments/CR5.rb +151 -0
- data/lib/hippo_eyeDoc/segments/CR6.rb +175 -0
- data/lib/hippo_eyeDoc/segments/CR7.rb +31 -0
- data/lib/hippo_eyeDoc/segments/CR8.rb +79 -0
- data/lib/hippo_eyeDoc/segments/CRC.rb +63 -0
- data/lib/hippo_eyeDoc/segments/CTP.rb +211 -0
- data/lib/hippo_eyeDoc/segments/CTX.rb +99 -0
- data/lib/hippo_eyeDoc/segments/CUR.rb +175 -0
- data/lib/hippo_eyeDoc/segments/DMG.rb +115 -0
- data/lib/hippo_eyeDoc/segments/DN1.rb +39 -0
- data/lib/hippo_eyeDoc/segments/DN2.rb +55 -0
- data/lib/hippo_eyeDoc/segments/DSB.rb +71 -0
- data/lib/hippo_eyeDoc/segments/DTM.rb +55 -0
- data/lib/hippo_eyeDoc/segments/DTP.rb +31 -0
- data/lib/hippo_eyeDoc/segments/EB.rb +207 -0
- data/lib/hippo_eyeDoc/segments/EM.rb +63 -0
- data/lib/hippo_eyeDoc/segments/EQ.rb +135 -0
- data/lib/hippo_eyeDoc/segments/FRM.rb +47 -0
- data/lib/hippo_eyeDoc/segments/GE.rb +23 -0
- data/lib/hippo_eyeDoc/segments/GS.rb +71 -0
- data/lib/hippo_eyeDoc/segments/HCP.rb +127 -0
- data/lib/hippo_eyeDoc/segments/HI.rb +919 -0
- data/lib/hippo_eyeDoc/segments/HL.rb +44 -0
- data/lib/hippo_eyeDoc/segments/HSD.rb +71 -0
- data/lib/hippo_eyeDoc/segments/IEA.rb +23 -0
- data/lib/hippo_eyeDoc/segments/III.rb +195 -0
- data/lib/hippo_eyeDoc/segments/IK3.rb +39 -0
- data/lib/hippo_eyeDoc/segments/IK4.rb +59 -0
- data/lib/hippo_eyeDoc/segments/IK5.rb +55 -0
- data/lib/hippo_eyeDoc/segments/IMM.rb +55 -0
- data/lib/hippo_eyeDoc/segments/INS.rb +171 -0
- data/lib/hippo_eyeDoc/segments/ISA.rb +136 -0
- data/lib/hippo_eyeDoc/segments/K3.rb +147 -0
- data/lib/hippo_eyeDoc/segments/LE.rb +15 -0
- data/lib/hippo_eyeDoc/segments/LIN.rb +255 -0
- data/lib/hippo_eyeDoc/segments/LQ.rb +23 -0
- data/lib/hippo_eyeDoc/segments/LS.rb +15 -0
- data/lib/hippo_eyeDoc/segments/LX.rb +20 -0
- data/lib/hippo_eyeDoc/segments/MEA.rb +219 -0
- data/lib/hippo_eyeDoc/segments/MIA.rb +199 -0
- data/lib/hippo_eyeDoc/segments/MOA.rb +79 -0
- data/lib/hippo_eyeDoc/segments/MPI.rb +63 -0
- data/lib/hippo_eyeDoc/segments/MSG.rb +31 -0
- data/lib/hippo_eyeDoc/segments/N1.rb +55 -0
- data/lib/hippo_eyeDoc/segments/N2.rb +23 -0
- data/lib/hippo_eyeDoc/segments/N3.rb +23 -0
- data/lib/hippo_eyeDoc/segments/N4.rb +63 -0
- data/lib/hippo_eyeDoc/segments/NM1.rb +103 -0
- data/lib/hippo_eyeDoc/segments/NTE.rb +23 -0
- data/lib/hippo_eyeDoc/segments/OI.rb +55 -0
- data/lib/hippo_eyeDoc/segments/PAT.rb +79 -0
- data/lib/hippo_eyeDoc/segments/PCT.rb +23 -0
- data/lib/hippo_eyeDoc/segments/PDP.rb +31 -0
- data/lib/hippo_eyeDoc/segments/PDR.rb +39 -0
- data/lib/hippo_eyeDoc/segments/PER.rb +79 -0
- data/lib/hippo_eyeDoc/segments/PID.rb +79 -0
- data/lib/hippo_eyeDoc/segments/PKD.rb +47 -0
- data/lib/hippo_eyeDoc/segments/PLB.rb +191 -0
- data/lib/hippo_eyeDoc/segments/PRV.rb +75 -0
- data/lib/hippo_eyeDoc/segments/PS1.rb +31 -0
- data/lib/hippo_eyeDoc/segments/PWK.rb +115 -0
- data/lib/hippo_eyeDoc/segments/QTY.rb +155 -0
- data/lib/hippo_eyeDoc/segments/RDM.rb +135 -0
- data/lib/hippo_eyeDoc/segments/REF.rb +83 -0
- data/lib/hippo_eyeDoc/segments/SBR.rb +79 -0
- data/lib/hippo_eyeDoc/segments/SD1.rb +71 -0
- data/lib/hippo_eyeDoc/segments/SE.rb +23 -0
- data/lib/hippo_eyeDoc/segments/ST.rb +31 -0
- data/lib/hippo_eyeDoc/segments/STC.rb +187 -0
- data/lib/hippo_eyeDoc/segments/SV1.rb +263 -0
- data/lib/hippo_eyeDoc/segments/SV2.rb +147 -0
- data/lib/hippo_eyeDoc/segments/SV3.rb +219 -0
- data/lib/hippo_eyeDoc/segments/SV4.rb +211 -0
- data/lib/hippo_eyeDoc/segments/SV5.rb +123 -0
- data/lib/hippo_eyeDoc/segments/SV6.rb +151 -0
- data/lib/hippo_eyeDoc/segments/SV7.rb +55 -0
- data/lib/hippo_eyeDoc/segments/SVC.rb +183 -0
- data/lib/hippo_eyeDoc/segments/SVD.rb +115 -0
- data/lib/hippo_eyeDoc/segments/TA1.rb +46 -0
- data/lib/hippo_eyeDoc/segments/TOO.rb +67 -0
- data/lib/hippo_eyeDoc/segments/TRN.rb +39 -0
- data/lib/hippo_eyeDoc/segments/TS2.rb +159 -0
- data/lib/hippo_eyeDoc/segments/TS3.rb +199 -0
- data/lib/hippo_eyeDoc/segments/UR.rb +23 -0
- data/lib/hippo_eyeDoc/segments/VEH.rb +159 -0
- data/lib/hippo_eyeDoc/segments/base.rb +190 -0
- data/lib/hippo_eyeDoc/separator.rb +79 -0
- data/lib/hippo_eyeDoc/transaction_sets.rb +16 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270.rb +15 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000A.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000B.rb +42 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000C.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000D.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100A.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100B.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100C.rb +97 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100D.rb +0 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2110C.rb +67 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2110D.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/base.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271.rb +19 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000A.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000B.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000C.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000D.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100A.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100B.rb +67 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100C.rb +124 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100D.rb +124 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2110C.rb +98 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2110D.rb +98 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2115C.rb +16 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2115D.rb +16 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2120C.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2120D.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/base.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276.rb +19 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000A.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000B.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000C.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000D.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000E.rb +50 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100A.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100B.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100C.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100D.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100E.rb +20 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2200D.rb +117 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2200E.rb +117 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2210D.rb +37 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2210E.rb +37 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/base.rb +90 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277.rb +22 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000A.rb +42 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000B.rb +42 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000C.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000D.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000E.rb +40 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100A.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100B.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100C.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100D.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100E.rb +20 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200A.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200B.rb +69 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200C.rb +79 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200D.rb +77 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200E.rb +104 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2220D.rb +57 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2220E.rb +44 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/base.rb +70 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835.rb +10 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L1000A.rb +74 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L1000B.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2000.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2100.rb +213 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2110.rb +106 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/base.rb +122 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L1000A.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L1000B.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000A.rb +88 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000B.rb +87 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000C.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AA.rb +65 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AB.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AC.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010BA.rb +76 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010BB.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010CA.rb +76 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2300.rb +570 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310A.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310B.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310C.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310D.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310E.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310F.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2320.rb +157 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330A.rb +45 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330B.rb +96 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330C.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330D.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330E.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330F.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330G.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2400.rb +537 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2410.rb +36 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420A.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420B.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420C.rb +44 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420D.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420E.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420F.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420G.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420H.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2430.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2440.rb +26 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/base.rb +71 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997.rb +7 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/L2000.rb +36 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/L2100.rb +29 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/base.rb +49 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999.rb +8 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2000 - AK2.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2000AK2.rb +36 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2100 - AK2.rb +37 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2100AK2.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2110 - AK2.rb +23 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2110AK2.rb +26 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/base.rb +49 -0
- data/lib/hippo_eyeDoc/transaction_sets/base.rb +236 -0
- data/lib/hippo_eyeDoc/transaction_sets/component.rb +96 -0
- data/lib/hippo_eyeDoc/transaction_sets/repeating_component.rb +48 -0
- data/lib/hippo_eyeDoc/utilities.rb +37 -0
- data/lib/hippo_eyeDoc/version.rb +3 -0
- data/samples/005010X221A1_business_scenario_1.edi +1 -0
- data/samples/005010X221A1_tmhp_example.edi +1 -0
- data/samples/005010X222A1_anesthesia.edi +1 -0
- data/samples/005010X222A1_commercial_health_insurance.edi +1 -0
- data/samples/005010X231A1_01.edi +11 -0
- data/samples/005010X231A1_02.edi +11 -0
- data/samples/200823.EDI +22 -0
- data/samples/837_L2000A_01.edi +1 -0
- data/samples/837_L2000A_02.edi +1 -0
- data/samples/parse_277.rb +127 -0
- data/samples/parse_999.rb +122 -0
- data/samples/sample835.html +1 -0
- data/samples/sample835.pretty_string +28 -0
- data/samples/sample837.html +1 -0
- data/test/test_helper.rb +155 -0
- data/test/test_hipaa_835.rb +229 -0
- data/test/test_hipaa_837.rb +596 -0
- data/test/test_html_outputter.rb +22 -0
- data/test/test_parser.rb +138 -0
- data/test/test_pretty_string_outputter.rb +33 -0
- data/test/test_segments_base.rb +201 -0
- data/test/test_transaction_sets_base.rb +122 -0
- metadata +356 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d14e9cb7eef3b322bcd148108b04101e52fd631b57c4df861ee7688cdeb07721
|
|
4
|
+
data.tar.gz: 1d14cbea027933c120f63cbdbfb34dc353d5ff33587faa25ab80f1031b9eb697
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 731dd629272c7373fc6f0ec3ca668d4cf41ffef1fab31109b8ed3d41fbb1361f0780df6a198f004418d253efad1a53087d505e528f367df046531782187f6734
|
|
7
|
+
data.tar.gz: 45ec5ea66b4595be6ded8347f618482b17969abaa0bda3cdb5c76e2c496d3ab725d94b7de6fcff3745f351fd4d01814e58ea118596e8a6c21009f5f5c5300694
|
data/CHANGELOG
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
0.5.5 - 2013/08/06
|
|
2
|
+
* Add license to gemspec.
|
|
3
|
+
* Add .to_pretty_string method to allow pretty printing.
|
|
4
|
+
* Setup #pretty_print method on TransactionSet and RepeatingComponent to
|
|
5
|
+
allow pp to work properly.
|
|
6
|
+
0.5.4 - 2013/08/06
|
|
7
|
+
* Handle whitespace prefixed segment identifiers. This allows you to parse a
|
|
8
|
+
file that has been output with indentation (to signify loops/segments).
|
|
9
|
+
0.5.3 - 2013/02/27
|
|
10
|
+
* Fix issue with repeating whitespace inside a field. (resolves #2)
|
|
11
|
+
0.5.2 - 2013/01/02
|
|
12
|
+
* Only define Hippo::VERSION if it isn't already defined (prevents an
|
|
13
|
+
already initialized constant error).
|
|
14
|
+
0.5.0 - 2012/12/13
|
|
15
|
+
* Allow parsing of HIPAA_837::L2000B to properly handle the 'floating' L2300
|
|
16
|
+
loop.
|
|
17
|
+
* Make segment/loop inclusion conditional (when :parent_context_conditions
|
|
18
|
+
is used)
|
|
19
|
+
* Refactor TransactionSets::Base.grouped_components.
|
|
20
|
+
* Properly handle the removal of empty fields.
|
|
21
|
+
0.4.1 - 2012/09/14
|
|
22
|
+
* Fix major issue (stupid typo) with Date parsing.
|
|
23
|
+
0.4.0 - 2012/09/13
|
|
24
|
+
* Do not hard-code separators in Hippo::Segments::Base#to_s.
|
|
25
|
+
* Properly escape regexps involving separators.
|
|
26
|
+
* Discard any empty segments when parsing transaction sets.
|
|
27
|
+
* Remove whitespace from fields containing only whitespace.
|
|
28
|
+
0.3.0
|
|
29
|
+
* Add support for 270/271 transaction sets.
|
|
30
|
+
0.2.3
|
|
31
|
+
* Fix issue preventing parsing when segments are not in the correct order. Now
|
|
32
|
+
we loop through all segments within a given section to make sure we grab them
|
|
33
|
+
all.
|
|
34
|
+
* Add shortcut methods to Segment::Base, TransactionSet::Base, and Component
|
|
35
|
+
to allow easier identification of segments? vs transaction_sets?.
|
|
36
|
+
* Fix issue causing all :decimal fields to be initialized to 0 even when not
|
|
37
|
+
required.
|
|
38
|
+
0.2.2 - 2012/01/25
|
|
39
|
+
* Fix issue with segment parsing. Make sure to set each segments parent
|
|
40
|
+
properly once we identify that it belongs in the particular transaction
|
|
41
|
+
set. (This allows traversing via segment.parent.parent.)
|
|
42
|
+
* Add ancestors method to TransactionSet::Base,TransactionSet::RepeatingComponent,
|
|
43
|
+
and Segments::Base which returns an array containing each ancestor (parent)
|
|
44
|
+
from the current segment to the outermost containing element.
|
|
45
|
+
* Fix issue causing non-required fields to be blank filled.
|
|
46
|
+
* Refactor Field#string_value and Field#formatted_value to handle more situations.
|
|
47
|
+
* Add segments method to TransactionSet::Base,TransactionSet::RepeatingComponent,
|
|
48
|
+
and Segments::Base which returns a flattened array of segments within each
|
|
49
|
+
container. (Segment::Base simply returns [self].)
|
|
50
|
+
* Refactor TransactionSet::Base#segment_count to use new segments array.
|
|
51
|
+
* Add shortcut methods to Hippo::Parser for parse_file and parse_string. Now they
|
|
52
|
+
can be called without creating an instance of Parser. (i.e Hippo::Parser.parse_string(s))
|
|
53
|
+
* Fix issue causing access to empty composite fields to throw an error ([] for NilClass).
|
|
54
|
+
0.2.1 - 2012/01/21
|
|
55
|
+
* Fix issue preventing fixed width segments from printing
|
|
56
|
+
properly. (Non set fields on ISA were empty not padded.)
|
|
57
|
+
0.2.0 - 2012/01/21
|
|
58
|
+
* Updated segment definitions to differentiate between
|
|
59
|
+
Integer and Decimal.
|
|
60
|
+
* Add field level datatype conversion. Date, Time, Integer,
|
|
61
|
+
and Decimal fields will be stored internally as their
|
|
62
|
+
appropriate type and converted to a properly formatted
|
|
63
|
+
string representation when needed.
|
|
64
|
+
0.1.2 - 2012/01/18
|
|
65
|
+
* Add RepeatingComponent to Outputters.
|
|
66
|
+
* Add HIPAA_997 to list of supported transaction sets.
|
|
67
|
+
0.1.1 - 2012/01/11
|
|
68
|
+
* Update Parser to better handle Loops and repeating components.
|
|
69
|
+
* Flesh out to_html outputter with a basic layout.
|
|
70
|
+
0.1.0 - 2012/01/05
|
|
71
|
+
* Add concept of Outputters.
|
|
72
|
+
* Create PDF and HTML outputters.
|
|
73
|
+
* Create PaperClaim outputter for HIPAA_837::L2000A.
|
|
74
|
+
* Refactor parsing so any descendant of TransactionSet::Base is
|
|
75
|
+
able to parse a string representation of itself.
|
|
76
|
+
* Refactor Separator module to use super instead of a custom
|
|
77
|
+
function call to initialize the separators.
|
|
78
|
+
* Fix project so that we do not modify $LOAD_PATH.
|
|
79
|
+
* Only use autoload for Segments and TransactionSets that are optional.
|
|
80
|
+
0.0.12 - 2011/12/22
|
|
81
|
+
* Fix a number of parsing errors.
|
|
82
|
+
* Ensure that we only evaluate the first segment when matching
|
|
83
|
+
against non-loop components.
|
|
84
|
+
* Fix issue causing sub-loops to be reversed on parsing.
|
|
85
|
+
* Fix issue preventing proper recursion when parsing a repeating
|
|
86
|
+
component inside TransactionSet::Base.
|
|
87
|
+
0.0.11 - 2011/12/18
|
|
88
|
+
* Ignore Base Control Set when parsing input files.
|
|
89
|
+
* Make sure to only append a segment when we are within a transaction.
|
|
90
|
+
* Added TA1 segment.
|
|
91
|
+
* Add ISA, GS, GE, and IEA to TransactionSets::Base, and populate them
|
|
92
|
+
when parsing. This allows the client application to access each
|
|
93
|
+
transaction sets individual envelope.
|
|
94
|
+
* Added common code lists including:
|
|
95
|
+
- Claim Adjustment Reason Codes
|
|
96
|
+
- Claim Status Category Codes
|
|
97
|
+
- Claim Status Codes
|
|
98
|
+
- Remittance Advice Remark Codes
|
|
99
|
+
- Service Type Codes
|
|
100
|
+
- Taxonomy Codes
|
|
101
|
+
* Fix issue preventing repeating loops from being parsed properly.
|
|
102
|
+
* Allow accessing composite fields via shorthand notation. (e.g
|
|
103
|
+
SV101_01 = SV1.ProductServiceIdQualifier)
|
|
104
|
+
0.0.10 - 2011/11/29
|
|
105
|
+
* Fix autoload issue with enveloping structures.
|
|
106
|
+
0.0.9 - 2011/11/29
|
|
107
|
+
* Update Enveloping structures for 5010.
|
|
108
|
+
0.0.8 - 2011/11/15
|
|
109
|
+
* Add ability to use Regexp with TransactionSet::Base#find_by_name.
|
|
110
|
+
0.0.7 - 2011/11/15
|
|
111
|
+
* Add TransactionSet::Base#find_by_name to allow searching for components
|
|
112
|
+
by name rather than only by identifier.
|
|
113
|
+
0.0.6 - 2011/11/09
|
|
114
|
+
* Add Separator module for handling segment, field, composite, and
|
|
115
|
+
repetition separators the same.
|
|
116
|
+
* Respect 'parent's separators when building/initializing components.
|
|
117
|
+
* Fixed parsing logic to properly handle nested groups.
|
|
118
|
+
0.0.5 - 2011/09/16
|
|
119
|
+
* Add ability to parse transaction sets.
|
|
120
|
+
0.0.4
|
|
121
|
+
* Fix issue when no values are set in any subfield of a composite field.
|
|
122
|
+
* Add more segment tests.
|
|
123
|
+
* Import all segments and loops from the X12 CSV Table Data
|
|
124
|
+
* Initial version.
|
data/Gemfile
ADDED
data/Guardfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# A sample Guardfile
|
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
|
3
|
+
|
|
4
|
+
guard 'minitest' do
|
|
5
|
+
# with Minitest::Unit
|
|
6
|
+
watch(%r|^test/test_(.*)\.rb|)
|
|
7
|
+
watch(%r|^lib/(.+).rb|) { "test" }
|
|
8
|
+
watch(%r|^test/test_helper\.rb|) { "test" }
|
|
9
|
+
|
|
10
|
+
# with Minitest::Spec
|
|
11
|
+
# watch(%r|^spec/(.*)_spec\.rb|)
|
|
12
|
+
# watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
|
|
13
|
+
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
|
14
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2011, ProMedical, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
* Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
* Neither the name of ProMedical, Inc. nor the
|
|
12
|
+
names of its contributors may be used to endorse or promote products
|
|
13
|
+
derived from this software without specific prior written permission.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL PROMEDICAL, INC. BE LIABLE FOR ANY
|
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
Hippo_eyeDoc
|
|
2
|
+
============
|
|
3
|
+
Fork of Hippo with bugfixes by DrBassman. Forked so that a "fixed" ruby gem could be
|
|
4
|
+
created / uploaded to rubygems.org.
|
|
5
|
+
|
|
6
|
+
Hippo
|
|
7
|
+
=====
|
|
8
|
+
|
|
9
|
+
The Hippo library is an attempt at creating a simple DSL to generate and parse HIPAA
|
|
10
|
+
transaction sets. HIPAA or the Health Insurance Portability Accountability Act is a
|
|
11
|
+
series of regulations which place restrictions and requirements on the way transaction
|
|
12
|
+
sets (ie. Claims, Remittances, Eligibility, Claim Status, etc.) must be formatted.
|
|
13
|
+
|
|
14
|
+
The HIPAA required transactions sets are created by the X12
|
|
15
|
+
organization. The current production version (as of 2011/02/05) is 4010A1, but
|
|
16
|
+
effective 2012/01/01 all organizations must be migrated to using version
|
|
17
|
+
5010.
|
|
18
|
+
|
|
19
|
+
To obtain copies of the implementation guides you must purchase them from the X12
|
|
20
|
+
organization. The implementation data is also available in tabular format (CSV). The
|
|
21
|
+
transaction sets, loops, and segments in Hippo were created from the X12 CSV Table Data.
|
|
22
|
+
|
|
23
|
+
More information can be found at the following sites:
|
|
24
|
+
|
|
25
|
+
* [General HIPAA information from CMS](https://www.cms.gov/HIPAAGenInfo/01_Overview.asp)
|
|
26
|
+
* [Wikipedia HIPAA Article](http://en.wikipedia.org/wiki/Hipaa)
|
|
27
|
+
* [5010 Implementation Timeline](https://www.cms.gov/ElectronicBillingEDITrans/18_5010D0.asp)
|
|
28
|
+
* [X12 Store](https://store.x12.org)
|
|
29
|
+
|
|
30
|
+
Sample scripts using Hippo:
|
|
31
|
+
|
|
32
|
+
* [277CA Parser](https://gist.github.com/1492492)
|
|
33
|
+
|
|
34
|
+
This Repository
|
|
35
|
+
---------------
|
|
36
|
+
|
|
37
|
+
I was needing to parse the so-called '999' and '277' files that the vendor to whom I submit electronic
|
|
38
|
+
medical claims provides for each file uploaded. A google search led me to the hippo ruby gem. When my claims processor
|
|
39
|
+
changed the segment_separator in the 999 & 277's that they provide, my script quit working. I discovered that the '~'
|
|
40
|
+
character was HARD-CODED as the segment_separator. I copied the repository to github so that I could
|
|
41
|
+
"forget" which file it was that I updated, and to contribute the fix back to whomever would find it
|
|
42
|
+
useful.
|
|
43
|
+
|
|
44
|
+
I have attempted to email a patch to the author, but many of the links for this gem on
|
|
45
|
+
http://rubygems.org/gems/hippo (particularly the links to github source) are broken. To date, I have not received any
|
|
46
|
+
response from the author linked from that page...
|
|
47
|
+
|
|
48
|
+
This repository also includes my scripts for parsing the 999 & 277 files that I use in my practice...
|
|
49
|
+
|
|
50
|
+
Ryan Losh, O.D.
|
|
51
|
+
01/11/2018 @ 11:03PM CST.
|
|
52
|
+
|
|
53
|
+
Installation
|
|
54
|
+
------------
|
|
55
|
+
gem install hippo
|
|
56
|
+
|
|
57
|
+
Usage
|
|
58
|
+
-----
|
|
59
|
+
This is very straight forward. Basically, create an instance of the
|
|
60
|
+
transaction set that you will be working with, and start filling in the
|
|
61
|
+
loops, segments, and fields. For a complete example from the 222A1 (837-P) implementation
|
|
62
|
+
guide please review [test/test_hipaa_837.rb](/promedical/hippo/blob/master/test/test_hipaa_837.rb).
|
|
63
|
+
|
|
64
|
+
Below is a small sample of how to create a transaction set.
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
ts = Hippo::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
|
+
puts ts.to_s
|
|
99
|
+
|
|
100
|
+
# Below is the output of ts.to_s (split onto separate lines for readability)
|
|
101
|
+
#
|
|
102
|
+
# ST*837*0021*005010X222A1~
|
|
103
|
+
# BHT*0019*00*244579*20061015*1023*CH~
|
|
104
|
+
# NM1*41*2*PREMIER BILLING SERVICE*****46*TGJ23~
|
|
105
|
+
# PER*IC*JERRY*TE*3055552222*EX*231~
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Transaction Set/Loop and Segment DSL
|
|
109
|
+
------------------------------------
|
|
110
|
+
Transaction Sets/Loops and Segments are defined with a very straight forward DSL.
|
|
111
|
+
|
|
112
|
+
```ruby
|
|
113
|
+
module Hippo::Segments
|
|
114
|
+
class TestSimpleSegment < Hippo::Segments::Base
|
|
115
|
+
segment_identifier 'TSS'
|
|
116
|
+
|
|
117
|
+
field :name => 'Field1'
|
|
118
|
+
field :name => 'Field2'
|
|
119
|
+
field :name => 'Field3'
|
|
120
|
+
field :name => 'Field4'
|
|
121
|
+
field :name => 'CommonName'
|
|
122
|
+
field :name => 'CommonName'
|
|
123
|
+
field :name => 'DateField', :datatype => :date
|
|
124
|
+
field :name => 'TimeField', :datatype => :time
|
|
125
|
+
field :name => 'IntegerField', :datatype => :integer
|
|
126
|
+
field :name => 'DecimalField', :datatype => :decimal
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
class TestCompoundSegment < Hippo::Segments::Base
|
|
130
|
+
segment_identifier 'TCS'
|
|
131
|
+
|
|
132
|
+
composite_field 'CompositeField' do
|
|
133
|
+
field :name => 'Field1'
|
|
134
|
+
field :name => 'Field2'
|
|
135
|
+
field :name => 'Field3'
|
|
136
|
+
field :name => 'CompositeCommonName'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
composite_field 'CompositeField' do
|
|
140
|
+
field :name => 'Field4'
|
|
141
|
+
field :name => 'Field5'
|
|
142
|
+
field :name => 'Field6'
|
|
143
|
+
field :name => 'CompositeCommonName'
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
field :name => 'Field7'
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
module Hippo::TransactionSets
|
|
151
|
+
module Test
|
|
152
|
+
class Base < Hippo::TransactionSets::Base
|
|
153
|
+
|
|
154
|
+
segment Hippo::Segments::TestSimpleSegment,
|
|
155
|
+
:name => 'Test Simple Segment #1',
|
|
156
|
+
:minimum => 1,
|
|
157
|
+
:maximum => 5,
|
|
158
|
+
:position => 50,
|
|
159
|
+
:defaults => {
|
|
160
|
+
'TSS01' => 'Blah'
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
segment Hippo::Segments::TestCompoundSegment,
|
|
164
|
+
:name => 'Test Compound Segment #2',
|
|
165
|
+
:minimum => 1,
|
|
166
|
+
:maximum => 1,
|
|
167
|
+
:position => 100,
|
|
168
|
+
:defaults => {
|
|
169
|
+
'Field7' => 'Preset Field 7'
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
segment Hippo::Segments::TestSimpleSegment,
|
|
173
|
+
:name => 'Test Simple Segment #3',
|
|
174
|
+
:minimum => 1,
|
|
175
|
+
:maximum => 1,
|
|
176
|
+
:position => 50,
|
|
177
|
+
:defaults => {
|
|
178
|
+
'TSS01' => 'Last Segment'
|
|
179
|
+
}
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Quick Guide to Populating a Transaction Set
|
|
186
|
+
-------------------------------------------
|
|
187
|
+
Using the simple transaction set and segments defined above, here are a few ways to access
|
|
188
|
+
the fields.
|
|
189
|
+
|
|
190
|
+
To create a transaction set simple choose the set you want and call new on it's Base class.
|
|
191
|
+
|
|
192
|
+
```ruby
|
|
193
|
+
ts = Hippo::TransactionSets::Test::Base.new
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The segments can be accessed directly from the created transaction set using the segment
|
|
197
|
+
identifier.
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
ts.TCS
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Since the TSS segment can be repeated we must call #build to generate a new
|
|
204
|
+
instance for each repeat. (You will be returned the first instance each time if you
|
|
205
|
+
do not call #build.)
|
|
206
|
+
|
|
207
|
+
```ruby
|
|
208
|
+
tss = ts.TSS.build
|
|
209
|
+
|
|
210
|
+
# or
|
|
211
|
+
|
|
212
|
+
ts.TSS.build do |tss|
|
|
213
|
+
# do something here...
|
|
214
|
+
end
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The code above produces the following string output (notice how the values from
|
|
218
|
+
:defaults are prefilled, and the output is automatically sorted based on the order
|
|
219
|
+
that the segments were declared):
|
|
220
|
+
|
|
221
|
+
```ruby
|
|
222
|
+
# ts.to_s => 'TSS*Blah~TCS***Preset Field 7~'
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
You can set the field values on a given segment a few different ways.
|
|
226
|
+
|
|
227
|
+
First you must access the segment that the field belongs to. You can
|
|
228
|
+
either access the fields directly on the segment or use the block syntax.
|
|
229
|
+
|
|
230
|
+
```ruby
|
|
231
|
+
# this is one way to populate the fields
|
|
232
|
+
ts.TCS.Field1 = 'Foo'
|
|
233
|
+
ts.TSS.Field2 = 'Bar'
|
|
234
|
+
|
|
235
|
+
# this is another way
|
|
236
|
+
ts.TCS do |tcs|
|
|
237
|
+
tcs.Field1 = 'Foo'
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
ts.TSS do |tss|
|
|
241
|
+
tss.Field2 = 'Bar'
|
|
242
|
+
end
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Once you have access to the segment you can set the field values by either
|
|
246
|
+
calling the field name or using its relative position in the segment. If the
|
|
247
|
+
field name is used more than once in a segment or if you are accessing a
|
|
248
|
+
composite field you can optionally pass the index of the field to access.
|
|
249
|
+
|
|
250
|
+
```ruby
|
|
251
|
+
ts.TCS do |tcs|
|
|
252
|
+
tcs.Field1 = 'Foo' # use the field name
|
|
253
|
+
tcs.TCS01_01 = 'Bar' # use shorthand notation:
|
|
254
|
+
# TCS01 refers to the first field within the current segment
|
|
255
|
+
# _01 refers to the first field within the composite field
|
|
256
|
+
end
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
If you read the transaction set declaration from above you will notice that the TSS segment
|
|
260
|
+
can be set in two different sequences (with different preset values). By default (as you
|
|
261
|
+
can see from the previous example) when we call TSS we are referring to the first segment,
|
|
262
|
+
but if you need to access the second instance of TSS in the transaction set you would specify
|
|
263
|
+
TSS_02 instead.
|
|
264
|
+
|
|
265
|
+
```ruby
|
|
266
|
+
ts.TCS.Field1 = 'Foo'
|
|
267
|
+
ts.TSS.Field2 = 'Bar'
|
|
268
|
+
ts.TSS_02.Field2 = 'Baz'
|
|
269
|
+
|
|
270
|
+
# ts.to_s => 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~TSS*Last Segment*Baz~'
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Obviously, this could get somewhat tedious when operating on a TransactionSet with many segments
|
|
274
|
+
with the same identifier. As an alternative you can also access a particular segment/loop based
|
|
275
|
+
on the name provided in the TransactionSet definition. You can either pass the actual name or
|
|
276
|
+
a Regexp to search with.
|
|
277
|
+
|
|
278
|
+
```ruby
|
|
279
|
+
ts.find_by_name('Test Simple Segment #1') do |tss|
|
|
280
|
+
tss.Field2 = 'Baz'
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# which is essentially equivilent (because the search occurs in order of declaration)
|
|
284
|
+
ts.find_by_name(/Segment/) do |tss|
|
|
285
|
+
tss.Field2 = 'Baz'
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# ts.to_s => 'TSS*Blah*Baz~'
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
The same technique can be used to reference fields within a segment that have the same name.
|
|
292
|
+
|
|
293
|
+
```ruby
|
|
294
|
+
ts.TSS.CommonName = 'Value1'
|
|
295
|
+
ts.TSS.CommonName_02 = 'Value2'
|
|
296
|
+
|
|
297
|
+
# ts.to_s => 'TSS*Blah*Bar***Value1*Value2~TCS*Foo**Preset Field 7~TSS*Last Segment*Baz~'
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Type Conversion
|
|
301
|
+
---------------
|
|
302
|
+
|
|
303
|
+
As of Hippo version 0.2.0 values are stored in the native format, and coverted back to the
|
|
304
|
+
appropriate string representation when required. This means that you can set and access date,
|
|
305
|
+
time, integer, and decimal fields without having to convert back and forth between strings.
|
|
306
|
+
|
|
307
|
+
As part of the type conversion process we are also validating that a fields value is being set
|
|
308
|
+
with a valid value for that particular data type.
|
|
309
|
+
|
|
310
|
+
Just a few examples using the type conversion:
|
|
311
|
+
|
|
312
|
+
```ruby
|
|
313
|
+
seg = Hippo::Segments::TSS.new # Please review definition from above.
|
|
314
|
+
|
|
315
|
+
# Date fields:
|
|
316
|
+
seg.DateField = Date.new(2012, 01, 20)
|
|
317
|
+
seg.DateField = "20120120"
|
|
318
|
+
seg.DateField = Time.new(2012, 01, 20, 10, 15, 20)
|
|
319
|
+
|
|
320
|
+
# all of these formats result in the same internal representation
|
|
321
|
+
puts seg.DateField.inspect # => #<Date: 2012-01-20 ((2455947j,0s,0n),+0s,2299161j)>
|
|
322
|
+
|
|
323
|
+
# To set the field back to a blank/empty value simply assign it to nil
|
|
324
|
+
seg.DateField = nil
|
|
325
|
+
|
|
326
|
+
# Time fields:
|
|
327
|
+
seg.TimeField = "0120" # => 1:20 am (HHMM)
|
|
328
|
+
seg.TimeField = "012023" # => 1:20:23 am (HHMMSS)
|
|
329
|
+
seg.TimeField = "01202322" # => 1:20:23.22 am (HHMMSSDD)
|
|
330
|
+
seg.TimeField = Time.now
|
|
331
|
+
|
|
332
|
+
# Integer fields:
|
|
333
|
+
seg.IntegerField = "10" # => 10
|
|
334
|
+
seg.IntegerField = 10 # => 10
|
|
335
|
+
seg.IntegerField = "10blah" # => 10
|
|
336
|
+
|
|
337
|
+
# Decimal fields:
|
|
338
|
+
seg.DecimalField = "123.45" # => #<BigDecimal:7fe83c315750,'0.12345E3',18(18)>
|
|
339
|
+
seg.DecimalField = 123.45 # => #<BigDecimal:7fe83c315750,'0.12345E3',18(18)>
|
|
340
|
+
seg.DecimalField = 123 # => #<BigDecimal:7fe83b9dd4f8,'0.123E3',9(18)>
|
|
341
|
+
seg.DecimalField = 123.0 # => #<BigDecimal:7fe83b9dd4f8,'0.123E3',9(18)>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
__Please Note__: Due to issues with floating point representation of currency values we have
|
|
345
|
+
chosen to use BigDecimal internally to store all fields with a decimal datatype.
|
|
346
|
+
|
|
347
|
+
Hierarchy Traversal
|
|
348
|
+
-------------------
|
|
349
|
+
|
|
350
|
+
There are times with a given transaction set that you may start with a given segment but need
|
|
351
|
+
to traverse up to a higher level loop/transaction set container. The best example of this is
|
|
352
|
+
when dealing with 997 or 999 acknowledgments. If there are errors in your original transmission
|
|
353
|
+
they are reported on the 997 and 999 as the segment number in error. We need to then take that
|
|
354
|
+
errored segment and figure out more context.
|
|
355
|
+
|
|
356
|
+
The first thing we have to do is find the segment in error. The 999 contains this in the IK3
|
|
357
|
+
segment of the 2100 - AK2/IK3 loop. Then we need to access those segments in the original
|
|
358
|
+
transmitted file. Finally, we need to access an ancestor that gives enough context to resolve
|
|
359
|
+
the error.
|
|
360
|
+
|
|
361
|
+
Here is a quick example:
|
|
362
|
+
|
|
363
|
+
```ruby
|
|
364
|
+
ts_999 = Hippo::Parser.parse_file('location/to/999/file.999')
|
|
365
|
+
ts_837 = Hippo::Parser.parse_file('location/to/837/file.837')
|
|
366
|
+
|
|
367
|
+
# first lets get the index of all of the errored segments
|
|
368
|
+
error_indexes = ts_999.L2000AK2.map{|l| l.L2100AK2.map{|m| m.IK3.IK303}}.flatten
|
|
369
|
+
# or
|
|
370
|
+
error_indexes = ts_999.segments.select{|s| s.class.to_s =~ /IK3/}.collect{|s| s.IK303}
|
|
371
|
+
|
|
372
|
+
# now lets find those segments in the file being confirmed
|
|
373
|
+
errored_segments = ts_837.segments.values_at(error_indexes)
|
|
374
|
+
|
|
375
|
+
# and finally lets find the claim that they belong to
|
|
376
|
+
errored_claims = errored_segments.collect{|s| s.ancestors.select{|a| a.class.to_s =~ /L2000B/}}.flatten
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
For more example please review the test suite.
|
|
380
|
+
|
|
381
|
+
License
|
|
382
|
+
-------
|
|
383
|
+
Copyright 2011 by ProMedical, and licensed under the Modified BSD License. See included
|
|
384
|
+
[LICENSE](/promedical/hippo/blob/master/LICENSE) file for
|
|
385
|
+
details.
|