Class: HealthDataStandards::Import::CCR::ProductImporter
- Inherits:
-
SectionImporter
- Object
- SectionImporter
- HealthDataStandards::Import::CCR::ProductImporter
- Defined in:
- lib/health-data-standards/import/ccr/product_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.
- #create_product_entries(doc) ⇒ Object
-
#process_product(product, entry) ⇒ Object
Special handling for the medications section.
-
#process_product_codes(node, entry) ⇒ Object
Add the codes from a <Product> block subsection to an Entry.
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 |
# File 'lib/health-data-standards/import/ccr/product_importer.rb', line 12 def create_entries(doc) entry_list = [] entry_elements = doc.xpath(@entry_xpath) entry_elements.each do |entry_element| entry = Entry.new product = entry_element.at_xpath("./ccr:Product") process_product(product,entry) extract_dates(entry_element, entry) extract_status(entry_element, entry) if @check_for_usable entry_list << entry if entry.usable? else entry_list << entry end end entry_list end |
#create_product_entries(doc) ⇒ Object
55 56 |
# File 'lib/health-data-standards/import/ccr/product_importer.rb', line 55 def create_product_entries(doc) end |
#process_product(product, entry) ⇒ Object
Special handling for the medications section
44 45 46 47 48 49 50 51 52 |
# File 'lib/health-data-standards/import/ccr/product_importer.rb', line 44 def process_product (product, entry) productName = product.at_xpath("./ccr:ProductName") brandName = product.at_xpath("./ccr:BrandName") productNameText = productName.at_xpath("./ccr:Text") brandNameText = brandName.at_xpath("./ccr:Text") if brandName entry.description = productNameText.content if productNameText process_product_codes(productName, entry) # we throw any codes found within the productName and brandName into the same entry process_product_codes(brandName, entry) if brandName end |
#process_product_codes(node, entry) ⇒ Object
Add the codes from a <Product> block subsection to an Entry
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/health-data-standards/import/ccr/product_importer.rb', line 31 def process_product_codes(node, entry) codes = node.xpath("./ccr:Code") if codes.size > 0 found_code = true codes.each do |code| normalize_coding_system(code) codetext = code.at_xpath("./ccr:CodingSystem").content entry.add_code(code.at_xpath("./ccr:Value").content, codetext) end end end |