Sha256: 1e7d568f46622d76a27dec1fd479fb0c08eba3213174cdb34b56b9b23f3596a0

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

module HealthDataStandards
  module Import
    module GreenC32
      class ConditionImporter < SectionImporter
        include Singleton
        
        def initialize
          super
        end
        
        def import(condition_xml)
          condition_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
          
          condition_element = condition_xml.xpath("./gc32:condition")
          
          condition = Condition.new
          
          extract_entry(condition_element, condition)
          extract_name(condition_element, condition)
          extract_interval(condition_element, condition)
          extract_cause_of_death(condition_element, condition)
          extract_type(condition_element, condition)
          condition
        end
        
        private
        
        def extract_type(condition_xml, condition)
          type = condition_xml.xpath("./gc32:type").first
          condition.type = extract_node_text(type)
        end
        
        def extract_name(condition_xml, condition)
          name = condition_xml.xpath("./gc32:name").first
          condition.name = extract_node_text(name)
        end
        
        def extract_cause_of_death(condition_xml, condition)
          condition.cause_of_death = extract_node_attribute(condition_xml, "causeOfDeath")
        end
        
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
health-data-standards-0.7.1 lib/health-data-standards/import/green_c32/condition_importer.rb