PD_x12 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +25 -6
- data/lib/x12/version.rb +1 -1
- data/misc/835.xml +85 -0
- data/test/tc_factory_837p.rb +4 -4
- data/test/tc_parse_835.rb +66 -0
- data/x12.gemspec +3 -2
- metadata +11 -6
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# X12
|
2
2
|
|
3
|
-
This project originated from App Design's X12 parser. The website is located: http://www.appdesign.com/x12parser. Project was forked by Sean Walberg, creating version 1.2.0 in April 2012.
|
4
3
|
Current version has been upgraded to run under ruby version >= 1.9.1
|
5
4
|
|
6
5
|
Changes welcome, especially new document types or better tests.
|
@@ -25,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
25
24
|
|
26
25
|
Add this line to your application's Gemfile:
|
27
26
|
|
28
|
-
gem '
|
27
|
+
gem 'PD_x12'
|
29
28
|
|
30
29
|
And then execute:
|
31
30
|
|
@@ -33,18 +32,38 @@ And then execute:
|
|
33
32
|
|
34
33
|
Or install it yourself as:
|
35
34
|
|
36
|
-
$ gem install
|
35
|
+
$ gem install PD_x12
|
37
36
|
|
38
|
-
|
37
|
+
## Documentation
|
38
|
+
### Wiki Page: https://github.com/mjpete3/x12/wiki
|
39
|
+
|
40
|
+
## Major deficiencies
|
41
|
+
|
42
|
+
Validation is not implemented.
|
43
|
+
Field types and sizes are ignored.
|
44
|
+
No access methods for composites’ fields.
|
45
|
+
|
46
|
+
# Acknowledgments
|
47
|
+
|
48
|
+
The authors of the project were inspired by the following works:
|
49
|
+
|
50
|
+
* The Perl X12 parser by Prasad Poruporuthan, search.cpan.org/~prasad/X12-0.09/lib/X12/Parser.pm
|
51
|
+
* The Ruby port of the above by Chris Parker, rubyforge.org/projects/x12-parser/
|
52
|
+
* This project originated from App Design's X12 parser.
|
53
|
+
* Project was forked by Sean Walberg, creating version 1.2.0 in April 2012.
|
39
54
|
|
40
|
-
TODO: Write usage instructions here
|
41
55
|
|
42
56
|
# Change Log
|
57
|
+
12/2/12 - release 1.3.2
|
58
|
+
* Added the 835 transaction
|
59
|
+
|
60
|
+
12/1/12 - release 1.3.1
|
61
|
+
* Added the 837p transaction
|
43
62
|
|
44
63
|
11/23/12 - release 1.3.0
|
45
64
|
* Updated to work with Ruby version >= 1.9.1
|
46
65
|
* includes bundle gem_tasks
|
47
|
-
* In misc/T105.xml escaped ampersand in Dun & Bradstreet
|
66
|
+
* In misc/T105.xml escaped ampersand in Dun & Bradstreet
|
48
67
|
|
49
68
|
4/18/12 - Release 1.2.0
|
50
69
|
* Works with Ruby version >= 1.8.6
|
data/lib/x12/version.rb
CHANGED
data/misc/835.xml
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
<!--
|
2
|
+
This file is part of the X12Parser library that provides tools to
|
3
|
+
manipulate X12 messages using Ruby native syntax.
|
4
|
+
|
5
|
+
http://x12parser.rubyforge.org
|
6
|
+
|
7
|
+
Copyright (C) 2012 P&D Technical Solutions, LLC
|
8
|
+
|
9
|
+
This library is free software; you can redistribute it and/or
|
10
|
+
modify it under the terms of the GNU Lesser General Public
|
11
|
+
License as published by the Free Software Foundation; either
|
12
|
+
version 2.1 of the License, or (at your option) any later version.
|
13
|
+
|
14
|
+
This library is distributed in the hope that it will be useful,
|
15
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
Lesser General Public License for more details.
|
18
|
+
|
19
|
+
You should have received a copy of the GNU Lesser General Public
|
20
|
+
License along with this library; if not, write to the Free Software
|
21
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22
|
+
|
23
|
+
$Id: 837p.xml 2012-11-23 mjp using version 5010 $
|
24
|
+
-->
|
25
|
+
|
26
|
+
<Definition>
|
27
|
+
<Loop name="835" required="y">
|
28
|
+
<Segment name="ISA" max="1" required="y" />
|
29
|
+
<Segment name="GS" max="1" required="y" />
|
30
|
+
<Loop name="L835" max="1" comment="This X12 Transaction Set contains the format and establishes the data contents of the Professional Healthcare Claim Transaction Set (837p) for use within the context of an Electronic Data Interchange (EDI) environment.">
|
31
|
+
<Segment name="ST" max="1" required="y" />
|
32
|
+
<Segment name="BPR" max="1" required="y" comment="Fianancial Information" />
|
33
|
+
<Segment name="TRN" max="1" required="y" comment="Re-association Trace Number" />
|
34
|
+
<Segment name="CUR" max="1" required="n" />
|
35
|
+
<Segment name="REF" max="2" required="n" />
|
36
|
+
<Segment name="DTM" max="1" required="n" comment="Production Date" />
|
37
|
+
<Loop name="L1000A" max="1" required="y" comment="Payer Identification">
|
38
|
+
<Segment name="N1" max="1" required="y" />
|
39
|
+
<Segment name="N3" max="1" required="y" />
|
40
|
+
<Segment name="N4" max="1" required="y" />
|
41
|
+
<Segment name="REF" max="4" required="n" />
|
42
|
+
<Segment name="PER" min="1" max="inf" required="y" />
|
43
|
+
</Loop>
|
44
|
+
<Loop name="L1000B" max="1" required="y" comment="Payee Identification" >
|
45
|
+
<Segment name="N1" max="1" required="y" />
|
46
|
+
<Segment name="N3" max="1" required="n" />
|
47
|
+
<Segment name="N4" max="1" required="y" />
|
48
|
+
<Segment name="REF" required="n" />
|
49
|
+
<Segment name="RDM" max="1" required="n" />
|
50
|
+
</Loop>
|
51
|
+
<Loop name="L2000" required="n" comment="Claim Payment Information" >
|
52
|
+
<Segment name="LX" max="1" required="n" />
|
53
|
+
<Segment name="TS3" max="1" required="n" />
|
54
|
+
<Segment name="TS2" max="1" required="n" />
|
55
|
+
</Loop>
|
56
|
+
<Loop name="L2100" min="1" comment="The Loop 2100 CLP Claim Payment Information Segment begins data on each individual claim for a service provider within the 835 Transaction." >
|
57
|
+
<Segment name="CLP" max="1" required="y" />
|
58
|
+
<Segment name="CAS" max="99" required="n" />
|
59
|
+
<Segment name="CLP" max="1" required="y" />
|
60
|
+
<Segment name="NM1" max="1" required="y" />
|
61
|
+
<Segment name="NM1" max="6" required="n" />
|
62
|
+
<Segment name="MIA" max="1" required="n" />
|
63
|
+
<Segment name="MOA" max="1" required="n" />
|
64
|
+
<Segment name="REF" max="15" required="n" />
|
65
|
+
<Segment name="DTM" max="4" required="n" />
|
66
|
+
<Segment name="PER" max="2" required="n" />
|
67
|
+
<Segment name="AMT" max="13" required="n" />
|
68
|
+
<Segment name="QTY" max="14" required="n" />
|
69
|
+
<Loop name="L2110" max="999" required="n" comment="Service Payment Information">
|
70
|
+
<Segment name="SVC" max="1" required="n" />
|
71
|
+
<Segment name="DTM" max="2" required="n" />
|
72
|
+
<Segment name="CAS" max="99" required="n" />
|
73
|
+
<Segment name="REF" max="24" required="n" />
|
74
|
+
<Segment name="AMT" max="9" required="n" />
|
75
|
+
<Segment name="QTY" max="6" required="n" />
|
76
|
+
<Segment name="LQ" max="99" required="n" />
|
77
|
+
</Loop>
|
78
|
+
</Loop>
|
79
|
+
<Segment name="PLB" required="n" comment="Provider Level Adjustment" />
|
80
|
+
<Segment name="SE" required="y" />
|
81
|
+
</Loop>
|
82
|
+
<Segment name="GE" max="1" required="y"/>
|
83
|
+
<Segment name="IEA" max="1" required="y"/>
|
84
|
+
</Loop>
|
85
|
+
</Definition>
|
data/test/tc_factory_837p.rb
CHANGED
@@ -47,7 +47,7 @@ N3*P O BOX 12312~
|
|
47
47
|
N4*DURHAM*NC*27715~
|
48
48
|
DMG*D8*19670807*F~
|
49
49
|
NM1*PR*2*BCBSNC*****PI*987654321~
|
50
|
-
CLM*PTACCT2235057*100.5***11::1*Y*A*Y*N
|
50
|
+
CLM*PTACCT2235057*100.5***11::1*Y*A*Y*N**********~
|
51
51
|
REF*EA*MEDREC11111~
|
52
52
|
HI*BK:78901~
|
53
53
|
LX*1~
|
@@ -134,7 +134,7 @@ EOT
|
|
134
134
|
loop.SBR {|s|
|
135
135
|
s.PayerResponsibilitySequenceNumberCode = "P"
|
136
136
|
s.IndividualRelationshipCode = "18"
|
137
|
-
s.
|
137
|
+
s.InsuredGroupOrPolicyNumber = "ABC123101"
|
138
138
|
s.ClaimFilingIndicatorCode = "BL"
|
139
139
|
}
|
140
140
|
|
@@ -158,11 +158,11 @@ EOT
|
|
158
158
|
|
159
159
|
def loop_l2300(loop)
|
160
160
|
loop.CLM {|c|
|
161
|
-
c.
|
161
|
+
c.PatientAccountNumber = "PTACCT2235057"
|
162
162
|
c.MonetaryAmount = "100.5"
|
163
163
|
c.HealthCareServiceLocationInformation = "11::1"
|
164
164
|
c.ProviderOrSupplierSignatureIndicator = "Y"
|
165
|
-
c.
|
165
|
+
c.MedicareAssignmentCode = "A"
|
166
166
|
c.BenefitsAssignmentCertificationIndicator = "Y"
|
167
167
|
c.ReleaseOfInformationCode = "N"
|
168
168
|
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#--
|
2
|
+
# This file is part of the X12Parser library that provides tools to
|
3
|
+
# manipulate X12 messages using Ruby native syntax.
|
4
|
+
#
|
5
|
+
# http://x12parser.rubyforge.org
|
6
|
+
#
|
7
|
+
# Copyright (C) 2012 P&D Technical Solutions, LLC.
|
8
|
+
#
|
9
|
+
# This library is free software; you can redistribute it and/or
|
10
|
+
# modify it under the terms of the GNU Lesser General Public
|
11
|
+
# License as published by the Free Software Foundation; either
|
12
|
+
# version 2.1 of the License, or (at your option) any later version.
|
13
|
+
#
|
14
|
+
# This library is distributed in the hope that it will be useful,
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
# Lesser General Public License for more details.
|
18
|
+
#
|
19
|
+
# You should have received a copy of the GNU Lesser General Public
|
20
|
+
# License along with this library; if not, write to the Free Software
|
21
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22
|
+
#++
|
23
|
+
#
|
24
|
+
require 'x12'
|
25
|
+
require 'test/unit'
|
26
|
+
|
27
|
+
class Test835Parse < Test::Unit::TestCase
|
28
|
+
|
29
|
+
def setup
|
30
|
+
@parser = X12::Parser.new('835.xml')
|
31
|
+
@msg = []
|
32
|
+
# sample 5010 835 test message
|
33
|
+
@temporary = "ISA*00* *00* *ZZ*5010TEST *ZZ*835RECVR *110930*1105*^*00501*000004592*0*T*:~GS*HP*5010TEST*835RECVR*20110930*100718*45920001*X*005010X221A1~ST*835*0001~BPR*I*57.44*C*CHK************20110930~TRN*1*123456789*1123456789~REF*EV*5010835EXAMPLE~DTM*405*20110930~N1*PR*PAYER NAME~N3*PAYER ADDRESS~N4*CINCINNATI*OH*45206~PER*CX**TE*8003030303~PER*BL*TECHNICAL CONTACT*TE*8004040404*EM*PAYER@PAYER.COM~PER*IC**UR*WWW.PAYER.COM~N1*PE*PROVIDER NAME*XX*1122334455~N3*PROVIDER ADDRESS~N4*CITY*OH*89999~REF*TJ*123456789~LX*1~CLP*EDI DENIAL*1*1088*0*1088*HM*CLAIMNUMBER1*21~NM1*QC*1*LAST*FIRST****MI*1A2A1A2A1A2A~NM1*IL*1*LAST1*FIRST1*G***MI*BBB1A2A1A2A1A2A~NM1*82*1*PROVIDER*MR*A***XX*1234567898~REF*EA*11223344~REF*1L*123456~DTM*232*20090113~DTM*233*20090113~DTM*050*20110908~SVC*HC:00220:P2*1088*0**8**76~DTM*150*20090113~DTM*151*20090113~CAS*PR*29*1088~CLP*EDI PAID*1*100*57.44*30*12*CLAIMNUMBER2*11~NM1*QC*1*LAST2*FIRST2*A***MI*R123456789~NM1*IL*1*LAST3*FIRST3*B***MI*R1234567~NM1*82*1*PROVIDER1*MRS1*B***XX*1234567899~REF*EA*11223344~REF*1L*123456~DTM*232*20110729~DTM*233*20110729~DTM*050*20110927~SVC*HC:97110*100*57.44**2~DTM*150*20110729~DTM*151*20110729~CAS*PR*3*30~CAS*CO*45*12.56~AMT*B6*87.44~SE*45*0001~GE*1*45920001~IEA*1*000004592~"
|
34
|
+
@msg << @temporary
|
35
|
+
|
36
|
+
@r = @parser.parse('835', @msg[0])
|
37
|
+
end
|
38
|
+
|
39
|
+
def teardown
|
40
|
+
#nothing
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_ISA_IEA
|
44
|
+
assert_equal('ISA*00* *00* *ZZ*5010TEST *ZZ*835RECVR *110930*1105*^*00501*000004592*0*T*:~', @r.ISA.to_s)
|
45
|
+
assert_equal('5010TEST ', @r.ISA.InterchangeSenderId)
|
46
|
+
puts @r.IEA.to_s
|
47
|
+
assert_equal('1', @r.IEA.NumberOfIncludedFunctionalGroups)
|
48
|
+
end # test_ST
|
49
|
+
|
50
|
+
def test_GS_GE
|
51
|
+
assert_equal("HP", @r.GS.FunctionalIdentifierCode)
|
52
|
+
assert_equal("45920001", @r.GS.GroupControlNumber)
|
53
|
+
assert_equal(@r.GS.GroupControlNumber, @r.GE.GroupControlNumber)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def test_timing
|
58
|
+
start = Time::now
|
59
|
+
X12::TEST_REPEAT.times do
|
60
|
+
@r = @parser.parse('835', @msg[1])
|
61
|
+
end
|
62
|
+
finish = Time::now
|
63
|
+
puts sprintf("Parses per second, 835: %.2f, elapsed: %.1f", X12::TEST_REPEAT.to_f/(finish-start), finish-start)
|
64
|
+
end # test_timing
|
65
|
+
end
|
66
|
+
|
data/x12.gemspec
CHANGED
@@ -6,9 +6,10 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.version = X12::VERSION
|
7
7
|
gem.authors = ["App Design, Inc.", "Sean Walberg", "Marty Petersen"]
|
8
8
|
gem.email = ["info@appdesign.com", "sean@ertw.com", "themooseman@comcast.net"]
|
9
|
-
gem.description = %q{A gem to handle parsing and generation of ANSI X12 documents.
|
9
|
+
gem.description = %q{A gem to handle parsing and generation of ANSI X12 documents. Currently tested with Ruby >= 1.9.2. Gem supports X12 EDI transactions 270, 997, 837p and 835. Anyone wanting to create additional XML files for other transactions welcomed. }
|
10
10
|
gem.summary = %q{A gem to handle parsing and generation of ANSI X12 documents}
|
11
|
-
gem.homepage = ""
|
11
|
+
gem.homepage = "https://github.com/mjpete3/x12"
|
12
|
+
gem.licenses = 'GPL-2'
|
12
13
|
|
13
14
|
gem.files = `git ls-files`.split($\)
|
14
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PD_x12
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,10 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-12-
|
14
|
+
date: 2012-12-02 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
|
-
description: A gem to handle parsing and generation of ANSI X12 documents.
|
17
|
-
|
16
|
+
description: ! 'A gem to handle parsing and generation of ANSI X12 documents. Currently
|
17
|
+
tested with Ruby >= 1.9.2. Gem supports X12 EDI transactions 270, 997, 837p and
|
18
|
+
835. Anyone wanting to create additional XML files for other transactions welcomed. '
|
18
19
|
email:
|
19
20
|
- info@appdesign.com
|
20
21
|
- sean@ertw.com
|
@@ -44,6 +45,7 @@ files:
|
|
44
45
|
- lib/x12/xmldefinitions.rb
|
45
46
|
- misc/270.xml
|
46
47
|
- misc/270interchange.xml
|
48
|
+
- misc/835.xml
|
47
49
|
- misc/837p.xml
|
48
50
|
- misc/997.xml
|
49
51
|
- misc/997single.xml
|
@@ -1855,11 +1857,13 @@ files:
|
|
1855
1857
|
- test/tc_factory_997.rb
|
1856
1858
|
- test/tc_parse_270.rb
|
1857
1859
|
- test/tc_parse_270interchange.rb
|
1860
|
+
- test/tc_parse_835.rb
|
1858
1861
|
- test/tc_parse_837p.rb
|
1859
1862
|
- test/tc_parse_997.rb
|
1860
1863
|
- x12.gemspec
|
1861
|
-
homepage:
|
1862
|
-
licenses:
|
1864
|
+
homepage: https://github.com/mjpete3/x12
|
1865
|
+
licenses:
|
1866
|
+
- GPL-2
|
1863
1867
|
post_install_message:
|
1864
1868
|
rdoc_options: []
|
1865
1869
|
require_paths:
|
@@ -1889,5 +1893,6 @@ test_files:
|
|
1889
1893
|
- test/tc_factory_997.rb
|
1890
1894
|
- test/tc_parse_270.rb
|
1891
1895
|
- test/tc_parse_270interchange.rb
|
1896
|
+
- test/tc_parse_835.rb
|
1892
1897
|
- test/tc_parse_837p.rb
|
1893
1898
|
- test/tc_parse_997.rb
|