Class: HealthDataStandards::Import::C32::AllergyImporter
- Inherits:
-
SectionImporter
- Object
- SectionImporter
- HealthDataStandards::Import::C32::AllergyImporter
- Defined in:
- lib/health-data-standards/import/c32/allergy_importer.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from SectionImporter
Instance Method Summary collapse
-
#create_entries(doc, id_map = {}) ⇒ Array
Traverses that HITSP C32 document passed in using XPath and creates an Array of Entry objects based on what it finds.
-
#initialize ⇒ AllergyImporter
constructor
A new instance of AllergyImporter.
Methods inherited from SectionImporter
Constructor Details
#initialize ⇒ AllergyImporter
Returns a new instance of AllergyImporter.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/health-data-standards/import/c32/allergy_importer.rb', line 6 def initialize @entry_xpath = "//cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.18']" @code_xpath = "./cda:participant/cda:participantRole/cda:playingEntity/cda:code" @description_xpath = "./cda:code/cda:originalText/cda:reference[@value] | ./cda:text/cda:reference[@value]" @type_xpath = "./cda:code" @reaction_xpath = "./cda:entryRelationship[@typeCode='MFST']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.54']/cda:value" @severity_xpath = "./cda:entryRelationship[@typeCode='SUBJ']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.55']/cda:value" @status_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.1.39']/cda:value" @id_map = {} end |
Instance Method Details
#create_entries(doc, id_map = {}) ⇒ Array
Traverses that HITSP C32 document passed in using XPath and creates an Array of Entry objects based on what it finds
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/health-data-standards/import/c32/allergy_importer.rb', line 23 def create_entries(doc,id_map = {}) @id_map = id_map allergy_list = [] entry_elements = doc.xpath(@entry_xpath) entry_elements.each do |entry_element| allergy = Allergy.new extract_codes(entry_element, allergy) extract_dates(entry_element, allergy) extract_description(entry_element, allergy, id_map) extract_negation(entry_element, allergy) extract_status(entry_element, allergy) allergy.type = extract_code(entry_element, @type_xpath) allergy.reaction = extract_code(entry_element, @reaction_xpath) allergy.severity = extract_code(entry_element, @severity_xpath) allergy_list << allergy end allergy_list end |