[372] | 1 | module OpenEHR
|
---|
[4] | 2 | module AM
|
---|
| 3 | module Archetype
|
---|
| 4 | module Ontology
|
---|
[372] | 5 | class ArchetypeOntology
|
---|
[411] | 6 | attr_accessor :constraint_definitions, :specialisation_depth
|
---|
| 7 | attr_accessor :term_attribute_names, :term_bindings
|
---|
| 8 | attr_reader :terminologies_available, :term_definitions
|
---|
[23] | 9 |
|
---|
[403] | 10 | def initialize(args = { })
|
---|
| 11 | self.specialisation_depth = args[:specialisation_depth]
|
---|
[411] | 12 | self.term_definitions = args[:term_definitions]
|
---|
| 13 | self.constraint_definitions = args[:constraint_definitions]
|
---|
| 14 | self.term_bindings = args[:term_bindings]
|
---|
[403] | 15 | end
|
---|
| 16 |
|
---|
[411] | 17 | # def terminologies_available=(terminologies_available)
|
---|
| 18 | # if terminologies_available.nil?
|
---|
| 19 | # raise ArgumentError, 'terminologies_available is mandatory'
|
---|
| 20 | # end
|
---|
| 21 | # @terminologies_available = terminologies_available
|
---|
| 22 | # end
|
---|
| 23 |
|
---|
| 24 | def term_definitions=(term_definitions)
|
---|
| 25 | if term_definitions.nil?
|
---|
| 26 | raise ArgumentError, 'term_definitions is mandatory'
|
---|
[403] | 27 | end
|
---|
[411] | 28 | @term_definitions = term_definitions
|
---|
[403] | 29 | end
|
---|
| 30 |
|
---|
[411] | 31 | def term_codes
|
---|
| 32 | return @term_definitions.values.collect {|value|
|
---|
| 33 | value.collect {|term| term.code}}.flatten.uniq
|
---|
| 34 | end
|
---|
| 35 |
|
---|
| 36 | def constraint_codes
|
---|
| 37 | if @constraint_definitions.nil?
|
---|
| 38 | return nil
|
---|
| 39 | else
|
---|
| 40 | return @constraint_definitions.values.collect {|value|
|
---|
| 41 | value.collect {|term| term.code}}.flatten.uniq
|
---|
| 42 | end
|
---|
| 43 | end
|
---|
| 44 |
|
---|
[4] | 45 | def constraint_binding(a_terminology, a_code)
|
---|
| 46 | end
|
---|
[23] | 47 |
|
---|
[4] | 48 | def constraint_definition(a_lang, a_code)
|
---|
| 49 | end
|
---|
[23] | 50 |
|
---|
[4] | 51 | def has_language?(a_lang)
|
---|
| 52 | end
|
---|
[23] | 53 |
|
---|
[4] | 54 | def has_terminology?(a_terminology)
|
---|
| 55 | end
|
---|
[23] | 56 |
|
---|
[4] | 57 | def term_binding(a_terminology, a_code)
|
---|
| 58 | end
|
---|
[23] | 59 |
|
---|
[4] | 60 | def term_definition(a_lang, a_code)
|
---|
| 61 | end
|
---|
| 62 | end
|
---|
[23] | 63 |
|
---|
[402] | 64 | class ARCHETYPE_ONTOLOGY < ArchetypeOntology
|
---|
[23] | 65 |
|
---|
[402] | 66 | end
|
---|
| 67 |
|
---|
| 68 | class ArchetypeTerm
|
---|
| 69 | attr_accessor :items
|
---|
| 70 | attr_reader :code
|
---|
| 71 |
|
---|
[23] | 72 | def initialize(args = { })
|
---|
[402] | 73 | self.code = args[:code]
|
---|
| 74 | self.items =args[:items]
|
---|
| 75 | end
|
---|
| 76 |
|
---|
| 77 | def code=(code)
|
---|
| 78 | if code.nil? or code.empty?
|
---|
| 79 | raise ArgumentError, 'code is mandatory'
|
---|
| 80 | end
|
---|
| 81 | @code = code
|
---|
[4] | 82 | end
|
---|
[23] | 83 |
|
---|
[4] | 84 | def keys
|
---|
[402] | 85 | if items.nil?
|
---|
| 86 | return Set.new
|
---|
| 87 | else
|
---|
| 88 | return Set.new(@items.keys)
|
---|
| 89 | end
|
---|
[4] | 90 | end
|
---|
| 91 | end
|
---|
[402] | 92 |
|
---|
| 93 | class ARCHETYPE_TERM < ArchetypeTerm
|
---|
| 94 |
|
---|
| 95 | end
|
---|
[4] | 96 | end # end of Ontology
|
---|
| 97 | end # end of Archetype
|
---|
| 98 | end # end of AM
|
---|
| 99 | end # end of OpenEHR
|
---|
| 100 |
|
---|