Ignore:
Timestamp:
Sep 25, 2009, 12:27:29 PM (15 years ago)
Author:
KOBAYASHI, Shinji
Message:

rake spec works on trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ruby/trunk/lib/open_ehr/rm/support/terminology.rb

    r167 r298  
    11
    2 module OpenEhr
     2module OpenEHR
    33  module RM
    44    module Support
     
    88            raise NotImplementedError, "all_codes must be implemented"
    99          end
     10
    1011          def has_code(a_code)
    1112            raise NotImplementedError, "has_code must be implemented"
    1213          end
     14
    1315          def has_lang(a_lang)
    1416            raise NotImplementedError, "has_lang must be implemented"
    1517          end
     18
    1619          def id
    1720            raise NotImplementedError, "id must be returned"
    1821          end
    1922        end
    20         module OpenEhrCodeSetIdentifier
     23
     24        module OpenEHRCodeSetIdentifier
    2125          CODE_SET_ID_CHARACER_SETS = "character sets".freeze
    2226          CODE_SET_ID_COMPRESSION_ALGORITHMS = "compression algorithms".freeze
     
    2933          end
    3034        end
    31         module OpenEhrTerminologyGroupIdentifiers
     35
     36        module OpenEHRTerminologyGroupIdentifiers
    3237          GROUP_ID_ATTESTATION_REASON = "attestation reason".freeze
    3338          GROUP_ID_AUDIT_CHANGE_TYPE = "audit change type".freeze
     
    4651          TERMINOLOGY_ID = "openehr".freeze
    4752        end
     53
    4854        class TerminologyAccess
     55          attr_reader :id
     56
     57          def initialize(args = {})
     58            self.id = args[:id]
     59          end
     60
    4961          def all_codes
    5062            raise NotImplementedError, "all_codes is not implemented"
    5163          end
     64
    5265          def codes_for_group_id(group_id)
    5366            raise NotImplementedError, "codes_for_group_id is not implemented"
    5467          end
     68
    5569          def codes_for_group_name(name, lang)
    5670            raise NotImplementedError, "codes_for_group_name is not implemented"
    5771          end
     72
    5873          def has_code_for_group_id(group_id, a_code)
    59             raise NotImplementedError, "has_code_for_group_id is not implemented"
     74           
    6075          end
    61           def id
    62             raise NotImplementedError, "id is not implemented"
     76
     77          def id=(id)
     78            @terminology = Terminology.find_all_by_name(id)
     79            @id = id
    6380          end
     81
    6482          def rubric_for_code(code, lang)
    65             raise NotImplementedError, "rubic_for_code is not implemented"
     83            return Terminology.find(:first, :conditions => {:code => code,
     84                                      :lang => lang})
    6685          end
     86
    6787          private
    6888          def id_exists
     
    7494          end
    7595        end
     96
    7697        class TerminologyService
    77           include OpenEhrCodeSetIdentifier, OpenEhrTerminologyGroupIdentifiers
     98          include OpenEHRCodeSetIdentifier, OpenEHRTerminologyGroupIdentifiers
     99
    78100          def code_set(name)
    79101            raise NotImplementedError, "code_set is not implemented"
    80102          end
     103
    81104          def code_set_for_id(id)
    82105            raise NotImplementedError, "code_set_for_id is not implemented"
    83106          end
     107
    84108          def code_set_identifiers
    85109            raise NotImplementedError, "code_set_for_identifiers is not implemented"
    86110          end
     111
    87112          def has_code_set(name)
    88113            raise NotImplementedError, "has_code_set is not implemented"
    89114          end
     115
    90116          def has_terminology?(name)
    91117            raise NotImplementedError, "has_terminology is not implemented"
    92118          end
     119
    93120          def openehr_code_sets
    94121            raise NotImplementedError, "openehr_code_set is not implemented"
    95122          end
     123
    96124          def terminology(name)
    97             raise NotImplementedError, "terminology is not implemented"
     125            return TerminologyAccess.new(:id => name)
    98126          end
     127         
    99128          def terminology_identifiers
    100129            raise NotImplementedError, "terminology_identiferes is not implemented"
Note: See TracChangeset for help on using the changeset viewer.