Class: OpenEHR::RM::Support::Identification::ArchetypeID

Inherits:
ObjectID
  • Object
show all
Defined in:
lib/openehr/rm/support/identification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ObjectID

#==

Constructor Details

#initialize(args = {}) ⇒ ArchetypeID

Returns a new instance of ArchetypeID.



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/openehr/rm/support/identification.rb', line 57

def initialize(args = {})
  if args[:value].nil?
    self.rm_originator = args[:rm_originator]
    self.rm_name = args[:rm_name]
    self.rm_entity = args[:rm_entity]
    self.concept_name = args[:concept_name]
    self.version_id = args[:version_id]
    self.specialisation = args[:specialisation]
  else
    super(args)
  end
end

Instance Attribute Details

#concept_nameObject

Returns the value of attribute concept_name.



54
55
56
# File 'lib/openehr/rm/support/identification.rb', line 54

def concept_name
  @concept_name
end

#rm_entityObject

Returns the value of attribute rm_entity.



54
55
56
# File 'lib/openehr/rm/support/identification.rb', line 54

def rm_entity
  @rm_entity
end

#rm_nameObject

Returns the value of attribute rm_name.



54
55
56
# File 'lib/openehr/rm/support/identification.rb', line 54

def rm_name
  @rm_name
end

#rm_originatorObject

Returns the value of attribute rm_originator.



54
55
56
# File 'lib/openehr/rm/support/identification.rb', line 54

def rm_originator
  @rm_originator
end

#specialisationObject

Returns the value of attribute specialisation.



54
55
56
# File 'lib/openehr/rm/support/identification.rb', line 54

def specialisation
  @specialisation
end

#version_idObject

Returns the value of attribute version_id.



54
55
56
# File 'lib/openehr/rm/support/identification.rb', line 54

def version_id
  @version_id
end

Instance Method Details

#domain_conceptObject



87
88
89
90
91
92
93
# File 'lib/openehr/rm/support/identification.rb', line 87

def domain_concept
  if @specialisation.nil?
    return @concept_name
  else
    return @concept_name + '-' + @specialisation
  end
end

#domain_concept=(domain_concept) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/openehr/rm/support/identification.rb', line 107

def domain_concept=(domain_concept)
  if domain_concept.nil? or domain_concept.empty?
    raise ArgumentError, "domain concept not valid"
  end
  if /([a-zA-Z]\w+)(-([a-zA-Z]\w))?/ =~ domain_concept
    self.concept_name = $1
    self.specialisation = $3
  else
    raise ArgumentError, 'invalid domain concept form'
  end
end

#qualified_rm_entityObject



83
84
85
# File 'lib/openehr/rm/support/identification.rb', line 83

def qualified_rm_entity
  return @rm_originator + '-' + @rm_name + '-' + @rm_entity
end

#valueObject



95
96
97
98
# File 'lib/openehr/rm/support/identification.rb', line 95

def value
  return self.qualified_rm_entity + '.' +
    self.domain_concept + '.' + @version_id
end

#value=(value) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/openehr/rm/support/identification.rb', line 70

def value=(value)
  if /([a-zA-Z]\w+)-([a-zA-Z]\w+)-([a-zA-Z]\w+)\.([a-zA-Z]\w+)(-([a-zA-Z]\w+))?\.(v[1-9]\d*)/ =~ value
    self.rm_originator = $1
    self.rm_name = $2
    self.rm_entity = $3
    self.concept_name = $4
    self.specialisation = $6
    self.version_id = $7
  else
    raise ArgumentError, 'invalid archetype id form'
  end
end