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 | module OpenEHR
|
---|
5 | module RM
|
---|
6 | module Data_Types
|
---|
7 | module Quantity
|
---|
8 | class DV_Ordered < OpenEHR::RM::Data_Types::Basic::Data_Value
|
---|
9 | include Comparable
|
---|
10 | attr_reader :other_refference_ranges, :normal_range, :normal_status
|
---|
11 |
|
---|
12 | def initialize(normal_range=nil, other_reference_ranges=nil,
|
---|
13 | normal_status = nil)
|
---|
14 | self.normal_range = normal_range
|
---|
15 | self.other_reference_ranges = other_reference_ranges
|
---|
16 | self.normal_status = normal_status
|
---|
17 | end
|
---|
18 |
|
---|
19 | def is_normal?
|
---|
20 | !normal_range.nil? or !normal_status.nil?
|
---|
21 | end
|
---|
22 |
|
---|
23 | def is_simple?
|
---|
24 | normal_status.nil? and other_refference_ranges.nil?
|
---|
25 | end
|
---|
26 |
|
---|
27 | def <=>(other)
|
---|
28 | raise NotImplementError, 'This method should be implemented'
|
---|
29 | end
|
---|
30 |
|
---|
31 | def normal_range=(normal_range)
|
---|
32 | @normal_range = normal_range
|
---|
33 | end
|
---|
34 |
|
---|
35 | def other_reference_ranges=(other_reference_ranges)
|
---|
36 | unless other_reference_ranges.nil? or !other_reference_ranges.is_empty?
|
---|
37 | raise ArgumentError, "Other reference ranges validity error"
|
---|
38 | end
|
---|
39 |
|
---|
40 | @other_reference_ranges = other_reference_ranges
|
---|
41 | end
|
---|
42 |
|
---|
43 | def normal_status=(normal_status)
|
---|
44 | @normal_status = normal_status
|
---|
45 | end
|
---|
46 |
|
---|
47 | end
|
---|
48 |
|
---|
49 | class DV_Quantified < DV_Ordered
|
---|
50 | def magnitude
|
---|
51 | end
|
---|
52 | def valid_magnitude_status(s)
|
---|
53 | end
|
---|
54 | end
|
---|
55 |
|
---|
56 | class DV_Ordinal < DV_Ordered
|
---|
57 | attr_reader :symbol, :value
|
---|
58 | def is_strictly_comparable_to?
|
---|
59 | end
|
---|
60 | def limits
|
---|
61 | end
|
---|
62 | end
|
---|
63 |
|
---|
64 | class DV_Absolute_Quantity < DV_Quantified
|
---|
65 | attr_reader :accuracy
|
---|
66 |
|
---|
67 | def add(a_diff)
|
---|
68 | raise NotImplementError, 'add must be implemented'
|
---|
69 | end
|
---|
70 |
|
---|
71 | def diff(other)
|
---|
72 | raise NotImplementError, 'diff must be implemented'
|
---|
73 | end
|
---|
74 |
|
---|
75 | def subtract(a_diff)
|
---|
76 | raise NotImplementError, 'subtract must be implemented'
|
---|
77 | end
|
---|
78 | end
|
---|
79 |
|
---|
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 |
|
---|
90 | autoload :Date_Time, "rm/data_types/quantity/date_time.rb"
|
---|
91 |
|
---|
92 | end # of Quantity
|
---|
93 | end # of Data_Types
|
---|
94 | end # of RM
|
---|
95 | end # of OpenEHR
|
---|