source: ruby/trunk/lib/models/rm/data_types/time_specification.rb@ 152

Last change on this file since 152 was 152, checked in by KOBAYASHI, Shinji, 15 years ago

refs #47

we must clarify HL7 specification

File size: 2.1 KB
RevLine 
[152]1# This module is related to the ticket #47
2
[4]3module OpenEHR
4 module RM
5 module Data_Types
6 module Time_Specification
7 class DV_Time_Specification < OpenEHR::RM::Data_Types::Basic::Data_Value
[152]8 attr_reader :value
9
[4]10 def initialize(value)
[152]11 self.value=(value)
12 end
13
14 def value=(value)
15 raise ArgumentError, 'value must be not nil' if value.nil?
[4]16 @value = value
17 end
[152]18
[4]19 def calender_alignment
20 raise NotImlementedError, "calender_alignment must be implemented"
21 end
[152]22
[4]23 def event_alignment
24 raise NotImlementedError, "event_alignment must be implemented"
25 end
[152]26
[4]27 def institution_specified
28 raise NotImlementedError, "institution_specified must be implemented"
29 end
30 end
[152]31
32
[4]33 class DV_General_Time_Specification < DV_Time_Specification
34 attr_reader :value
35 def initialize(value)
36 super(value)
37 end
38 def value=(value)
[152]39 raise ArgumentError, "value is not valied" unless value.formalism.is_equal?('HL7:GTS')
[4]40 @value = value
41 end
42 private
43 def value_valid(value)
44 end
45 end
[5]46
47 class DV_Periodic_Time_Specification < DV_Time_Specification
[152]48 attr_reader :value, :calender_alignment, :event_alingment, :period
[5]49 def initialize(value)
50 value_valid(value)
51 super(value)
52 end
[152]53 def value=(value)
54 unless value.formalism.is_equal('HL7:PIVL') or value.formalism.is_equal('HL7:EIVL')
55 raise ArgumentError, "value is not valid"
56 end
57 /^\[(\d+)\;?(\d+)?\]\/\((\d+\w+)\)(@(\w+?))?(IST)?$/ =~ value
58 interval1, interval2, difference, allignment = $1, $2, $3, $5
59# not implemented because of unknown HL7 specification
60
61 end
62
[5]63 def calender_alignment
[152]64
[5]65 end
[152]66
[5]67 def event_alignment
[152]68
[5]69 end
[152]70
[5]71 def institution_specified?
[152]72
[5]73 end
74 def period
75 end
76 end
[4]77 end
78 end # of Data_Type
79 end # of RM
80end # of OpenEHR
Note: See TracBrowser for help on using the repository browser.