Class: QRDA::Cat1::SectionImporter
- Inherits:
-
Object
- Object
- QRDA::Cat1::SectionImporter
- Defined in:
- lib/qrda-import/base-importers/section_importer.rb
Direct Known Subclasses
AdverseEventImporter, AllergyIntoleranceImporter, AssessmentOrderImporter, AssessmentPerformedImporter, AssessmentRecommendedImporter, CommunicationPerformedImporter, DeviceOrderImporter, DeviceRecommendedImporter, DiagnosisImporter, DiagnosticStudyOrderImporter, DiagnosticStudyPerformedImporter, DiagnosticStudyRecommendedImporter, EncounterOrderImporter, EncounterPerformedImporter, EncounterRecommendedImporter, FamilyHistoryImporter, ImmunizationAdministeredImporter, ImmunizationOrderImporter, InterventionOrderImporter, InterventionPerformedImporter, InterventionRecommendedImporter, LaboratoryTestOrderImporter, LaboratoryTestPerformedImporter, LaboratoryTestRecommendedImporter, MedicationActiveImporter, MedicationAdministeredImporter, MedicationDischargeImporter, MedicationDispensedImporter, MedicationOrderImporter, PatientCareExperienceImporter, PatientCharacteristicClinicalTrialParticipantImporter, PatientCharacteristicExpiredImporter, PatientCharacteristicPayerImporter, PhysicalExamOrderImporter, PhysicalExamPerformedImporter, PhysicalExamRecommendedImporter, ProcedureOrderImporter, ProcedurePerformedImporter, ProcedureRecommendedImporter, ProgramParticipationImporter, ProviderCareExperienceImporter, RelatedPersonImporter, SubstanceAdministeredImporter, SubstanceOrderImporter, SubstanceRecommendedImporter, SymptomImporter
Instance Attribute Summary collapse
-
#check_for_usable ⇒ Object
Returns the value of attribute check_for_usable.
-
#code_xpath ⇒ Object
Returns the value of attribute code_xpath.
-
#codes ⇒ Object
Returns the value of attribute codes.
-
#codes_modifiers ⇒ Object
Returns the value of attribute codes_modifiers.
-
#status_xpath ⇒ Object
Returns the value of attribute status_xpath.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#create_entries(doc, nrh = NarrativeReferenceHandler.new) ⇒ Array
Traverses an HL7 CDA document passed in and creates an Array of Entry objects based on what it finds.
- #create_entry(entry_element, _nrh = NarrativeReferenceHandler.new) ⇒ Object
-
#initialize(entry_finder) ⇒ SectionImporter
constructor
A new instance of SectionImporter.
- #usable_entry?(entry) ⇒ Boolean
Constructor Details
#initialize(entry_finder) ⇒ SectionImporter
Returns a new instance of SectionImporter.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 8 def initialize(entry_finder) @entry_finder = entry_finder @code_xpath = "./cda:code" @entry_id_map = {} @check_for_usable = true @entry_class = QDM::DataElement @warnings = [] @codes = Set.new @codes_modifiers = {} end |
Instance Attribute Details
#check_for_usable ⇒ Object
Returns the value of attribute check_for_usable.
6 7 8 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 6 def check_for_usable @check_for_usable end |
#code_xpath ⇒ Object
Returns the value of attribute code_xpath.
6 7 8 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 6 def code_xpath @code_xpath end |
#codes ⇒ Object
Returns the value of attribute codes.
6 7 8 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 6 def codes @codes end |
#codes_modifiers ⇒ Object
Returns the value of attribute codes_modifiers.
6 7 8 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 6 def codes_modifiers @codes_modifiers end |
#status_xpath ⇒ Object
Returns the value of attribute status_xpath.
6 7 8 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 6 def status_xpath @status_xpath end |
#warnings ⇒ Object
Returns the value of attribute warnings.
6 7 8 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 6 def warnings @warnings end |
Instance Method Details
#create_entries(doc, nrh = NarrativeReferenceHandler.new) ⇒ Array
Traverses an HL7 CDA document passed in and creates an Array of Entry objects based on what it finds
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 25 def create_entries(doc, nrh = NarrativeReferenceHandler.new) entry_list = [] @entry_id_map = {} entry_elements = @entry_finder.entries(doc) entry_elements.each do |entry_element| entry = create_entry(entry_element, nrh) if @check_for_usable entry_list << entry if usable_entry?(entry) else entry_list << entry end end [entry_list, @entry_id_map] end |
#create_entry(entry_element, _nrh = NarrativeReferenceHandler.new) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 44 def create_entry(entry_element, _nrh = NarrativeReferenceHandler.new) entry = @entry_class.new # This is the id found in the QRDA file entry_qrda_id = extract_id(entry_element, @id_xpath) # Create a hash to map all of entry.ids to the same QRDA ids. This will be used to merge QRDA entries # that represent the same event. @entry_id_map["#{entry_qrda_id.value}***#{entry_qrda_id.namingSystem}"] ||= [] @entry_id_map["#{entry_qrda_id.value}***#{entry_qrda_id.namingSystem}"] << entry.id entry.dataElementCodes = extract_codes(entry_element, @code_xpath) extract_dates(entry_element, entry) if @result_xpath entry.result = extract_result_values(entry_element) end extract_negation(entry_element, entry) entry end |
#usable_entry?(entry) ⇒ Boolean
40 41 42 |
# File 'lib/qrda-import/base-importers/section_importer.rb', line 40 def usable_entry?(entry) entry.dataElementCodes.present? end |