Class: HQMF2::Coded

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/hqmf-parser/2.0/types.rb

Overview

Represents a HQMF CD value which has a code and codeSystem

Instance Method Summary collapse

Methods included from Utilities

#attr_val, attr_val, #to_xml

Methods included from HQMF::Conversion::Utilities

#build_hash, #check_equality, #json_array, #openstruct_to_json

Constructor Details

#initialize(entry) ⇒ Coded

Returns a new instance of Coded.



134
135
136
# File 'lib/hqmf-parser/2.0/types.rb', line 134

def initialize(entry)
  @entry = entry
end

Instance Method Details

#codeObject



146
147
148
# File 'lib/hqmf-parser/2.0/types.rb', line 146

def code
  attr_val('./@code')
end

#code_list_idObject



150
151
152
# File 'lib/hqmf-parser/2.0/types.rb', line 150

def code_list_id
  attr_val('./@valueSet')
end

#derived?Boolean

Returns:

  • (Boolean)


162
163
164
# File 'lib/hqmf-parser/2.0/types.rb', line 162

def derived?
  false
end

#systemObject



142
143
144
# File 'lib/hqmf-parser/2.0/types.rb', line 142

def system
  attr_val('./@codeSystem')
end

#titleObject



154
155
156
# File 'lib/hqmf-parser/2.0/types.rb', line 154

def title
  attr_val('./*/@value')
end

#to_modelObject



170
171
172
# File 'lib/hqmf-parser/2.0/types.rb', line 170

def to_model
  HQMF::Coded.new(type, system, code, code_list_id, title)
end

#typeObject



138
139
140
# File 'lib/hqmf-parser/2.0/types.rb', line 138

def type
  attr_val('./@xsi:type') || 'CD'
end

#unitObject



166
167
168
# File 'lib/hqmf-parser/2.0/types.rb', line 166

def unit
  nil
end

#valueObject



158
159
160
# File 'lib/hqmf-parser/2.0/types.rb', line 158

def value
  code
end