class HealthDataStandards::Import::CDA::NarrativeReferenceHandler
Public Class Methods
new()
click to toggle source
# File lib/health-data-standards/import/cda/narrative_reference_handler.rb, line 5 def initialize @id_map = {} end
Public Instance Methods
build_id_map(doc)
click to toggle source
# File lib/health-data-standards/import/cda/narrative_reference_handler.rb, line 9 def build_id_map(doc) path = "//*[@ID]" ids = doc.xpath(path) ids.each do |id| tag = id['ID'] value = id.content @id_map[tag] = value end end
lookup_tag(tag)
click to toggle source
@param [String] tag
@return [String] text description of tag
# File lib/health-data-standards/import/cda/narrative_reference_handler.rb, line 21 def lookup_tag(tag) value = @id_map[tag] # Not sure why, but sometimes the reference is #<Reference> and the ID value is <Reference>, and # sometimes it is #<Reference>. We look for both. if !value and tag[0] == '#' tag = tag[1,tag.length] value = @id_map[tag] end value end