Module: NPPESApi

Defined in:
lib/nppes_api_v2.rb

Constant Summary collapse

ENUMERATION_TYPES =
[
  NPI_1 = 'NPI-1'.freeze,
  NPI_2 = 'NPI-2'.freeze
].freeze
ADDRESS_PURPOSES =
[
  LOCATION = 'LOCATION'.freeze,
  MAILING = 'MAILING'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.search(options = {}) ⇒ Object

This is the main entry point for searches. Provide params as described below to parameterize the search. Search results can consist of at most 1200 results, and each search can return at most 200 of them. Use the limit and skip parameters as described below to perform pagination of the data. https://npiregistry.cms.hhs.gov/registry/help-api

Parameters:

  • number (Integer)

    An NPI number to search with. Must be exactly 10 characters

  • enumeration_type (String)

    One of the ENUMERATION_TYPES from above. NPI_1 is an individual search, and NPI_2 is organizations. Will search across both types if unspecified.

  • taxonomy_description (String)

    Specialty or Description. Can include a wildcard (*) after at least two characters

  • first_name (String)

    Exact name or include a wildcard after two characters. Only valid for type 1 searches.

  • last_name (String)

    Exact name or include a wildcard after two characters. Only valid for type 1 searches.

  • organization_name (String)

    Exact name or include a wildcard after two characters. Only valid for type 2 searches.

  • address_purpose (String)

    One of the ADDRESS_PURPOSES above. Requires other criteria.

  • city (String)

    Exact city name, no wildcards

  • state (String)

    2-character abbreviation, requires other criteria

  • postal_code (String)

    At least two characters, wildcard is implied

  • country_code (String)

    Exactly two characters. If “US” other criteria are required

  • limit (Integer)

    Limit results, default = 10, max = 200

  • skip (Integer)

    Skip first N results, max = 1000



40
41
42
# File 'lib/nppes_api_v2.rb', line 40

def self.search(options = {})
  SearchResults.new(RestClient.get('https://npiregistry.cms.hhs.gov/api/?version=2.1', params: options).body)
end