hippo 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGELOG +9 -0
- data/Gemfile +11 -0
- data/Guardfile +14 -0
- data/README.md +227 -0
- data/Rakefile +12 -0
- data/bin/demo_270.rb +280 -0
- data/bin/demo_276.rb +296 -0
- data/bin/demo_835.rb +170 -0
- data/hippo.gemspec +24 -0
- data/lib/hippo/exceptions.rb +8 -0
- data/lib/hippo/field.rb +6 -0
- data/lib/hippo/loop.rb +0 -0
- data/lib/hippo/parser.rb +92 -0
- data/lib/hippo/samples/835.edi +88 -0
- data/lib/hippo/samples/sample_835_with.rb +272 -0
- data/lib/hippo/samples/sample_parsed.rb +1162 -0
- data/lib/hippo/segments/AK1.rb +32 -0
- data/lib/hippo/segments/AK2.rb +31 -0
- data/lib/hippo/segments/AK9.rb +82 -0
- data/lib/hippo/segments/AMT.rb +31 -0
- data/lib/hippo/segments/BHT.rb +55 -0
- data/lib/hippo/segments/BPR.rb +175 -0
- data/lib/hippo/segments/CAS.rb +159 -0
- data/lib/hippo/segments/CL1.rb +39 -0
- data/lib/hippo/segments/CLM.rb +223 -0
- data/lib/hippo/segments/CLP.rb +119 -0
- data/lib/hippo/segments/CN1.rb +55 -0
- data/lib/hippo/segments/CR1.rb +87 -0
- data/lib/hippo/segments/CR2.rb +104 -0
- data/lib/hippo/segments/CR3.rb +47 -0
- data/lib/hippo/segments/CR4.rb +239 -0
- data/lib/hippo/segments/CR5.rb +151 -0
- data/lib/hippo/segments/CR6.rb +175 -0
- data/lib/hippo/segments/CR7.rb +33 -0
- data/lib/hippo/segments/CR8.rb +79 -0
- data/lib/hippo/segments/CRC.rb +63 -0
- data/lib/hippo/segments/CTP.rb +212 -0
- data/lib/hippo/segments/CTX.rb +105 -0
- data/lib/hippo/segments/CUR.rb +175 -0
- data/lib/hippo/segments/DMG.rb +115 -0
- data/lib/hippo/segments/DN1.rb +39 -0
- data/lib/hippo/segments/DN2.rb +55 -0
- data/lib/hippo/segments/DSB.rb +71 -0
- data/lib/hippo/segments/DTM.rb +55 -0
- data/lib/hippo/segments/DTP.rb +31 -0
- data/lib/hippo/segments/FRM.rb +47 -0
- data/lib/hippo/segments/GE.rb +19 -0
- data/lib/hippo/segments/GS.rb +52 -0
- data/lib/hippo/segments/HCP.rb +127 -0
- data/lib/hippo/segments/HI.rb +919 -0
- data/lib/hippo/segments/HL.rb +44 -0
- data/lib/hippo/segments/HSD.rb +72 -0
- data/lib/hippo/segments/IEA.rb +19 -0
- data/lib/hippo/segments/IK3.rb +40 -0
- data/lib/hippo/segments/IK4.rb +63 -0
- data/lib/hippo/segments/IK5.rb +55 -0
- data/lib/hippo/segments/IMM.rb +55 -0
- data/lib/hippo/segments/ISA.rb +95 -0
- data/lib/hippo/segments/K3.rb +147 -0
- data/lib/hippo/segments/LIN.rb +255 -0
- data/lib/hippo/segments/LQ.rb +23 -0
- data/lib/hippo/segments/LX.rb +21 -0
- data/lib/hippo/segments/MEA.rb +219 -0
- data/lib/hippo/segments/MIA.rb +199 -0
- data/lib/hippo/segments/MOA.rb +79 -0
- data/lib/hippo/segments/N1.rb +55 -0
- data/lib/hippo/segments/N2.rb +23 -0
- data/lib/hippo/segments/N3.rb +23 -0
- data/lib/hippo/segments/N4.rb +63 -0
- data/lib/hippo/segments/NM1.rb +103 -0
- data/lib/hippo/segments/NTE.rb +23 -0
- data/lib/hippo/segments/OI.rb +55 -0
- data/lib/hippo/segments/PAT.rb +79 -0
- data/lib/hippo/segments/PER.rb +79 -0
- data/lib/hippo/segments/PLB.rb +191 -0
- data/lib/hippo/segments/PRV.rb +75 -0
- data/lib/hippo/segments/PS1.rb +31 -0
- data/lib/hippo/segments/PWK.rb +116 -0
- data/lib/hippo/segments/QTY.rb +155 -0
- data/lib/hippo/segments/RDM.rb +135 -0
- data/lib/hippo/segments/REF.rb +83 -0
- data/lib/hippo/segments/SBR.rb +79 -0
- data/lib/hippo/segments/SE.rb +24 -0
- data/lib/hippo/segments/ST.rb +31 -0
- data/lib/hippo/segments/STC.rb +187 -0
- data/lib/hippo/segments/SV1.rb +267 -0
- data/lib/hippo/segments/SV2.rb +147 -0
- data/lib/hippo/segments/SV3.rb +223 -0
- data/lib/hippo/segments/SV4.rb +211 -0
- data/lib/hippo/segments/SV5.rb +123 -0
- data/lib/hippo/segments/SV6.rb +155 -0
- data/lib/hippo/segments/SV7.rb +55 -0
- data/lib/hippo/segments/SVC.rb +183 -0
- data/lib/hippo/segments/SVD.rb +116 -0
- data/lib/hippo/segments/TOO.rb +67 -0
- data/lib/hippo/segments/TRN.rb +39 -0
- data/lib/hippo/segments/TS2.rb +159 -0
- data/lib/hippo/segments/TS3.rb +199 -0
- data/lib/hippo/segments/UR.rb +23 -0
- data/lib/hippo/segments/base.rb +148 -0
- data/lib/hippo/segments.rb +85 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2000A.rb +28 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2000B.rb +28 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2000C.rb +28 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2000D.rb +45 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2000E.rb +45 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2100A.rb +20 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2100B.rb +20 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2100C.rb +19 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2100D.rb +19 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2100E.rb +20 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2200D.rb +116 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2200E.rb +116 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2210D.rb +36 -0
- data/lib/hippo/transaction_sets/HIPAA_276/L2210E.rb +36 -0
- data/lib/hippo/transaction_sets/HIPAA_276/base.rb +86 -0
- data/lib/hippo/transaction_sets/HIPAA_276.rb +21 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2000A.rb +35 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2000B.rb +35 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2000C.rb +35 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2000D.rb +35 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2000E.rb +35 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2100A.rb +19 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2100B.rb +20 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2100C.rb +19 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2100D.rb +20 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2100E.rb +20 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2200A.rb +41 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2200B.rb +66 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2200C.rb +73 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2200D.rb +73 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2200E.rb +103 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2220D.rb +56 -0
- data/lib/hippo/transaction_sets/HIPAA_277/L2220E.rb +43 -0
- data/lib/hippo/transaction_sets/HIPAA_277/base.rb +77 -0
- data/lib/hippo/transaction_sets/HIPAA_277.rb +24 -0
- data/lib/hippo/transaction_sets/HIPAA_835/L1000A.rb +71 -0
- data/lib/hippo/transaction_sets/HIPAA_835/L1000B.rb +47 -0
- data/lib/hippo/transaction_sets/HIPAA_835/L2000.rb +37 -0
- data/lib/hippo/transaction_sets/HIPAA_835/L2100.rb +182 -0
- data/lib/hippo/transaction_sets/HIPAA_835/L2110.rb +85 -0
- data/lib/hippo/transaction_sets/HIPAA_835/base.rb +112 -0
- data/lib/hippo/transaction_sets/HIPAA_835.rb +12 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L1000A.rb +30 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L1000B.rb +21 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2000A.rb +65 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2000B.rb +49 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2000C.rb +42 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2010AA.rb +57 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2010AB.rb +33 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2010AC.rb +51 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2010BA.rb +74 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2010BB.rb +48 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2010CA.rb +72 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2300.rb +510 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2310A.rb +26 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2310B.rb +37 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2310C.rb +52 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2310D.rb +27 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2310E.rb +34 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2310F.rb +34 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2320.rb +122 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330A.rb +43 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330B.rb +92 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330C.rb +26 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330D.rb +26 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330E.rb +27 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330F.rb +27 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2330G.rb +26 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2400.rb +475 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2410.rb +30 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420A.rb +37 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420B.rb +26 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420C.rb +41 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420D.rb +27 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420E.rb +51 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420F.rb +26 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420G.rb +34 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2420H.rb +34 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2430.rb +44 -0
- data/lib/hippo/transaction_sets/HIPAA_837/L2440.rb +23 -0
- data/lib/hippo/transaction_sets/HIPAA_837/base.rb +81 -0
- data/lib/hippo/transaction_sets/HIPAA_837.rb +45 -0
- data/lib/hippo/transaction_sets/HIPAA_999/L2000 - AK2.rb +30 -0
- data/lib/hippo/transaction_sets/HIPAA_999/L2000AK2.rb +30 -0
- data/lib/hippo/transaction_sets/HIPAA_999/L2100 - AK2.rb +37 -0
- data/lib/hippo/transaction_sets/HIPAA_999/L2100AK2.rb +37 -0
- data/lib/hippo/transaction_sets/HIPAA_999/L2110 - AK2.rb +23 -0
- data/lib/hippo/transaction_sets/HIPAA_999/L2110AK2.rb +23 -0
- data/lib/hippo/transaction_sets/HIPAA_999/base.rb +46 -0
- data/lib/hippo/transaction_sets/HIPAA_999.rb +10 -0
- data/lib/hippo/transaction_sets/base.rb +136 -0
- data/lib/hippo/transaction_sets.rb +11 -0
- data/lib/hippo/version.rb +3 -0
- data/lib/hippo.rb +15 -0
- data/samples/835_4010.edi +1 -0
- data/samples/837_4010A1.edi +1 -0
- data/test/test_helper.rb +118 -0
- data/test/test_hipaa_837.rb +396 -0
- data/test/test_segments_base.rb +106 -0
- data/test/test_transaction_sets_base.rb +85 -0
- metadata +277 -0
@@ -0,0 +1,272 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'pp'
|
3
|
+
s = "ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER *080319*2327*U*00401*002721171*0*P*:~
|
4
|
+
GS*HC*SENDER*RECEIVER*20080319*2327*27211711*X*004010X091A1~
|
5
|
+
ST*835*1234~
|
6
|
+
BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456
|
7
|
+
*1512345678**01*999988880*DA*98765*19960913~
|
8
|
+
TRN*1*12345*1512345678~
|
9
|
+
DTM*405*19960916~
|
10
|
+
N1*PR*INSURANCE COMPANY OF TIMBUCKTU~
|
11
|
+
N3*1 MAIN STREET~
|
12
|
+
N4*TIMBUCKTU*AK*89111~
|
13
|
+
REF*2U*999~
|
14
|
+
N1*PE*CYBIL MENTAL HOSPITAL*XX*6543210903~
|
15
|
+
LX*961211~
|
16
|
+
TS3*6543210903*11*19961231*1*211366.97*138018.4***
|
17
|
+
138018.4**73348.57~
|
18
|
+
TS2*2178.45*1919.71**56.82*197.69*4.23~
|
19
|
+
CLP*666123*1*211366.97*138018.4**MA*1999999444444*
|
20
|
+
11*1~
|
21
|
+
CAS*CO*A2*73348.57~
|
22
|
+
NM1*QC*1*SHEPARD*SAM*O***HN*666666666A~
|
23
|
+
MIA*0***138018.4~
|
24
|
+
DTM*232*19960816~
|
25
|
+
DTM*233*19960824~
|
26
|
+
QTY*CA*8~
|
27
|
+
LX*961213~
|
28
|
+
TS3*6543210909*13*19961231*1*15000*15000**
|
29
|
+
*11980.33**3019.67~
|
30
|
+
CLP*777777*1*15000*11980.33**MB*1999999444445*13*
|
31
|
+
1~
|
32
|
+
CAS*CO*A2*3019.67~
|
33
|
+
NM1*QC*1*BORDEN*LIZ*E***HN*996669999B~
|
34
|
+
NM1*82*2*CYBIL MENTAL HOSPITAL*****XX*6543210903~
|
35
|
+
MIA*0****MA130~
|
36
|
+
REF*EA*00000000012345~
|
37
|
+
DTM*050*19960128~
|
38
|
+
DTM*232*19961214~
|
39
|
+
DTM*233*19961216~
|
40
|
+
SVC*NU:0111*2000*0****2~
|
41
|
+
DTM*472*19961216~
|
42
|
+
CAS*CO*22*2000*2~
|
43
|
+
SVC*NU:0250*1113.08*0****217~
|
44
|
+
DTM*472*19961216~
|
45
|
+
CAS*CO*22*1113.08*217~
|
46
|
+
SVC*NU:0270*349.4*0****8~
|
47
|
+
DTM*472*19961216~
|
48
|
+
CAS*CO*22*349.4*8~
|
49
|
+
SVC*NU:0301*747.65*0****16~
|
50
|
+
DTM*472*19961216~
|
51
|
+
CAS*CO*22*747.65*16~
|
52
|
+
SVC*NU:0305*187.53*0****5~
|
53
|
+
DTM*472*19961216~
|
54
|
+
CAS*CO*22*187.53*5~
|
55
|
+
SVC*NU:0320*375.73*0****2~
|
56
|
+
DTM*472*19961216~
|
57
|
+
CAS*CO*22*375.73*2~
|
58
|
+
SVC*NU:0324*365.87*0****2~
|
59
|
+
DTM*472*19961216~
|
60
|
+
CAS*CO*22*365.87*2~
|
61
|
+
SVC*NU:0410*222.5*0****4~
|
62
|
+
DTM*472*19961216~
|
63
|
+
CAS*CO*22*222.5*4~
|
64
|
+
SVC*NU:0450*715.55*0****1~
|
65
|
+
DTM*472*19961216~
|
66
|
+
CAS*CO*22*715.55*1~
|
67
|
+
SVC*NU:0460*230*0****4~
|
68
|
+
DTM*472*19961216~
|
69
|
+
CAS*CO*22*230*4~
|
70
|
+
SVC*NU:0730*256.86*0****2~
|
71
|
+
DTM*472*19961216~
|
72
|
+
CAS*CO*22*256.86*2~
|
73
|
+
SVC*NU:0801*1550*0****2~
|
74
|
+
DTM*472*19961216~
|
75
|
+
CAS*CO*22*1550*2~
|
76
|
+
SE*28*1234~
|
77
|
+
ST*835*1234~
|
78
|
+
BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456
|
79
|
+
*1512345678**01*999988880*DA*98765*19960913~
|
80
|
+
TRN*1*12345*1512345678~
|
81
|
+
DTM*405*19960916~
|
82
|
+
N1*PR*INSURANCE COMPANY OF TIMBUCKTU~
|
83
|
+
N3*1 MAIN STREET~
|
84
|
+
N4*TIMBUCKTU*AK*89111~
|
85
|
+
REF*2U*999~
|
86
|
+
N1*PE*CYBIL MENTAL HOSPITAL*XX*6543210903~
|
87
|
+
LX*961211~
|
88
|
+
TS3*6543210903*11*19961231*1*211366.97*138018.4***
|
89
|
+
138018.4**73348.57~
|
90
|
+
TS2*2178.45*1919.71**56.82*197.69*4.23~
|
91
|
+
CLP*666123*1*211366.97*138018.4**MA*1999999444444*
|
92
|
+
11*1~
|
93
|
+
CAS*CO*A2*73348.57~
|
94
|
+
NM1*QC*1*SHEPARD*SAM*O***HN*666666666A~
|
95
|
+
MIA*0***138018.4~
|
96
|
+
DTM*232*19960816~
|
97
|
+
DTM*233*19960824~
|
98
|
+
QTY*CA*8~
|
99
|
+
LX*961213~
|
100
|
+
TS3*6543210909*13*19961231*1*15000*15000**
|
101
|
+
*11980.33**3019.67~
|
102
|
+
CLP*777777*1*15000*11980.33**MB*1999999444445*13*
|
103
|
+
1~
|
104
|
+
CAS*CO*A2*3019.67~
|
105
|
+
NM1*QC*1*JONES*LEN*E***HN*996669999B~
|
106
|
+
MOA***MA02~
|
107
|
+
DTM*232*19960512~
|
108
|
+
PLB*6543210903*19961231*CV:CP*-1.27~
|
109
|
+
SE*28*1234~
|
110
|
+
ST*835*1234~
|
111
|
+
BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456
|
112
|
+
*1512345678**01*999988880*DA*98765*19960913~
|
113
|
+
TRN*1*12345*1512345678~
|
114
|
+
DTM*405*19960916~
|
115
|
+
N1*PR*INSURANCE COMPANY OF TIMBUCKTU~
|
116
|
+
N3*1 MAIN STREET~
|
117
|
+
N4*TIMBUCKTU*AK*89111~
|
118
|
+
REF*2U*999~
|
119
|
+
N1*PE*CYBIL MENTAL HOSPITAL*XX*6543210903~
|
120
|
+
LX*961211~
|
121
|
+
TS3*6543210903*11*19961231*1*211366.97*138018.4***
|
122
|
+
138018.4**73348.57~
|
123
|
+
TS2*2178.45*1919.71**56.82*197.69*4.23~
|
124
|
+
CLP*666123*1*211366.97*138018.4**MA*1999999444444*
|
125
|
+
11*1~
|
126
|
+
CAS*CO*A2*73348.57~
|
127
|
+
NM1*QC*1*SMITH*JOE*E***HN*666666666A~
|
128
|
+
MIA*0***138018.4~
|
129
|
+
DTM*232*19960816~
|
130
|
+
DTM*233*19960824~
|
131
|
+
QTY*CA*8~
|
132
|
+
LX*961213~
|
133
|
+
TS3*6543210909*13*19961231*1*15000*15000**
|
134
|
+
*11980.33**3019.67~
|
135
|
+
CLP*777777*1*15000*11980.33**MB*1999999444445*13*
|
136
|
+
1~
|
137
|
+
CAS*CO*A2*3019.67~
|
138
|
+
NM1*QC*1*BORDEN*LIZ*E***HN*996669999B~
|
139
|
+
NM1*82*2*CYBIL MENTAL HOSPITAL*****XX*6543210903~
|
140
|
+
MIA*0****MA130~
|
141
|
+
REF*EA*00000000012345~
|
142
|
+
DTM*050*19960128~
|
143
|
+
DTM*232*19961214~
|
144
|
+
DTM*233*19961216~
|
145
|
+
SVC*NU:0111*2000*0****2~
|
146
|
+
DTM*472*19961216~
|
147
|
+
CAS*CO*22*2000*2~
|
148
|
+
SVC*NU:0250*1113.08*0****217~
|
149
|
+
DTM*472*19961216~
|
150
|
+
CAS*CO*22*1113.08*217~
|
151
|
+
SVC*NU:0270*349.4*0****8~
|
152
|
+
DTM*472*19961216~
|
153
|
+
CAS*CO*22*349.4*8~
|
154
|
+
SVC*NU:0301*747.65*0****16~
|
155
|
+
DTM*472*19961216~
|
156
|
+
CAS*CO*22*747.65*16~
|
157
|
+
SVC*NU:0305*187.53*0****5~
|
158
|
+
DTM*472*19961216~
|
159
|
+
CAS*CO*22*187.53*5~
|
160
|
+
SVC*NU:0320*375.73*0****2~
|
161
|
+
DTM*472*19961216~
|
162
|
+
CAS*CO*22*375.73*2~
|
163
|
+
SVC*NU:0324*365.87*0****2~
|
164
|
+
DTM*472*19961216~
|
165
|
+
CAS*CO*22*365.87*2~
|
166
|
+
SVC*NU:0410*222.5*0****4~
|
167
|
+
DTM*472*19961216~
|
168
|
+
CAS*CO*22*222.5*4~
|
169
|
+
SVC*NU:0450*715.55*0****1~
|
170
|
+
DTM*472*19961216~
|
171
|
+
CAS*CO*22*715.55*1~
|
172
|
+
SVC*NU:0460*230*0****4~
|
173
|
+
DTM*472*19961216~
|
174
|
+
CAS*CO*22*230*4~
|
175
|
+
SVC*NU:0730*256.86*0****2~
|
176
|
+
DTM*472*19961216~
|
177
|
+
CAS*CO*22*256.86*2~
|
178
|
+
SVC*NU:0801*1550*0****2~
|
179
|
+
DTM*472*19961216~
|
180
|
+
CAS*CO*22*1550*2~
|
181
|
+
SE*28*1234~
|
182
|
+
ST*835*1234~
|
183
|
+
BPR*C*150000*C*ACH*CTX*01*999999992*DA*123456
|
184
|
+
*1512345678**01*999988880*DA*98765*19960913~
|
185
|
+
TRN*1*12345*1512345678~
|
186
|
+
DTM*405*19960916~
|
187
|
+
N1*PR*INSURANCE COMPANY OF TIMBUCKTU~
|
188
|
+
N3*1 MAIN STREET~
|
189
|
+
N4*TIMBUCKTU*AK*89111~
|
190
|
+
REF*2U*999~
|
191
|
+
N1*PE*CYBIL MENTAL HOSPITAL*XX*6543210903~
|
192
|
+
LX*961211~
|
193
|
+
TS3*6543210903*11*19961231*1*211366.97*138018.4***
|
194
|
+
138018.4**73348.57~
|
195
|
+
TS2*2178.45*1919.71**56.82*197.69*4.23~
|
196
|
+
CLP*666123*1*211366.97*138018.4**MA*1999999444444*
|
197
|
+
11*1~
|
198
|
+
CAS*CO*A2*73348.57~
|
199
|
+
NM1*QC*1*SHEPARD*SAM*O***HN*666666666A~
|
200
|
+
MIA*0***138018.4~
|
201
|
+
DTM*232*19960816~
|
202
|
+
DTM*233*19960824~
|
203
|
+
QTY*CA*8~
|
204
|
+
LX*961213~
|
205
|
+
TS3*6543210909*13*19961231*1*15000*15000**
|
206
|
+
*11980.33**3019.67~
|
207
|
+
CLP*777777*1*15000*11980.33**MB*1999999444445*13*
|
208
|
+
1~
|
209
|
+
CAS*CO*A2*3019.67~
|
210
|
+
NM1*QC*1*BORDEN*LIZ*E***HN*996669999B~
|
211
|
+
MOA***MA02~
|
212
|
+
DTM*232*19960512~
|
213
|
+
PLB*6543210903*19961231*CV:CP*-1.27~
|
214
|
+
SE*28*1234~
|
215
|
+
GE*1*27211711~
|
216
|
+
IEA*1*002721171~"
|
217
|
+
|
218
|
+
@segments = []
|
219
|
+
segments = s.gsub("\n", "").split(/~/)
|
220
|
+
segments.each do |segment|
|
221
|
+
@segment = {
|
222
|
+
segment[0,3].gsub("*", "").ljust(3) => segment.gsub(" ", "").
|
223
|
+
gsub(":", "").
|
224
|
+
split(/\*/)
|
225
|
+
}
|
226
|
+
@segments << @segment
|
227
|
+
end
|
228
|
+
|
229
|
+
|
230
|
+
@output = ''
|
231
|
+
|
232
|
+
@output += "ts = Hippo::TransactionSets::HIPAA_835::Base.new" #Transaction set start
|
233
|
+
|
234
|
+
@segments.each do |segmento|
|
235
|
+
segmento.each do |key, value|
|
236
|
+
i = 0
|
237
|
+
value.each do |x|
|
238
|
+
seg = (key.to_s + "%02d" % i).gsub(" ", "")
|
239
|
+
unless x == "" #start unless
|
240
|
+
case #start meta case
|
241
|
+
when seg =~ /LX01/
|
242
|
+
@output += " seg.#{seg} = #{x} #LX - Possible Loop" + "\n"
|
243
|
+
when seg =~ /#{x.to_s}/
|
244
|
+
@output += " end"+ "\n\n"
|
245
|
+
@output += " ts.#{key.upcase} do |seg|" + "\n" #segment loop
|
246
|
+
else
|
247
|
+
case #start sub-case
|
248
|
+
when x.to_i == 0
|
249
|
+
@output += " seg.#{seg} = '#{x}'" + "\n" #segments
|
250
|
+
when x.to_i != 0
|
251
|
+
@output += " seg.#{seg} = rand(10 ** #{x.length})" + "\n"
|
252
|
+
end #end sub-case
|
253
|
+
end #end meta-case
|
254
|
+
i += 1
|
255
|
+
end #end unless
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
@output += " end" + "\n" + "end" #Transaction set end
|
261
|
+
|
262
|
+
File.open("./sample_parsed.rb", "w") do |line|
|
263
|
+
line.write(@output)
|
264
|
+
end
|
265
|
+
puts @output
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|