Class: OpenEHR::AM::Template::OperationalTemplate
- Inherits:
-
Archetype::Archetype
- Object
- RM::Common::Resource::AuthoredResource
- Archetype::Archetype
- OpenEHR::AM::Template::OperationalTemplate
- Defined in:
- lib/openehr/am/template.rb
Overview
OPERATIONAL_TEMPLATE class represents a “compiled” template derived from a source TEMPLATE by a “flattening” process, used for generating and validating reference model instance data. According to openEHR AOM2 specification, it inherits from AUTHORED_ARCHETYPE.
Constant Summary
Constants included from Archetype::ADLDefinition
Archetype::ADLDefinition::CURRENT_ADL_VERSION
Instance Attribute Summary collapse
-
#component_terminologies ⇒ Object
Returns the value of attribute component_terminologies.
-
#template_id ⇒ Object
Returns the value of attribute template_id.
-
#terminology_extracts ⇒ Object
Returns the value of attribute terminology_extracts.
Attributes inherited from Archetype::Archetype
#adl_version, #archetype_id, #definition, #invariants, #ontology, #parent_archetype_id, #uid
Attributes inherited from RM::Common::Resource::AuthoredResource
#description, #original_language, #revision_history, #translations
Instance Method Summary collapse
-
#concept ⇒ Object
Override concept to use template concept or fallback to archetype concept.
-
#initialize(args = {}) ⇒ OperationalTemplate
constructor
A new instance of OperationalTemplate.
-
#is_specialized? ⇒ Boolean
Returns whether the template is specialized (should be true for operational templates).
-
#is_valid_operational_template? ⇒ Boolean
Returns true if this is a valid operational template.
-
#language ⇒ Object
Compatibility method for backward compatibility with existing tests.
-
#language=(language) ⇒ Object
Compatibility setter for language (maps to original_language).
-
#referenced_archetype_ids ⇒ Object
Get all archetype identifiers referenced in this operational template.
-
#terminology_for_archetype(archetype_id) ⇒ Object
Get terminology for a specific archetype.
Methods inherited from Archetype::Archetype
#concept_name, #constraint_references_valid?, create, #internal_references_valid?, #is_specialised?, #is_valid?, #logical_paths, #node_ids_vaild?, #physical_paths, #previous_version, #short_concept_name, #specialisation_depth, #to_rm, #version
Methods inherited from RM::Common::Resource::AuthoredResource
#current_revision, #is_controlled?, #languages_available
Constructor Details
#initialize(args = {}) ⇒ OperationalTemplate
Returns a new instance of OperationalTemplate.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/openehr/am/template.rb', line 13 def initialize(args = {}) # Initialize parent archetype with template-specific archetype_id template_args = args.dup template_args[:archetype_id] = args[:template_id] if args[:template_id] && !args[:archetype_id] super(template_args) self.template_id = args[:template_id] self.component_terminologies = args[:component_terminologies] || {} self.terminology_extracts = args[:terminology_extracts] || {} end |
Instance Attribute Details
#component_terminologies ⇒ Object
Returns the value of attribute component_terminologies.
11 12 13 |
# File 'lib/openehr/am/template.rb', line 11 def component_terminologies @component_terminologies end |
#template_id ⇒ Object
Returns the value of attribute template_id.
11 12 13 |
# File 'lib/openehr/am/template.rb', line 11 def template_id @template_id end |
#terminology_extracts ⇒ Object
Returns the value of attribute terminology_extracts.
11 12 13 |
# File 'lib/openehr/am/template.rb', line 11 def terminology_extracts @terminology_extracts end |
Instance Method Details
#concept ⇒ Object
Override concept to use template concept or fallback to archetype concept
66 67 68 |
# File 'lib/openehr/am/template.rb', line 66 def concept @concept || (archetype_id ? archetype_id.concept_name : nil) end |
#is_specialized? ⇒ Boolean
Returns whether the template is specialized (should be true for operational templates)
51 52 53 |
# File 'lib/openehr/am/template.rb', line 51 def is_specialized? !parent_archetype_id.nil? end |
#is_valid_operational_template? ⇒ Boolean
Returns true if this is a valid operational template
43 44 45 46 47 48 |
# File 'lib/openehr/am/template.rb', line 43 def is_valid_operational_template? return false if template_id.nil? return false if definition.nil? return false if component_terminologies.nil? true end |
#language ⇒ Object
Compatibility method for backward compatibility with existing tests
71 72 73 |
# File 'lib/openehr/am/template.rb', line 71 def language original_language end |
#language=(language) ⇒ Object
Compatibility setter for language (maps to original_language)
76 77 78 |
# File 'lib/openehr/am/template.rb', line 76 def language=(language) self.original_language = language end |
#referenced_archetype_ids ⇒ Object
Get all archetype identifiers referenced in this operational template
56 57 58 |
# File 'lib/openehr/am/template.rb', line 56 def referenced_archetype_ids component_terminologies.keys end |
#terminology_for_archetype(archetype_id) ⇒ Object
Get terminology for a specific archetype
61 62 63 |
# File 'lib/openehr/am/template.rb', line 61 def terminology_for_archetype(archetype_id) component_terminologies[archetype_id] end |