Class: HQMF::Parser::V2Parser
- Inherits:
-
Object
- Object
- HQMF::Parser::V2Parser
- Defined in:
- lib/hqmf-parser/parser.rb
Overview
HQMF v2 Parser for measures that use QDM for measure logic
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ V2Parser
constructor
A new instance of V2Parser.
- #parse(xml_contents, codes = nil) ⇒ Object
- #parse_fields(xml_contents) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize ⇒ V2Parser
Returns a new instance of V2Parser.
9 10 |
# File 'lib/hqmf-parser/parser.rb', line 9 def initialize end |
Class Method Details
Instance Method Details
#parse(xml_contents, codes = nil) ⇒ Object
12 13 14 15 |
# File 'lib/hqmf-parser/parser.rb', line 12 def parse(xml_contents, codes=nil) HQMF::Counter.instance.reset() HQMF2::Document.new(xml_contents).to_model end |
#parse_fields(xml_contents) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hqmf-parser/parser.rb', line 17 def parse_fields(xml_contents) result = {} doc = HQMF2::Document.parse(xml_contents) type = doc.at_xpath('/cda:QualityMeasureDocument/cda:code/@code').value if type == '57024-2' id = doc.at_xpath('cda:QualityMeasureDocument/cda:id/@extension', HQMF2::Document::NAMESPACES).value.upcase set_id = doc.at_xpath('cda:QualityMeasureDocument/cda:setId/@extension').value.upcase version_number = doc.at_xpath('cda:QualityMeasureDocument/cda:versionNumber/@value').value.to_i title = doc.at_xpath('cda:QualityMeasureDocument/cda:title/@value').inner_text description = doc.at_xpath('cda:QualityMeasureDocument/cda:text/@value').inner_text result= {'id' => id, 'set_id' => set_id, 'version' => version_number, 'title' => title, 'description' => description} end result end |
#version ⇒ Object
32 33 34 |
# File 'lib/hqmf-parser/parser.rb', line 32 def version HQMF_VERSION_2 end |