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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3f68acdaf125738bd9d594e05165507e4b80a58
4
- data.tar.gz: a21baf96ce948bb1157db16a27fe19a3f38ed058
3
+ metadata.gz: 005071a850becbb69bd856337698d824eb7514a7
4
+ data.tar.gz: fe3b1cd645846d3eae704f2738ea9e4372d06877
5
5
  SHA512:
6
- metadata.gz: 212b413382550143b6bd88db4c2613feb5e4fd77da4df4f30c5681667f0229506b07e15d2b37ca54481db74da5a90dab89b70087b9e3de62e688a2b95968c901
7
- data.tar.gz: 6219350799dc68714d10f869dca2f1365fd8b746d97a5c42b0562a0355e15f39b666fb294118eda691118ff359587da71bf2dfbba36e74202598d82cc13c4280
6
+ metadata.gz: 8dbc973a6f883acd2f59c626276ccae85934cf8a614fcd8a974c888191ad3ab9888ff8f0cdd8b6c2db91d99a7c167abe4661c71188afc3bbc745c6b2355ddffb
7
+ data.tar.gz: 71769e021da5a7f72f5eec461e340830d3573b26fbba1ee91fea1e89269c69cb0b07bfe11be09cb04ee300785cda671d784eede5eefd5ca3221b6b1f07791c68
@@ -34,10 +34,10 @@ class HL7::Message
34
34
  extend HL7::MessageBatchParser
35
35
 
36
36
  attr_reader :message_parser
37
- attr :element_delim
38
- attr :item_delim
39
- attr :segment_delim
40
- attr :delimiter
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, Fixnum or anything that
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?(Fixnum)
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, Fixnum or anything that
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?(Fixnum)
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, Fixnum or to_sym providing object" )
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
- def get_symbol_from_name(seg_name)
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
 
@@ -21,7 +21,7 @@ require 'stringio'
21
21
  require 'date'
22
22
 
23
23
  module HL7 # :nodoc:
24
- VERSION = '1.2.0'
24
+ VERSION = '1.2.1'
25
25
  def self.ParserConfig
26
26
  @parser_cfg ||= { :empty_segment_is_error => true }
27
27
  end
@@ -21,10 +21,10 @@ class HL7::Message::Segment
21
21
  extend HL7::Message::SegmentListStorage
22
22
  include HL7::Message::SegmentFields
23
23
 
24
- attr :segment_parent, true
25
- attr :element_delim
26
- attr :item_delim
27
- attr :segment_weight
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 )
@@ -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 fixnum
82
- unless name.kind_of?( Fixnum )
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
@@ -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
@@ -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
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::EVN < HL7::Message::Segment
4
3
  weight 0 # should occur after the MSH segment
5
4
  add_field :type_code
@@ -0,0 +1,5 @@
1
+ class HL7::Message::Segment::FTS < HL7::Message::Segment
2
+ weight 1001 # at the end
3
+ add_field :file_batch_count
4
+ add_field :file_trailer_comment
5
+ end
@@ -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
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::MSA < HL7::Message::Segment
4
3
  weight 1 # should occur after the msh segment
5
4
  add_field :ack_code
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::MSH < HL7::Message::Segment
4
3
  weight( -1 ) # the msh should always start a message
5
4
  add_field :enc_chars
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::NK1 < HL7::Message::Segment
4
3
  add_field :set_id
5
4
  add_field :name
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::NTE < HL7::Message::Segment
4
3
  weight 4
5
4
  add_field :set_id, :idx=>1
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::OBR < HL7::Message::Segment
4
3
  weight 89 # obx.weight-1
5
4
  has_children [:NTE,:OBX,:SPM]
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::OBX < HL7::Message::Segment
4
3
  weight 90
5
4
  has_children [:NTE]
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::ORC < HL7::Message::Segment
4
3
  weight 88 # obr.weight-1
5
4
  has_children [:OBR]
@@ -1,4 +1,3 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::ORU < HL7::Message::Segment
4
3
  end
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::PID < HL7::Message::Segment
4
3
  weight 1
5
4
  has_children [:NK1,:NTE,:PV1,:PV2]
@@ -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
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::PV1 < HL7::Message::Segment
4
3
  weight 2
5
4
  add_field :set_id
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::PV2 < HL7::Message::Segment
4
3
  weight 3
5
4
  add_field :prior_pending_location
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::QRD < HL7::Message::Segment
4
3
  weight 84
5
4
  add_field :query_date
@@ -1,5 +1,4 @@
1
1
  # encoding: UTF-8
2
- require 'ruby-hl7'
3
2
  class HL7::Message::Segment::QRF < HL7::Message::Segment
4
3
  weight 85
5
4
  add_field :where_subject_filter
@@ -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
@@ -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.0
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: 2016-07-26 00:00:00.000000000 Z
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: 10.5.0
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: 10.5.0
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