[88] | 1 | # This modules are implemented from the UML shown bellow
|
---|
| 2 | # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109599337877_94556_1510Report.html
|
---|
| 3 | # Ticket refs #50
|
---|
[4] | 4 | module OpenEHR
|
---|
| 5 | module RM
|
---|
| 6 | module Data_Types
|
---|
| 7 | module Quantity
|
---|
[104] | 8 | class DV_Ordered < OpenEHR::RM::Data_Types::Basic::Data_Value
|
---|
[4] | 9 | include Comparable
|
---|
[122] | 10 | attr_reader :other_refference_ranges, :normal_range, :normal_status
|
---|
| 11 |
|
---|
| 12 | def initialize(normal_range=nil, other_reference_ranges=nil,
|
---|
[4] | 13 | normal_status = nil)
|
---|
[123] | 14 | self.normal_range = normal_range
|
---|
| 15 | self.other_reference_ranges = other_reference_ranges
|
---|
| 16 | self.normal_status = normal_status
|
---|
[4] | 17 | end
|
---|
[122] | 18 |
|
---|
[4] | 19 | def is_normal?
|
---|
[123] | 20 | !normal_range.nil? or !normal_status.nil?
|
---|
[4] | 21 | end
|
---|
[122] | 22 |
|
---|
[4] | 23 | def is_simple?
|
---|
[88] | 24 | normal_status.nil? and other_refference_ranges.nil?
|
---|
[4] | 25 | end
|
---|
[122] | 26 |
|
---|
| 27 | def <=>(other)
|
---|
| 28 | raise NotImplementError, 'This method should be implemented'
|
---|
| 29 | end
|
---|
| 30 |
|
---|
| 31 | def normal_range=(normal_range)
|
---|
[123] | 32 | @normal_range = normal_range
|
---|
[122] | 33 | end
|
---|
| 34 |
|
---|
| 35 | def other_reference_ranges=(other_reference_ranges)
|
---|
[123] | 36 | unless other_reference_ranges.nil? or !other_reference_ranges.is_empty?
|
---|
[4] | 37 | raise ArgumentError, "Other reference ranges validity error"
|
---|
| 38 | end
|
---|
[123] | 39 |
|
---|
| 40 | @other_reference_ranges = other_reference_ranges
|
---|
[4] | 41 | end
|
---|
[123] | 42 |
|
---|
| 43 | def normal_status=(normal_status)
|
---|
| 44 | @normal_status = normal_status
|
---|
| 45 | end
|
---|
| 46 |
|
---|
[4] | 47 | end
|
---|
[88] | 48 |
|
---|
[104] | 49 | class DV_Quantified < DV_Ordered
|
---|
[4] | 50 | def magnitude
|
---|
| 51 | end
|
---|
| 52 | def valid_magnitude_status(s)
|
---|
| 53 | end
|
---|
| 54 | end
|
---|
[88] | 55 |
|
---|
[104] | 56 | class DV_Ordinal < DV_Ordered
|
---|
[88] | 57 | attr_reader :symbol, :value
|
---|
| 58 | def is_strictly_comparable_to?
|
---|
| 59 | end
|
---|
| 60 | def limits
|
---|
| 61 | end
|
---|
| 62 | end
|
---|
| 63 |
|
---|
[104] | 64 | class DV_Absolute_Quantity < DV_Quantified
|
---|
[88] | 65 | attr_reader :accuracy
|
---|
| 66 |
|
---|
| 67 | def add(a_diff)
|
---|
[122] | 68 | raise NotImplementError, 'add must be implemented'
|
---|
[88] | 69 | end
|
---|
| 70 |
|
---|
| 71 | def diff(other)
|
---|
[122] | 72 | raise NotImplementError, 'diff must be implemented'
|
---|
[88] | 73 | end
|
---|
| 74 |
|
---|
| 75 | def subtract(a_diff)
|
---|
[122] | 76 | raise NotImplementError, 'subtract must be implemented'
|
---|
[88] | 77 | end
|
---|
| 78 | end
|
---|
[120] | 79 |
|
---|
[122] | 80 | class DV_Amount < DV_Quantified
|
---|
| 81 | attr_reader :accuracy, :accuracy_is_percent
|
---|
| 82 | def infix(dv_amount, op)
|
---|
| 83 | raise NotImplementError, 'infix must be implemented'
|
---|
| 84 | end
|
---|
| 85 | def accuracy=(accuracy)
|
---|
| 86 | raise ArgumentError, 'accuracy invalid'
|
---|
| 87 | end
|
---|
| 88 | end
|
---|
| 89 |
|
---|
[120] | 90 | autoload :Date_Time, "rm/data_types/quantity/date_time.rb"
|
---|
| 91 |
|
---|
[4] | 92 | end # of Quantity
|
---|
| 93 | end # of Data_Types
|
---|
| 94 | end # of RM
|
---|
| 95 | end # of OpenEHR
|
---|