ruby-hl7 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/message.rb +11 -11
- data/lib/ruby-hl7.rb +1 -1
- data/lib/segment.rb +4 -4
- data/lib/segment_fields.rb +10 -2
- data/lib/segment_list_storage.rb +3 -3
- data/lib/segments/dg1.rb +38 -0
- data/lib/segments/evn.rb +0 -1
- data/lib/segments/fts.rb +5 -0
- data/lib/segments/in1.rb +1 -2
- data/lib/segments/msa.rb +0 -1
- data/lib/segments/msh.rb +0 -1
- data/lib/segments/nk1.rb +0 -1
- data/lib/segments/nte.rb +0 -1
- data/lib/segments/obr.rb +0 -1
- data/lib/segments/obx.rb +0 -1
- data/lib/segments/orc.rb +0 -1
- data/lib/segments/oru.rb +0 -1
- data/lib/segments/pid.rb +0 -1
- data/lib/segments/prd.rb +1 -2
- data/lib/segments/pv1.rb +0 -1
- data/lib/segments/pv2.rb +0 -1
- data/lib/segments/qrd.rb +0 -1
- data/lib/segments/qrf.rb +0 -1
- data/lib/segments/rf1.rb +1 -2
- data/lib/segments/zcf.rb +1 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 005071a850becbb69bd856337698d824eb7514a7
|
4
|
+
data.tar.gz: fe3b1cd645846d3eae704f2738ea9e4372d06877
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dbc973a6f883acd2f59c626276ccae85934cf8a614fcd8a974c888191ad3ab9888ff8f0cdd8b6c2db91d99a7c167abe4661c71188afc3bbc745c6b2355ddffb
|
7
|
+
data.tar.gz: 71769e021da5a7f72f5eec461e340830d3573b26fbba1ee91fea1e89269c69cb0b07bfe11be09cb04ee300785cda671d784eede5eefd5ca3221b6b1f07791c68
|
data/lib/message.rb
CHANGED
@@ -34,10 +34,10 @@ class HL7::Message
|
|
34
34
|
extend HL7::MessageBatchParser
|
35
35
|
|
36
36
|
attr_reader :message_parser
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
attr_reader :element_delim
|
38
|
+
attr_reader :item_delim
|
39
|
+
attr_reader :segment_delim
|
40
|
+
attr_reader :delimiter
|
41
41
|
|
42
42
|
# setup a new hl7 message
|
43
43
|
# raw_msg:: is an optional object containing an hl7 message
|
@@ -78,12 +78,12 @@ class HL7::Message
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# access a segment of the message
|
81
|
-
# index:: can be a Range,
|
81
|
+
# index:: can be a Range, Integer or anything that
|
82
82
|
# responds to to_sym
|
83
83
|
def []( index )
|
84
84
|
ret = nil
|
85
85
|
|
86
|
-
if index.kind_of?(Range) || index.kind_of?(
|
86
|
+
if index.kind_of?(Range) || index.kind_of?(Integer)
|
87
87
|
ret = @segments[ index ]
|
88
88
|
elsif (index.respond_to? :to_sym)
|
89
89
|
ret = @segments_by_name[ index.to_sym ]
|
@@ -94,7 +94,7 @@ class HL7::Message
|
|
94
94
|
end
|
95
95
|
|
96
96
|
# modify a segment of the message
|
97
|
-
# index:: can be a Range,
|
97
|
+
# index:: can be a Range, Integer or anything that
|
98
98
|
# responds to to_sym
|
99
99
|
# value:: an HL7::Message::Segment object
|
100
100
|
def []=( index, value )
|
@@ -102,12 +102,12 @@ class HL7::Message
|
|
102
102
|
raise HL7::Exception.new( "attempting to assign something other than an HL7 Segment" )
|
103
103
|
end
|
104
104
|
|
105
|
-
if index.kind_of?(Range) || index.kind_of?(
|
105
|
+
if index.kind_of?(Range) || index.kind_of?(Integer)
|
106
106
|
@segments[ index ] = value
|
107
107
|
elsif index.respond_to?(:to_sym)
|
108
108
|
(@segments_by_name[ index.to_sym ] ||= []) << value
|
109
109
|
else
|
110
|
-
raise HL7::Exception.new( "attempting to use an indice that is not a Range,
|
110
|
+
raise HL7::Exception.new( "attempting to use an indice that is not a Range, Integer or to_sym providing object" )
|
111
111
|
end
|
112
112
|
|
113
113
|
value.segment_parent = self
|
@@ -146,7 +146,7 @@ class HL7::Message
|
|
146
146
|
(@segments ||= []) << value
|
147
147
|
name = value.class.to_s.gsub("HL7::Message::Segment::", "").to_sym
|
148
148
|
(@segments_by_name[ name ] ||= []) << value
|
149
|
-
sequence_segments unless @parsing # let's auto-set the set-id as we go
|
149
|
+
sequence_segments unless defined?(@parsing) && @parsing # let's auto-set the set-id as we go
|
150
150
|
end
|
151
151
|
|
152
152
|
# yield each segment in the message
|
@@ -270,7 +270,7 @@ class HL7::Message
|
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
|
-
|
273
|
+
def get_symbol_from_name(seg_name)
|
274
274
|
seg_name.to_s.strip.length > 0 ? seg_name.to_sym : nil
|
275
275
|
end
|
276
276
|
|
data/lib/ruby-hl7.rb
CHANGED
data/lib/segment.rb
CHANGED
@@ -21,10 +21,10 @@ class HL7::Message::Segment
|
|
21
21
|
extend HL7::Message::SegmentListStorage
|
22
22
|
include HL7::Message::SegmentFields
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
attr_accessor :segment_parent
|
25
|
+
attr_reader :element_delim
|
26
|
+
attr_reader :item_delim
|
27
|
+
attr_reader :segment_weight
|
28
28
|
|
29
29
|
METHOD_MISSING_FOR_INITIALIZER = <<-END
|
30
30
|
def method_missing( sym, *args, &blk )
|
data/lib/segment_fields.rb
CHANGED
@@ -78,8 +78,8 @@ module HL7::Message::SegmentFields
|
|
78
78
|
|
79
79
|
def field_info( name ) #:nodoc:
|
80
80
|
field_blk = nil
|
81
|
-
idx = name # assume we've gotten a
|
82
|
-
unless name.kind_of?(
|
81
|
+
idx = name # assume we've gotten a integer
|
82
|
+
unless name.kind_of?(Integer)
|
83
83
|
fld_info = self.class.fields[ name ]
|
84
84
|
idx = fld_info[:idx].to_i
|
85
85
|
field_blk = fld_info[:blk]
|
@@ -88,6 +88,14 @@ module HL7::Message::SegmentFields
|
|
88
88
|
[ idx, field_blk ]
|
89
89
|
end
|
90
90
|
|
91
|
+
def []( index )
|
92
|
+
@elements[index]
|
93
|
+
end
|
94
|
+
|
95
|
+
def []=( index, value )
|
96
|
+
@elements[index] = value.to_s
|
97
|
+
end
|
98
|
+
|
91
99
|
def read_field( name ) #:nodoc:
|
92
100
|
idx, field_blk = field_info( name )
|
93
101
|
return nil unless idx
|
data/lib/segment_list_storage.rb
CHANGED
@@ -5,7 +5,7 @@ module HL7::Message::SegmentListStorage
|
|
5
5
|
attr_reader :child_types
|
6
6
|
|
7
7
|
def add_child_type(child_type)
|
8
|
-
if @child_types
|
8
|
+
if defined?(@child_types)
|
9
9
|
@child_types << child_type.to_sym
|
10
10
|
else
|
11
11
|
has_children [ child_type.to_sym ]
|
@@ -41,7 +41,7 @@ module HL7::Message::SegmentListStorage
|
|
41
41
|
def define_method_children
|
42
42
|
self.class_eval do
|
43
43
|
define_method(:children) do
|
44
|
-
unless @my_children
|
44
|
+
unless defined?(@my_children)
|
45
45
|
p = self
|
46
46
|
@my_children ||= []
|
47
47
|
@my_children.instance_eval do
|
@@ -76,4 +76,4 @@ module HL7::Message::SegmentListStorage
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
data/lib/segments/dg1.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module HL7
|
2
|
+
class Message::Segment::DG1 < HL7::Message::Segment
|
3
|
+
weight 92
|
4
|
+
add_field :set_id
|
5
|
+
add_field :diagnosis_coding_method
|
6
|
+
add_field :diagnosis_code
|
7
|
+
add_field :diagnosis_description
|
8
|
+
add_field :diagnosis_date_time do |value|
|
9
|
+
convert_to_ts(value)
|
10
|
+
end
|
11
|
+
add_field :diagnosis_type
|
12
|
+
add_field :major_diagnostic_category
|
13
|
+
add_field :diagnosis_related_group
|
14
|
+
add_field :drg_approval_indicator
|
15
|
+
add_field :drg_grouper_review_code
|
16
|
+
add_field :outlier_type
|
17
|
+
add_field :outlier_days
|
18
|
+
add_field :outlier_cost
|
19
|
+
add_field :grouper_version_and_type
|
20
|
+
add_field :diagnosis_priority
|
21
|
+
add_field :diagnosis_clinician
|
22
|
+
add_field :diagnosis_classification
|
23
|
+
add_field :confidential_indicator
|
24
|
+
add_field :attestation_date_time do |value|
|
25
|
+
convert_to_ts(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def self.convert_to_ts(value) #:nodoc:
|
31
|
+
if value.is_a?(Time) || value.is_a?(Date)
|
32
|
+
value.to_hl7
|
33
|
+
else
|
34
|
+
value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/segments/evn.rb
CHANGED
data/lib/segments/fts.rb
ADDED
data/lib/segments/in1.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# via https://github.com/bbhoss/ruby-hl7/blob/master/lib/segments/in1.rb
|
3
|
-
require 'ruby-hl7'
|
4
3
|
class HL7::Message::Segment::IN1 < HL7::Message::Segment
|
5
4
|
add_field :set_id
|
6
5
|
add_field :insurance_plan_id
|
@@ -51,4 +50,4 @@ class HL7::Message::Segment::IN1 < HL7::Message::Segment
|
|
51
50
|
add_field :coverage_type
|
52
51
|
add_field :handicap
|
53
52
|
add_field :insureds_id_number
|
54
|
-
end
|
53
|
+
end
|
data/lib/segments/msa.rb
CHANGED
data/lib/segments/msh.rb
CHANGED
data/lib/segments/nk1.rb
CHANGED
data/lib/segments/nte.rb
CHANGED
data/lib/segments/obr.rb
CHANGED
data/lib/segments/obx.rb
CHANGED
data/lib/segments/orc.rb
CHANGED
data/lib/segments/oru.rb
CHANGED
data/lib/segments/pid.rb
CHANGED
data/lib/segments/prd.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'ruby-hl7'
|
3
2
|
class HL7::Message::Segment::PRD < HL7::Message::Segment
|
4
3
|
weight 2
|
5
4
|
add_field :provider_role
|
@@ -15,4 +14,4 @@ class HL7::Message::Segment::PRD < HL7::Message::Segment
|
|
15
14
|
add_field :effective_end_date_of_provider_role do |value|
|
16
15
|
convert_to_ts(value)
|
17
16
|
end
|
18
|
-
end
|
17
|
+
end
|
data/lib/segments/pv1.rb
CHANGED
data/lib/segments/pv2.rb
CHANGED
data/lib/segments/qrd.rb
CHANGED
data/lib/segments/qrf.rb
CHANGED
data/lib/segments/rf1.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
-
require 'ruby-hl7'
|
3
2
|
class HL7::Message::Segment::RF1 < HL7::Message::Segment
|
4
3
|
weight 0 # should occur after the MSH segment
|
5
4
|
add_field :referral_status
|
@@ -19,4 +18,4 @@ class HL7::Message::Segment::RF1 < HL7::Message::Segment
|
|
19
18
|
end
|
20
19
|
add_field :referral_reason
|
21
20
|
add_field :external_referral_identifier
|
22
|
-
end
|
21
|
+
end
|
data/lib/segments/zcf.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'ruby-hl7'
|
2
1
|
class HL7::Message::Segment::ZCF < HL7::Message::Segment
|
3
2
|
add_field :custom_field_1
|
4
3
|
add_field :custom_field_2
|
@@ -20,4 +19,4 @@ class HL7::Message::Segment::ZCF < HL7::Message::Segment
|
|
20
19
|
add_field :custom_field_18
|
21
20
|
add_field :custom_field_19
|
22
21
|
add_field :custom_field_20
|
23
|
-
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-hl7
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Guzman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '11.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '11.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyforge
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,8 +58,10 @@ files:
|
|
58
58
|
- lib/segment_fields.rb
|
59
59
|
- lib/segment_generator.rb
|
60
60
|
- lib/segment_list_storage.rb
|
61
|
+
- lib/segments/dg1.rb
|
61
62
|
- lib/segments/err.rb
|
62
63
|
- lib/segments/evn.rb
|
64
|
+
- lib/segments/fts.rb
|
63
65
|
- lib/segments/in1.rb
|
64
66
|
- lib/segments/mfe.rb
|
65
67
|
- lib/segments/mfi.rb
|