Class: QRDA::Cat1::MedicationDispensedImporter
- Inherits:
-
SectionImporter
- Object
- SectionImporter
- QRDA::Cat1::MedicationDispensedImporter
- Defined in:
- lib/qrda-import/data-element-importers/medication_dispensed_importer.rb
Instance Attribute Summary
Attributes inherited from SectionImporter
#check_for_usable, #code_xpath, #codes, #codes_modifiers, #status_xpath, #warnings
Instance Method Summary collapse
- #create_entry(entry_element, nrh = NarrativeReferenceHandler.new) ⇒ Object
-
#initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.139']")) ⇒ MedicationDispensedImporter
constructor
A new instance of MedicationDispensedImporter.
Methods inherited from SectionImporter
#create_entries, #usable_entry?
Constructor Details
#initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.139']")) ⇒ MedicationDispensedImporter
Returns a new instance of MedicationDispensedImporter.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/qrda-import/data-element-importers/medication_dispensed_importer.rb', line 4 def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.139']")) super(entry_finder) @id_xpath = './cda:entryRelationship/cda:supply/cda:id' @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:product/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code" @relevant_period_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime" @relevant_date_time_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime" @author_datetime_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:author[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.155']/cda:time" @refills_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:entryRelationship/cda:substanceAdministration/cda:repeatNumber" @dosage_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:entryRelationship/cda:substanceAdministration/cda:doseQuantity" @supply_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.99']/cda:quantity" @frequency_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:entryRelationship/cda:substanceAdministration/cda:effectiveTime[@operator='A']/cda:period" @days_supplied_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.157']/cda:quantity" @route_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:entryRelationship/cda:substanceAdministration/cda:routeCode" @entry_class = QDM::MedicationDispensed end |
Instance Method Details
#create_entry(entry_element, nrh = NarrativeReferenceHandler.new) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/qrda-import/data-element-importers/medication_dispensed_importer.rb', line 20 def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) medication_dispensed = super medication_dispensed.refills = extract_refills(entry_element, @refills_xpath) medication_dispensed.dosage = extract_scalar(entry_element, @dosage_xpath) medication_dispensed.supply = extract_scalar(entry_element, @supply_xpath) medication_dispensed.frequency = frequency_as_coded_value(entry_element, @frequency_xpath) medication_dispensed.daysSupplied = extract_scalar(entry_element, @days_supplied_xpath)&.value medication_dispensed.route = code_if_present(entry_element.at_xpath(@route_xpath)) entity1 = extract_entity(entry_element, "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']//cda:participant[@typeCode='PRF']") medication_dispensed.prescriber.concat(entity1) if entity1 entity2 = extract_entity(entry_element, "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:participant[@typeCode='DIST']") medication_dispensed.dispenser.concat(entity2) if entity2 medication_dispensed end |