- Timestamp:
- Sep 15, 2009, 11:09:11 AM (15 years ago)
- Location:
- ruby
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb
r267 r268 19 19 20 20 def ==(object_id) 21 @value == object_id.value21 self.value == object_id.value 22 22 end 23 23 end # of ObjectID -
ruby/trunk/lib/models/rm/support/identification.rb
r266 r268 19 19 end 20 20 def ==(object_id) 21 @value == object_id.value21 self.value == object_id.value 22 22 end 23 23 end # of ObjectID … … 49 49 50 50 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) 60 55 end 61 56 … … 86 81 87 82 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 89 85 end 90 86 -
ruby/trunk/lib/models/tests/rm/test_common.rb
r163 r268 88 88 @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new('Test') 89 89 @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') 91 91 @template_id = OpenEHR::RM::Support::Identification::Template_ID.new('1.0.1') 92 92 assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')} … … 144 144 assert_nothing_raised(Exception){@archetyped.template_id = @template_id} 145 145 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') 147 147 assert_nothing_raised(ArgumentError){@archetyped.archetype_id = archetype_id2} 148 148 assert_equal archetype_id2, @archetyped.archetype_id -
ruby/trunk/lib/models/tests/rm/test_data_structure.rb
r165 r268 4 4 5 5 include OpenEHR::RM::Data_Structures 6 include OpenEHR::RM::Data_Structures::Item_Structure7 6 8 7 class RmDataStructureTest < Test::Unit::TestCase … … 25 24 end 26 25 end 27 28 class RmDataStructureItemStructureTest < Test::Unit::TestCase29 def setup30 assert_nothing_raised(Exception){31 32 end33 34 def test_init35 end36 end -
ruby/trunk/lib/models/tests/rm/test_support.rb
r158 r268 15 15 assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")} 16 16 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')} 18 18 assert_nothing_raised(Exception){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('ICD10(2003)')} 19 19 assert_nothing_raised(Exception){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("0.0.3", "openehr")} … … 85 85 86 86 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 143 95 end 144 96
Note:
See TracChangeset
for help on using the changeset viewer.