Class: HealthDataStandards::Import::CCR::ResultImporter
- Inherits:
-
SectionImporter
- Object
- SectionImporter
- HealthDataStandards::Import::CCR::ResultImporter
- Defined in:
- lib/health-data-standards/import/ccr/result_importer.rb
Constant Summary
Constants inherited from SectionImporter
SectionImporter::CODE_SYSTEM_MAP
Instance Attribute Summary
Attributes inherited from SectionImporter
Instance Method Summary collapse
-
#create_entries(doc) ⇒ Array
Traverses that ASTM CCR document passed in using XPath and creates an Array of Entry objects based on what it finds.
Methods inherited from SectionImporter
#extract_codes, #extract_dates, #extract_status, #extract_time, #extract_value, #initialize, #normalize_coding_system
Constructor Details
This class inherits a constructor from HealthDataStandards::Import::CCR::SectionImporter
Instance Method Details
#create_entries(doc) ⇒ Array
Traverses that ASTM CCR document passed in using XPath and creates an Array of Entry objects based on what it finds
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/health-data-standards/import/ccr/result_importer.rb', line 12 def create_entries(doc) entry_list = [] entry_elements = doc.xpath(@entry_xpath) entry_elements.each do |entry_element| # Grab the time and the description from the Result node dummy_entry = Entry.new extract_dates(entry_element, dummy_entry) dummy_entry.description = "" if entry_element.at_xpath("./ccr:Description/ccr:Text") dummy_entry.description = entry_element.at_xpath("./ccr:Description/ccr:Text").content end # Iterate over embedded tests # Grab the values and the description from the Test nodes # For each test, create an entry with the time from the Result, the description a concatenation of the Result and Test descriptions, # and the value from the Test tests = entry_element.xpath("./ccr:Test") tests.each do |test| entry = Entry.new entry = dummy_entry.clone # copies time and description extract_codes(test, entry) extract_value(test, entry) extract_status(test, entry) extract_dates(test, entry) entry.description = dummy_entry.description + ": " + entry.description if @check_for_usable entry_list << entry if entry.usable? else entry_list << entry end end end entry_list end |