Class: QRDA::Cat1::MedicationOrderImporter
- Inherits:
-
SectionImporter
- Object
- SectionImporter
- QRDA::Cat1::MedicationOrderImporter
- Defined in:
- lib/qrda-import/data-element-importers/medication_order_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:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.47']")) ⇒ MedicationOrderImporter
constructor
A new instance of MedicationOrderImporter.
Methods inherited from SectionImporter
#create_entries, #usable_entry?
Constructor Details
#initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.47']")) ⇒ MedicationOrderImporter
Returns a new instance of MedicationOrderImporter.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/qrda-import/data-element-importers/medication_order_importer.rb', line 4 def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.47']")) super(entry_finder) @id_xpath = './cda:id' @code_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code" @relevant_period_xpath = "./cda:effectiveTime" @author_datetime_xpath = "./cda:author[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.155']/cda:time" @dosage_xpath = "./cda:doseQuantity" @supply_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.99']/cda:quantity" @frequency_xpath = "./cda:effectiveTime[@operator='A']/cda:period" @refills_xpath = "./cda:repeatNumber" @route_xpath = "./cda:routeCode" @setting_xpath = "./cda:participant[@typeCode='LOC']/cda:participantRole/cda:code" @prescriber_id_xpath = "./cda:author/cda:assignedAuthor/cda:id" @days_supplied_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.157']/cda:quantity" @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value" @related_to_xpath = "./sdtc:inFulfillmentOf1/sdtc:actReference" @entry_class = QDM::MedicationOrder end |
Instance Method Details
#create_entry(entry_element, nrh = NarrativeReferenceHandler.new) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/qrda-import/data-element-importers/medication_order_importer.rb', line 23 def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) medication_order = super medication_order.dosage = extract_scalar(entry_element, @dosage_xpath) medication_order.supply = extract_scalar(entry_element, @supply_xpath) medication_order.frequency = frequency_as_coded_value(entry_element, @frequency_xpath) medication_order.refills = extract_scalar(entry_element, @refills_xpath)&.value medication_order.route = code_if_present(entry_element.at_xpath(@route_xpath)) medication_order.setting = code_if_present(entry_element.at_xpath(@setting_xpath)) medication_order.daysSupplied = extract_scalar(entry_element, @days_supplied_xpath)&.value medication_order.reason = extract_reason(entry_element) entity = extract_entity(entry_element, "./cda:participant[@typeCode='PRF']") medication_order.prescriber.concat(entity) if entity medication_order. = (entry_element) medication_order end |