Module: ComponentDescriptors

Defined in:
lib/component_descriptors.rb

Overview

In order to be able to parse and validate a particular form of XML based medical document, we need to be able to describe the logical components of the document such that we can extract key fields for comparison with or export to some other model.

components - a base component module of a patient document, like medications or allergies.

section - a node in the document which may contain other sections or fields.

repeating_section - a section which may occur one or more times, keyed by a value or set of values.

field - a value in the document.

attribute - shortcut for a field whose xpath locator is simply the key value as an attribute of the current node (“@#key”).

Every descriptor has a section_key which uniquely identifies it within its current section. This key serves as the method used to look up a matching element in an object model of the patient document. Every descriptor also has an xpath locator, either explictly declared or implicit from the section_key, which is used to identify a node within the document. These locators nest. So a descriptor's locator is within the context of it's parent's xml node (as identified by the parent's locator), and so on, up to the root section, whose context is the document.

Every descriptor also has an index_key which uniquely identifies it within the nested hash of descriptors that it is a part of.

Defined Under Namespace

Modules: DSL, DescriptorInitialization, HashExtensions, Mapping, NodeTraversal, OptionsParser, XMLManipulation Classes: ComponentDefinition, ComponentModule, DescriptorArgumentError, DescriptorError, DescriptorHash, Field, FieldValue, RepeatingSection, RepeatingSectionInstance, Section, ValuesHash