Class: XDS::CodedAttribute

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/xds/coded_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#create_classification, #create_external_identifier, #create_extrinsic_object, #create_localized_string, #create_name, #create_slot, #get_external_identifier_value, #get_slot_value, #get_slot_values, #with_classification

Constructor Details

#initialize(attribute_type, code = nil, display_name = nil, coding_scheme = nil) ⇒ CodedAttribute

Returns a new instance of CodedAttribute.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/xds/coded_attribute.rb', line 6

def initialize(attribute_type, code = nil, display_name = nil, coding_scheme = nil)
  case attribute_type
  when :class_code
    @classification_scheme = 'urn:uuid:41a5887f-8865-4c09-adf7-e362475b143a'
  when :confidentiality_code
    @classification_scheme = 'urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840f'
  when :format_code
    @classification_scheme = 'urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d'
  when :healthcare_facility_type_code
    @classification_scheme = 'urn:uuid:f33fb8ac-18af-42cc-ae0e-ed0b0bdb91e1'
  when :practice_setting_code
    @classification_scheme = 'urn:uuid:cccf5598-8b07-4b77-a05e-ae952c785ead'
  when :type_code
    @classification_scheme = 'urn:uuid:f0306f51-975f-434e-a61c-c59651d33983'
  end
  @code = code
  @display_name = display_name
  @coding_scheme=coding_scheme
end

Instance Attribute Details

#classification_schemeObject (readonly)

Returns the value of attribute classification_scheme.



4
5
6
# File 'lib/xds/coded_attribute.rb', line 4

def classification_scheme
  @classification_scheme
end

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/xds/coded_attribute.rb', line 4

def code
  @code
end

#coding_schemeObject (readonly)

Returns the value of attribute coding_scheme.



4
5
6
# File 'lib/xds/coded_attribute.rb', line 4

def coding_scheme
  @coding_scheme
end

#display_nameObject (readonly)

Returns the value of attribute display_name.



4
5
6
# File 'lib/xds/coded_attribute.rb', line 4

def display_name
  @display_name
end

Instance Method Details

#from_extrinsic_object(eo_node) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/xds/coded_attribute.rb', line 33

def from_extrinsic_object(eo_node)
  with_classification(eo_node, @classification_scheme) do |classification|
    @code = classification.attributes['nodeRepresentation']
    localized_string_node = REXML::XPath.first(classification, 'rim:Name/rim:LocalizedString')
    if localized_string_node
      @display_name = localized_string_node.attributes['value']
    end
    @coding_scheme = get_slot_value(classification, 'codingScheme')
  end
end

#to_soap(builder, object_id) ⇒ Object



26
27
28
29
30
31
# File 'lib/xds/coded_attribute.rb', line 26

def to_soap(builder, object_id)      
  create_classification(builder,@classification_scheme,object_id,@code) do |build|
    create_slot(build,"codingScheme",@coding_scheme || [])
    create_name(build,@display_name)        
  end
end