hippo 0.0.6 → 0.0.7
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.
- data/CHANGELOG +3 -0
- data/README.md +28 -16
- data/lib/hippo/transaction_sets/base.rb +19 -2
- data/lib/hippo/version.rb +1 -1
- data/test/test_transaction_sets_base.rb +10 -1
- metadata +7 -7
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Hippo
|
2
2
|
=====
|
3
3
|
|
4
|
-
The Hippo library is an attempt at creating a simple DSL to generate and parse HIPAA
|
5
|
-
transaction sets. HIPAA or the Health Insurance Portability Accountability Act is a
|
6
|
-
series of regulations which place restrictions and requirements on the way transaction
|
4
|
+
The Hippo library is an attempt at creating a simple DSL to generate and parse HIPAA
|
5
|
+
transaction sets. HIPAA or the Health Insurance Portability Accountability Act is a
|
6
|
+
series of regulations which place restrictions and requirements on the way transaction
|
7
7
|
sets (ie. Claims, Remittances, Eligibility, Claim Status, etc.) must be formatted.
|
8
8
|
|
9
9
|
The HIPAA required transactions sets are created by the X12
|
@@ -12,7 +12,7 @@ effective 2012/01/01 all organizations must be migrated to using version
|
|
12
12
|
5010.
|
13
13
|
|
14
14
|
To obtain copies of the implementation guides you must purchase them from the X12
|
15
|
-
organization. The implementation data is also available in tabular format (CSV). The
|
15
|
+
organization. The implementation data is also available in tabular format (CSV). The
|
16
16
|
transaction sets, loops, and segments in Hippo were created from the X12 CSV Table Data.
|
17
17
|
|
18
18
|
More information can be found at the following sites:
|
@@ -85,7 +85,7 @@ Transaction Sets/Loops and Segments are defined with a very straight forward DSL
|
|
85
85
|
module Hippo::Segments
|
86
86
|
class TestSimpleSegment < Hippo::Segments::Base
|
87
87
|
segment_identifier 'TSS'
|
88
|
-
|
88
|
+
|
89
89
|
field :name => 'Field1'
|
90
90
|
field :name => 'Field2'
|
91
91
|
field :name => 'Field3'
|
@@ -93,32 +93,32 @@ Transaction Sets/Loops and Segments are defined with a very straight forward DSL
|
|
93
93
|
field :name => 'CommonName'
|
94
94
|
field :name => 'CommonName'
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
class TestCompoundSegment < Hippo::Segments::Base
|
98
98
|
segment_identifier 'TCS'
|
99
|
-
|
99
|
+
|
100
100
|
composite_field 'CompositeField' do
|
101
101
|
field :name => 'Field1'
|
102
102
|
field :name => 'Field2'
|
103
103
|
field :name => 'Field3'
|
104
104
|
field :name => 'CompositeCommonName'
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
composite_field 'CompositeField' do
|
108
108
|
field :name => 'Field4'
|
109
109
|
field :name => 'Field5'
|
110
110
|
field :name => 'Field6'
|
111
111
|
field :name => 'CompositeCommonName'
|
112
112
|
end
|
113
|
-
|
113
|
+
|
114
114
|
field :name => 'Field7'
|
115
115
|
end
|
116
116
|
end
|
117
|
-
|
117
|
+
|
118
118
|
module Hippo::TransactionSets
|
119
119
|
module Test
|
120
120
|
class Base < Hippo::TransactionSets::Base
|
121
|
-
|
121
|
+
|
122
122
|
segment Hippo::Segments::TestSimpleSegment,
|
123
123
|
:name => 'Test Simple Segment #1',
|
124
124
|
:minimum => 1,
|
@@ -127,7 +127,7 @@ Transaction Sets/Loops and Segments are defined with a very straight forward DSL
|
|
127
127
|
:defaults => {
|
128
128
|
'TSS01' => 'Blah'
|
129
129
|
}
|
130
|
-
|
130
|
+
|
131
131
|
segment Hippo::Segments::TestCompoundSegment,
|
132
132
|
:name => 'Test Compound Segment #2',
|
133
133
|
:minimum => 1,
|
@@ -136,7 +136,7 @@ Transaction Sets/Loops and Segments are defined with a very straight forward DSL
|
|
136
136
|
:defaults => {
|
137
137
|
'Field7' => 'Preset Field 7'
|
138
138
|
}
|
139
|
-
|
139
|
+
|
140
140
|
segment Hippo::Segments::TestSimpleSegment,
|
141
141
|
:name => 'Test Simple Segment #3',
|
142
142
|
:minimum => 1,
|
@@ -176,7 +176,7 @@ do not call #build.)
|
|
176
176
|
ts.TSS.build
|
177
177
|
```
|
178
178
|
|
179
|
-
The code above produces the following string output (notice how the values from
|
179
|
+
The code above produces the following string output (notice how the values from
|
180
180
|
:defaults are prefilled, and the output is automatically sorted based on the order
|
181
181
|
that the segments were declared):
|
182
182
|
|
@@ -196,11 +196,11 @@ on the segment or by passing a block to the segment.
|
|
196
196
|
ts.TCS do |tcs|
|
197
197
|
tcs.Field1 = 'Foo'
|
198
198
|
end
|
199
|
-
|
199
|
+
|
200
200
|
ts.TSS do |tss|
|
201
201
|
tss.Field2 = 'Bar'
|
202
202
|
end
|
203
|
-
|
203
|
+
|
204
204
|
# both of the mechanisms above have the same string representation:
|
205
205
|
#
|
206
206
|
# ts.to_s => 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~'
|
@@ -220,6 +220,18 @@ TSS_02 instead.
|
|
220
220
|
# ts.to_s => 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~TSS*Last Segment*Baz~'
|
221
221
|
```
|
222
222
|
|
223
|
+
Obviously, this could get somewhat tedious when operating on a TransactionSet with many segments
|
224
|
+
with the same identifier. As an alternative you can also access a particular segment/loop based
|
225
|
+
on the name provided in the TransactionSet definition.
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
ts.find\_by\_name('Test Simple Segment #1') do |tss|
|
229
|
+
tss.Field2 = 'Baz'
|
230
|
+
end
|
231
|
+
|
232
|
+
# ts.to_s => 'TSS*Blah*Baz~'
|
233
|
+
```
|
234
|
+
|
223
235
|
The same technique can be used to reference fields within a segment that have the same name.
|
224
236
|
|
225
237
|
```ruby
|
@@ -129,9 +129,26 @@ module Hippo::TransactionSets
|
|
129
129
|
end[sequence]
|
130
130
|
end
|
131
131
|
|
132
|
+
def get_component_by_name(name, sequence = nil)
|
133
|
+
sequence = if sequence.nil?
|
134
|
+
0
|
135
|
+
else
|
136
|
+
sequence.to_i - 1
|
137
|
+
end
|
138
|
+
|
139
|
+
self.class.components.select do |c|
|
140
|
+
puts c.options.inspect
|
141
|
+
c.options[:name] == name
|
142
|
+
end[sequence]
|
143
|
+
end
|
144
|
+
|
132
145
|
def method_missing(method_name, *args)
|
133
|
-
|
134
|
-
|
146
|
+
component = if method_name == :find_by_name
|
147
|
+
get_component_by_name(args[0], args[1])
|
148
|
+
else
|
149
|
+
component_name, component_sequence = method_name.to_s.split('_')
|
150
|
+
get_component(component_name, component_sequence)
|
151
|
+
end
|
135
152
|
|
136
153
|
if component.nil?
|
137
154
|
raise Hippo::Exceptions::InvalidSegment.new "Invalid segment specified: '#{method_name.to_s}'."
|
data/lib/hippo/version.rb
CHANGED
@@ -31,7 +31,7 @@ class TestTransactionSetBase < MiniTest::Unit::TestCase
|
|
31
31
|
assert_equal 'TSS*Foo~', ts.to_s
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def test_accessing_segments_with_same_segment_id
|
35
35
|
ts = Hippo::TransactionSets::Test::Base.new
|
36
36
|
ts.TSS.Field2 = 'Bar'
|
37
37
|
ts.TCS.Field1 = 'Foo'
|
@@ -40,6 +40,15 @@ class TestTransactionSetBase < MiniTest::Unit::TestCase
|
|
40
40
|
assert_equal 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~TSS*Last Standalone Segment*Baz~', ts.to_s
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_accessing_segments_by_name
|
44
|
+
ts = Hippo::TransactionSets::Test::Base.new
|
45
|
+
ts.find_by_name('Test Simple Segment #1') do |tss|
|
46
|
+
tss.Field2 = 'Baz'
|
47
|
+
end
|
48
|
+
|
49
|
+
assert_equal 'TSS*Blah*Baz~', ts.to_s
|
50
|
+
end
|
51
|
+
|
43
52
|
def test_assigning_segment_values_with_block_syntax
|
44
53
|
ts = Hippo::TransactionSets::Test::Base.new
|
45
54
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hippo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: minitest
|
17
|
-
requirement: &
|
17
|
+
requirement: &70305083942840 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70305083942840
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rake
|
28
|
-
requirement: &
|
28
|
+
requirement: &70305083942340 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 0.9.2
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70305083942340
|
37
37
|
description: HIPAA Transaction Set Generator/Parser
|
38
38
|
email:
|
39
39
|
- robertj@promedicalinc.com
|
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
version: '0'
|
266
266
|
requirements: []
|
267
267
|
rubyforge_project: hippo
|
268
|
-
rubygems_version: 1.8.
|
268
|
+
rubygems_version: 1.8.11
|
269
269
|
signing_key:
|
270
270
|
specification_version: 3
|
271
271
|
summary: HIPAA Transaction Set Generator/Parser
|