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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module Hippo_eyeDoc::TransactionSets
|
|
2
|
+
class Component
|
|
3
|
+
attr_reader :options, :klass, :sequence, :maximum, :identified_by, :conditions
|
|
4
|
+
|
|
5
|
+
def initialize(options)
|
|
6
|
+
@identified_by = options.delete(:identified_by) || {}
|
|
7
|
+
@conditions = options.delete(:parent_context_conditions) || {}
|
|
8
|
+
@maximum = options.delete(:maximum) || 1
|
|
9
|
+
@klass = options.delete(:klass)
|
|
10
|
+
@sequence = options.delete(:sequence)
|
|
11
|
+
|
|
12
|
+
@options = options
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def repeating?
|
|
16
|
+
@maximum > 1
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def transaction_set?
|
|
20
|
+
@klass.ancestors.include? Hippo_eyeDoc::TransactionSets::Base
|
|
21
|
+
end
|
|
22
|
+
alias :loop? :transaction_set?
|
|
23
|
+
|
|
24
|
+
def segment?
|
|
25
|
+
@klass.ancestors.include? Hippo_eyeDoc::Segments::Base
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def identifier
|
|
29
|
+
@klass.identifier
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def populate_component(component, defaults = nil)
|
|
33
|
+
defaults ||= identified_by
|
|
34
|
+
|
|
35
|
+
defaults.each do |key, value|
|
|
36
|
+
value = Array(value)
|
|
37
|
+
|
|
38
|
+
if key =~ /(\w+)\.(.+)/
|
|
39
|
+
next_component, next_component_value = component.send($1.to_sym), {$2 => value}
|
|
40
|
+
|
|
41
|
+
populate_component(next_component, next_component_value)
|
|
42
|
+
else
|
|
43
|
+
next if value.length > 1
|
|
44
|
+
|
|
45
|
+
component.send((key + '=').to_sym, value.first)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
component
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def initialize_component(parent)
|
|
53
|
+
if repeating?
|
|
54
|
+
RepeatingComponent.new(self, parent)
|
|
55
|
+
else
|
|
56
|
+
populate_component(@klass.new(:parent => parent))
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def valid?(segment)
|
|
61
|
+
if klass.ancestors.include? Hippo_eyeDoc::Segments::Base
|
|
62
|
+
valid_segment?(segment)
|
|
63
|
+
else
|
|
64
|
+
valid_entry_segment?(segment)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def valid_segment?(segment)
|
|
69
|
+
segment.identifier == identifier && identified_by.all? {|k, v| Array(v).include?(segment.send(k.to_sym))}
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def valid_entry_segment?(segment)
|
|
73
|
+
if identified_by.empty?
|
|
74
|
+
initial_segment_id = @klass.components.first.identifier
|
|
75
|
+
|
|
76
|
+
segment.identifier == initial_segment_id
|
|
77
|
+
else
|
|
78
|
+
path, value = identified_by.first
|
|
79
|
+
# TODO: handle arbitrary depth in loop identified_by parsing
|
|
80
|
+
segment_id, field_name = path.split('.')
|
|
81
|
+
|
|
82
|
+
segment.identifier == segment_id && Array(value).include?(segment.send(field_name))
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def conditions_match?(instance, segment)
|
|
87
|
+
if conditions.empty?
|
|
88
|
+
true
|
|
89
|
+
else
|
|
90
|
+
conditions.all? do |method, expected|
|
|
91
|
+
Array(expected).include?(instance.instance_eval("self." + method))
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Hippo_eyeDoc::TransactionSets
|
|
2
|
+
class RepeatingComponent < Array
|
|
3
|
+
include Hippo_eyeDoc::Outputters::HTML::RepeatingComponent
|
|
4
|
+
include Hippo_eyeDoc::Outputters::PDF::RepeatingComponent
|
|
5
|
+
include Hippo_eyeDoc::Outputters::PrettyString::RepeatingComponent
|
|
6
|
+
|
|
7
|
+
def initialize(component_entry, parent)
|
|
8
|
+
@component_entry = component_entry
|
|
9
|
+
@parent = parent
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def build
|
|
13
|
+
component = @component_entry.populate_component(@component_entry.klass.new(:parent => @parent))
|
|
14
|
+
|
|
15
|
+
push(component)
|
|
16
|
+
yield component if block_given?
|
|
17
|
+
component
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def to_s
|
|
21
|
+
self.map(&:to_s).join
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def segments
|
|
25
|
+
return [] unless self.length != 0
|
|
26
|
+
|
|
27
|
+
self.map(&:segments).flatten
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def segment_count
|
|
31
|
+
segments.length
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def ancestors
|
|
35
|
+
if parent
|
|
36
|
+
parent.ancestors.flatten
|
|
37
|
+
else
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def method_missing(method_name, *args, &block)
|
|
43
|
+
build if self.length == 0
|
|
44
|
+
|
|
45
|
+
self.first.send(method_name, *args, &block)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
# This is the source code for require_relative, a Ruby gem that backports that
|
|
4
|
+
# particular feature to Ruby 1.8.
|
|
5
|
+
#
|
|
6
|
+
# Please check out the [README](https://github.com/steveklabnik/require_relative/blob/master/README.md)
|
|
7
|
+
# for more information on how to build your own copy of the gem, as well as
|
|
8
|
+
# contribute fixes.
|
|
9
|
+
|
|
10
|
+
# require\_relative has no effect on Ruby 1.9 (or other versions that provide Kernel#require_relative
|
|
11
|
+
# out of the box)
|
|
12
|
+
unless Object.new.respond_to?(:require_relative, true)
|
|
13
|
+
# Yep, you're looking at it! This gem is pretty small, and for good reason.
|
|
14
|
+
# There's not much to do! We use split to find the filename that we're
|
|
15
|
+
# looking to require, raise a LoadError if it's called in a context (like eval)
|
|
16
|
+
# that it shouldn't be, and then require it via regular old require.
|
|
17
|
+
#
|
|
18
|
+
# Now, in 1.9, "." is totally removed from the $LOAD_PATH. We don't do that
|
|
19
|
+
# here, because that would break a lot of other code! You're still vulnerable
|
|
20
|
+
# to the security hole that caused this change to happen in the first place.
|
|
21
|
+
# You will be able to use this gem to transition the code you write over to
|
|
22
|
+
# the 1.9 syntax, though.
|
|
23
|
+
def require_relative(relative_feature)
|
|
24
|
+
|
|
25
|
+
file = caller.first.split(/:\d/,2).first
|
|
26
|
+
|
|
27
|
+
raise LoadError, "require_relative is called in #{$1}" if /\A\((.*)\)/ =~ file
|
|
28
|
+
|
|
29
|
+
require File.expand_path(relative_feature, File.dirname(file))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def autoload_relative(symbol, relative_path)
|
|
34
|
+
file = caller.first.split(/:\d/,2).first
|
|
35
|
+
|
|
36
|
+
autoload symbol, File.expand_path(relative_path, File.dirname(file))
|
|
37
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ST*835*1234~BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456*1512345678**01*999988880*DA*98765*20020913~TRN*1*12345*1512345678~DTM*405*20020916~N1*PR*INSURANCE COMPANY OF TIMBUCKTU~N3*1 MAIN STREET~N4*TIMBUCKTU*AK*89111~REF*2U*999~N1*PE*REGIONAL HOPE HOSPITAL*XX*6543210903~LX*110212~TS3*6543210903*11*20021231*1*211366.97****138018.4**73348.57~TS2*2178.45*1919.71**56.82*197.69*4.23~CLP*666123*1*211366.97*138018.4**MA*1999999444444*11*1~CAS*CO*45*73348.57~NM1*QC*1*JONES*SAM*O***HN*666666666A~MIA*0***138018.4~DTM*232*20020816~DTM*233*20020824~QTY*CA*8~LX*130212~TS3*6543210909*13*19961231*1*15000****11980.33**3019.67~CLP*777777*1*15000*11980.33**MB*1999999444445*13*1~CAS*CO*45*3019.67~NM1*QC*1*BORDER*LIZ*E***HN*996669999B~MOA***MA02~DTM*232*20020512~PLB*6543210903*20021231*CV:CP*-1.27~SE*28*1234~
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ST*835*0001~BPR*I*40.80*C*CHK************20110707~TRN*1*020961585*1123456789~REF*EV*745276163~REF*F2*0001~DTM*405*20110701~N1*PR*TEXASMEDICAIDHEALTHCARESERVICES~N3*12365ARIATATRACEPARKWAY~N4*ARSTIN*TX*787276524~PER*BL*JOHNWAYNE*TE*8005551212*EX*123~N1*PE*PROV2*XX*1234567891~N3*ADDRESS2~N4*CITY2*TX*77210~REF*TJ*999999999~LX*1~CLP*PATACCTNTMBER11111*1*40.8*40.8**MC*111111*12*A**10*123456789012345*99999999.99~NM1*QC*1*SHEPHARD*SAM*O***HN*666666666A~NM1*74*1******C*555555555~NM1*PR*2*OHTERINSTRANCENAME2*****PI*9876543210~REF*EA*777~REF*SY*645507788~REF*F8*222222~REF*G1*444~DTM*232*20110103~DTM*233*20110105~PER*CX*1234*TE*5125125122~AMT*DY*9999.89~AMT*T*89988.01~QTY*CA*2222.2~SVC*HC:99215*40.8*40.8~DTM*472*20110223~REF*G3*12345678~REF*1D*749999999~REF*HPI*1234567890~SE*35*0001~ST*835*0002~BPR*I*40.8*C*CHK************20110707~TRN*1*020961585*1123456789~REF*F2*0001~DTM*405*20110301~N1*PR*TEXASMEDICAIDHEALTHCARESERVICES~N3*12365ATRACEPARKWAY~N4*ARSTIN*TX*787276524~PER*BL*JOHNWAYNE*TE*8005551212*EX*123~N1*PE*PROV2*XX*1234567899~N3*ADDRESS2~N4*CITY2*TX*77210~REF*TJ*999999999~LX*1~CLP*PATACCTNTMBER11111*1*40.8*40.8**MC*111111*12*A**10*123456789012345*99999999.99~NM1*QC*1*5PATIENTLASTNAME*PATFTNAM*N**PATSTFFIX*MI*444444444~NM1*74*1******C*555555555~NM1*PR*2*OHTERINSTRANCENAME2*****PI*9876543210~REF*EA*777~REF*SY*645507788~REF*F8*222222~REF*G1*444~DTM*232*20110103~DTM*233*20110107~PER*CX*1234*TE*5125125122~AMT*DY*9999.89~AMT*T*89988.01~QTY*CA*2222.2~SVC*HC:99215*40.8*40.8~DTM*472*20110223~REF*G3*12345678~REF*1D*749999999~REF*HPI*9999999990~SE*34*0002~
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ST*837*0001*005010X222A1~BHT*0019*00*0123*20050117*1023*CH~NM1*41*2*PROVIDER MEDICAL GROUP*****46*N305~PER*IC*NINA*TE*6155551212*EX*911~NM1*40*2*ABC PAYER*****46*05440~HL*1**20*1~NM1*85*2*PROVIDER MEDICAL GROUP*****XX*2366554859~N3*1234 WEST END AVE~N4*NASHVILLE*TN*37232~REF*EI*756473826~HL*2*1*22*0~SBR*P*18*******MB~NM1*IL*1*JONES*MARGARET****MI*123456789A~N3*123 RAINBOW ROAD~N4*NASHVILLE*TN*37232~DMG*D8*19740303*F~NM1*PR*2*ABC PAYER*****PI*05440~CLM*153829140*827***22:B:1*Y*A*Y*Y~HI*BK:36616~NM1*82*1*TOWNSEND*JACOB*E***XX*5678912345~PRV*PE*ZZ*207L00000X~NM1*77*2*PROVIDER OP HOSP*****XX*432198765~N3*345 MAIN DRIVE~N4*NASHVILLE*TN*37232~LX*1~SV1*HC:00142:QK:QS:P1*827*MJ*61***1~DTP*472*D8*20050112~SE*28*0001~
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ST*837*0021*005010X222A1~BHT*0019*00*244579*20061015*1023*CH~NM1*41*2*PREMIER BILLING SERVICE*****46*TGJ23~PER*IC*JERRY*TE*3055552222*EX*231~NM1*40*2*KEY INSURANCE COMPANY*****46*66783JJT~HL*1**20*1~PRV*BI*PXC*203BF0100Y~NM1*85*2*BEN KILDARE SERVICE*****XX*9876543210~N3*234 SEAWAY ST~N4*MIAMI*FL*33111~REF*EI*587654321~NM1*87*2~N3*2345 OCEAN BLVD~N4*MIAMI*FL*33111~HL*2*1*22*1~SBR*P**2222-SJ******CI~NM1*IL*1*SMITH*JANE****MI*JS00111223333~DMG*D8*19430501*F~NM1*PR*2*KEY INSURANCE COMPANY*****PI*999996666~REF*G2*KA6663~HL*3*2*23*0~PAT*19~NM1*QC*1*SMITH*TED~N3*236 N MAIN ST~N4*MIAMI*FL*33413~DMG*D8*19730501*M~CLM*26463774*100***11:B:1*Y*A*Y*I~REF*D9*17312345600006351~HI*BK:0340*BF:V7389~LX*1~SV1*HC:99213*40*UN*1***1~DTP*472*D8*20061003~LX*2~SV1*HC:87070*15*UN*1***1~DTP*472*D8*20061003~LX*3~SV1*HC:99214*35*UN*1***2~DTP*472*D8*20061010~LX*4~SV1*HC:86663*10*UN*1***2~DTP*472*D8*20061010~SE*42*0021~
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ISA*00* *00* *01*XXXXXXXXXXXXXXX*ZZ*XXXXXXXXXXXXXXX*111212*1628*^*00501*445289179*0*P*:~
|
|
2
|
+
TA1*346155305*111212*1553*A*000~
|
|
3
|
+
GS*FA*XXXXXX*XXXXXX*20111212*162832*1*X*005010X231A1~
|
|
4
|
+
ST*999*1001*005010X231A1~
|
|
5
|
+
AK1*HC*346155305*005010X222A1~
|
|
6
|
+
AK2*837*0005*005010X222A1~
|
|
7
|
+
IK5*A~
|
|
8
|
+
AK9*A*1*1*1~
|
|
9
|
+
SE*6*1001~
|
|
10
|
+
GE*1*1~
|
|
11
|
+
IEA*1*445289179~
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ISA!00! !00! !01!XXXXXXXXXXXXXXX!ZZ!XXXXXXXXXXXXXXX!111212!1628!@!00501!445289179!0!P!~^
|
|
2
|
+
TA1!346155305!111212!1553!A!000^
|
|
3
|
+
GS!FA!XXXXXX!XXXXXX!20111212!162832!1!X!005010X231A1^
|
|
4
|
+
ST!999!1001!005010X231A1^
|
|
5
|
+
AK1!HC!346155305!005010X222A1^
|
|
6
|
+
AK2!837!0005!005010X222A1^
|
|
7
|
+
IK5!A^
|
|
8
|
+
AK9!A!1!1!1^
|
|
9
|
+
SE!6!1001^
|
|
10
|
+
GE!1!1^
|
|
11
|
+
IEA!1!445289179^
|
data/samples/200823.EDI
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
ISA*00* *00* *ZZ*592015694 *ZZ*B9820 *120119*1701*^*00501*000000001*0*P*:~
|
|
2
|
+
GS*FA*09102*B9820*20120119*170146*1*X*005010X231A1~
|
|
3
|
+
ST*999*0001*005010X231A1~
|
|
4
|
+
AK1*HC*155*005010X222A1~
|
|
5
|
+
AK2*837*0002*005010X222A1~
|
|
6
|
+
IK5*A~
|
|
7
|
+
AK9*A*1*1*1~
|
|
8
|
+
SE*6*0001~
|
|
9
|
+
GE*1*1~
|
|
10
|
+
IEA*1*000000001~
|
|
11
|
+
ISA*00* *00* *ZZ*592015694 *ZZ*B9820 *120119*1703*^*00501*000000001*0*P*:~
|
|
12
|
+
GS*FA*09102*B9820*20120119*170300*1*X*005010X231A1~
|
|
13
|
+
ST*999*0001*005010X231A1~
|
|
14
|
+
AK1*HC*156*005010X222A1~
|
|
15
|
+
AK2*837*0002*005010X222A1~
|
|
16
|
+
IK3*N4*5074*2010*8~
|
|
17
|
+
IK4*3*26*2~
|
|
18
|
+
IK5*R*5~
|
|
19
|
+
AK9*R*1*1*0~
|
|
20
|
+
SE*8*0001~
|
|
21
|
+
GE*1*1~
|
|
22
|
+
IEA*1*000000001~
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
HL*1**20*1~PRV*BI*PXC*193200000X~NM1*85*2*ACME CORP*****XX*0123456789~N3*1234 NOWHERE~N4*Testington*CO*1234556789~REF*EI*55801234~NM1*87*2~N3*ACME ADDRESS 1~N4*Testbason*CO*123456789~HL*2*1*22*1~SBR*P**170105M002******BL~NM1*IL*1*FLINSTONE*FRED*D***MI*SABLAD1249~NM1*PR*2*RUBBLE CORP*****PI*RC0201~HL*3*2*23*0~PAT*01~NM1*QC*1*FLINSTONE*WILMA*A~N3*17 RUBBLE WAY~N4*Ancient*WD*000010001~DMG*D8*19000101*F~CLM*3670078*983***21:B:1*Y*A*Y*Y~DTP*435*D8*19000101~REF*G1*NA~HI*BK:65231~NM1*DN*1*NUGGS JR MD*BETTY****XX*9876543210~NM1*82*1*BILLING MD*NAME****XX*6758493021~PRV*PE*PXC*207L00000X~NM1*77*2*HOSPITAL - OB*****XX*930284756~N3*1400 EAST STREET~N4*RANDOM CITY*CO*1234556789~LX*1~SV1*HC:01961:AA*787*MJ*57***1**Y~DTP*472*D8*20120102~REF*6R*3866045~LX*2~SV1*HC:99140*196*UN*1***1**Y~DTP*472*D8*20120102~REF*6R*3866046~
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
HL*1**20*1~PRV*BI*PXC*193200000X~NM1*85*2*ACME*****XX*1234567789~N3*1400 ST~N4*SPRINGS*CA*857363900~REF*EI*999125555~NM1*87*2~N3*1234 TEST ST~N4*SPRINGS*CA*01732898~HL*2*1*22*0~SBR*P*18*108000******CI~NM1*IL*1*KELLEY*GRACE*M***MI*JK134324~N3*3825 TERMINAL~N4*SPRINGS*CA*988775801~DMG*D8*19791120*F~NM1*PR*2*UNITED HEALTHCARE*****PI*87726~CLM*3670206*1615***22:B:1*Y*A*Y*Y~HI*BK:7244*BF:72210*BF:E9293~NM1*DN*1*OKEENEN MD*JAMES*S***XX~NM1*82*1*WILL MD*JOSE****XX*0998865412~PRV*PE*PXC*207L00000X~NM1*77*2*MEMORIAL*****XX*12314143423~N3*4050 PARKWAY~N4*SPRINGS*CA*09786653~LX*1~SV1*HC:99201:25*190*UN*1***1:2:3~DTP*472*D8*20120104~REF*6R*3866711~NM1*DN*1*OKEENEN MD*JAMES*S***XX~LX*2~SV1*HC:64483*760*UN*1***1:2:3~DTP*472*D8*20120104~REF*6R*3866712~NM1*DN*1*OKEENEN MD*JAMES*S***XX~LX*3~SV1*HC:64484*475*UN*1***1:2:3~DTP*472*D8*20120104~REF*6R*3866713~NM1*DN*1*OKEENEN MD*JAMES*S***XX~LX*4~SV1*HC:99144*190*UN*1***1:2:3~DTP*472*D8*20120104~REF*6R*3866714~NM1*DN*1*OKEENEN MD*JAMES*S***XX~
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'pp'
|
|
3
|
+
require 'pry'
|
|
4
|
+
require 'hippo_eyeDoc'
|
|
5
|
+
|
|
6
|
+
def wrap_text(text, max_width, wrap_string = "\n")
|
|
7
|
+
if text.length <= max_width
|
|
8
|
+
text
|
|
9
|
+
else
|
|
10
|
+
text.scan(/.{1,#{max_width}}/).join(wrap_string)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
category_codes = Hippo_eyeDoc::CodeLists::ClaimStatusCategoryCodes
|
|
15
|
+
status_codes = Hippo_eyeDoc::CodeLists::ClaimStatusCodes
|
|
16
|
+
|
|
17
|
+
ARGF.each do |infile|
|
|
18
|
+
ftaq = 0
|
|
19
|
+
ftaa = 0
|
|
20
|
+
ftrq = 0
|
|
21
|
+
ftra = 0
|
|
22
|
+
parser = Hippo_eyeDoc::Parser.new
|
|
23
|
+
transaction_sets = parser.parse_string(infile)
|
|
24
|
+
|
|
25
|
+
transaction_sets.each do |ts|
|
|
26
|
+
puts '=' * 120
|
|
27
|
+
puts "+---------" + ('-' * ARGF.filename.length) + "+"
|
|
28
|
+
puts "| File [%s] |" % [ARGF.filename]
|
|
29
|
+
puts "+---------" + ('-' * ARGF.filename.length) + "+"
|
|
30
|
+
puts "Confirmation for 837 transaction on %s with a batch control number of %s." % [ts.L2000A.L2200A.DTP.DTP03.to_s, ts.L2000B.L2200B.TRN.TRN02]
|
|
31
|
+
puts " %s(%s)" % [ts.L2000A.L2100A.NM1.NameLastOrOrganizationName, ts.L2000A.L2100A.NM1.EntityIdentifierCode]
|
|
32
|
+
|
|
33
|
+
if ts.L2000B.L2200B.STC.STC03 == 'U'
|
|
34
|
+
puts " Entire batch REJECTED!!!!"
|
|
35
|
+
else
|
|
36
|
+
taq = ts.L2000B.L2200B.find_by_name('Total Accepted Quantity').QTY02
|
|
37
|
+
taq ||= 0
|
|
38
|
+
taa = ts.L2000B.L2200B.find_by_name('Total Accepted Amount').AMT02
|
|
39
|
+
taa ||= 0
|
|
40
|
+
trq = ts.L2000B.L2200B.find_by_name('Total Rejected Quantity').QTY02
|
|
41
|
+
trq ||= 0
|
|
42
|
+
tra = ts.L2000B.L2200B.find_by_name('Total Rejected Amount').AMT02
|
|
43
|
+
tra ||= 0
|
|
44
|
+
ftaq = ftaq + taq
|
|
45
|
+
ftaa = ftaa + taa
|
|
46
|
+
ftrq = ftrq + trq
|
|
47
|
+
ftra = ftra + tra
|
|
48
|
+
puts " Accepted: %4d ($%-9.2f) Rejected: %4d ($%-9.2f)" % [taq, taa, trq, tra]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
ts.L2000C.each do |l2000c|
|
|
52
|
+
puts '-----------------------------------------------------------------------------------------------------------------------'
|
|
53
|
+
puts " Billing Provider: %s(%s)" % [l2000c.L2100C.NM1.NM103, l2000c.L2100C.NM1.NM109]
|
|
54
|
+
taq = l2000c.L2200C.find_by_name('Total Accepted Quantity').QTY02
|
|
55
|
+
taq ||= 0
|
|
56
|
+
taa = l2000c.L2200C.find_by_name('Total Accepted Amount').AMT02
|
|
57
|
+
taa ||= 0
|
|
58
|
+
trq = l2000c.L2200C.find_by_name('Total Rejected Quantity').QTY02
|
|
59
|
+
trq ||= 0
|
|
60
|
+
tra = l2000c.L2200C.find_by_name('Total Rejected Amount').AMT02
|
|
61
|
+
tra ||= 0
|
|
62
|
+
puts " Accepted: %4d ($%-9.2f) Rejected: %4d ($%-9.2f)" % [taq, taa, trq, tra]
|
|
63
|
+
|
|
64
|
+
#TODO: need to handle/print out Provider level STC if present
|
|
65
|
+
|
|
66
|
+
l2000c.L2000D.each do |l2000d|
|
|
67
|
+
claim_number = ''
|
|
68
|
+
patient_name = ''
|
|
69
|
+
date_of_service = ''
|
|
70
|
+
claim_status = ''
|
|
71
|
+
claim_status_text = []
|
|
72
|
+
services = []
|
|
73
|
+
|
|
74
|
+
patient_name = (l2000d.L2100D.NM1.NM103 + ', ' + l2000d.L2100D.NM1.NM104)[0,30].ljust(30)
|
|
75
|
+
|
|
76
|
+
l2000d.L2200D.each do |l2200d|
|
|
77
|
+
claim_number = l2200d.TRN.TRN02
|
|
78
|
+
date_of_service = l2200d.DTP.DTP03
|
|
79
|
+
|
|
80
|
+
# claim level
|
|
81
|
+
claim_status = l2200d.STC.any?{|stc| stc.STC03 == 'U'} ? 'REJECTED' : 'ACCEPTED'
|
|
82
|
+
claim_status_text = []
|
|
83
|
+
|
|
84
|
+
l2200d.STC.each do |stc|
|
|
85
|
+
next if stc.STC03 != 'U'
|
|
86
|
+
claim_status_text << "Cat: #{stc.STC01_01} Stat: #{code = stc.STC01_02} - #{wrap_text(status_codes[code][:description], 65)}"
|
|
87
|
+
claim_status_text << "#{stc.STC12}" if stc.STC12
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
l2200d.L2220D.each do |l2220d|
|
|
91
|
+
next unless l2220d.STC.STC03 != 'U'
|
|
92
|
+
|
|
93
|
+
service_status_text = []
|
|
94
|
+
l2220d.STC.each do |stc|
|
|
95
|
+
next if stc.STC03 != 'U'
|
|
96
|
+
|
|
97
|
+
service_status_text << "Cat: #{stc.STC01_01} Stat: #{code = stc.STC01_02} - #{wrap_text(status_codes[code][:description], 65)}"
|
|
98
|
+
service_status_text << "#{stc.STC12}" if stc.STC12
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
services << {
|
|
102
|
+
:date_of_service => l2220d.DTP.DTP03,
|
|
103
|
+
:procedure_code => l2220d.SVC.SVC01_02,
|
|
104
|
+
:modifier_1 => l2220d.SVC.SVC01_03,
|
|
105
|
+
:modifier_2 => l2220d.SVC.SVC01_04,
|
|
106
|
+
:service_status_text => service_status_text
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
puts " CLM# #{claim_number} - #{patient_name} #{claim_status}"
|
|
112
|
+
puts " #{claim_status_text.join("\n ")}\n" if claim_status_text.length > 0
|
|
113
|
+
puts "" if claim_status == 'REJECTED'
|
|
114
|
+
services.each do |s|
|
|
115
|
+
puts " SVC - REJECTED DOS: #{s[:date_of_service]} - CPT: #{s[:procedure_code]}"
|
|
116
|
+
puts " #{s[:service_status_text].join("\n ")}" if s[:service_status_text].length > 0
|
|
117
|
+
puts ""
|
|
118
|
+
end
|
|
119
|
+
end #l2000d.L2200D.each
|
|
120
|
+
end #l2000c.L2000D.each
|
|
121
|
+
end #ts.L2000C.each
|
|
122
|
+
puts "+---------" + ('-' * ARGF.filename.length) + "+"
|
|
123
|
+
puts "| END [%s] |" % [ARGF.filename]
|
|
124
|
+
puts "| Accepted: %4d ($%-9.2f) Rejected: %4d ($%-9.2f) |" % [ftaq, ftaa, ftrq, ftra]
|
|
125
|
+
puts "+---------" + ('-' * ARGF.filename.length) + "+"
|
|
126
|
+
end #transaction_sets
|
|
127
|
+
end #infile
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
require 'pp'
|
|
3
|
+
require 'pry'
|
|
4
|
+
require 'hippo_eyeDoc'
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# This will parse an ANSI X12 999B file and
|
|
8
|
+
# indicate if there are any reported errors / rejections.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
def seg_syntax_code_lookup(code)
|
|
12
|
+
seg_syntax_desc = ""
|
|
13
|
+
case code
|
|
14
|
+
when "1"
|
|
15
|
+
seg_syntax_desc = "Unrecognized Segment ID."
|
|
16
|
+
when "2"
|
|
17
|
+
seg_syntax_desc = "Unexpected Segment."
|
|
18
|
+
when "3"
|
|
19
|
+
seg_syntax_desc = "Required Segment Missing."
|
|
20
|
+
when "4"
|
|
21
|
+
seg_syntax_desc = "Loop Occurs Over Maximum Times."
|
|
22
|
+
when "5"
|
|
23
|
+
seg_syntax_desc = "Segment Exceeds Maximum Use."
|
|
24
|
+
when "6"
|
|
25
|
+
seg_syntax_desc = "Segment Not in Defined Transaction Set."
|
|
26
|
+
when "7"
|
|
27
|
+
seg_syntax_desc = "Segment Not in Proper Sequence."
|
|
28
|
+
when "8"
|
|
29
|
+
seg_syntax_desc = "Segment Has Data Element Errors."
|
|
30
|
+
when "I4"
|
|
31
|
+
seg_syntax_desc = 'Implementation "Not Used" Segment Present.'
|
|
32
|
+
when "I6"
|
|
33
|
+
seg_syntax_desc = "Implementation Dependent Segment Missing."
|
|
34
|
+
when "I7"
|
|
35
|
+
seg_syntax_desc = "Implementation Loop Occurs Under Minimum Times."
|
|
36
|
+
when "I8"
|
|
37
|
+
seg_syntax_desc = "Implementation Segment Below Minimum Use."
|
|
38
|
+
when "I9"
|
|
39
|
+
seg_syntax_desc = 'Implementation Dependent "Not Used" Segment Present.'
|
|
40
|
+
else
|
|
41
|
+
seg_syntax_desc = "Unknown seg_syntax_code"
|
|
42
|
+
end # case code
|
|
43
|
+
seg_syntax_desc
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
ARGF.each do |infile|
|
|
47
|
+
parser = Hippo::Parser.new
|
|
48
|
+
|
|
49
|
+
trans_sets = parser.parse_string(infile)
|
|
50
|
+
|
|
51
|
+
trans_sets.each do |ts|
|
|
52
|
+
if ts.ST.ST01 == '999'
|
|
53
|
+
if ts.AK9.AK901 == 'A'
|
|
54
|
+
puts "%s indicates all transaction sets were accepted for further processing." % [ARGF.filename]
|
|
55
|
+
else
|
|
56
|
+
ts.L2000AK2.each do |l2000ak2|
|
|
57
|
+
if l2000ak2.IK5.IK501 != 'A'
|
|
58
|
+
trans_set_control_no = l2000ak2.AK2.AK202
|
|
59
|
+
emsg = "Error: "
|
|
60
|
+
#
|
|
61
|
+
# presence of loop 2100AK2 for Error Identification
|
|
62
|
+
#
|
|
63
|
+
l2000ak2.L2100AK2.each do |l2100ak2|
|
|
64
|
+
seg_id = l2100ak2.IK3.IK301
|
|
65
|
+
seg_pos = l2100ak2.IK3.IK302
|
|
66
|
+
loop_id = l2100ak2.IK3.IK303
|
|
67
|
+
seg_syntax_code = l2100ak2.IK3.IK304
|
|
68
|
+
seg_syntax_desc = seg_syntax_code_lookup(seg_syntax_code)
|
|
69
|
+
ctx_seg_context = l2100ak2.find_by_name('Segment Context')
|
|
70
|
+
ctx_bus_unit_id = l2100ak2.find_by_name('Business Unit Identifier')
|
|
71
|
+
emsg += "trans_number: [%s]\n seg_id_code: [%s]\n seg_position: [%s]\n loop: [%s]\n syntax code: [%s] %s" % [trans_set_control_no, seg_id, seg_pos, loop_id, seg_syntax_code, seg_syntax_desc]
|
|
72
|
+
if ctx_seg_context.to_s.length > 0
|
|
73
|
+
emsg += "\n Segment Context : [%s]" % [ctx_seg_context]
|
|
74
|
+
end
|
|
75
|
+
if ctx_bus_unit_id.to_s.length > 0
|
|
76
|
+
emsg += "\n Business Unit Identifier : [%s]" % [ctx_bus_unit_id]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
#
|
|
80
|
+
# presence of loop 2110AK2 for Implementation Data Element Note
|
|
81
|
+
#
|
|
82
|
+
l2100ak2.L2110AK2.each do |l2110ak2|
|
|
83
|
+
pos_in_seg = l2110ak2.IK4
|
|
84
|
+
data_element = l2110ak2.IK4.IK402
|
|
85
|
+
data_ele_err_cd = l2110ak2.IK4.IK403
|
|
86
|
+
data_copy = l2110ak2.IK4.IK404
|
|
87
|
+
data_ele_err_desc = ""
|
|
88
|
+
case data_ele_err_cd
|
|
89
|
+
when "1"
|
|
90
|
+
data_ele_err_desc = "Mandatory data element missing"
|
|
91
|
+
when "2"
|
|
92
|
+
data_ele_err_desc = "Conditional required data element missing"
|
|
93
|
+
when "3"
|
|
94
|
+
data_ele_err_desc = "Too many data elements"
|
|
95
|
+
when "4"
|
|
96
|
+
data_ele_err_desc = "Data element too short"
|
|
97
|
+
when "5"
|
|
98
|
+
data_ele_err_desc = "Data element too long"
|
|
99
|
+
when "6"
|
|
100
|
+
data_ele_err_desc = "Invalid character in data element"
|
|
101
|
+
when "7"
|
|
102
|
+
data_ele_err_desc = "Invalid code value"
|
|
103
|
+
when "8"
|
|
104
|
+
data_ele_err_desc = "Invalid date"
|
|
105
|
+
when "9"
|
|
106
|
+
data_ele_err_desc = "Invalid time"
|
|
107
|
+
when "10"
|
|
108
|
+
data_ele_err_desc = "Exclusion Condition Violated"
|
|
109
|
+
else
|
|
110
|
+
data_ele_err_desc = "Unknown"
|
|
111
|
+
end
|
|
112
|
+
emsg += "\n Position in Segment [%s] Data Element Ref No [%s] Data Element Err Code [%s ==> %s] Copy of Bad Data Element [%s]" % [pos_in_seg, data_element, data_ele_err_cd, data_ele_err_desc, data_copy]
|
|
113
|
+
end #l2110ak2
|
|
114
|
+
end # l2100ak2
|
|
115
|
+
puts emsg
|
|
116
|
+
end # IK501 != 'A'
|
|
117
|
+
end # l2000ak2
|
|
118
|
+
end
|
|
119
|
+
end # ST01 = 999
|
|
120
|
+
end # ts
|
|
121
|
+
|
|
122
|
+
end # infile
|