Sha256: 691d2aa941db94fa3dd2218b6e0826b6e17adc71c9ba1f5af7513c0b5c55eca6

Contents?: true

Size: 666 Bytes

Versions: 8

Compression:

Stored size: 666 Bytes

Contents

module ProviderImportUtils
  
  def extract_provider(performer)
    provider_data = extract_provider_data(performer, false)
    find_or_create_provider(provider_data)
  end
  
  def find_or_create_provider(provider_hash)
    provider = Provider.where(npi: provider_hash[:npi]).first if provider_hash[:npi] && !provider_hash[:npi].empty?
    provider ||= Provider.create(provider_hash)
  end

  # Returns nil if result is an empty string, block allows text munging of result if there is one
  def extract_data(subject, query)
    result = subject.at_xpath(query)
    if result.nil? || result.content.empty?
      nil
    else
      result.content
    end
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
health-data-standards-2.2.1 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.2.0 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.1.4 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.1.3 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.1.2 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.1.1 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.1.0 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-2.0.0 lib/health-data-standards/import/provider_import_utils.rb