Changeset 268


Ignore:
Timestamp:
Sep 15, 2009, 11:09:11 AM (11 years ago)
Author:
KOBAYASHI, Shinji
Message:

fixed around identification

Location:
ruby
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb

    r267 r268  
    1919
    2020          def ==(object_id)
    21             @value == object_id.value
     21            self.value == object_id.value
    2222          end
    2323        end # of ObjectID
  • ruby/trunk/lib/models/rm/support/identification.rb

    r266 r268  
    1919          end
    2020          def ==(object_id)
    21             @value == object_id.value
     21            self.value == object_id.value
    2222          end
    2323        end # of ObjectID
     
    4949
    5050        class Archetype_ID < Object_ID
    51           attr_reader :domain_concept, :rm_name, :rm_entity, :rm_originator, :specialisation, :version_id
    52 
    53           def initialize(value)
    54             super(value)
    55 
    56           end
    57           def domain_concept=(domain_concept)
    58             raise ArgumentError, "domain concept not valid" if domain_concept.nil? or domain_concept.empty?
    59             @domain_concept = domain_concept
     51          attr_reader :rm_name, :rm_entity, :rm_originator, :concept_name, :specialisation, :version_id
     52
     53          def initialize(value)
     54            super(value)
    6055          end
    6156
     
    8681
    8782          def value
    88             return self.qualified_rm_entity + self.domain_concept + '.' + @version_id
     83            return self.qualified_rm_entity + '.' +
     84              self.domain_concept + '.' + @version_id
    8985          end
    9086
  • ruby/trunk/lib/models/tests/rm/test_common.rb

    r163 r268  
    8888    @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new('Test')
    8989    @uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.5')
    90     @archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
     90    @archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new('openEHR-EHR-SECTION.physical_examination-prenatal.v2')
    9191    @template_id = OpenEHR::RM::Support::Identification::Template_ID.new('1.0.1')
    9292    assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
     
    144144    assert_nothing_raised(Exception){@archetyped.template_id = @template_id}
    145145    assert_equal @template_id, @archetyped.template_id
    146     archetype_id2 = OpenEHR::RM::Support::Identification::Archetype_ID.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
     146    archetype_id2 = OpenEHR::RM::Support::Identification::Archetype_ID.new('openEHR-EHR-SECTION.physical_examination-prenatal.v2')
    147147    assert_nothing_raised(ArgumentError){@archetyped.archetype_id = archetype_id2}
    148148    assert_equal archetype_id2, @archetyped.archetype_id
  • ruby/trunk/lib/models/tests/rm/test_data_structure.rb

    r165 r268  
    44
    55include OpenEHR::RM::Data_Structures
    6 include OpenEHR::RM::Data_Structures::Item_Structure
    76
    87class RmDataStructureTest < Test::Unit::TestCase
     
    2524  end
    2625end
    27 
    28 class RmDataStructureItemStructureTest < Test::Unit::TestCase
    29   def setup
    30     assert_nothing_raised(Exception){
    31      
    32   end
    33 
    34   def test_init
    35   end
    36 end
  • ruby/trunk/lib/models/tests/rm/test_support.rb

    r158 r268  
    1515    assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")}
    1616    assert_nothing_raised(Exception){@object_ref = OpenEHR::RM::Support::Identification::Object_Ref.new('local', 'ANY', @object_id)}
    17     assert_nothing_raised(Exception){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
     17    assert_nothing_raised(Exception){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new('openEHR-EHR-SECTION.physical_examination-prenatal.v2')}
    1818    assert_nothing_raised(Exception){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('ICD10(2003)')}
    1919    assert_nothing_raised(Exception){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("0.0.3", "openehr")}
     
    8585
    8686  def test_archetype_id
    87     assert_equal "0.0.5", @archetype_id.value
    88     assert_nothing_raised(Exception){@archetype_id.value = "0.0.6"}
    89     assert_equal "0.0.6", @archetype_id.value
    90     assert_raise(ArgumentError){@archetype_id.value=nil}
    91     assert_raise(ArgumentError){@archetype_id.value=""}
    92     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new}
    93     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new(nil, "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    94     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    95     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", nil, "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    96     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    97     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", nil, "ehr_rm", "openehr","cholesterol","0.0.3")}
    98     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "", "ehr_rm", "openehr","cholesterol","0.0.3")}
    99     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", nil, "openehr","cholesterol","0.0.3")}
    100     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "", "openehr","cholesterol","0.0.3")}
    101     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", nil,"cholesterol","0.0.3")}
    102     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "","cholesterol","0.0.3")}
    103     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr",nil ,"0.0.3")}
    104     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","","0.0.3")}
    105     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol", nil)}
    106     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","")}
    107 
    108     assert_equal "biochemistry result_cholesterol", @archetype_id.domain_concept
    109     assert_nothing_raised(Exception){(@archetype_id.domain_concept = "biochemistry result_triglyceride")}
    110     assert_equal "biochemistry result_triglyceride", @archetype_id.domain_concept
    111     assert_raise(ArgumentError){@archetype_id.domain_concept = nil}
    112     assert_raise(ArgumentError){@archetype_id.domain_concept = ""}
    113 
    114     assert_equal "entry", @archetype_id.rm_name
    115     assert_nothing_raised(Exception){@archetype_id.rm_name = "section"}
    116     assert_equal "section", @archetype_id.rm_name
    117     assert_raise(ArgumentError){@archetype_id.rm_name = nil}
    118     assert_raise(ArgumentError){@archetype_id.rm_name = ""}
    119 
    120     assert_equal "ehr_rm", @archetype_id.rm_entity
    121     assert_nothing_raised(Exception){@archetype_id.rm_entity = "13606"}
    122     assert_equal "13606", @archetype_id.rm_entity
    123     assert_raise(ArgumentError){@archetype_id.rm_entity = nil}
    124     assert_raise(ArgumentError){@archetype_id.rm_entity = ""}
    125 
    126     assert_equal "openehr", @archetype_id.rm_originator
    127     assert_nothing_raised(Exception){@archetype_id.rm_originator = "cen"}
    128     assert_equal "cen", @archetype_id.rm_originator
    129     assert_raise(ArgumentError){@archetype_id.rm_originator = nil}
    130     assert_raise(ArgumentError){@archetype_id.rm_originator = ""}
    131 
    132     assert_equal "cholesterol", @archetype_id.specialisation
    133     assert_nothing_raised(Exception){@archetype_id.specialisation = "triglyceride"}
    134     assert_equal "triglyceride", @archetype_id.specialisation
    135     assert_raise(ArgumentError){@archetype_id.specialisation = nil}
    136     assert_raise(ArgumentError){@archetype_id.specialisation = ""}
    137 
    138     assert_equal "0.0.3", @archetype_id.version_id
    139     assert_nothing_raised(Exception){@archetype_id.version_id = "0.0.7"}
    140     assert_equal "0.0.7", @archetype_id.version_id
    141     assert_raise(ArgumentError){@archetype_id.version_id = nil}
    142     assert_raise(ArgumentError){@archetype_id.version_id = ""}
     87    assert_equal 'openEHR-EHR-SECTION.physical_examination-prenatal.v2', @archetype_id.value
     88    assert_equal 'openEHR-EHR-SECTION', @archetype_id.qualified_rm_entity
     89    assert_equal 'openEHR', @archetype_id.rm_originator
     90    assert_equal 'EHR', @archetype_id.rm_name
     91    assert_equal 'SECTION', @archetype_id.rm_entity
     92    assert_equal 'physical_examination', @archetype_id.concept_name
     93    assert_equal 'prenatal', @archetype_id.specialisation
     94    assert_equal 'v2', @archetype_id.version_id
    14395  end
    14496
Note: See TracChangeset for help on using the changeset viewer.