Class: QRDA::Cat1::EncounterPerformedImporter
- Inherits:
-
SectionImporter
- Object
- SectionImporter
- QRDA::Cat1::EncounterPerformedImporter
- Defined in:
- lib/qrda-import/data-element-importers/encounter_performed_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.133']")) ⇒ EncounterPerformedImporter
constructor
A new instance of EncounterPerformedImporter.
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.133']")) ⇒ EncounterPerformedImporter
Returns a new instance of EncounterPerformedImporter.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/qrda-import/data-element-importers/encounter_performed_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.133']")) super(entry_finder) @id_xpath = './cda:entryRelationship/cda:encounter/cda:id' @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:code" @relevant_period_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:effectiveTime" @author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:author[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.155']/cda:time" @admission_source_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:participant/cda:participantRole[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.151']/cda:code" @discharge_disposition_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/sdtc:dischargeDispositionCode" @facility_locations_xpath = "./cda:entryRelationship/cda:encounter/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']" @diagnosis_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.23']/cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.168']" @entry_class = QDM::EncounterPerformed end |
Instance Method Details
#create_entry(entry_element, nrh = NarrativeReferenceHandler.new) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/qrda-import/data-element-importers/encounter_performed_importer.rb', line 17 def create_entry(entry_element, nrh = NarrativeReferenceHandler.new) encounter_performed = super encounter_performed.admissionSource = code_if_present(entry_element.at_xpath(@admission_source_xpath)) encounter_performed.dischargeDisposition = code_if_present(entry_element.at_xpath(@discharge_disposition_xpath)) encounter_performed.facilityLocations = extract_facility_locations(entry_element) encounter_performed.diagnoses = extract_diagnoses(entry_element) if encounter_performed&.relevantPeriod&.low && encounter_performed&.relevantPeriod&.high los = encounter_performed.relevantPeriod.high.to_date - encounter_performed.relevantPeriod.low.to_date encounter_performed.lengthOfStay = QDM::Quantity.new(los.to_i, 'd') end encounter_performed.participant = extract_entity(entry_element, "./cda:entryRelationship/cda:encounter//cda:participant[@typeCode='PRF']") extract_modifier_code(encounter_performed, entry_element) encounter_performed end |