Ignore:
Timestamp:
Jul 2, 2009, 7:10:46 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

refs #47

we must clarify HL7 specification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/models/rm/data_types/time_specification.rb

    r5 r152  
     1# This module is related to the ticket #47
     2
    13module OpenEHR
    24  module RM
     
    46      module Time_Specification
    57        class DV_Time_Specification < OpenEHR::RM::Data_Types::Basic::Data_Value
     8          attr_reader :value
     9
    610          def initialize(value)
     11            self.value=(value)
     12          end
     13
     14          def value=(value)
     15            raise ArgumentError, 'value must be not nil' if value.nil?
    716            @value = value
    817          end
     18         
    919          def calender_alignment
    1020            raise NotImlementedError, "calender_alignment must be implemented"
    1121          end
     22
    1223          def event_alignment
    1324            raise NotImlementedError, "event_alignment must be implemented"
    1425          end
     26
    1527          def institution_specified
    1628            raise NotImlementedError, "institution_specified must be implemented"
    1729          end
    1830        end
    19        
     31
     32
    2033        class DV_General_Time_Specification < DV_Time_Specification
    2134          attr_reader :value
     35          def initialize(value)
     36            super(value)
     37          end
     38          def value=(value)
     39            raise ArgumentError, "value is not valied" unless value.formalism.is_equal?('HL7:GTS')
     40            @value = value
     41          end
     42          private
     43          def value_valid(value)
     44          end
     45        end
     46
     47        class DV_Periodic_Time_Specification < DV_Time_Specification
     48          attr_reader :value, :calender_alignment, :event_alingment, :period
    2249          def initialize(value)
    2350            value_valid(value)
     
    2552          end
    2653          def value=(value)
    27             value_valid(value)
    28             @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
    2961          end
    30           private
    31           def value_valid(value)
    32             raise ArgumentError, "value is not valied" if !value.formalism.is_equal?('HL7:GTS')
     62
     63          def calender_alignment
     64
    3365          end
    34         end
    3566
    36         class DV_Periodic_Time_Specification < DV_Time_Specification
    37           attr_reader :value
    38           def initialize(value)
    39             value_valid(value)
    40             super(value)
     67          def event_alignment
     68
    4169          end
    42           def calender_alignment
    43           end
    44           def event_alignment
    45           end
     70
    4671          def institution_specified?
     72
    4773          end
    4874          def period
    49           end
    50           private
    51           def value_valid(value)
    52             if !value.formalism.is_equal('HL7:PIVL') && value.formalism.is_equal('HL7:EIVL')
    53               raise ArgumentError, "value is not valid"
    54             end
    5575          end
    5676        end
Note: See TracChangeset for help on using the changeset viewer.