- Timestamp:
- Apr 25, 2010, 5:21:15 PM (14 years ago)
- Location:
- ruby/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk/lib/open_ehr/am/archetype/ontology.rb
r411 r412 14 14 self.term_bindings = args[:term_bindings] 15 15 end 16 17 # def terminologies_available=(terminologies_available)18 # if terminologies_available.nil?19 # raise ArgumentError, 'terminologies_available is mandatory'20 # end21 # @terminologies_available = terminologies_available22 # end23 16 24 17 def term_definitions=(term_definitions) … … 41 34 value.collect {|term| term.code}}.flatten.uniq 42 35 end 36 end 37 38 def terminologies_available 39 return @term_bindings.keys 43 40 end 44 41 -
ruby/trunk/lib/open_ehr/parser.rb
r404 r412 15 15 16 16 class XMLParser < Parser 17 17 18 18 end 19 19 end -
ruby/trunk/lib/open_ehr/serializer.rb
r411 r412 105 105 ontology = 'ontology'+NL 106 106 ontology << INDENT + 'term_definitions = <' + NL 107 ao.term_ codes.each do |term, items|108 ontology << INDENT*2 + "[\"#{ term}\"] = <" + NL107 ao.term_definitions.each do |lang, items| 108 ontology << INDENT*2 + "[\"#{lang}\"] = <" + NL 109 109 ontology << INDENT*3 + 'items = <' + NL 110 items.each do | code, attribute|111 ontology << INDENT*4 + "[\"#{ code}\] = <" + NL112 terms.each do |name, description|113 ontology << INDENT*5 + "#{name} = <\"#{desc ription}\">" +NL110 items.each do |item| 111 ontology << INDENT*4 + "[\"#{item.code}\"] = <" + NL 112 item.items.each do |name, desc| 113 ontology << INDENT*5 + "#{name} = <\"#{desc}\">" +NL 114 114 end 115 115 ontology << INDENT*4 + '>'+NL 116 116 end 117 onto goly << INDENT*3 + '>' + NL117 ontology << INDENT*3 + '>' + NL 118 118 ontology << INDENT*2 + '>' + NL 119 119 end -
ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb
r411 r412 52 52 code_string.should == '163020007' 53 53 end 54 55 it 'terminologies_available should return available terminology' do 56 @archetype_ontology.terminologies_available.should == ['SNOMED-CT(2003)'] 57 end 54 58 end 55 59 -
ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb
r411 r412 40 40 41 41 it 'ontology should return ADL formatted ontology' do 42 @adl_serializer.ontology.should == @sample_ definition42 @adl_serializer.ontology.should == @sample_ontology 43 43 end 44 44 end -
ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb
r408 r412 9 9 shared_examples_for 'sample archetype' do 10 10 before(:all) do 11 terminologies_available = Set.new('ja') 12 term_codes = ['at0000'] 13 archetype_term = ArchetypeTerm.new(:code => 'ja', 11 archetype_term = ArchetypeTerm.new(:code => 'at0000', 14 12 :items => {'text' => 'simple test', 15 13 'description' => 'simple test for serializer'}) 16 term_definitions = {'ja' => {'at0000' => archetype_term}}14 term_definitions = {'ja' => [archetype_term]} 17 15 ontology = 18 ArchetypeOntology.new(:terminologies_available => terminologies_available, 19 :specialisation_depth => 0, 20 :term_codes => term_codes, 21 :constraint_codes => [], 22 :term_attribute_names => ['text','description'], 16 ArchetypeOntology.new(:specialisation_depth => 0, 23 17 :term_definitions => term_definitions) 24 18 archetype_id = ArchetypeID.new(:value =>
Note:
See TracChangeset
for help on using the changeset viewer.