Class: OpenEHR::Parser::OPTParser

Inherits:
Base
  • Object
show all
Defined in:
lib/openehr/parser/opt_parser.rb

Constant Summary collapse

TEMPLATE_LANGUAGE_CODE_PATH =
'/template/language/code_string'
TEMPLATE_LANGUAGE_TERM_ID_PATH =
'/template/language/terminology_id/value'
TEMPLATE_ID_PATH =
'/template/template_id/value'
UID_PATH =
'/template/uid/value'
CONCEPT_PATH =
'/template/concept'
DESC_ORIGINAL_AUTHOR_PATH =
'/template/description/original_author'
DESC_LIFECYCLE_STATE_PATH =
'/template/description/lifecycle_state'
DESC_DETAILS_LANGUAGE_TERM_ID_PATH =
'/template/description/details/language/terminology_id/value'
DESC_DETAILS_LANGUAGE_CODE_PATH =
'/template/description/details/language/code_string'
DESC_DETAILS_PURPOSE_PATH =
'/template/description/details/purpose'
DESC_DETAILS_KEYWORDS_PATH =
'/template/description/details/keywords'
DESC_DETAILS_USE_PATH =
'/template/description/details/use'
DESC_DETAILS_MISUSE_PATH =
'/template/description/details/misuse'
'/template/description/details/copyright'
DEFINITION_PATH =
'/template/definition'
OCCURRENCE_PATH =
'/occurrences'

Instance Attribute Summary

Attributes inherited from Base

#filename

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ OPTParser

Returns a new instance of OPTParser.



33
34
35
# File 'lib/openehr/parser/opt_parser.rb', line 33

def initialize(filename)
  super(filename)
end

Instance Method Details

#parseObject



37
38
39
40
41
42
43
# File 'lib/openehr/parser/opt_parser.rb', line 37

def parse
  @opt = Nokogiri::XML::Document.parse(File.open(@filename))
  @opt.remove_namespaces!
  uid = OpenEHR::RM::Support::Identification::UIDBasedID.new(value: text_on_path(@opt, UID_PATH))
  defs = definition
  OpenEHR::AM::Template::OperationalTemplate.new(uid: uid, concept: concept, language: language, description: description, template_id: template_id, definition: defs, component_terminologies: @component_terminologies)
end