Class: HealthDataStandards::Import::CDA::ProviderImporter

Inherits:
SectionImporter
  • Object
show all
Includes:
ProviderImportUtils, Singleton
Defined in:
lib/health-data-standards/import/cda/provider_importer.rb

Instance Attribute Summary

Attributes inherited from SectionImporter

#check_for_usable, #code_xpath, #status_xpath

Instance Method Summary collapse

Methods included from ProviderImportUtils

#extract_provider, #find_or_create_provider

Methods inherited from SectionImporter

#create_entries, #create_entry

Methods included from LocatableImportUtils

#import_address, #import_telecom

Constructor Details

#initializeProviderImporter

Returns a new instance of ProviderImporter.



10
11
12
# File 'lib/health-data-standards/import/cda/provider_importer.rb', line 10

def initialize
  
end

Instance Method Details

#extract_providers(doc, patient = nil) ⇒ Array

Extract Healthcare Providers from C32

Parameters:

  • doc (Nokogiri::XML::Document)

    It is expected that the root node of this document will have the “cda” namespace registered to “urn:hl7-org:v3”

Returns:

  • (Array)

    an array of providers found in the document



21
22
23
24
25
26
27
# File 'lib/health-data-standards/import/cda/provider_importer.rb', line 21

def extract_providers(doc, patient=nil)
  performers = doc.xpath("//cda:documentationOf/cda:serviceEvent/cda:performer")
  performers.map do |performer|
    provider_perf = extract_provider_data(performer, true)
    ProviderPerformance.new(start_date: provider_perf.delete(:start), end_date: provider_perf.delete(:end), provider: find_or_create_provider(provider_perf, patient))
  end
end