Sha256: 66fef3b59c1a90a8f37c69238573283c636a34444ec197ef75017048809f8e71

Contents?: true

Size: 722 Bytes

Versions: 19

Compression:

Stored size: 722 Bytes

Contents

module ProviderImportUtils
  
  def extract_provider(performer, element_name="assignedEntity")
    provider_data = extract_provider_data(performer, false, "./cda:#{element_name}")
    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

19 entries across 19 versions & 1 rubygems

Version Path
health-data-standards-3.2.12 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.3.0 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.11 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.10 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.8 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.7 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.6 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.5 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.4 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.3 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.2 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.1 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.2.0 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.1.1 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.1.0 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.0.6 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.0.5 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.0.4 lib/health-data-standards/import/provider_import_utils.rb
health-data-standards-3.0.3 lib/health-data-standards/import/provider_import_utils.rb