Class: OpenEHR::RM::DataTypes::Quantity::DvOrdered

Inherits:
Basic::DataValue show all
Includes:
Comparable
Defined in:
lib/open_ehr/rm/data_types/quantity.rb

Direct Known Subclasses

DvOrdinal, DvQuantified

Constant Summary

Constants included from Support::Definition::BasicDefinition

Support::Definition::BasicDefinition::CR, Support::Definition::BasicDefinition::LF

Instance Attribute Summary collapse

Attributes inherited from Basic::DataValue

#value

Instance Method Summary collapse

Methods inherited from Basic::DataValue

#==

Constructor Details

#initialize(args = {}) ⇒ DvOrdered

Returns a new instance of DvOrdered.



18
19
20
21
22
23
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 18

def initialize(args = {})
  super(args)
  self.normal_range = args[:normal_range]
  self.normal_status = args[:normal_status]
  self.other_reference_ranges = args[:other_reference_ranges]
end

Instance Attribute Details

#normal_rangeObject

Returns the value of attribute normal_range.



16
17
18
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 16

def normal_range
  @normal_range
end

#normal_statusObject

Returns the value of attribute normal_status.



16
17
18
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 16

def normal_status
  @normal_status
end

#other_refference_rangesObject

Returns the value of attribute other_refference_ranges.



16
17
18
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 16

def other_refference_ranges
  @other_refference_ranges
end

Instance Method Details

#<=>(other) ⇒ Object

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 39

def <=>(other)
  raise NotImplementedError, 'This method should be implemented'
end

#is_normal?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 25

def is_normal?
  if @normal_range.nil? and @normal_status.nil?
    return false
  elsif !@normal_range.nil?
    return @normal_range.has(@value)
  elsif !@normal_status.nil?
    return @normal_status.code_string == 'N'
  end
end

#is_simple?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 35

def is_simple?
  return @other_reference_ranges.nil?
end

#is_strictly_comparable_to?(others) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
53
54
55
56
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 50

def is_strictly_comparable_to?(others)
  if others.instance_of? self.class
    return true
  else
    return false
  end
end

#other_reference_ranges=(other_reference_ranges) ⇒ Object



43
44
45
46
47
48
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 43

def other_reference_ranges=(other_reference_ranges)
  if !other_reference_ranges.nil? && other_reference_ranges.empty?
    raise ArgumentError, "Other reference ranges validity error"
  end
  @other_reference_ranges = other_reference_ranges
end