Sha256: d1e6fdf0b86c5bf7385c160699f9367757b570cc5273c2424eab8d1903ce5c70

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 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_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

2 entries across 2 versions & 1 rubygems

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