Help us shape the future of Go! Take the 2026 Go Developer Survey

npi

package module
v0.0.0-...-a480876 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2018 License: BSD-3-Clause Imports: 7 Imported by: 0

README

NPI

This is an NPI API client for Go. It has no external dependencies.

Installation

Installation is simple:

$ go get github.com/mylanconnolly/npi

Usage

TBD

Documentation

Index

Constants

View Source
const (
	LogLevelDevel int = 1 << iota
	LogLevelProd
)

The different possible log levels.

Variables

View Source
var ErrNotFound = errors.New("record not found")

ErrNotFound is used when the record simply wasn't found. This does not indicate that there was a problem with the request, simply that the record does not exist, or the criteria was incorrect.

Functions

This section is empty.

Types

type Address

type Address struct {
	Address1    string `json:"address_1"`
	Address2    string `json:"address_2"`
	City        string `json:"city"`
	State       string `json:"state"`
	ZIP         string `json:"postal_code"`
	Phone       string `json:"telephone_number"`
	Fax         string `json:"fax_number"`
	AddressType string `json:"address_type"`
	Purpose     string `json:"address_purpose"`
}

Address is used to represent an address in the NPI record.

type Basic

type Basic struct {
	Status          string `json:"status"`
	Credential      string `json:"credential"`
	FirstName       string `json:"first_name"`
	LastName        string `json:"last_name"`
	MiddleName      string `json:"middle_name"`
	Name            string `json:"name"`
	Gender          string `json:"gender"`
	SoleProprietor  string `json:"sole_proprietor"`  // Should this get changed to a bool?
	LastUpdated     string `json:"last_updated"`     // Should this get changed to a time.Time?
	EnumerationDate string `json:"enumeration_date"` // Should this get changed to a time.Time?
}

Basic includes basic result information.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the client used to interact with the NPI API.

func NewClient

func NewClient(logLevel int) (*Client, error)

NewClient is used to create and prepare a new NPI client for use.

func (Client) Get

func (c Client) Get(id int) (Result, error)

Get is used to retrieve an NPI result based on the NPI number provided.

func (Client) SearchName

func (c Client) SearchName(firstName, lastName string) ([]Result, error)

SearchName is used to find NPI results with the given names. Note that the criteria here is fuzzy (by design on the NPI API), so there's no need for asterisks or percent signs.

type Identifier

type Identifier struct {
	Code        string `json:"code"`
	Issuer      string `json:"issuer"`
	State       string `json:"state"`
	Identifier  string `json:"identifier"`
	Description string `json:"desc"`
}

Identifier is used to represent identifiers for the result.

type Result

type Result struct {
	Number           int       `json:"number"`
	CreatedEpoch     int       `json:"created_epoch"`
	LastUpdatedEpoch int       `json:"last_updated_epoch"`
	EnumerationType  string    `json:"enumeration_type"`
	Basic            Basic     `json:"basic"`
	Addresses        []Address `json:"addresses"`
}

Result is used to represent an NPI lookup result.

func (Result) GetAddress

func (r Result) GetAddress(purpose string) (Address, bool)

GetAddress is used to fetch the address with the given purpose, as well as a boolean flag to denote whether it was found or not.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL