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

Inherits:
ObjectID
  • Object
show all
Defined in:
lib/open_ehr/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.



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

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.



55
56
57
# File 'lib/open_ehr/rm/support/identification.rb', line 55

def concept_name
  @concept_name
end

#rm_entityObject

Returns the value of attribute rm_entity.



55
56
57
# File 'lib/open_ehr/rm/support/identification.rb', line 55

def rm_entity
  @rm_entity
end

#rm_nameObject

Returns the value of attribute rm_name.



55
56
57
# File 'lib/open_ehr/rm/support/identification.rb', line 55

def rm_name
  @rm_name
end

#rm_originatorObject

Returns the value of attribute rm_originator.



55
56
57
# File 'lib/open_ehr/rm/support/identification.rb', line 55

def rm_originator
  @rm_originator
end

#specialisationObject

Returns the value of attribute specialisation.



55
56
57
# File 'lib/open_ehr/rm/support/identification.rb', line 55

def specialisation
  @specialisation
end

#version_idObject

Returns the value of attribute version_id.



55
56
57
# File 'lib/open_ehr/rm/support/identification.rb', line 55

def version_id
  @version_id
end

Instance Method Details

#domain_conceptObject



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

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

#domain_concept=(domain_concept) ⇒ Object



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

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



84
85
86
# File 'lib/open_ehr/rm/support/identification.rb', line 84

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

#valueObject



96
97
98
99
# File 'lib/open_ehr/rm/support/identification.rb', line 96

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

#value=(value) ⇒ Object



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

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