hippo 0.3.0 → 0.4.0
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 +8 -1
- data/lib/hippo/field.rb +9 -4
- data/lib/hippo/parser/transaction_set.rb +4 -2
- data/lib/hippo/segments/DTP.rb +1 -1
- data/lib/hippo/segments/base.rb +6 -4
- data/lib/hippo/segments.rb +1 -0
- data/lib/hippo/separator.rb +27 -1
- data/lib/hippo/transaction_sets/HIPAA_270/L2000A.rb +11 -0
- data/lib/hippo/transaction_sets/HIPAA_270/L2000B.rb +10 -0
- data/lib/hippo/transaction_sets/HIPAA_270/L2000C.rb +11 -0
- data/lib/hippo/transaction_sets/HIPAA_270/base.rb +0 -33
- data/lib/hippo/transaction_sets/HIPAA_270.rb +11 -13
- data/lib/hippo/transaction_sets/HIPAA_271/L2000A.rb +11 -0
- data/lib/hippo/transaction_sets/HIPAA_271/L2000B.rb +11 -0
- data/lib/hippo/transaction_sets/HIPAA_271/L2000C.rb +11 -0
- data/lib/hippo/transaction_sets/HIPAA_271/base.rb +0 -33
- data/lib/hippo/transaction_sets/HIPAA_271.rb +15 -17
- data/lib/hippo/version.rb +1 -1
- data/test/test_segments_base.rb +1 -1
- metadata +23 -8
data/CHANGELOG
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0 - 2012/09/13
|
2
|
+
* Do not hard-code separators in Hippo::Segments::Base#to_s.
|
3
|
+
* Properly escape regexps involving separators.
|
4
|
+
* Discard any empty segments when parsing transaction sets.
|
5
|
+
* Remove whitespace from fields containing only whitespace.
|
6
|
+
0.3.0
|
7
|
+
* Add support for 270/271 transaction sets.
|
8
|
+
0.2.3
|
2
9
|
* Fix issue preventing parsing when segments are not in the correct order. Now
|
3
10
|
we loop through all segments within a given section to make sure we grab them
|
4
11
|
all.
|
data/lib/hippo/field.rb
CHANGED
@@ -105,7 +105,9 @@ module Hippo
|
|
105
105
|
def generate_date(value)
|
106
106
|
value ||= Date.today
|
107
107
|
|
108
|
-
if
|
108
|
+
if value.class.to_s == 'Range'
|
109
|
+
"#{value.first.strftime('%Y%m%d')}-#{value.last.strftime('%Y%m%d')}"
|
110
|
+
elsif maximum == 6
|
109
111
|
value.strftime('%y%m%d')
|
110
112
|
else
|
111
113
|
value.strftime('%Y%m%d')
|
@@ -119,12 +121,15 @@ module Hippo
|
|
119
121
|
end
|
120
122
|
|
121
123
|
case value.class.to_s
|
122
|
-
when "
|
123
|
-
when "
|
124
|
+
when "Range" then value
|
125
|
+
when "Date" then value
|
126
|
+
when "Time" then value.to_date
|
124
127
|
when "String"
|
125
128
|
format = case value
|
126
129
|
when /\A\d{6}\z/ then '%y%m%d'
|
127
|
-
when /\A\d{8}\z/ then '%Y
|
130
|
+
when /\A\d{8}\z/ then '%Y%`%d'
|
131
|
+
when /\A(\d{8})-(\d{8})\z/ then
|
132
|
+
return Date.parse($1, '%Y%m%d')..Date.parse($2, '%Y%m%d')
|
128
133
|
else
|
129
134
|
invalid!
|
130
135
|
end
|
@@ -22,7 +22,9 @@ module Hippo
|
|
22
22
|
segment = Hippo::Segments.const_get(segment_string.split(@field_separator).first).new(:parent => self)
|
23
23
|
|
24
24
|
segment.parse(segment_string)
|
25
|
-
|
25
|
+
|
26
|
+
segment.to_s == '' ? nil : segment
|
27
|
+
end.compact
|
26
28
|
end
|
27
29
|
|
28
30
|
def read(input = nil)
|
@@ -39,4 +41,4 @@ module Hippo
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
42
|
-
end
|
44
|
+
end
|
data/lib/hippo/segments/DTP.rb
CHANGED
data/lib/hippo/segments/base.rb
CHANGED
@@ -145,13 +145,15 @@ module Hippo::Segments
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
|
149
|
-
|
150
|
-
output = output.gsub(
|
148
|
+
unless self.class.fixed_width
|
149
|
+
output = output.gsub(repeating_composite_separator_regexp, @field_separator)
|
150
|
+
output = output.gsub(empty_field_regexp,'\1\2')
|
151
151
|
end
|
152
152
|
|
153
153
|
output += @segment_separator
|
154
|
-
output = output.gsub(
|
154
|
+
output = output.gsub(repeating_field_separator_at_end_of_segment_regexp, @segment_separator)
|
155
|
+
|
156
|
+
output =~ /\A#{self.class.identifier}~/ ? '' : output
|
155
157
|
end
|
156
158
|
|
157
159
|
def identifier
|
data/lib/hippo/segments.rb
CHANGED
@@ -53,6 +53,7 @@ module Hippo
|
|
53
53
|
autoload_relative :LE, 'segments/LE'
|
54
54
|
autoload_relative :LIN, 'segments/LIN'
|
55
55
|
autoload_relative :LQ, 'segments/LQ'
|
56
|
+
autoload_relative :LS, 'segments/LS'
|
56
57
|
autoload_relative :LX, 'segments/LX'
|
57
58
|
autoload_relative :MEA, 'segments/MEA'
|
58
59
|
autoload_relative :MIA, 'segments/MIA'
|
data/lib/hippo/separator.rb
CHANGED
@@ -40,5 +40,31 @@ module Hippo
|
|
40
40
|
:repetition_separator => @repetition_separator
|
41
41
|
}
|
42
42
|
end
|
43
|
+
|
44
|
+
def repeating_field_separator_at_end_of_segment_regexp
|
45
|
+
%r{
|
46
|
+
#{Regexp.escape(@field_separator)}+
|
47
|
+
#{Regexp.escape(@segment_separator)}
|
48
|
+
}x
|
49
|
+
end
|
50
|
+
|
51
|
+
def repeating_composite_separator_regexp
|
52
|
+
%r{
|
53
|
+
#{Regexp.escape(@composite_separator)}+
|
54
|
+
#{Regexp.escape(@field_separator)}
|
55
|
+
}x
|
56
|
+
end
|
57
|
+
|
58
|
+
def empty_field_regexp
|
59
|
+
%r{(?<separators>
|
60
|
+
[
|
61
|
+
#{Regexp.escape(@composite_separator)}
|
62
|
+
#{Regexp.escape(@field_separator)}
|
63
|
+
#{Regexp.escape(@segment_separator)}
|
64
|
+
])
|
65
|
+
\s+
|
66
|
+
(\g<separators>)
|
67
|
+
}x
|
68
|
+
end
|
43
69
|
end
|
44
|
-
end
|
70
|
+
end
|
@@ -27,6 +27,17 @@ module Hippo::TransactionSets
|
|
27
27
|
'NM1.NM108' => ["24", "46", "FI", "NI", "PI", "XV", "XX"]
|
28
28
|
}
|
29
29
|
|
30
|
+
#Information Receiver Level
|
31
|
+
loop Hippo::TransactionSets::HIPAA_270::L2000B,
|
32
|
+
:name => 'Information Receiver Level',
|
33
|
+
:minimum => 1,
|
34
|
+
:maximum => 99999,
|
35
|
+
:position => 100,
|
36
|
+
:identified_by => {
|
37
|
+
'HL.HL03' => '21',
|
38
|
+
'HL.HL04' => '1'
|
39
|
+
}
|
40
|
+
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
@@ -27,6 +27,16 @@ module Hippo::TransactionSets
|
|
27
27
|
'NM1.NM108' => ["24", "34", "FI", "PI", "PP", "SV", "XV", "XX"]
|
28
28
|
}
|
29
29
|
|
30
|
+
#Subscriber Level
|
31
|
+
loop Hippo::TransactionSets::HIPAA_270::L2000C,
|
32
|
+
:name => 'Subscriber Level',
|
33
|
+
:minimum => 1,
|
34
|
+
:maximum => 99999,
|
35
|
+
:position => 100,
|
36
|
+
:identified_by => {
|
37
|
+
'HL.HL03' => '22',
|
38
|
+
'HL.HL04' => ["0", "1"]
|
39
|
+
}
|
30
40
|
end
|
31
41
|
end
|
32
42
|
end
|
@@ -36,6 +36,17 @@ module Hippo::TransactionSets
|
|
36
36
|
'NM1.NM102' => ["1", "2"]
|
37
37
|
}
|
38
38
|
|
39
|
+
#Dependent Level
|
40
|
+
loop Hippo::TransactionSets::HIPAA_270::L2000D,
|
41
|
+
:name => 'Dependent Level',
|
42
|
+
:minimum => 0,
|
43
|
+
:maximum => 99999,
|
44
|
+
:position => 100,
|
45
|
+
:identified_by => {
|
46
|
+
'HL.HL03' => '23',
|
47
|
+
'HL.HL04' => '0'
|
48
|
+
}
|
49
|
+
|
39
50
|
end
|
40
51
|
end
|
41
52
|
end
|
@@ -35,39 +35,6 @@ module Hippo::TransactionSets
|
|
35
35
|
'HL.HL04' => '1'
|
36
36
|
}
|
37
37
|
|
38
|
-
#Information Receiver Level
|
39
|
-
loop Hippo::TransactionSets::HIPAA_270::L2000B,
|
40
|
-
:name => 'Information Receiver Level',
|
41
|
-
:minimum => 1,
|
42
|
-
:maximum => 99999,
|
43
|
-
:position => 100,
|
44
|
-
:identified_by => {
|
45
|
-
'HL.HL03' => '21',
|
46
|
-
'HL.HL04' => '1'
|
47
|
-
}
|
48
|
-
|
49
|
-
#Subscriber Level
|
50
|
-
loop Hippo::TransactionSets::HIPAA_270::L2000C,
|
51
|
-
:name => 'Subscriber Level',
|
52
|
-
:minimum => 1,
|
53
|
-
:maximum => 99999,
|
54
|
-
:position => 100,
|
55
|
-
:identified_by => {
|
56
|
-
'HL.HL03' => '22',
|
57
|
-
'HL.HL04' => ["0", "1"]
|
58
|
-
}
|
59
|
-
|
60
|
-
#Dependent Level
|
61
|
-
loop Hippo::TransactionSets::HIPAA_270::L2000D,
|
62
|
-
:name => 'Dependent Level',
|
63
|
-
:minimum => 0,
|
64
|
-
:maximum => 99999,
|
65
|
-
:position => 100,
|
66
|
-
:identified_by => {
|
67
|
-
'HL.HL03' => '23',
|
68
|
-
'HL.HL04' => '0'
|
69
|
-
}
|
70
|
-
|
71
38
|
#Transaction Set Trailer
|
72
39
|
segment Hippo::Segments::SE,
|
73
40
|
:name => 'Transaction Set Trailer',
|
@@ -1,17 +1,15 @@
|
|
1
1
|
module Hippo::TransactionSets
|
2
2
|
module HIPAA_270
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
autoload :L2110D, 'hippo/transaction_sets/HIPAA_270/L2110D'
|
15
|
-
|
3
|
+
autoload_relative :Base, 'HIPAA_270/base'
|
4
|
+
autoload_relative :L2000A, 'HIPAA_270/L2000A'
|
5
|
+
autoload_relative :L2000B, 'HIPAA_270/L2000B'
|
6
|
+
autoload_relative :L2000C, 'HIPAA_270/L2000C'
|
7
|
+
autoload_relative :L2000D, 'HIPAA_270/L2000D'
|
8
|
+
autoload_relative :L2100A, 'HIPAA_270/L2100A'
|
9
|
+
autoload_relative :L2100B, 'HIPAA_270/L2100B'
|
10
|
+
autoload_relative :L2100C, 'HIPAA_270/L2100C'
|
11
|
+
autoload_relative :L2100D, 'HIPAA_270/L2100D'
|
12
|
+
autoload_relative :L2110C, 'HIPAA_270/L2110C'
|
13
|
+
autoload_relative :L2110D, 'HIPAA_270/L2110D'
|
16
14
|
end
|
17
15
|
end
|
@@ -39,6 +39,17 @@ module Hippo::TransactionSets
|
|
39
39
|
'NM1.NM108' => ["24", "46", "FI", "NI", "PI", "XV", "XX"]
|
40
40
|
}
|
41
41
|
|
42
|
+
#Information Receiver Level
|
43
|
+
loop Hippo::TransactionSets::HIPAA_271::L2000B,
|
44
|
+
:name => 'Information Receiver Level',
|
45
|
+
:minimum => 0,
|
46
|
+
:maximum => 99999,
|
47
|
+
:position => 100,
|
48
|
+
:identified_by => {
|
49
|
+
'HL.HL03' => '21',
|
50
|
+
'HL.HL04' => ["0", "1"]
|
51
|
+
}
|
52
|
+
|
42
53
|
end
|
43
54
|
end
|
44
55
|
end
|
@@ -27,6 +27,17 @@ module Hippo::TransactionSets
|
|
27
27
|
'NM1.NM108' => ["24", "34", "FI", "PI", "PP", "SV", "XV", "XX"]
|
28
28
|
}
|
29
29
|
|
30
|
+
#Subscriber Level
|
31
|
+
loop Hippo::TransactionSets::HIPAA_271::L2000C,
|
32
|
+
:name => 'Subscriber Level',
|
33
|
+
:minimum => 0,
|
34
|
+
:maximum => 99999,
|
35
|
+
:position => 100,
|
36
|
+
:identified_by => {
|
37
|
+
'HL.HL03' => '22',
|
38
|
+
'HL.HL04' => ["0", "1"]
|
39
|
+
}
|
40
|
+
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
@@ -36,6 +36,17 @@ module Hippo::TransactionSets
|
|
36
36
|
'NM1.NM102' => ["1", "2"]
|
37
37
|
}
|
38
38
|
|
39
|
+
#Dependent Level
|
40
|
+
loop Hippo::TransactionSets::HIPAA_271::L2000D,
|
41
|
+
:name => 'Dependent Level',
|
42
|
+
:minimum => 0,
|
43
|
+
:maximum => 99999,
|
44
|
+
:position => 100,
|
45
|
+
:identified_by => {
|
46
|
+
'HL.HL03' => '23',
|
47
|
+
'HL.HL04' => '0'
|
48
|
+
}
|
49
|
+
|
39
50
|
end
|
40
51
|
end
|
41
52
|
end
|
@@ -35,39 +35,6 @@ module Hippo::TransactionSets
|
|
35
35
|
'HL.HL04' => ["0", "1"]
|
36
36
|
}
|
37
37
|
|
38
|
-
#Information Receiver Level
|
39
|
-
loop Hippo::TransactionSets::HIPAA_271::L2000B,
|
40
|
-
:name => 'Information Receiver Level',
|
41
|
-
:minimum => 0,
|
42
|
-
:maximum => 99999,
|
43
|
-
:position => 100,
|
44
|
-
:identified_by => {
|
45
|
-
'HL.HL03' => '21',
|
46
|
-
'HL.HL04' => ["0", "1"]
|
47
|
-
}
|
48
|
-
|
49
|
-
#Subscriber Level
|
50
|
-
loop Hippo::TransactionSets::HIPAA_271::L2000C,
|
51
|
-
:name => 'Subscriber Level',
|
52
|
-
:minimum => 0,
|
53
|
-
:maximum => 99999,
|
54
|
-
:position => 100,
|
55
|
-
:identified_by => {
|
56
|
-
'HL.HL03' => '22',
|
57
|
-
'HL.HL04' => ["0", "1"]
|
58
|
-
}
|
59
|
-
|
60
|
-
#Dependent Level
|
61
|
-
loop Hippo::TransactionSets::HIPAA_271::L2000D,
|
62
|
-
:name => 'Dependent Level',
|
63
|
-
:minimum => 0,
|
64
|
-
:maximum => 99999,
|
65
|
-
:position => 100,
|
66
|
-
:identified_by => {
|
67
|
-
'HL.HL03' => '23',
|
68
|
-
'HL.HL04' => '0'
|
69
|
-
}
|
70
|
-
|
71
38
|
#Transaction Set Trailer
|
72
39
|
segment Hippo::Segments::SE,
|
73
40
|
:name => 'Transaction Set Trailer',
|
@@ -1,21 +1,19 @@
|
|
1
1
|
module Hippo::TransactionSets
|
2
2
|
module HIPAA_271
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
autoload :L2120D, 'hippo/transaction_sets/HIPAA_271/L2120D'
|
19
|
-
|
3
|
+
autoload_relative :Base, 'HIPAA_271/base'
|
4
|
+
autoload_relative :L2000A, 'HIPAA_271/L2000A'
|
5
|
+
autoload_relative :L2000B, 'HIPAA_271/L2000B'
|
6
|
+
autoload_relative :L2000C, 'HIPAA_271/L2000C'
|
7
|
+
autoload_relative :L2000D, 'HIPAA_271/L2000D'
|
8
|
+
autoload_relative :L2100A, 'HIPAA_271/L2100A'
|
9
|
+
autoload_relative :L2100B, 'HIPAA_271/L2100B'
|
10
|
+
autoload_relative :L2100C, 'HIPAA_271/L2100C'
|
11
|
+
autoload_relative :L2100D, 'HIPAA_271/L2100D'
|
12
|
+
autoload_relative :L2110C, 'HIPAA_271/L2110C'
|
13
|
+
autoload_relative :L2110D, 'HIPAA_271/L2110D'
|
14
|
+
autoload_relative :L2115C, 'HIPAA_271/L2115C'
|
15
|
+
autoload_relative :L2115D, 'HIPAA_271/L2115D'
|
16
|
+
autoload_relative :L2120C, 'HIPAA_271/L2120C'
|
17
|
+
autoload_relative :L2120D, 'HIPAA_271/L2120D'
|
20
18
|
end
|
21
19
|
end
|
data/lib/hippo/version.rb
CHANGED
data/test/test_segments_base.rb
CHANGED
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.
|
4
|
+
version: 0.4.0
|
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: 2012-
|
13
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: minitest
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: rake
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ~>
|
@@ -33,7 +38,12 @@ dependencies:
|
|
33
38
|
version: 0.9.2
|
34
39
|
type: :development
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.9.2
|
37
47
|
description: HIPAA Transaction Set Generator/Parser
|
38
48
|
email:
|
39
49
|
- robertj@promedicalinc.com
|
@@ -329,15 +339,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
329
339
|
- - ! '>='
|
330
340
|
- !ruby/object:Gem::Version
|
331
341
|
version: '0'
|
342
|
+
segments:
|
343
|
+
- 0
|
344
|
+
hash: 3757696545577319633
|
332
345
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
333
346
|
none: false
|
334
347
|
requirements:
|
335
348
|
- - ! '>='
|
336
349
|
- !ruby/object:Gem::Version
|
337
350
|
version: '0'
|
351
|
+
segments:
|
352
|
+
- 0
|
353
|
+
hash: 3757696545577319633
|
338
354
|
requirements: []
|
339
355
|
rubyforge_project: hippo
|
340
|
-
rubygems_version: 1.8.
|
356
|
+
rubygems_version: 1.8.24
|
341
357
|
signing_key:
|
342
358
|
specification_version: 3
|
343
359
|
summary: HIPAA Transaction Set Generator/Parser
|
@@ -349,4 +365,3 @@ test_files:
|
|
349
365
|
- test/test_parser.rb
|
350
366
|
- test/test_segments_base.rb
|
351
367
|
- test/test_transaction_sets_base.rb
|
352
|
-
has_rdoc:
|