Interacting with an API: NPPES NPI Registry

JSON API NPPES NPI

A short description of the post.

Andrew Bruce https://twitter.com/aabrucehimni (Healthcare Analytics in R)https://andrewbruce.netlify.app/about
2022-07-16

National Provider Identifier

The National Provider Identifier (NPI) is a HIPAA Admnistrative Standard that consists of a unique 10-digit identification number for covered health care providers, created to help send health information electronically more quickly and effectively. Covered health care providers, all health plans, and health care clearinghouses must use NPIs in their administrative and financial transactions. CMS developed the National Plan and Provider Enumeration System (NPPES) to assign NPIs.

NPPES NPI Registry

The NPPES NPI Registry Public Search is a free directory of all active National Provider Identifier (NPI) records. Healthcare providers acquire their unique 10-digit NPIs to identify themselves in a standard way throughout their industry. After CMS supplies an NPI, they publish the parts of the NPI record that have public relevance, including the provider’s name, specialty (taxonomy) and practice address. It enables you to search for providers in the NPPES (National Plan and Provider Enumeration System.) All information produced by the NPI Registry is provided in accordance with the NPPES Data Dissemination Notice. There is no charge to use the NPI Registry.

NPPES API

The NPPES Application Programming Interface (API) is a faster alternative to the downloadable NPPES data files. It allows systems to access NPPES public data in real-time, rather than through batched uploads. The API retrieves data from NPPES daily.

An API query will return a maximum of 200 results per request. The Skip field in the API will let you skip up to 1000 records. By using these two fields with your search criteria, you can get up to a maximum of 1,200 records over six requests.

Other Examples

There are several wrappers around this same API, but in different languages:

API Documentation & Notes

Inputs

Show Code
# Google Sheet ID
id_documentation <- "1VdL_oA4Rbg1OKqZHHDjRhi5nhWCbQ8QqTFokk1pCFVU"

# Read in Google Sheet
goog_apidoc <- read_sheet(ss = id_documentation, sheet = "api_inputs")

# Print head of data
goog_apidoc |>
  gt() |>
  cols_width(field ~ px(215), description ~ px(200)) |>
  fmt_markdown(columns = everything()) |>
  gt_theme_nytimes() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines() |>
  opt_table_font(font = list(google_font(name = "Karla"))) |>
  tab_header(
    title = md("NPPES API Search Fields"),
    subtitle = md("CMS **National Plan and Provider Enumeration System** (NPPES) NPI Registry")
  ) |>
  tab_source_note(source_note = md("*Source:* [NPPES API Help](https://npiregistry.cms.hhs.gov/registry/help-api).")) |>
  tab_options(table.width = pct(100))
NPPES API Search Fields
CMS National Plan and Provider Enumeration System (NPPES) NPI Registry
field description notes

version

API version

{provider} uses version 2.1

number

National Provider ID

10-digit number

enumeration_type

NPI type

When not specified, both types will be returned; cannot be the only criteria entered

taxonomy_description

Description of the provider's specialty

A taxonomy code is a unique 10-character alphanumeric code that designates a provider’s classification and specialization. Examples of descriptions are Physical Therapist, Emergency Medicine, General Practice, etc.

first_name

Provider's first name

Only applies to Individual Providers. Trailing wildcard entries require at least two characters to be entered (e.g. “jo*” ).

use_first_name_alias

Similar first name

Only applies to Individual Providers. Trailing wildcard entries require at least two characters to be entered (e.g. “jo*” ).

last_name

Provider's last name

Only applies to Individual Providers. Trailing wildcard entries require at least two characters to be entered (e.g. “jo*” ).

organization_name

Organization name for Type-2 Entity

Only applies to Organizational Providers. All types of Organization Names (LBN, DBA, Former LBN, Other Name) associated with an NPI are examined for matching contents, therefore, the results might contain an organization name different from the one entered in the Organization Name criterion.

address_purpose

Identifies Provider’s Mailing Address or Practice Location Address

When not specified, the results will contain the providers where either the Mailing Address or any of Practice Location Addresses match the entered address information.

city

City associated with Provider’s address in address_purpose

Enter either APO or FPO for a Military Address.

state

State abbreviation associated with Provider’s address in address_purpose

Cannot be used as the only input. If used, at least one other field, besides enumeration_type and country, must be populated.

postal_code

Postal code associated with Provider’s address in address_purpose

Trailing wildcard entries are permitted requiring at least two characters to be entered (e.g., “21*”).

country_code

Country abbreviation associated with Provider’s address in address_purpose

Can be used as the only input criterion as long as the value selected is NOT “US” (United States).

limit

Number of results returned

Default value is 10; can be any value from 1 to 200.

skip

Number of results to skip

Results meeting the entered criteria to be bypassed if there are more than 200 results.

pretty

Output is pretty-printed

When checked, the JSON output will be displayed in an easy-to-read format.

Source: NPPES API Help.

Outputs

Show Code
# Read in Google Sheet
goog_basicdoc <- read_sheet(ss = id_documentation, sheet = "basic")

# Print head of data
goog_basicdoc |>
  gt(rowname_col = "JSON field") |>
  gt_theme_nytimes() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines() |>
  tab_row_group(label = "ADDRESSES: Mailing Location", rows = starts_with("addresses[1]")) |>
  tab_row_group(label = "ADDRESSES: Primary Location", rows = starts_with("addresses[0]")) |>
  tab_row_group(label = "BASIC: Authorized Official", rows = starts_with("basic.authorized_official")) |>
  tab_header(
    title = md("NPPES API Output Groups and Fields"),
    subtitle = md("CMS **National Plan and Provider Enumeration System** (NPPES) NPI Registry")
  ) |>
  tab_source_note(source_note = md("*Source:* [NPPES API JSON Conversion Map](https://npiregistry.cms.hhs.gov/registry/Json-Conversion-Field-Map).")) |>
  tab_options(table.width = pct(100), row_group.default_label = "Other")
NPPES API Output Groups and Fields
CMS National Plan and Provider Enumeration System (NPPES) NPI Registry
Header Note
BASIC: Authorized Official
basic.authorized_official_credential Authorized Official Credential Text NA
basic.authorized_official_first_name Authorized Official First Name NA
basic.authorized_official_last_name Authorized Official Last Name NA
basic.authorized_official_middle_name Authorized Official Middle Name NA
basic.authorized_official_name_prefix Authorized Official Name Prefix Text NA
basic.authorized_official_name_suffix Authorized Official Name Suffix Text NA
basic.authorized_official_telephone_number Authorized Official Telephone Number NA
basic.authorized_official_title_or_position Authorized Official Title or Position NA
ADDRESSES: Primary Location
addresses[0]. fax_number Provider Business Practice Location Address Fax Number NA
addresses[0]. postal_code Provider Business Practice Location Address Postal Code NA
addresses[0].address_1 Provider First Line Business Practice Location Address NA
addresses[0].address_2 Provider Second Line Business Practice Location Address NA
addresses[0].address_purpose CONSTANT VALUE LOCATION
addresses[0].city Provider Business Practice Location Address City Name NA
addresses[0].country_code Provider Business Practice Location Address Country Code (If outside U.S.) NA
addresses[0].state Provider Business Practice Location Address State Name NA
addresses[0].telephone_number Provider Business Practice Location Address Telephone Number NA
ADDRESSES: Mailing Location
addresses[1]. fax_number Provider Business Mailing Address Fax Number NA
addresses[1]. postal_code Provider Business Mailing Address Postal Code NA
addresses[1].address_1 Provider First Line Business Mailing Address NA
addresses[1].address_2 Provider Second Line Business Mailing Address NA
addresses[1].address_purpose CONSTANT VALUE MAILING
addresses[1].city Provider Business Mailing Address City Name NA
addresses[1].country_code Provider Business Mailing Address Country Code (If outside U.S.) NA
addresses[1].state Provider Business Mailing Address State Name NA
addresses[1].telephone_number Provider Business Mailing Address Telephone Number NA
Other
basic.certification_date Certification Date NA
basic.credential Provider Credential Text NA
basic.deactivation_date NPI Deactivation Date NA
basic.deactivation_reason_code NPI Deactivation Reason Code NA
basic.ein Employer Identification Number (EIN) NA
basic.enumeration_date Provider Enumeration Date NA
basic.first_name Provider First Name NA
basic.gender Provider Gender Code NA
basic.last_name Provider Last Name (Legal Name) NA
basic.last_updated Last Update Date NA
basic.middle_name Provider Middle Name NA
basic.name_prefix Provider Name Prefix Text NA
basic.name_suffix Provider Name Suffix Text NA
basic.organization_name Provider Organization Name (Legal Business Name) NA
basic.organizational_subpart Is Organization Subpart NA
basic.parent_organization_ein Parent Organization TIN NA
basic.parent_organization_legal_business_name Parent Organization LBN NA
basic.reactivation_date NPI Reactivation Date NA
basic.replacement_npi Replacement NPI NA
basic.sole_proprietor Is Sole Proprietor NA
endpoints[n].address_1 Affiliation Address Line One NA
endpoints[n].address_2 Affiliation Address Line Two NA
endpoints[n].address_type DERIVED VALUE DOM - Domestic, FGN - Foreign, MIL - Military
endpoints[n].affiliation Affiliation NA
endpoints[n].affliationName Affiliation Legal Business Name NA
endpoints[n].city Affiliation Address City NA
endpoints[n].contentOtherDescription Other Content Description NA
endpoints[n].contentType Content Code NA
endpoints[n].contentTypeDescription Content Description NA
endpoints[n].country_code Affiliation Address Country NA
endpoints[n].country_name DERIVED VALUE Derived from Country Code
endpoints[n].endpoint Endpoint NA
endpoints[n].endpointDescription Endpoint Description NA
endpoints[n].endpointType Endpoint Type NA
endpoints[n].endpointTypeDescription Endpoint Type Description NA
endpoints[n].postal_code Affiliation Address Postal Code NA
endpoints[n].state Affiliation Address State NA
endpoints[n].use Use Code NA
endpoints[n].useDescription Use Description NA
endpoints[n].useOtherDescription Other Use Description NA
enumeration_type Entity Type Code NA
identifiers[0].code Other Provider Identifier Type Code_1 NA
identifiers[0].desc DERIVED VALUE Derived from code
identifiers[0].identifier Other Provider Identifier_1 NA
identifiers[0].issuer Other Provider Identifier Issuer_1 NA
identifiers[0].state Other Provider Identifier State_1 NA
number NPI NA
other_names[0].code Provider Other Last Name Type Code NA
other_names[0].code Provider Other Organization Name Type Code NA
other_names[0].credential Provider Other Credential Text NA
other_names[0].first_name Provider Other First Name NA
other_names[0].last_name Provider Other Last Name NA
other_names[0].middle_name Provider Other Middle Name NA
other_names[0].prefix Provider Other Name Prefix Text NA
other_names[0].suffix Provider Other Name Suffix Text NA
other_names[0].type DERIVED VALUE Derived from code
other_names[n].code Provider Other Organization Name Type Code NA
other_names[n].organization_name Provider Other Organization Name NA
other_names[n].type DERIVED VALUE Type Description Derived From Name Type Code
practiceLocations[n].address_1 Provider Secondary Practice Location Address- Address Line 1 NA
practiceLocations[n].address_2 Provider Secondary Practice Location Address- Address Line 2 NA
practiceLocations[n].city Provider Secondary Practice Location Address- City Name NA
practiceLocations[n].country_code Provider Secondary Practice Location Address- Country Code NA
practiceLocations[n].country_name DERIVED VALUE Derived From Country Code
practiceLocations[n].postal_code Provider Secondary Practice Location Address- Postal Code NA
practiceLocations[n].state Provider Secondary Practice Location Address- State Name NA
practiceLocations[n].telephone_number Provider Secondary Practice Location Address- Telephone Number NA
taxonomies[0].code Healthcare Provider Taxonomy Code_1 NA
taxonomies[0].desc DERIVED VALUE Derived from code
taxonomies[0].license Provider License Number_1 NA
taxonomies[0].primary Healthcare Provider Primary Taxonomy Switch_1 NA
taxonomies[0].state Provider License Number State Code_1 NA
taxonomies[0].taxonomy_group Healthcare Provider Taxonomy Group_1 NA
taxonomies[14].code Healthcare Provider Taxonomy Code_15 NA
Source: NPPES API JSON Conversion Map.

Valid States

Show Code
# Read in Google Sheet
goog_country <- read_sheet(ss = id_documentation, sheet = "country")

# Print head of data
goog_country |>
  gt() |>
  gt_theme_nytimes() |>
  tab_source_note(source_note = md("*Source:* [NPPES API JSON Conversion Map](https://npiregistry.cms.hhs.gov/registry/API-State-Abbr)."))
abbreviation name
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua and Barbuda
AI Anguilla
AL Albania
AM Armenia
AN Netherlands Antilles
AO Angola
AQ Antarctica
AR Argentina
AT Austria
AU Australia
AW Aruba
AZ Azerbaijan
BA Bosnia and Herzegovina
BB Barbados
BD Bangladesh
BE Belgium
BF Burkina Faso
BG Bulgaria
BH Bahrain
BI Burundi
BJ Benin
BM Bermuda
BN Brunei Darussalam
BO Bolivia
BR Brazil
BS Bahamas
BT Bhutan
BV Bouvet Island
BW Botswana
BY Belarus
BZ Belize
CA Canada
CC Cocos (Keeling Islands)
CD Congo, The Democratic Republic Of
CF Central African Republic
CH Switzerland
CI Ctte D'Ivoire
CK Cook Islands
CL Chile
CM Cameroon
CN China
CO Colombia
CR Costa Rica
CS Serbia And Montenegro
CU Cuba
CV Cape Verde
CX Christmas Island
CY Cyprus
CZ Czech Republic
DE Germany
DJ Djibouti
DK Denmark
DM Dominica
DO Dominican Republic
DZ Algeria
EC Ecuador
EE Estonia
EG Egypt
EH Western Sahara
ER Eritrea
ES Spain
ET Ethiopia
FI Finland
FJ Fiji
FK Falkland Islands (Malvinas)
FO Faroe Islands
FR France
GA Gabon
GB Great Britain (UK)
GD Grenada
GE Georgia
GF French Guiana
GG Guernsey
GH Ghana
GI Gibraltar
GL Greenland
GM Gambia
GN Guinea
GP Guadeloupe
GQ Equatorial Guinea
GR Greece
GS Sout Georgia and South Sandwich Isls
GT Guatemala
GW Guinea-Bissau
GY Guyana
HK Hong Kong
HM Heard Island and McDonald Islands
HN Honduras
HR Croatia (Hrvatska)
HT Haiti
HU Hungary
ID Indonesia
IE Ireland
IL Israel
IM Isle Of Man
IN India
IO British Indian Ocean Territory
IQ Iraq
IR Iran, Islamic Republic Of
IS Iceland
IT Italy
JE Jersey
JM Jamaica
JO Jordan
JP Japan
KE Kenya
KG Kyrgyzstan
KH Cambodia
KI Kiribati
KM Comoros
KN Saint Kitts and Nevis
KP Korea, D. Peoples Republic of
KR Korea, Republic of
KW Kuwait
KY Cayman Islands
KZ Kazakhstan
LA Lao Peoples Democratic Republic
LB Lebanon
LC Saint Lucia
LI Liechtenstein
LK Sri Lanka
LR Liberia
LS Lesotho
LT Lithuania
LU Luxembourg
LV Latvia
LY Libyan Arab Jamahiriya
MA Morocco
MC Monaco
MD Moldova
MG Madagascar
MK Macedonia
ML Mali
MM Myanmar
MN Mongolia
MO Macao
MQ Martinique
MR Mauritania
MS Montserrat
MT Malta
MU Mauritius
MV Maldives
MW Malawi
MX Mexico
MY Malaysia
MZ Mozambique
NA Namibia
NC New Caledonia
NE Niger
NF Norfolk Island
NG Nigeria
NI Nicaragua
NL Netherlands
NO Norway
NP Nepal
NR Nauru
NU Niue
NZ New Zealand
OM Oman
PA Panama
PE Peru
PF French Polynesia
PG Papua New Guinea
PH Philippines
PK Pakistan
PL Poland
PM Saint Pierre and Miquelon
PN Pitcairn
PS Palestinian Territory, Occupied
PT Portugal
PW Palau
PY Paraguay
QA Qatar
RE Reunion
RO Romania
RU Russian Federation
RW Rwanda
SA Saudi Arabia
SB Solomon Islands
SC Seychelles
SD Sudan
SE Sweden
SG Singapore
SH Saint Helena
SI Slovenia
SJ Svalbard and Jan Mayen Islands
SK Slovakia
SL Sierra Leone
SM San Marino
SN Senegal
SO Somalia
SR Suriname
ST Sao Tome and Principe
SV El Salvador
SY Syrian Arab Republic
SZ Swaziland
TC Turks and Caicos Islands
TD Chad
TF French Southern Territories
TG Togo
TH Thailand
TJ Tajikistan
TK Tokelau
TL Timor-Leste
TM Turkmenistan
TN Tunisia
TO Tonga
TR Turkey
TT Trinidad and Tobago
TV Tuvalu
TW Taiwan
TZ Tanzania, United Republic Of
UA Ukraine
UG Uganda
UM US Minor Outlying Islands
US United States
UY Uruguay
UZ Uzbekistan
VA Holy See (Vatican City State)
VC Saint Vincent and The Grenadines
VE Venezuela
VG Virgin Islands (British)
VN Viet Nam
VU Vanuatu
WF Wallis and Futuna Islands
WS Samoa
XK Kosovo
YE Yemen
YT Mayotte
ZA South Africa
ZM Zambia
ZW Zimbabwe
Source: NPPES API JSON Conversion Map.

Valid Countries

Show Code
# Read in Google Sheet
goog_state <- read_sheet(ss = id_documentation, sheet = "state")

# Print head of data
goog_state |>
  gt() |>
  gt_theme_nytimes()
abbreviation name
AA ARMED FORCES AMERICAS
AE ARMED FORCES EUROPE, CANADA, MIDDLE EAST, AFRICA
AK ALASKA
AL ALABAMA
AP ARMED FORCES PACIFIC
AR ARKANSAS
AS AMERICAN SAMOA
AZ ARIZONA
CA CALIFORNIA
CO COLORADO
CT CONNECTICUT
DC DISTRICT OF COLUMBIA
DE DELAWARE
FL FLORIDA
FM FEDERATED STATES OF MICRONESIA
GA GEORGIA
GU GUAM
HI HAWAII
IA IOWA
ID IDAHO
IL ILLINOIS
IN INDIANA
KS KANSAS
KY KENTUCKY
LA LOUISIANA
MA MASSACHUSETTS
MD MARYLAND
ME MAINE
MH MARSHALL ISLANDS
MI MICHIGAN
MN MINNESOTA
MO MISSOURI
MP MARIANA ISLANDS, NORTHERN
MS MISSISSIPPI
MT MONTANA
NC NORTH CAROLINA
ND NORTH DAKOTA
NE NEBRASKA
NH NEW HAMPSHIRE
NJ NEW JERSEY
NM NEW MEXICO
NV NEVADA
NY NEW YORK
OH OHIO
OK OKLAHOMA
OR OREGON
PA PENNSYLVANIA
PR PUERTO RICO
RI RHODE ISLAND
SC SOUTH CAROLINA
SD SOUTH DAKOTA
TN TENNESSEE
TX TEXAS
UT UTAH
VA VIRGINIA
VI VIRGIN ISLANDS
VT VERMONT
WA WASHINGTON
WI WISCONSIN
WV WEST VIRGINIA
WY WYOMING

Terminology Notes

Enumeration Type

Two categories of health care providers exist for NPI enumeration purposes: Entity Type 1 (Individual) and Entity Type 2 (Organization).

NPI-1: Individual

Individual health care providers (including sole proprietors) may get an NPI as Entity Type 1. As a sole proprietor, they must apply for the NPI using your own SSN, not an Employer Identification Number (EIN) even if they have an EIN. As a sole proprietor, they may get only one NPI, just like any other individual.

The following factors do not affect whether a sole proprietor is an Entity Type 1:

  • Number of different office locations
  • Whether they have employees
  • Whether the IRS issued them an EIN.


An incorporated individual is a single health care provider who forms and conducts business under a corporation. A sole proprietor is not an incorporated individual because the sole proprietor didn’t form a corporation. If you’re a sole/solo practitioner, it doesn’t necessarily mean you’re a sole proprietor, and vice versa. If you’re an individual health care provider who’s incorporated, you may need to get an NPI for yourself (Entity Type 1) and an NPI for your corporation or LLC (Entity Type 2).

NPI-2: Organizational

Organization health care providers are group health care providers eligible for NPIs as Entity Type 2. Organization health care providers may have a single employee or thousands of employees. An example is an incorporated individual who is an organization’s only employee.

Some organization health care providers are made up of parts that work somewhat independently from their parent organization. These parts may offer different types of health care or offer health care in separate physical locations. These parts and their physical locations aren’t themselves legal entities but are part of the organization health care provider (which is a legal entity). The NPI Final Rule refers to the parts and locations as subparts.

An organization health care provider can get its subparts their own NPIs. If a subpart conducts any HIPAA standard transactions on its own (separately from its parent), it must get its own NPI. Subpart determination makes sure that entities within a covered organization are uniquely identified in HIPAA standard transactions they conduct with Medicare and other covered entities. For example, a hospital offers acute care, laboratory, pharmacy, and rehabilitation services. Each of these subparts may need its own NPI because each sends its own standard transactions to one or more health plans.


Subpart delegation doesn’t affect Entity Type 1 health care providers. As individuals, these health care providers can’t choose subparts and are not subparts.

Last Updated/Created Epoch

Two columns that will appear in the initial output are last_updated_epoch and created_epoch. These are dates in Unix time and are the same as the dates in the basic.enumeration_date and basic.last_updated columns, which are the dates when the NPI was issued and when it was last updated. The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

You can convert back-and-forth in R like so:

# Convert from epoch to human-readable date
as.POSIXct(1183939200, origin = "1970-01-01", tz = "GMT")
# [1] "2007-07-09 GMT"
# Convert from human-readable date to epoch
as.numeric(as.POSIXct("2007-07-09 00:00:00", tz = "GMT", origin = "1970-01-01"))
# [1] 1183939200




Querying the API with {jsonlite}

Let’s say we want to look up a provider named John Sargeant. We can directly query the NPPES API by simply building out the html link according to the documentation, then using {jsonlite}’s fromJSON() function to call the results:

# Assign URL to object
jsarg_url <- "https://npiregistry.cms.hhs.gov/api/?version=2.1&first_name=John&last_name=Sargeant"

# Call API
jsarg_resp <- jsonlite::fromJSON(
  jsarg_url,
  simplifyDataFrame = FALSE,
  flatten = FALSE
)

# Inspect response
jsarg_resp |> lobstr::tree(max_depth = 2)
# <list>
# ├─result_count: 3
# └─results: <list>
#   ├─<list>...
#   ├─<list>...
#   └─<list>...

The call returned three results. Let’s look through each branch of the first one:

Enumeration Type

# $enumeration_type is the provider's npi type
jsarg_resp$results[[1]]$enumeration_type |> lobstr::tree()
# "NPI-1"

Number

# $number is the provider's npi
jsarg_resp$results[[1]]$number |> lobstr::tree()
# 1528060837

Basic

# $basic has the demographic information about the provider
jsarg_resp$results[[1]]$basic |> lobstr::tree()
# <list>
# ├─name_prefix: "MR."
# ├─first_name: "JOHN"
# ├─last_name: "SARGEANT"
# ├─middle_name: "B"
# ├─credential: "PT"
# ├─sole_proprietor: "NO"
# ├─gender: "M"
# ├─enumeration_date: "2005-06-01"
# ├─last_updated: "2007-07-09"
# ├─status: "A"
# └─name: "SARGEANT JOHN"

Other Names

# $other_names looks like it's empty
jsarg_resp$results[[1]]$other_names |> lobstr::tree()
# <list>
# Is $other_names empty?
insight::is_empty_object(jsarg_resp$results[[1]]$other_names)
# [1] TRUE

Addresses

# $addresses has information about the practice and mailing addresses
jsarg_resp$results[[1]]$addresses |> lobstr::tree()
# <list>
# ├─<list>
# │ ├─country_code: "US"
# │ ├─country_name: "United States"
# │ ├─address_purpose: "LOCATION"
# │ ├─address_type: "DOM"
# │ ├─address_1: "6000 EXECUTIVE BLVD"
# │ ├─address_2: "STE 201"
# │ ├─city: "ROCKVILLE"
# │ ├─state: "MD"
# │ ├─postal_code: "208523803"
# │ ├─telephone_number: "301-816-0020"
# │ └─fax_number: "301-816-0334"
# └─<list>
#   ├─country_code: "US"
#   ├─country_name: "United States"
#   ├─address_purpose: "MAILING"
#   ├─address_type: "DOM"
#   ├─address_1: "1939 OLD ANNAPOLIS RD"
#   ├─address_2: ""
#   ├─city: "WOODBINE"
#   ├─state: "MD"
#   ├─postal_code: "217978201"
#   └─telephone_number: "301-854-6748"
# $address_2 is empty
insight::is_empty_object(jsarg_resp$results$addresses[[2]]$address_2)
# [1] TRUE

Taxonomies

# $taxonomies has information about the provider's specialty
jsarg_resp$results[[1]]$taxonomies |> lobstr::tree()
# <list>
# └─<list>
#   ├─code: "225100000X"
#   ├─desc: "Physical Therapist"
#   ├─primary: TRUE
#   ├─state: "MD"
#   └─license: "14262"

Identifiers

# $identifiers contains ids from insurance payers
jsarg_resp$results[[1]]$identifiers |> lobstr::tree()
# <list>
# ├─<list>
# │ ├─identifier: "4074069"
# │ ├─code: "01"
# │ ├─desc: "Other"
# │ ├─state: "MD"
# │ └─issuer: "CIGNA"
# ├─<list>
# │ ├─identifier: "230033"
# │ ├─code: "01"
# │ ├─desc: "Other"
# │ ├─state: "MD"
# │ └─issuer: "UNITED HEALTHCARE"
# ├─<list>
# │ ├─identifier: "38311"
# │ ├─code: "01"
# │ ├─desc: "Other"
# │ ├─state: "MD"
# │ └─issuer: "MDIPA/ALLIANCE/MLH/OC"
# ├─<list>
# │ ├─identifier: "0129008"
# │ ├─code: "01"
# │ ├─desc: "Other"
# │ ├─state: "MD"
# │ └─issuer: "AETNA HMO"
# ├─<list>
# │ ├─identifier: "4296824"
# │ ├─code: "01"
# │ ├─desc: "Other"
# │ ├─state: "MD"
# │ └─issuer: "AETNA PPO"
# └─<list>
#   ├─identifier: "K366"
#   ├─code: "01"
#   ├─desc: "Other"
#   ├─state: "MD"
#   └─issuer: "BC/BS NON PROVIDER#"
Epochs (Last Updated / Created)
# $last_updated_epoch
jsarg_resp$results[[1]]$last_updated_epoch |> lobstr::tree()
# 1183939200
## Convert to MM-DD-YYYY Format
jsarg_resp$results[[1]]$last_updated_epoch |> as.POSIXct(origin = "1970-01-01", tz = "UTC")
# [1] "2007-07-09 UTC"
# $created_epoch
jsarg_resp$results[[1]]$created_epoch |> lobstr::tree()
# 1117584000
## Convert to MM-DD-YYYY Format
jsarg_resp$results[[1]]$created_epoch |> as.POSIXct(origin = "1970-01-01", tz = "UTC")
# [1] "2005-06-01 UTC"
# Equality of Dates
epoch_last_updated <- jsarg_resp$results[[1]]$last_updated_epoch |>
  as.POSIXct(origin = "1970-01-01", tz = "UTC")

basic_last_updated <- jsarg_resp$results[[1]]$basic$last_updated |>
  as.POSIXct(origin = "1970-01-01", tz = "UTC")

all.equal.POSIXt(epoch_last_updated, basic_last_updated)
# [1] TRUE
# Returns 7 (out of 126 total) providers whose records match "john" and "bethesda".
# Assign URL to object
nlm_url <- "https://clinicaltables.nlm.nih.gov/api/npi_idv/v3/search?terms=john+bethesda"

# Call API
nlm_resp <- jsonlite::fromJSON(
  nlm_url,
  simplifyDataFrame = TRUE,
  flatten = TRUE
)

# Inspect response
nlm_resp[[4]]
#      [,1]              [,2]         [,3]                                                             [,4]                                                                    
# [1,] "KELLY, JOHN"     "1760880173" "Dentist"                                                        "4833 BETHESDA AVE STE 302, BETHESDA, MD 20814"                         
# [2,] "VAVREK, JOHN"    "1801864624" "Military Health Care Provider"                                  "NNMC BETHESDA INTERNAL MEDICINE 8901 WISCONSIN AVE, BETHESDA, MD 20889"
# [3,] "MAYE, JOHN"      "1225008147" "Certified Registered Nurse Anesthetist (CRNA)"                  "8901 WISCONSIN AVE, BETHESDA, MD 20889"                                
# [4,] "SANCHEZ, JOHN"   "1437770369" "Student in an Organized Health Care Education/Training Program" "8901 WISCONSIN AVE, BETHESDA, MD 20889"                                
# [5,] "STANAVAGE, JOHN" "1710634175" "Student in an Organized Health Care Education/Training Program" "8901 WISCONSIN AVE, BETHESDA, MD 20889"                                
# [6,] "ORISASONA, JOHN" "1760833891" "Home Health Aide"                                               "3812 BETHESDA CT, CHESTER, VA 23831"                                   
# [7,] "SHUMAR, JOHN"    "1407389125" "Physician/Internal Medicine"                                    "8901 WISCONSIN AVE, BETHESDA, MD 20889"
nlm_resp2 <- httr::GET(nlm_url) |> httr::content()

nlm_npis <- nlm_resp2[[2]] |>
  unlist() |>
  enframe()

nlm_npis <- nlm_resp2[[4]] |>
  tibble() |>
  unnest() |>
  unnest_wider(1)

We need to “unnest” the lists so that we can get the data into a tidy format. I’ll go through one way to do it, building a function for each step:

Show Functions
# Function: Number & Enumeration Type
clean_npi_one <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    tibble::enframe() |>
    dplyr::mutate(name = case_when(name == 1 ~ section))

  response_section$group <- "basic"

  return(response_section)
}

# Function: Basic
clean_npi_basic <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    tibble::enframe() |>
    tidyr::unnest(value)

  response_section$group <- section

  return(response_section)
}

# Function: Identifiers
clean_npi_id <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    tibble::enframe() |>
    tidyr::unnest_wider(value) |>
    dplyr::select(name = issuer, value = identifier)

  response_section$group <- section

  return(response_section)
}

# Function: Taxonomies
clean_npi_tax <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    unlist() |>
    tibble::enframe()

  response_section$group <- section

  return(response_section)
}

# Function: Addresses
clean_npi_add <- function(response, results, section, purpose) {
  response_section <- response |>
    purrr::pluck(results, 1, section[[1]]) |>
    tibble::enframe() |>
    tidyr::unnest_wider(value) |>
    dplyr::group_split(name)

  response_subsection <- response_section[[purpose]] |>
    unlist() |>
    tibble::enframe()

  response_subsection$group <- section

  return(response_subsection)
}

# Bind Functions by Rows
function_test_final <- rbind(
  clean_npi_one(jsarg_resp, "results", "number"),
  clean_npi_one(jsarg_resp, "results", "enumeration_type"),
  clean_npi_basic(jsarg_resp, "results", "basic"),
  clean_npi_id(jsarg_resp, "results", "identifiers"),
  clean_npi_tax(jsarg_resp, "results", "taxonomies"),
  clean_npi_add(jsarg_resp, "results", "addresses", purpose = 1),
  clean_npi_add(jsarg_resp, "results", "addresses", purpose = 2)
)

# GT Table Output
function_test_final |>
  gt(
    rowname_col = "name",
    groupname_col = "group"
  ) |>
  gt_add_divider(
    columns = "value",
    sides = "left",
    style = "dotted",
    color = "lightgray",
    weight = px(2)
  ) |>
  tab_stubhead(label = "Description") |>
  tab_header(title = md("NPI Information for **John Sargeant, M.D.**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y"))) |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
NPI Information for John Sargeant, M.D.
Description value
basic
number 1528060837
enumeration_type NPI-1
name_prefix MR.
first_name JOHN
last_name SARGEANT
middle_name B
credential PT
sole_proprietor NO
gender M
enumeration_date 2005-06-01
last_updated 2007-07-09
status A
name SARGEANT JOHN
identifiers
CIGNA 4074069
UNITED HEALTHCARE 230033
MDIPA/ALLIANCE/MLH/OC 38311
AETNA HMO 0129008
AETNA PPO 4296824
BC/BS NON PROVIDER# K366
taxonomies
code 225100000X
desc Physical Therapist
primary TRUE
state MD
license 14262
addresses
name 1
country_code US
country_name United States
address_purpose LOCATION
address_type DOM
address_1 6000 EXECUTIVE BLVD
address_2 STE 201
city ROCKVILLE
state MD
postal_code 208523803
telephone_number 301-816-0020
fax_number 301-816-0334
name 2
country_code US
country_name United States
address_purpose MAILING
address_type DOM
address_1 1939 OLD ANNAPOLIS RD
address_2
city WOODBINE
state MD
postal_code 217978201
telephone_number 301-854-6748
fax_number NA
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:56:49 PM 2022




Building A Query with {httr}

I’ll build the exact same API request example from earlier, but construct the call with the {httr} package:

# Use GET() to begin the call
httr_req <- GET(
  url = "https://npiregistry.cms.hhs.gov/api/?version=2.1",
  query = list(
    first_name = "John",
    use_first_name_alias = "True",
    state = "MD",
    last_name = "Sargeant"
  )
)

httr_req |> lobstr::tree()
# S3<response>
# ├─url: "https://npiregistry.cms.hhs.gov/..."
# ├─status_code: 200
# ├─headers: S3<insensitive/list>
# │ ├─date: "Tue, 02 Aug 2022 23:56:53 GMT"
# │ ├─content-type: "application/json"
# │ ├─strict-transport-security: "max-age=31536000; includeSubDomains"
# │ ├─set-cookie: "TS017b4e40=01cffab1d37c78c5c4d57..."
# │ └─transfer-encoding: "chunked"
# ├─all_headers: <list>
# │ └─<list>
# │   ├─status: 200
# │   ├─version: "HTTP/1.1"
# │   └─headers: S3<insensitive/list>
# │     ├─date: "Tue, 02 Aug 2022 23:56:53 GMT"
# │     ├─content-type: "application/json"
# │     ├─strict-transport-security: "max-age=31536000; includeSubDomains"
# │     ├─set-cookie: "TS017b4e40=01cffab1d37c78c5c4d57..."
# │     └─transfer-encoding: "chunked"
# ├─cookies: S3<data.frame>
# │ ├─domain: ".npiregistry.cms.hhs.gov"
# │ ├─flag: TRUE
# │ ├─path: "/"
# │ ├─secure: FALSE
# │ ├─expiration: Inf
# │ ├─name: "TS017b4e40"
# │ └─value: "01cffab1d37c78c5c4d5768489d3d9b1..."
# ├─content<raw [1,744]>: 7b, 22, 72, 65, 73, 75, 6c, 74, 5f, 63, ...
# ├─date: 2022-08-02 23:56:53
# ├─times<dbl [6]>: 0, 0.001432, 0.036858, 0.119061, 0.159154, 0.159193
# ├─request: S3<request>
# │ ├─method: "GET"
# │ ├─url: "https://npiregistry.cms.hhs.gov/..."
# │ ├─headers: "application/json, text/xml, appl..."
# │ ├─fields: <NULL>
# │ ├─options: <list>
# │ │ ├─useragent: "libcurl/7.64.1 r-curl/4.3.2 httr..."
# │ │ └─httpget: TRUE
# │ ├─auth_token: <NULL>
# │ └─output: S3<write_memory/write_function>
# └─handle: S3<curl_handle>
# Parse the response
httr_resp <- jsonlite::fromJSON(rawToChar(httr_req$content),
  simplifyVector    = FALSE,
  simplifyMatrix    = FALSE,
  simplifyDataFrame = FALSE,
  flatten           = FALSE
)

# Inspect the response
httr_resp |> lobstr::tree()
# <list>
# ├─result_count: 1
# └─results: <list>
#   └─<list>
#     ├─enumeration_type: "NPI-1"
#     ├─number: 1528060837
#     ├─last_updated_epoch: 1183939200
#     ├─created_epoch: 1117584000
#     ├─basic: <list>
#     │ ├─name_prefix: "MR."
#     │ ├─first_name: "JOHN"
#     │ ├─last_name: "SARGEANT"
#     │ ├─middle_name: "B"
#     │ ├─credential: "PT"
#     │ ├─sole_proprietor: "NO"
#     │ ├─gender: "M"
#     │ ├─enumeration_date: "2005-06-01"
#     │ ├─last_updated: "2007-07-09"
#     │ ├─status: "A"
#     │ └─name: "SARGEANT JOHN"
#     ├─other_names: <list>
#     ├─addresses: <list>
#     │ ├─<list>
#     │ │ ├─country_code: "US"
#     │ │ ├─country_name: "United States"
#     │ │ ├─address_purpose: "LOCATION"
#     │ │ ├─address_type: "DOM"
#     │ │ ├─address_1: "6000 EXECUTIVE BLVD"
#     │ │ ├─address_2: "STE 201"
#     │ │ ├─city: "ROCKVILLE"
#     │ │ ├─state: "MD"
#     │ │ ├─postal_code: "208523803"
#     │ │ ├─telephone_number: "301-816-0020"
#     │ │ └─fax_number: "301-816-0334"
#     │ └─<list>
#     │   ├─country_code: "US"
#     │   ├─country_name: "United States"
#     │   ├─address_purpose: "MAILING"
#     │   ├─address_type: "DOM"
#     │   ├─address_1: "1939 OLD ANNAPOLIS RD"
#     │   ├─address_2: ""
#     │   ├─city: "WOODBINE"
#     │   ├─state: "MD"
#     │   ├─postal_code: "217978201"
#     │   └─telephone_number: "301-854-6748"
#     ├─taxonomies: <list>
#     │ └─<list>
#     │   ├─code: "225100000X"
#     │   ├─desc: "Physical Therapist"
#     │   ├─primary: TRUE
#     │   ├─state: "MD"
#     │   └─license: "14262"
#     └─identifiers: <list>
#       ├─<list>
#       │ ├─identifier: "4074069"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "CIGNA"
#       ├─<list>
#       │ ├─identifier: "230033"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "UNITED HEALTHCARE"
#       ├─<list>
#       │ ├─identifier: "38311"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "MDIPA/ALLIANCE/MLH/OC"
#       ├─<list>
#       │ ├─identifier: "0129008"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "AETNA HMO"
#       ├─<list>
#       │ ├─identifier: "4296824"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "AETNA PPO"
#       └─<list>
#         ├─identifier: "K366"
#         ├─code: "01"
#         ├─desc: "Other"
#         ├─state: "MD"
#         └─issuer: "BC/BS NON PROVIDER#"

Building A Query with {httr2}

# Create request that uses the base API url
httr2_req <- httr2::request("https://npiregistry.cms.hhs.gov/api/?version=2.1")

httr2_req |> lobstr::tree()
# S3<httr2_request>
# ├─url: "https://npiregistry.cms.hhs.gov/..."
# ├─method: <NULL>
# ├─headers: <list>
# ├─body: <NULL>
# ├─fields: <list>
# ├─options: <list>
# └─policies: <list>
httr2_resp <- httr2_req |>
  httr2::req_url_query(
    first_name = "John",
    last_name = "Sargeant",
    use_first_name_alias = "False",
    state = "MD"
  ) |>
  httr2::req_perform()

httr2_resp |> lobstr::tree()
# S3<httr2_response>
# ├─method: "GET"
# ├─url: "https://npiregistry.cms.hhs.gov/..."
# ├─status_code: 200
# ├─headers: S3<httr2_headers>
# │ ├─Date: "Tue, 02 Aug 2022 23:56:53 GMT"
# │ ├─Content-Type: "application/json"
# │ ├─Strict-Transport-Security: "max-age=31536000; includeSubDomains"
# │ ├─Set-Cookie: "TS017b4e40=01cffab1d3dc55d636160..."
# │ └─Transfer-Encoding: "chunked"
# └─body<raw [1,744]>: 7b, 22, 72, 65, 73, 75, 6c, 74, 5f, 63, ...
# The result comes back as JSON
httr2_resp |>
  resp_body_json() |>
  lobstr::tree()
# <list>
# ├─result_count: 1
# └─results: <list>
#   └─<list>
#     ├─enumeration_type: "NPI-1"
#     ├─number: 1528060837
#     ├─last_updated_epoch: 1183939200
#     ├─created_epoch: 1117584000
#     ├─basic: <list>
#     │ ├─name_prefix: "MR."
#     │ ├─first_name: "JOHN"
#     │ ├─last_name: "SARGEANT"
#     │ ├─middle_name: "B"
#     │ ├─credential: "PT"
#     │ ├─sole_proprietor: "NO"
#     │ ├─gender: "M"
#     │ ├─enumeration_date: "2005-06-01"
#     │ ├─last_updated: "2007-07-09"
#     │ ├─status: "A"
#     │ └─name: "SARGEANT JOHN"
#     ├─other_names: <list>
#     ├─addresses: <list>
#     │ ├─<list>
#     │ │ ├─country_code: "US"
#     │ │ ├─country_name: "United States"
#     │ │ ├─address_purpose: "LOCATION"
#     │ │ ├─address_type: "DOM"
#     │ │ ├─address_1: "6000 EXECUTIVE BLVD"
#     │ │ ├─address_2: "STE 201"
#     │ │ ├─city: "ROCKVILLE"
#     │ │ ├─state: "MD"
#     │ │ ├─postal_code: "208523803"
#     │ │ ├─telephone_number: "301-816-0020"
#     │ │ └─fax_number: "301-816-0334"
#     │ └─<list>
#     │   ├─country_code: "US"
#     │   ├─country_name: "United States"
#     │   ├─address_purpose: "MAILING"
#     │   ├─address_type: "DOM"
#     │   ├─address_1: "1939 OLD ANNAPOLIS RD"
#     │   ├─address_2: ""
#     │   ├─city: "WOODBINE"
#     │   ├─state: "MD"
#     │   ├─postal_code: "217978201"
#     │   └─telephone_number: "301-854-6748"
#     ├─taxonomies: <list>
#     │ └─<list>
#     │   ├─code: "225100000X"
#     │   ├─desc: "Physical Therapist"
#     │   ├─primary: TRUE
#     │   ├─state: "MD"
#     │   └─license: "14262"
#     └─identifiers: <list>
#       ├─<list>
#       │ ├─identifier: "4074069"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "CIGNA"
#       ├─<list>
#       │ ├─identifier: "230033"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "UNITED HEALTHCARE"
#       ├─<list>
#       │ ├─identifier: "38311"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "MDIPA/ALLIANCE/MLH/OC"
#       ├─<list>
#       │ ├─identifier: "0129008"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "AETNA HMO"
#       ├─<list>
#       │ ├─identifier: "4296824"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "AETNA PPO"
#       └─<list>
#         ├─identifier: "K366"
#         ├─code: "01"
#         ├─desc: "Other"
#         ├─state: "MD"
#         └─issuer: "BC/BS NON PROVIDER#"
# Query Datetime for reporting purposes
query_date <- httr2_resp$headers[["Date"]] |> anytime::anytime()
query_date
# [1] "2022-08-02 23:56:53 EDT"

We can wrap all of this up in a function:

# Function to search for a Single NPI
nppes_request_httr2 <- function(number) {
  request("https://npiregistry.cms.hhs.gov/api/?version=2.1") |>
    req_url_query(number = number) |>
    req_perform() |>
    resp_body_json(check_type = TRUE)
}

# Check the response
npi_httr2_resp <- nppes_request_httr2(1528060837)

npi_httr2_resp |> lobstr::tree()
# <list>
# ├─result_count: 1
# └─results: <list>
#   └─<list>
#     ├─enumeration_type: "NPI-1"
#     ├─number: 1528060837
#     ├─last_updated_epoch: 1183939200
#     ├─created_epoch: 1117584000
#     ├─basic: <list>
#     │ ├─name_prefix: "MR."
#     │ ├─first_name: "JOHN"
#     │ ├─last_name: "SARGEANT"
#     │ ├─middle_name: "B"
#     │ ├─credential: "PT"
#     │ ├─sole_proprietor: "NO"
#     │ ├─gender: "M"
#     │ ├─enumeration_date: "2005-06-01"
#     │ ├─last_updated: "2007-07-09"
#     │ ├─status: "A"
#     │ └─name: "SARGEANT JOHN"
#     ├─other_names: <list>
#     ├─addresses: <list>
#     │ ├─<list>
#     │ │ ├─country_code: "US"
#     │ │ ├─country_name: "United States"
#     │ │ ├─address_purpose: "LOCATION"
#     │ │ ├─address_type: "DOM"
#     │ │ ├─address_1: "6000 EXECUTIVE BLVD"
#     │ │ ├─address_2: "STE 201"
#     │ │ ├─city: "ROCKVILLE"
#     │ │ ├─state: "MD"
#     │ │ ├─postal_code: "208523803"
#     │ │ ├─telephone_number: "301-816-0020"
#     │ │ └─fax_number: "301-816-0334"
#     │ └─<list>
#     │   ├─country_code: "US"
#     │   ├─country_name: "United States"
#     │   ├─address_purpose: "MAILING"
#     │   ├─address_type: "DOM"
#     │   ├─address_1: "1939 OLD ANNAPOLIS RD"
#     │   ├─address_2: ""
#     │   ├─city: "WOODBINE"
#     │   ├─state: "MD"
#     │   ├─postal_code: "217978201"
#     │   └─telephone_number: "301-854-6748"
#     ├─taxonomies: <list>
#     │ └─<list>
#     │   ├─code: "225100000X"
#     │   ├─desc: "Physical Therapist"
#     │   ├─primary: TRUE
#     │   ├─state: "MD"
#     │   └─license: "14262"
#     └─identifiers: <list>
#       ├─<list>
#       │ ├─identifier: "4074069"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "CIGNA"
#       ├─<list>
#       │ ├─identifier: "230033"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "UNITED HEALTHCARE"
#       ├─<list>
#       │ ├─identifier: "38311"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "MDIPA/ALLIANCE/MLH/OC"
#       ├─<list>
#       │ ├─identifier: "0129008"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "AETNA HMO"
#       ├─<list>
#       │ ├─identifier: "4296824"
#       │ ├─code: "01"
#       │ ├─desc: "Other"
#       │ ├─state: "MD"
#       │ └─issuer: "AETNA PPO"
#       └─<list>
#         ├─identifier: "K366"
#         ├─code: "01"
#         ├─desc: "Other"
#         ├─state: "MD"
#         └─issuer: "BC/BS NON PROVIDER#"
## Multiple Calls: NPI-1, NPI-2, Deactivated
npis_list <- list(1336413418, 1710975040, 1659781227)

npis_purr <- npis_list |> purrr::map(nppes_request_httr2)
Show Code
npis_final_1 <- rbind(
  clean_npi_one(npis_purr[[1]], "results", "number"),
  clean_npi_one(npis_purr[[1]], "results", "enumeration_type"),
  clean_npi_basic(npis_purr[[1]], "results", "basic"),
  # clean_npi_id(npis_purr[[1]], "results", "identifiers"),
  clean_npi_tax(npis_purr[[1]], "results", "taxonomies"),
  clean_npi_add(npis_purr[[1]], "results", "addresses", purpose = 1),
  clean_npi_add(npis_purr[[1]], "results", "addresses", purpose = 2)
)

# GT Table Output
npis_final_1 |>
  gt(
    rowname_col = "name",
    groupname_col = "group"
  ) |>
  gt_add_divider(
    columns = "value",
    sides = "left",
    style = "dotted",
    color = "lightgray",
    weight = px(2)
  ) |>
  tab_stubhead(label = "Description") |>
  tab_header(title = md("NPI Information for **LUMINUS DIAGNOSTICS, LLC**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y"))) |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
NPI Information for LUMINUS DIAGNOSTICS, LLC
Description value
basic
number 1336413418
enumeration_type NPI-2
organization_name LUMINUS DIAGNOSTICS, LLC
organizational_subpart NO
enumeration_date 2012-03-07
last_updated 2020-01-07
status A
authorized_official_first_name LAUREL
authorized_official_last_name GAMAGE
authorized_official_middle_name SMITH
authorized_official_telephone_number 229-238-0790
authorized_official_title_or_position MANAGER
name LUMINUS DIAGNOSTICS, LLC
certification_date 2020-01-07
authorized_official_name_prefix MRS.
taxonomies
code 291U00000X
desc Clinical Medical Laboratory
primary TRUE
state
license
addresses
name 1
country_code US
country_name United States
address_purpose LOCATION
address_type DOM
address_1 2773 MARSHALL DR
address_2 SUITE D
city TIFTON
state GA
postal_code 317938101
telephone_number 229-238-0790
fax_number 229-238-0791
name 2
country_code US
country_name United States
address_purpose MAILING
address_type DOM
address_1 2773 MARSHALL DR
address_2 SUITE D
city TIFTON
state GA
postal_code 317938101
telephone_number 229-238-0790
fax_number 229-238-0791
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:56:55 PM 2022
Show Code
npis_final_2 <- rbind(
  clean_npi_one(npis_purr[[2]], "results", "number"),
  clean_npi_one(npis_purr[[2]], "results", "enumeration_type"),
  clean_npi_basic(npis_purr[[2]], "results", "basic"),
  # clean_npi_id(npis_purr[[2]], "results", "identifiers"),
  clean_npi_tax(npis_purr[[2]], "results", "taxonomies"),
  clean_npi_add(npis_purr[[2]], "results", "addresses", purpose = 1),
  clean_npi_add(npis_purr[[2]], "results", "addresses", purpose = 2)
)

# GT Table Output
npis_final_2 |>
  gt(
    rowname_col = "name",
    groupname_col = "group"
  ) |>
  gt_add_divider(
    columns = "value",
    sides = "left",
    style = "dotted",
    color = "lightgray",
    weight = px(2)
  ) |>
  tab_stubhead(label = "Description") |>
  tab_header(title = md("NPI Information for **John Herring, M.D.**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y"))) |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
NPI Information for John Herring, M.D.
Description value
basic
number 1710975040
enumeration_type NPI-1
first_name JOHN
last_name HERRING
middle_name E
credential MD
sole_proprietor NO
gender M
enumeration_date 2005-10-11
last_updated 2007-07-08
status A
name HERRING JOHN
taxonomies
code 207R00000X
desc Internal Medicine
primary TRUE
state MD
license D0030414
addresses
name 1
country_code US
country_name United States
address_purpose LOCATION
address_type DOM
address_1 18101 PRINCE PHILIP DR
address_2
city OLNEY
state MD
postal_code 208321514
telephone_number 301-774-8900
fax_number 301-570-8574
name 2
country_code US
country_name United States
address_purpose MAILING
address_type DOM
address_1 1300 PICCARD DR
address_2 SUITE 202
city ROCKVILLE
state MD
postal_code 208504303
telephone_number 310-921-7900
fax_number 301-921-7915
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:56:57 PM 2022




Building Functions for the API

Show Functions
# First Function: Query NPI
nppes_npi_call <- function(npi) {
  httr::GET(
    url = "https://npiregistry.cms.hhs.gov/api/?",
    query = list(
      number = {{ npi }},
      version = "2.1"
    )
  )
}

# Second Function: Basic
nppes_npi_basic <- function(list) {
  jsonlite::fromJSON(rawToChar({{ list }}$content),
    simplifyVector = FALSE,
    simplifyMatrix = TRUE,
    simplifyDataFrame = TRUE,
    flatten = TRUE
  )
}

# Third Function: Addresses
nppes_npi_address <- function(list) {
  {{ list }}$results |>
    tibble() |>
    unnest(addresses, names_sep = "_")
}

# Fourth Function: Taxonomies
nppes_npi_taxonomy <- function(list) {
  {{ list }} |>
    tibble() |>
    unnest(taxonomies, names_sep = "_")
}

nppes_npi_taxonomy2 <- function(list) {
  {{ list }} |>
    tibble() |>
    unnest_longer(c(
      taxonomies_code,
      taxonomies_desc,
      taxonomies_primary,
      taxonomies_state,
      taxonomies_license
    ))
}

# Fifth Function: Identifiers
nppes_npi_identifier <- function(list) {
  if (sum(lengths({{ list }}$identifiers)) == 0) {
    {{ list }} |>
      dplyr::select(-identifiers)
  } else {{{ list }} |>
    tibble() |>
    unnest_wider(identifiers, names_sep = "_") |>
    unnest(starts_with("ident"))  }
}

# Sixth Function: Other Names
nppes_npi_other_names <- function(list) {
  if (sum(lengths({{ list }}$other_names)) == 0) {
    {{ list }} |>
      dplyr::select(-other_names)
  } else {{{ list }} |>
    tibble() |>
    unnest(other_names, names_sep = "_")  }
}

# Seventh Function: Endpoints
nppes_npi_endpoints <- function(list) {
  if (is.null({{ list }}$endpoints) == FALSE) {
    {{ list }} |>
      tibble() |>
      unnest(endpoints, names_sep = "_")
  } else {
    return({{ list }})
  }
}

# Eighth Function: practiceLocations
nppes_npi_practiceLocations <- function(list) {
  if (is.null({{ list }}$practiceLocations) == FALSE) {
    {{ list }} |>
      tibble() |>
      unnest(practiceLocations, names_sep = "_")
  } else {
    return({{ list }})
  }
}

Pipe (|>) Example

npi_1528060837_pipe <- nppes_npi_call(1528060837) |>
  nppes_npi_basic() |>
  nppes_npi_address() |>
  nppes_npi_taxonomy() |>
  nppes_npi_identifier() |>
  nppes_npi_other_names()

# GT Table Output
npi_1528060837_pipe |>
  select(
    First = basic.first_name,
    Last = basic.last_name,
    Specialty = taxonomies_desc,
    NPI = number,
    Address = addresses_address_1,
    City = addresses_city,
    State = addresses_state,
    Issuer = identifiers_issuer,
    ID = identifiers_identifier,
    addresses_address_purpose
  ) |>
  gt(groupname_col = "addresses_address_purpose") |>
  tab_header(title = md("NPI Information for **John Sargeant, M.D.**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
NPI Information for John Sargeant, M.D.
First Last Specialty NPI Address City State Issuer ID
LOCATION
JOHN SARGEANT Physical Therapist 1528060837 6000 EXECUTIVE BLVD ROCKVILLE MD CIGNA 4074069
JOHN SARGEANT Physical Therapist 1528060837 6000 EXECUTIVE BLVD ROCKVILLE MD UNITED HEALTHCARE 230033
JOHN SARGEANT Physical Therapist 1528060837 6000 EXECUTIVE BLVD ROCKVILLE MD MDIPA/ALLIANCE/MLH/OC 38311
JOHN SARGEANT Physical Therapist 1528060837 6000 EXECUTIVE BLVD ROCKVILLE MD AETNA HMO 0129008
JOHN SARGEANT Physical Therapist 1528060837 6000 EXECUTIVE BLVD ROCKVILLE MD AETNA PPO 4296824
JOHN SARGEANT Physical Therapist 1528060837 6000 EXECUTIVE BLVD ROCKVILLE MD BC/BS NON PROVIDER# K366
MAILING
JOHN SARGEANT Physical Therapist 1528060837 1939 OLD ANNAPOLIS RD WOODBINE MD CIGNA 4074069
JOHN SARGEANT Physical Therapist 1528060837 1939 OLD ANNAPOLIS RD WOODBINE MD UNITED HEALTHCARE 230033
JOHN SARGEANT Physical Therapist 1528060837 1939 OLD ANNAPOLIS RD WOODBINE MD MDIPA/ALLIANCE/MLH/OC 38311
JOHN SARGEANT Physical Therapist 1528060837 1939 OLD ANNAPOLIS RD WOODBINE MD AETNA HMO 0129008
JOHN SARGEANT Physical Therapist 1528060837 1939 OLD ANNAPOLIS RD WOODBINE MD AETNA PPO 4296824
JOHN SARGEANT Physical Therapist 1528060837 1939 OLD ANNAPOLIS RD WOODBINE MD BC/BS NON PROVIDER# K366
Source: NPPES NPI Public Registry.

lapply() for Multiple NPIs

# Create a list of NPIs to look up:
npi_list <- list(1528060837, 1710975040)

# Use `lapply()` to iterate over the NPIs in the list:
npi_list <- lapply(npi_list, nppes_npi_call)

## Basic
npi_list <- lapply(npi_list, nppes_npi_basic)

## Address
npi_list <- lapply(npi_list, nppes_npi_address)

## Taxonomies
npi_list <- lapply(npi_list, nppes_npi_taxonomy)

## Identifiers
npi_list <- lapply(npi_list, nppes_npi_identifier)

## Other Names
npi_list <- lapply(npi_list, nppes_npi_other_names)

# First data frame
npi_list[[1]] |>
  gt() |>
  gt_preview()
enumeration_type number last_updated_epoch created_epoch addresses_country_code addresses_country_name addresses_address_purpose addresses_address_type addresses_address_1 addresses_address_2 addresses_city addresses_state addresses_postal_code addresses_telephone_number addresses_fax_number taxonomies_code taxonomies_desc taxonomies_primary taxonomies_state taxonomies_license identifiers_identifier identifiers_code identifiers_desc identifiers_state identifiers_issuer basic.name_prefix basic.first_name basic.last_name basic.middle_name basic.credential basic.sole_proprietor basic.gender basic.enumeration_date basic.last_updated basic.status basic.name
1 NPI-1 1528060837 1183939200 1117584000 US United States LOCATION DOM 6000 EXECUTIVE BLVD STE 201 ROCKVILLE MD 208523803 301-816-0020 301-816-0334 225100000X Physical Therapist TRUE MD 14262 4074069 01 Other MD CIGNA MR. JOHN SARGEANT B PT NO M 2005-06-01 2007-07-09 A SARGEANT JOHN
2 NPI-1 1528060837 1183939200 1117584000 US United States LOCATION DOM 6000 EXECUTIVE BLVD STE 201 ROCKVILLE MD 208523803 301-816-0020 301-816-0334 225100000X Physical Therapist TRUE MD 14262 230033 01 Other MD UNITED HEALTHCARE MR. JOHN SARGEANT B PT NO M 2005-06-01 2007-07-09 A SARGEANT JOHN
3 NPI-1 1528060837 1183939200 1117584000 US United States LOCATION DOM 6000 EXECUTIVE BLVD STE 201 ROCKVILLE MD 208523803 301-816-0020 301-816-0334 225100000X Physical Therapist TRUE MD 14262 38311 01 Other MD MDIPA/ALLIANCE/MLH/OC MR. JOHN SARGEANT B PT NO M 2005-06-01 2007-07-09 A SARGEANT JOHN
4 NPI-1 1528060837 1183939200 1117584000 US United States LOCATION DOM 6000 EXECUTIVE BLVD STE 201 ROCKVILLE MD 208523803 301-816-0020 301-816-0334 225100000X Physical Therapist TRUE MD 14262 0129008 01 Other MD AETNA HMO MR. JOHN SARGEANT B PT NO M 2005-06-01 2007-07-09 A SARGEANT JOHN
5 NPI-1 1528060837 1183939200 1117584000 US United States LOCATION DOM 6000 EXECUTIVE BLVD STE 201 ROCKVILLE MD 208523803 301-816-0020 301-816-0334 225100000X Physical Therapist TRUE MD 14262 4296824 01 Other MD AETNA PPO MR. JOHN SARGEANT B PT NO M 2005-06-01 2007-07-09 A SARGEANT JOHN
6..11
12 NPI-1 1528060837 1183939200 1117584000 US United States MAILING DOM 1939 OLD ANNAPOLIS RD WOODBINE MD 217978201 301-854-6748 NA 225100000X Physical Therapist TRUE MD 14262 K366 01 Other MD BC/BS NON PROVIDER# MR. JOHN SARGEANT B PT NO M 2005-06-01 2007-07-09 A SARGEANT JOHN
# Second data frame
npi_list[[2]] |>
  gt() |>
  gt_preview()
enumeration_type number last_updated_epoch created_epoch addresses_country_code addresses_country_name addresses_address_purpose addresses_address_type addresses_address_1 addresses_address_2 addresses_city addresses_state addresses_postal_code addresses_telephone_number addresses_fax_number taxonomies_code taxonomies_desc taxonomies_primary taxonomies_state taxonomies_license basic.first_name basic.last_name basic.middle_name basic.credential basic.sole_proprietor basic.gender basic.enumeration_date basic.last_updated basic.status basic.name
1 NPI-1 1710975040 1183852800 1128988800 US United States LOCATION DOM 18101 PRINCE PHILIP DR OLNEY MD 208321514 301-774-8900 301-570-8574 207R00000X Internal Medicine TRUE MD D0030414 JOHN HERRING E MD NO M 2005-10-11 2007-07-08 A HERRING JOHN
2 NPI-1 1710975040 1183852800 1128988800 US United States MAILING DOM 1300 PICCARD DR SUITE 202 ROCKVILLE MD 208504303 310-921-7900 301-921-7915 207R00000X Internal Medicine TRUE MD D0030414 JOHN HERRING E MD NO M 2005-10-11 2007-07-08 A HERRING JOHN




API Wrapper Functions

Show Function
get_npi_data <- function(npi) {
  resp <- httr::GET(
    url = "https://npiregistry.cms.hhs.gov/api/?",
    query = list(
      number = {{ npi }},
      enumeration_type = "",
      taxonomy_description = "",
      first_name = "",
      use_first_name_alias = "True",
      last_name = "",
      organization_name = "",
      address_purpose = "",
      city = "",
      state = "",
      postal_code = "",
      country_code = "",
      limit = "200",
      skip = "",
      pretty = "on",
      version = "2.1"
    )
  )

  content <- jsonlite::fromJSON(
    rawToChar(resp$content),
    simplifyVector = FALSE,
    simplifyMatrix = TRUE,
    simplifyDataFrame = TRUE,
    flatten = TRUE
  )

  if (sum(lengths(content)) == 3) {
    errors <- content$Errors |>
      tibble::tibble() |>
      dplyr::select(
        error_field = field,
        error_code = number,
        error_desc = description
      )

    number <- tibble::tibble(number = {{ npi }})

    c(number, errors)
  } else {
    basic <- content$results |>
      dplyr::select(number, enumeration_type, dplyr::starts_with("basic"))


    addresses <- content$results |>
      tibble::tibble() |>
      tidyr::unnest(addresses,
        names_sep = "_",
        keep_empty = TRUE
      ) |>
      dplyr::select(number, dplyr::starts_with("addresses"))


    taxonomies <- content$results |>
      tibble::tibble() |>
      tidyr::unnest(taxonomies,
        names_sep = "_",
        keep_empty = TRUE
      ) |>
      dplyr::select(number, dplyr::starts_with("taxonomies"))



    if (sum(lengths(content$results[["identifiers"]])) == 0) {
      identifiers <- tibble::tibble(number = {{ npi }}, identifiers = NA)
    } else {
      identifiers <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(
          identifiers,
          names_sep = "_",
          keep_empty = TRUE
        ) |>
        dplyr::select(number, dplyr::starts_with("identifiers"))
    }


    if (sum(lengths(content$results[["other_names"]])) == 0) {
      other_names <- tibble::tibble(number = {{ npi }}, other_names = NA)
    } else {
      other_names <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(other_names,
          names_sep = "_",
          keep_empty = TRUE
        ) |>
        dplyr::select(number, dplyr::starts_with("other_names"))
    }

    if (is.null(content$results[["endpoints"]]) == FALSE) {
      endpoints <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(endpoints, names_sep = "_", keep_empty = TRUE) |>
        dplyr::select(number, dplyr::starts_with("endpoints"))
    } else {
      endpoints <- tibble::tibble(number = {{ npi }}, endpoints = NA)
    }

    if (is.null(content$results[["practiceLocations"]]) == FALSE) {
      practiceLocations <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(practiceLocations, names_sep = "_", keep_empty = TRUE) |>
        dplyr::select(number, dplyr::starts_with("practiceLocations"))
    } else {
      practiceLocations <- tibble::tibble(number = {{ npi }}, practiceLocations = NA)
    }

    join1 <- dplyr::left_join(basic, addresses, by = "number")
    join2 <- dplyr::left_join(join1, taxonomies, by = "number")
    join3 <- dplyr::left_join(join2, identifiers, by = "number")
    join4 <- dplyr::left_join(join3, other_names, by = "number")
    join5 <- dplyr::left_join(join4, endpoints, by = "number")
    result <- dplyr::left_join(join5, practiceLocations, by = "number")

    return(result)
  }
}
## Single NPI-1 Call Test
get_npi_data(1710975040) |> gt()
number enumeration_type basic.credential basic.enumeration_date basic.first_name basic.gender basic.last_name basic.last_updated basic.middle_name basic.name basic.sole_proprietor basic.status addresses_address_1 addresses_address_2 addresses_address_purpose addresses_address_type addresses_city addresses_country_code addresses_country_name addresses_fax_number addresses_postal_code addresses_state addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_license taxonomies_primary taxonomies_state identifiers other_names endpoints practiceLocations
1710975040 NPI-1 MD 2005-10-11 JOHN M HERRING 2007-07-08 E HERRING JOHN NO A 18101 PRINCE PHILIP DR LOCATION DOM OLNEY US United States 301-570-8574 208321514 MD 301-774-8900 207R00000X Internal Medicine D0030414 TRUE MD NA NA NA NA
1710975040 NPI-1 MD 2005-10-11 JOHN M HERRING 2007-07-08 E HERRING JOHN NO A 1300 PICCARD DR SUITE 202 MAILING DOM ROCKVILLE US United States 301-921-7915 208504303 MD 310-921-7900 207R00000X Internal Medicine D0030414 TRUE MD NA NA NA NA
## Single NPI-2 Call Test
get_npi_data(1336413418) |> gt()
number enumeration_type basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_middle_name basic.authorized_official_name_prefix basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.certification_date basic.enumeration_date basic.last_updated basic.name basic.organization_name basic.organizational_subpart basic.status addresses_address_1 addresses_address_2 addresses_address_purpose addresses_address_type addresses_city addresses_country_code addresses_country_name addresses_fax_number addresses_postal_code addresses_state addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_license taxonomies_primary taxonomies_state identifiers other_names endpoints practiceLocations
1336413418 NPI-2 LAUREL GAMAGE SMITH MRS. 229-238-0790 MANAGER 2020-01-07 2012-03-07 2020-01-07 LUMINUS DIAGNOSTICS, LLC LUMINUS DIAGNOSTICS, LLC NO A 2773 MARSHALL DR SUITE D LOCATION DOM TIFTON US United States 229-238-0791 317938101 GA 229-238-0790 291U00000X Clinical Medical Laboratory TRUE NA NA NA NA
1336413418 NPI-2 LAUREL GAMAGE SMITH MRS. 229-238-0790 MANAGER 2020-01-07 2012-03-07 2020-01-07 LUMINUS DIAGNOSTICS, LLC LUMINUS DIAGNOSTICS, LLC NO A 2773 MARSHALL DR SUITE D MAILING DOM TIFTON US United States 229-238-0791 317938101 GA 229-238-0790 291U00000X Clinical Medical Laboratory TRUE NA NA NA NA
## Multiple Calls: NPI-1, NPI-2, Deactivated
npis_list <- list(1336413418, 1710975040, 1659781227)

npis_purr <- npis_list |> purrr::map_dfr(get_npi_data)

# 1336413418
npis_purr[1:2, ] |>
  janitor::remove_empty() |>
  gt() |>
  gt_theme_538()
number enumeration_type basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_middle_name basic.authorized_official_name_prefix basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.certification_date basic.enumeration_date basic.last_updated basic.name basic.organization_name basic.organizational_subpart basic.status addresses_address_1 addresses_address_2 addresses_address_purpose addresses_address_type addresses_city addresses_country_code addresses_country_name addresses_fax_number addresses_postal_code addresses_state addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_license taxonomies_primary taxonomies_state
1336413418 NPI-2 LAUREL GAMAGE SMITH MRS. 229-238-0790 MANAGER 2020-01-07 2012-03-07 2020-01-07 LUMINUS DIAGNOSTICS, LLC LUMINUS DIAGNOSTICS, LLC NO A 2773 MARSHALL DR SUITE D LOCATION DOM TIFTON US United States 229-238-0791 317938101 GA 229-238-0790 291U00000X Clinical Medical Laboratory TRUE
1336413418 NPI-2 LAUREL GAMAGE SMITH MRS. 229-238-0790 MANAGER 2020-01-07 2012-03-07 2020-01-07 LUMINUS DIAGNOSTICS, LLC LUMINUS DIAGNOSTICS, LLC NO A 2773 MARSHALL DR SUITE D MAILING DOM TIFTON US United States 229-238-0791 317938101 GA 229-238-0790 291U00000X Clinical Medical Laboratory TRUE
# 1710975040
npis_purr[3:4, ] |>
  janitor::remove_empty() |>
  gt() |>
  gt_theme_538()
number enumeration_type basic.enumeration_date basic.last_updated basic.name basic.status addresses_address_1 addresses_address_2 addresses_address_purpose addresses_address_type addresses_city addresses_country_code addresses_country_name addresses_fax_number addresses_postal_code addresses_state addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_license taxonomies_primary taxonomies_state basic.credential basic.first_name basic.gender basic.last_name basic.middle_name basic.sole_proprietor
1710975040 NPI-1 2005-10-11 2007-07-08 HERRING JOHN A 18101 PRINCE PHILIP DR LOCATION DOM OLNEY US United States 301-570-8574 208321514 MD 301-774-8900 207R00000X Internal Medicine D0030414 TRUE MD MD JOHN M HERRING E NO
1710975040 NPI-1 2005-10-11 2007-07-08 HERRING JOHN A 1300 PICCARD DR SUITE 202 MAILING DOM ROCKVILLE US United States 301-921-7915 208504303 MD 310-921-7900 207R00000X Internal Medicine D0030414 TRUE MD MD JOHN M HERRING E NO
# 1659781227
npis_purr[5, ] |>
  janitor::remove_empty() |>
  gt() |>
  gt_theme_538()
number error_field error_code error_desc
1659781227 number 15 CMS deactivated NPI 1659781227. The provider can no longer use this NPI. Our public registry does not display provider information about NPIs that are not in service.

Multiple Call Test #2 (Spreadsheet)

# Google Sheet ID
id_npi_sheet <- "1g1M7V_WWSegytmdZ1wjZeOVi84a265ywP9ncWGsRHPA"

# Read in Google Sheet
google_npi <- read_sheet(ss = id_npi_sheet, sheet = "Sheet1")

# Print head of data
google_npi |>
  gt() |>
  gt_preview() |>
  gt_theme_538()
npi last city county zip n_hcpcs pts proc avg_sub avg_allow avg_pymt
1 1932166386 Quest Diagnostics Clinical Laboratories Inc Tucker DeKalb 30084 555 2980662 4359607 154.97 25.85 25.46
2 1760579825 Clinical Laboratory Services, Inc. Winder Barrow 30680 131 216033 2850989 57.25 13.90 13.90
3 1750636676 Genova Diagnostics Inc Duluth Gwinnett 30096 34 83883 163984 50.65 19.10 19.10
4 1609273317 Lifebrite Laboratories, Llc Brookhaven DeKalb 30329 70 87284 130277 154.67 73.75 73.75
5 1275971707 Labsolutions Llc Atlanta Fulton 30318 127 53075 67191 119.51 100.56 100.56
6..58
59 1225291859 Kaiser Foundation Health Plan Of Georgia Inc. Atlanta Fulton 30328 1 15 29 10.00 2.44 2.44
# NPIs should be 10 digits
nchar(google_npi$npi[[1]])
# [1] 10
# Number of NPIs searched for
nrow(google_npi)
# [1] 59
length(google_npi$npi)
# [1] 59
google_npi_lookup <- google_npi$npi |>
  purrr::map_dfr(get_npi_data)

google_npi_lookup |>
  janitor::remove_empty() |>
  gt() |>
  gt_preview() |>
  gt_theme_538()
number enumeration_type basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_middle_name basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.certification_date basic.enumeration_date basic.last_updated basic.name basic.organization_name basic.organizational_subpart basic.parent_organization_ein basic.parent_organization_legal_business_name basic.status addresses_address_1 addresses_address_2 addresses_address_purpose addresses_address_type addresses_city addresses_country_code addresses_country_name addresses_postal_code addresses_state addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_license taxonomies_primary taxonomies_state basic.authorized_official_name_prefix addresses_fax_number identifiers_code identifiers_desc identifiers_identifier identifiers_issuer identifiers_state practiceLocations_address_1 practiceLocations_address_2 practiceLocations_address_type practiceLocations_city practiceLocations_country_code practiceLocations_country_name practiceLocations_fax_number practiceLocations_postal_code practiceLocations_state practiceLocations_telephone_number practiceLocations_update_date other_names_code other_names_organization_name other_names_type basic.authorized_official_credential endpoints_address_1 endpoints_address_2 endpoints_address_type endpoints_affiliation endpoints_affiliationName endpoints_city endpoints_contentOtherDescription endpoints_contentType endpoints_contentTypeDescription endpoints_country_code endpoints_country_name endpoints_endpoint endpoints_endpointDescription endpoints_endpointType endpoints_endpointTypeDescription endpoints_postal_code endpoints_state endpoints_use endpoints_useDescription endpoints_useOtherDescription taxonomies_taxonomy_group
1 1932166386 NPI-2 CHARLES BOWLES ALBERT 610-454-6000 VICE PRESIDENT 2020-08-24 2006-04-28 2020-08-24 QUEST DIAGNOSTICS CLINICAL LABORATORIES INC QUEST DIAGNOSTICS CLINICAL LABORATORIES INC YES <UNAVAIL> QUEST DIAGNOSTICS INCORPORATED A 1777 MONTREAL CIR LOCATION DOM TUCKER US United States 300846802 GA 866-697-8378 291U00000X Clinical Medical Laboratory 11D0255931 TRUE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
2 1932166386 NPI-2 CHARLES BOWLES ALBERT 610-454-6000 VICE PRESIDENT 2020-08-24 2006-04-28 2020-08-24 QUEST DIAGNOSTICS CLINICAL LABORATORIES INC QUEST DIAGNOSTICS CLINICAL LABORATORIES INC YES <UNAVAIL> QUEST DIAGNOSTICS INCORPORATED A 1201 S COLLEGEVILLE RD MAILING DOM COLLEGEVILLE US United States 194262998 PA 866-697-8378 291U00000X Clinical Medical Laboratory 11D0255931 TRUE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
3 1760579825 NPI-2 KERRY MASHBURN G 770-307-5820 REGISTERED AGENT NA 2006-10-09 2013-08-06 CLINICAL LABORATORY SERVICES, INC. CLINICAL LABORATORY SERVICES, INC. NO NA NA A 189 W ATHENS ST SUITE 2 LOCATION DOM WINDER US United States 306802295 GA 770-307-5820 291U00000X Clinical Medical Laboratory 007003 TRUE GA MR. 678-963-9946 05 MEDICAID 00762539A GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
4 1760579825 NPI-2 KERRY MASHBURN G 770-307-5820 REGISTERED AGENT NA 2006-10-09 2013-08-06 CLINICAL LABORATORY SERVICES, INC. CLINICAL LABORATORY SERVICES, INC. NO NA NA A 189 W ATHENS ST SUITE 2 LOCATION DOM WINDER US United States 306802295 GA 770-307-5820 291U00000X Clinical Medical Laboratory 007003 TRUE GA MR. 678-963-9946 01 Other 3500072 EVERCARE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
5 1760579825 NPI-2 KERRY MASHBURN G 770-307-5820 REGISTERED AGENT NA 2006-10-09 2013-08-06 CLINICAL LABORATORY SERVICES, INC. CLINICAL LABORATORY SERVICES, INC. NO NA NA A 189 W ATHENS ST SUITE 2 LOCATION DOM WINDER US United States 306802295 GA 770-307-5820 291U00000X Clinical Medical Laboratory 007003 TRUE GA MR. 678-963-9946 01 Other 690007903 RAILROAD MEDICARE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
6..211
212 1225291859 NPI-2 KATHERINE FARMER NA 404-309-9314 DIRECTOR OF LABORATORY SERVICES 2021-07-15 2008-07-03 2021-07-15 KAISER FOUNDATION HEALTH PLAN OF GEORGIA INC. KAISER FOUNDATION HEALTH PLAN OF GEORGIA INC. NO NA NA A 3495 PIEDMONT RD NE MAILING DOM ATLANTA US United States 303051773 GA NA 291U00000X Clinical Medical Laboratory 11D0259776 TRUE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3495 PIEDMONT RD NE DOM N ATLANTA C-CDA OTHER Other US United States https://careepiceast.kp.org:14430/Interconnect-prodgam/wcf/epic.community.hie/xcpdrespondinggateways Carequality SOAP SOAP URL 303051717 GA HIE Health Information Exchange (HIE) NA
google_npi_join <- dplyr::left_join(google_npi, google_npi_lookup, by = c("npi" = "number"))

# Add new sheet to Google Sheets workbook
# googlesheets4::sheet_add(ss = id_npi_sheet, sheet = "npi_join", .after = 1)

# Write joined data to new Google Sheet
# googlesheets4::write_sheet(google_npi_join, ss = id_npi_sheet, sheet = "npi_join")

google_npi_join |>
  janitor::remove_empty() |>
  gt() |>
  gt_preview() |>
  gt_theme_538()
npi last city county zip n_hcpcs pts proc avg_sub avg_allow avg_pymt enumeration_type basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_middle_name basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.certification_date basic.enumeration_date basic.last_updated basic.name basic.organization_name basic.organizational_subpart basic.parent_organization_ein basic.parent_organization_legal_business_name basic.status addresses_address_1 addresses_address_2 addresses_address_purpose addresses_address_type addresses_city addresses_country_code addresses_country_name addresses_postal_code addresses_state addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_license taxonomies_primary taxonomies_state basic.authorized_official_name_prefix addresses_fax_number identifiers_code identifiers_desc identifiers_identifier identifiers_issuer identifiers_state practiceLocations_address_1 practiceLocations_address_2 practiceLocations_address_type practiceLocations_city practiceLocations_country_code practiceLocations_country_name practiceLocations_fax_number practiceLocations_postal_code practiceLocations_state practiceLocations_telephone_number practiceLocations_update_date other_names_code other_names_organization_name other_names_type basic.authorized_official_credential endpoints_address_1 endpoints_address_2 endpoints_address_type endpoints_affiliation endpoints_affiliationName endpoints_city endpoints_contentOtherDescription endpoints_contentType endpoints_contentTypeDescription endpoints_country_code endpoints_country_name endpoints_endpoint endpoints_endpointDescription endpoints_endpointType endpoints_endpointTypeDescription endpoints_postal_code endpoints_state endpoints_use endpoints_useDescription endpoints_useOtherDescription taxonomies_taxonomy_group
1 1932166386 Quest Diagnostics Clinical Laboratories Inc Tucker DeKalb 30084 555 2980662 4359607 154.97 25.85 25.46 NPI-2 CHARLES BOWLES ALBERT 610-454-6000 VICE PRESIDENT 2020-08-24 2006-04-28 2020-08-24 QUEST DIAGNOSTICS CLINICAL LABORATORIES INC QUEST DIAGNOSTICS CLINICAL LABORATORIES INC YES <UNAVAIL> QUEST DIAGNOSTICS INCORPORATED A 1777 MONTREAL CIR LOCATION DOM TUCKER US United States 300846802 GA 866-697-8378 291U00000X Clinical Medical Laboratory 11D0255931 TRUE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
2 1932166386 Quest Diagnostics Clinical Laboratories Inc Tucker DeKalb 30084 555 2980662 4359607 154.97 25.85 25.46 NPI-2 CHARLES BOWLES ALBERT 610-454-6000 VICE PRESIDENT 2020-08-24 2006-04-28 2020-08-24 QUEST DIAGNOSTICS CLINICAL LABORATORIES INC QUEST DIAGNOSTICS CLINICAL LABORATORIES INC YES <UNAVAIL> QUEST DIAGNOSTICS INCORPORATED A 1201 S COLLEGEVILLE RD MAILING DOM COLLEGEVILLE US United States 194262998 PA 866-697-8378 291U00000X Clinical Medical Laboratory 11D0255931 TRUE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
3 1760579825 Clinical Laboratory Services, Inc. Winder Barrow 30680 131 216033 2850989 57.25 13.90 13.90 NPI-2 KERRY MASHBURN G 770-307-5820 REGISTERED AGENT NA 2006-10-09 2013-08-06 CLINICAL LABORATORY SERVICES, INC. CLINICAL LABORATORY SERVICES, INC. NO NA NA A 189 W ATHENS ST SUITE 2 LOCATION DOM WINDER US United States 306802295 GA 770-307-5820 291U00000X Clinical Medical Laboratory 007003 TRUE GA MR. 678-963-9946 05 MEDICAID 00762539A GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
4 1760579825 Clinical Laboratory Services, Inc. Winder Barrow 30680 131 216033 2850989 57.25 13.90 13.90 NPI-2 KERRY MASHBURN G 770-307-5820 REGISTERED AGENT NA 2006-10-09 2013-08-06 CLINICAL LABORATORY SERVICES, INC. CLINICAL LABORATORY SERVICES, INC. NO NA NA A 189 W ATHENS ST SUITE 2 LOCATION DOM WINDER US United States 306802295 GA 770-307-5820 291U00000X Clinical Medical Laboratory 007003 TRUE GA MR. 678-963-9946 01 Other 3500072 EVERCARE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
5 1760579825 Clinical Laboratory Services, Inc. Winder Barrow 30680 131 216033 2850989 57.25 13.90 13.90 NPI-2 KERRY MASHBURN G 770-307-5820 REGISTERED AGENT NA 2006-10-09 2013-08-06 CLINICAL LABORATORY SERVICES, INC. CLINICAL LABORATORY SERVICES, INC. NO NA NA A 189 W ATHENS ST SUITE 2 LOCATION DOM WINDER US United States 306802295 GA 770-307-5820 291U00000X Clinical Medical Laboratory 007003 TRUE GA MR. 678-963-9946 01 Other 690007903 RAILROAD MEDICARE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
6..211
212 1225291859 Kaiser Foundation Health Plan Of Georgia Inc. Atlanta Fulton 30328 1 15 29 10.00 2.44 2.44 NPI-2 KATHERINE FARMER NA 404-309-9314 DIRECTOR OF LABORATORY SERVICES 2021-07-15 2008-07-03 2021-07-15 KAISER FOUNDATION HEALTH PLAN OF GEORGIA INC. KAISER FOUNDATION HEALTH PLAN OF GEORGIA INC. NO NA NA A 3495 PIEDMONT RD NE MAILING DOM ATLANTA US United States 303051773 GA NA 291U00000X Clinical Medical Laboratory 11D0259776 TRUE GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 3495 PIEDMONT RD NE DOM N ATLANTA C-CDA OTHER Other US United States https://careepiceast.kp.org:14430/Interconnect-prodgam/wcf/epic.community.hie/xcpdrespondinggateways Carequality SOAP SOAP URL 303051717 GA HIE Health Information Exchange (HIE) NA

Second Version

Show Function
get_npi_data2 <- function(number = NULL,
                          enumeration_type = NULL,
                          taxonomy_description = NULL,
                          first_name = NULL,
                          use_first_name_alias = NULL,
                          last_name = NULL,
                          organization_name = NULL,
                          address_purpose = NULL,
                          city = NULL,
                          state = NULL,
                          postal_code = NULL,
                          country_code = NULL,
                          limit = "200",
                          skip = NULL,
                          pretty = NULL,
                          version = "2.1") {
  base_url <- "https://npiregistry.cms.hhs.gov/api/?"

  args <- list(
    version = version,
    number = {{ number }},
    enumeration_type = {{ enumeration_type }},
    taxonomy_description = {{ taxonomy_description }},
    first_name = first_name,
    use_first_name_alias = use_first_name_alias,
    last_name = last_name,
    organization_name = organization_name,
    address_purpose = address_purpose,
    city = city,
    state = state,
    postal_code = postal_code,
    country_code = country_code,
    limit = limit,
    skip = skip,
    pretty = pretty
  )


  # Check that at least one argument is not null
  attempt::stop_if_all(args, is.null, "You need to specify at least one argument")

  # Create the call
  resp <- httr::GET(base_url, query = purrr::compact(args))

  # Check the result
  check_status <- function(resp) {
    attempt::stop_if_not(
      .x = httr::status_code(resp),
      .p = ~ .x == 200,
      msg = "The API returned an error"
    )
  }
  check_status(resp)

  # Get the content and return it as a data.frame
  content <- fromJSON(
    rawToChar(resp$content),
    simplifyVector = FALSE,
    simplifyMatrix = TRUE,
    simplifyDataFrame = TRUE,
    flatten = TRUE
  )

  if (sum(lengths(content)) == 3) {
    errors <- content$Errors |>
      tibble::tibble() |>
      dplyr::select(
        error_field = field,
        error_code = number,
        error_desc = description
      )

    error_npi <- tibble::tibble(number = {{ number }}) |>
      dplyr::select(error_npi = number)

    c(error_npi, errors)
  } else {
    basic <- content$results |>
      dplyr::select(number, enumeration_type, dplyr::starts_with("basic"))


    addresses <- content$results |>
      tibble::tibble() |>
      tidyr::unnest(addresses,
        names_sep = "_",
        keep_empty = TRUE
      ) |>
      dplyr::select(number, dplyr::starts_with("addresses"))


    taxonomies <- content$results |>
      tibble::tibble() |>
      tidyr::unnest(taxonomies,
        names_sep = "_",
        keep_empty = TRUE
      ) |>
      dplyr::select(number, dplyr::starts_with("taxonomies"))



    if (sum(lengths(content$results[["identifiers"]])) == 0) {
      identifiers <- tibble::tibble(number = {{ number }}, identifiers = NA)
    } else {
      identifiers <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(
          identifiers,
          names_sep = "_",
          keep_empty = TRUE
        ) |>
        dplyr::select(number, dplyr::starts_with("identifiers"))
    }


    if (sum(lengths(content$results[["other_names"]])) == 0) {
      other_names <- tibble::tibble(number = {{ number }}, other_names = NA)
    } else {
      other_names <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(other_names,
          names_sep = "_",
          keep_empty = TRUE
        ) |>
        dplyr::select(number, dplyr::starts_with("other_names"))
    }

    if (is.null(content$results[["endpoints"]]) == FALSE) {
      endpoints <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(endpoints, names_sep = "_", keep_empty = TRUE) |>
        dplyr::select(number, dplyr::starts_with("endpoints"))
    } else {
      endpoints <- tibble::tibble(number = {{ number }}, endpoints = NA)
    }

    if (is.null(content$results[["practiceLocations"]]) == FALSE) {
      practiceLocations <- content$results |>
        tibble::tibble() |>
        tidyr::unnest(practiceLocations, names_sep = "_", keep_empty = TRUE) |>
        dplyr::select(number, dplyr::starts_with("practiceLocations"))
    } else {
      practiceLocations <- tibble::tibble(number = {{ number }}, practiceLocations = NA)
    }

    join1 <- dplyr::left_join(basic, addresses, by = "number")
    join2 <- dplyr::left_join(join1, taxonomies, by = "number")
    join3 <- dplyr::left_join(join2, identifiers, by = "number")
    join4 <- dplyr::left_join(join3, other_names, by = "number")
    join5 <- dplyr::left_join(join4, endpoints, by = "number")
    result <- dplyr::left_join(join5, practiceLocations, by = "number")

    result |> janitor::remove_empty(c("rows", "cols"))

    # dplyr::mutate(basic.enumeration_date = as.Date(basic.enumeration_date), basic.last_updated = as.Date(basic.last_updated))
  }
}
npi_list2 <- as.list(google_npi$npi)

npi_list2_results <- npi_list2 |> purrr::map_dfr(get_npi_data2)

npi_list2_results |>
  gt(groupname_col = "basic.organization_name", rowname_col = "number") |>
  tab_header(title = md("NPI Information for **Diagnostic Laboratories in Georgia**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y"))) |>
  gt_preview() |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
number enumeration_type basic.organization_name basic.organizational_subpart basic.enumeration_date basic.last_updated basic.status basic.parent_organization_ein basic.parent_organization_legal_business_name basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_middle_name basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.name basic.certification_date addresses_country_code addresses_country_name addresses_address_purpose addresses_address_type addresses_address_1 addresses_address_2 addresses_city addresses_state addresses_postal_code addresses_telephone_number taxonomies_code taxonomies_desc taxonomies_primary taxonomies_state taxonomies_license basic.authorized_official_name_prefix addresses_fax_number identifiers_identifier identifiers_code identifiers_desc identifiers_state identifiers_issuer practiceLocations_address_type practiceLocations_address_1 practiceLocations_address_2 practiceLocations_city practiceLocations_state practiceLocations_postal_code practiceLocations_country_code practiceLocations_country_name practiceLocations_fax_number practiceLocations_telephone_number practiceLocations_update_date other_names_organization_name other_names_code other_names_type basic.authorized_official_credential endpoints_endpointType endpoints_endpointTypeDescription endpoints_endpoint endpoints_endpointDescription endpoints_affiliation endpoints_affiliationName endpoints_use endpoints_useDescription endpoints_useOtherDescription endpoints_contentType endpoints_contentTypeDescription endpoints_contentOtherDescription endpoints_address_type endpoints_address_1 endpoints_address_2 endpoints_city endpoints_state endpoints_country_code endpoints_postal_code endpoints_country_name taxonomies_taxonomy_group
1 1932166386 NPI-2 QUEST DIAGNOSTICS CLINICAL LABORATORIES INC YES 2006-04-28 2020-08-24 A <UNAVAIL> QUEST DIAGNOSTICS INCORPORATED CHARLES BOWLES ALBERT 610-454-6000 VICE PRESIDENT QUEST DIAGNOSTICS CLINICAL LABORATORIES INC 2020-08-24 US United States LOCATION DOM 1777 MONTREAL CIR TUCKER GA 300846802 866-697-8378 291U00000X Clinical Medical Laboratory TRUE GA 11D0255931 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
2 1932166386 NPI-2 QUEST DIAGNOSTICS CLINICAL LABORATORIES INC YES 2006-04-28 2020-08-24 A <UNAVAIL> QUEST DIAGNOSTICS INCORPORATED CHARLES BOWLES ALBERT 610-454-6000 VICE PRESIDENT QUEST DIAGNOSTICS CLINICAL LABORATORIES INC 2020-08-24 US United States MAILING DOM 1201 S COLLEGEVILLE RD COLLEGEVILLE PA 194262998 866-697-8378 291U00000X Clinical Medical Laboratory TRUE GA 11D0255931 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
3 1760579825 NPI-2 CLINICAL LABORATORY SERVICES, INC. NO 2006-10-09 2013-08-06 A NA NA KERRY MASHBURN G 770-307-5820 REGISTERED AGENT CLINICAL LABORATORY SERVICES, INC. NA US United States LOCATION DOM 189 W ATHENS ST SUITE 2 WINDER GA 306802295 770-307-5820 291U00000X Clinical Medical Laboratory TRUE GA 007003 MR. 678-963-9946 00762539A 05 MEDICAID GA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
4 1760579825 NPI-2 CLINICAL LABORATORY SERVICES, INC. NO 2006-10-09 2013-08-06 A NA NA KERRY MASHBURN G 770-307-5820 REGISTERED AGENT CLINICAL LABORATORY SERVICES, INC. NA US United States LOCATION DOM 189 W ATHENS ST SUITE 2 WINDER GA 306802295 770-307-5820 291U00000X Clinical Medical Laboratory TRUE GA 007003 MR. 678-963-9946 3500072 01 Other GA EVERCARE NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
5 1760579825 NPI-2 CLINICAL LABORATORY SERVICES, INC. NO 2006-10-09 2013-08-06 A NA NA KERRY MASHBURN G 770-307-5820 REGISTERED AGENT CLINICAL LABORATORY SERVICES, INC. NA US United States LOCATION DOM 189 W ATHENS ST SUITE 2 WINDER GA 306802295 770-307-5820 291U00000X Clinical Medical Laboratory TRUE GA 007003 MR. 678-963-9946 690007903 01 Other GA RAILROAD MEDICARE NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
6..211
212 1225291859 NPI-2 KAISER FOUNDATION HEALTH PLAN OF GEORGIA INC. NO 2008-07-03 2021-07-15 A NA NA KATHERINE FARMER NA 404-309-9314 DIRECTOR OF LABORATORY SERVICES KAISER FOUNDATION HEALTH PLAN OF GEORGIA INC. 2021-07-15 US United States MAILING DOM 3495 PIEDMONT RD NE ATLANTA GA 303051773 NA 291U00000X Clinical Medical Laboratory TRUE GA 11D0259776 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA SOAP SOAP URL https://careepiceast.kp.org:14430/Interconnect-prodgam/wcf/epic.community.hie/xcpdrespondinggateways Carequality N HIE Health Information Exchange (HIE) OTHER Other C-CDA DOM 3495 PIEDMONT RD NE ATLANTA GA US 303051717 United States NA
gwinett_final <- get_npi_data2(number = 1982200317)

gwinett_final |>
  gt(
    groupname_col = "basic.organization_name",
    rowname_col = "addresses_address_purpose"
  ) |>
  gtExtras::gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines() |>
  tab_header(title = paste("NPI Information for", gwinett_final$basic.organization_name[[1]])) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y")))
NPI Information for GWINNETT COUNTY HEALTH DEPARTMENT
number enumeration_type basic.organizational_subpart basic.enumeration_date basic.last_updated basic.status basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.name basic.certification_date addresses_country_code addresses_country_name addresses_address_type addresses_address_1 addresses_address_2 addresses_city addresses_state addresses_postal_code addresses_telephone_number addresses_fax_number taxonomies_code taxonomies_desc taxonomies_primary taxonomies_state taxonomies_license other_names_organization_name other_names_code other_names_type endpoints_endpointType endpoints_endpointTypeDescription endpoints_endpoint endpoints_endpointDescription endpoints_affiliation endpoints_affiliationName endpoints_use endpoints_useDescription endpoints_useOtherDescription endpoints_contentType endpoints_contentTypeDescription endpoints_contentOtherDescription endpoints_address_type endpoints_address_1 endpoints_address_2 endpoints_city endpoints_state endpoints_country_code endpoints_postal_code endpoints_country_name
GWINNETT COUNTY HEALTH DEPARTMENT
LOCATION 1982200317 NPI-2 NO 2020-12-10 2020-12-10 A VERONICA HUDSON 678-442-6884 BILLING SUPERVISOR GWINNETT COUNTY HEALTH DEPARTMENT 2020-12-10 US United States DOM 2570 RIVERSIDE PKWY LAWRENCEVILLE GA 300463339 678-442-6884 770-339-4297 251K00000X Public Health or Welfare TRUE GWINNETT COUNTY BOARD OF HEALTH 3 Doing Business As DIRECT Direct Messaging Address veronica.hudson@gnrhealth.com N HIE Health Information Exchange (HIE) CSV CSV Fax DOM 2570 RIVERSIDE PKWY LAWRENCEVILLE GA US 300463339 United States
MAILING 1982200317 NPI-2 NO 2020-12-10 2020-12-10 A VERONICA HUDSON 678-442-6884 BILLING SUPERVISOR GWINNETT COUNTY HEALTH DEPARTMENT 2020-12-10 US United States DOM PO BOX 897 LAWRENCEVILLE GA 300460897 678-442-6884 770-339-4297 251K00000X Public Health or Welfare TRUE GWINNETT COUNTY BOARD OF HEALTH 3 Doing Business As DIRECT Direct Messaging Address veronica.hudson@gnrhealth.com N HIE Health Information Exchange (HIE) CSV CSV Fax DOM 2570 RIVERSIDE PKWY LAWRENCEVILLE GA US 300463339 United States
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:57:30 PM 2022
# lobstr
get_npi_data2(number = 1982200317) |> lobstr::ast()
# █─get_npi_data2 
# └─number = 1982200317
# lobstr
get_npi_data2(number = 1982200317) |> lobstr::ref()
# █ [1:0x1f77854b970] <df[,52]> 
# ├─number = [2:0x1f77710cb38] <dbl> 
# ├─enumeration_type = [3:0x1f77710cbb8] <chr> 
# ├─basic.organization_name = [4:0x1f77710cc38] <chr> 
# ├─basic.organizational_subpart = [5:0x1f77710ccb8] <chr> 
# ├─basic.enumeration_date = [6:0x1f77710cd38] <chr> 
# ├─basic.last_updated = [7:0x1f77710cdb8] <chr> 
# ├─basic.status = [8:0x1f77710ce38] <chr> 
# ├─basic.authorized_official_first_name = [9:0x1f77710ceb8] <chr> 
# ├─basic.authorized_official_last_name = [10:0x1f77710cf38] <chr> 
# ├─basic.authorized_official_telephone_number = [11:0x1f77710cfb8] <chr> 
# ├─basic.authorized_official_title_or_position = [12:0x1f77710d038] <chr> 
# ├─basic.name = [13:0x1f77710d0b8] <chr> 
# ├─basic.certification_date = [14:0x1f77710d138] <chr> 
# ├─addresses_country_code = [15:0x1f77710d1b8] <chr> 
# ├─addresses_country_name = [16:0x1f77710d238] <chr> 
# ├─addresses_address_purpose = [17:0x1f77710d2b8] <chr> 
# ├─addresses_address_type = [18:0x1f77710d338] <chr> 
# ├─addresses_address_1 = [19:0x1f77710d3b8] <chr> 
# ├─addresses_address_2 = [20:0x1f77710d438] <chr> 
# ├─addresses_city = [21:0x1f77710d4b8] <chr> 
# ├─addresses_state = [22:0x1f77710d538] <chr> 
# ├─addresses_postal_code = [23:0x1f77710d5b8] <chr> 
# ├─addresses_telephone_number = [24:0x1f77710d638] <chr> 
# ├─addresses_fax_number = [25:0x1f77710d6b8] <chr> 
# ├─taxonomies_code = [26:0x1f77710d738] <chr> 
# ├─taxonomies_desc = [27:0x1f77710d7b8] <chr> 
# ├─taxonomies_primary = [28:0x1f7763bdb80] <lgl> 
# ├─taxonomies_state = [29:0x1f77710d878] <chr> 
# ├─taxonomies_license = [30:0x1f77710d8f8] <chr> 
# ├─other_names_organization_name = [31:0x1f77710d9b8] <chr> 
# ├─other_names_code = [32:0x1f77710da38] <chr> 
# ├─other_names_type = [33:0x1f77710dab8] <chr> 
# ├─endpoints_endpointType = [34:0x1f77710db38] <chr> 
# ├─endpoints_endpointTypeDescription = [35:0x1f77710dbb8] <chr> 
# ├─endpoints_endpoint = [36:0x1f77710dc38] <chr> 
# ├─endpoints_endpointDescription = [37:0x1f77710dcf8] <chr> 
# ├─endpoints_affiliation = [38:0x1f77710dd78] <chr> 
# ├─endpoints_affiliationName = [39:0x1f77710ddf8] <chr> 
# ├─endpoints_use = [40:0x1f77710de78] <chr> 
# ├─endpoints_useDescription = [41:0x1f77710def8] <chr> 
# ├─endpoints_useOtherDescription = [42:0x1f77710df78] <chr> 
# ├─endpoints_contentType = [43:0x1f7770fc078] <chr> 
# ├─endpoints_contentTypeDescription = [44:0x1f7770fc0f8] <chr> 
# ├─endpoints_contentOtherDescription = [45:0x1f7770fc1b8] <chr> 
# ├─endpoints_address_type = [46:0x1f7770fc238] <chr> 
# ├─endpoints_address_1 = [47:0x1f7770fc2b8] <chr> 
# ├─endpoints_address_2 = [48:0x1f7770fc338] <chr> 
# ├─endpoints_city = [49:0x1f7770fc3b8] <chr> 
# ├─endpoints_state = [50:0x1f7770fc438] <chr> 
# ├─endpoints_country_code = [51:0x1f7770fc4b8] <chr> 
# ├─endpoints_postal_code = [52:0x1f7770fc538] <chr> 
# └─endpoints_country_name = [53:0x1f7770fc5b8] <chr>
# lobstr
get_npi_data2(number = 1982200317) |> lobstr::tree(index_unnamed = TRUE)
# S3<data.frame>
# ├─number<dbl [2]>: 1982200317, 1982200317
# ├─enumeration_type<chr [2]>: "NPI-2", "NPI-2"
# ├─basic.organization_name<chr [2]>: "GWINNETT COU...", "GWINNETT COU..."
# ├─basic.organizational_subpart<chr [2]>: "NO", "NO"
# ├─basic.enumeration_date<chr [2]>: "2020-12-10", "2020-12-10"
# ├─basic.last_updated<chr [2]>: "2020-12-10", "2020-12-10"
# ├─basic.status<chr [2]>: "A", "A"
# ├─basic.authorized_official_first_name<chr [2]>: "VERONICA", "VERONICA"
# ├─basic.authorized_official_last_name<chr [2]>: "HUDSON", "HUDSON"
# ├─basic.authorized_official_telephone_number<chr [2]>: "678-442-6884", "678-442-6884"
# ├─basic.authorized_official_title_or_position<chr [2]>: "BILLING SUPE...", "BILLING SUPE..."
# ├─basic.name<chr [2]>: "GWINNETT COU...", "GWINNETT COU..."
# ├─basic.certification_date<chr [2]>: "2020-12-10", "2020-12-10"
# ├─addresses_country_code<chr [2]>: "US", "US"
# ├─addresses_country_name<chr [2]>: "United States", "United States"
# ├─addresses_address_purpose<chr [2]>: "LOCATION", "MAILING"
# ├─addresses_address_type<chr [2]>: "DOM", "DOM"
# ├─addresses_address_1<chr [2]>: "2570 RIVERSI...", "PO BOX 897"
# ├─addresses_address_2<chr [2]>: "", ""
# ├─addresses_city<chr [2]>: "LAWRENCEVILLE", "LAWRENCEVILLE"
# ├─addresses_state<chr [2]>: "GA", "GA"
# ├─addresses_postal_code<chr [2]>: "300463339", "300460897"
# ├─addresses_telephone_number<chr [2]>: "678-442-6884", "678-442-6884"
# ├─addresses_fax_number<chr [2]>: "770-339-4297", "770-339-4297"
# ├─taxonomies_code<chr [2]>: "251K00000X", "251K00000X"
# ├─taxonomies_desc<chr [2]>: "Public Healt...", "Public Healt..."
# ├─taxonomies_primary<lgl [2]>: TRUE, TRUE
# ├─taxonomies_state<chr [2]>: "", ""
# ├─taxonomies_license<chr [2]>: "", ""
# ├─other_names_organization_name<chr [2]>: "GWINNETT COU...", "GWINNETT COU..."
# ├─other_names_code<chr [2]>: "3", "3"
# ├─other_names_type<chr [2]>: "Doing Busine...", "Doing Busine..."
# ├─endpoints_endpointType<chr [2]>: "DIRECT", "DIRECT"
# ├─endpoints_endpointTypeDescription<chr [2]>: "Direct Messa...", "Direct Messa..."
# ├─endpoints_endpoint<chr [2]>: "veronica.hud...", "veronica.hud..."
# ├─endpoints_endpointDescription<chr [2]>: "", ""
# ├─endpoints_affiliation<chr [2]>: "N", "N"
# ├─endpoints_affiliationName<chr [2]>: "", ""
# ├─endpoints_use<chr [2]>: "HIE", "HIE"
# ├─endpoints_useDescription<chr [2]>: "Health Infor...", "Health Infor..."
# ├─endpoints_useOtherDescription<chr [2]>: "", ""
# ├─endpoints_contentType<chr [2]>: "CSV", "CSV"
# ├─endpoints_contentTypeDescription<chr [2]>: "CSV", "CSV"
# ├─endpoints_contentOtherDescription<chr [2]>: "Fax", "Fax"
# ├─endpoints_address_type<chr [2]>: "DOM", "DOM"
# ├─endpoints_address_1<chr [2]>: "2570 RIVERSI...", "2570 RIVERSI..."
# ├─endpoints_address_2<chr [2]>: "", ""
# ├─endpoints_city<chr [2]>: "LAWRENCEVILLE", "LAWRENCEVILLE"
# ├─endpoints_state<chr [2]>: "GA", "GA"
# ├─endpoints_country_code<chr [2]>: "US", "US"
# ├─endpoints_postal_code<chr [2]>: "300463339", "300463339"
# └─endpoints_country_name<chr [2]>: "United States", "United States"
dekalb_final <- get_npi_data2(number = 1093716979)

dekalb_final |>
  gt(
    groupname_col = "basic.organization_name",
    rowname_col = "addresses_address_purpose"
  ) |>
  gtExtras::gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines() |>
  tab_header(title = paste("NPI Information for", dekalb_final$basic.organization_name[[1]])) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y")))
NPI Information for DEKALB MEDICAL CENTER, INC.
number enumeration_type basic.organizational_subpart basic.enumeration_date basic.last_updated basic.status basic.authorized_official_first_name basic.authorized_official_last_name basic.authorized_official_middle_name basic.authorized_official_telephone_number basic.authorized_official_title_or_position basic.name basic.certification_date addresses_country_code addresses_country_name addresses_address_type addresses_address_1 addresses_address_2 addresses_city addresses_state addresses_postal_code addresses_telephone_number addresses_fax_number taxonomies_code taxonomies_desc taxonomies_primary taxonomies_state taxonomies_license identifiers_identifier identifiers_code identifiers_desc identifiers_state identifiers_issuer other_names_organization_name other_names_code other_names_type
DEKALB MEDICAL CENTER, INC.
LOCATION 1093716979 NPI-2 NO 2005-08-02 2022-03-30 A AVA DAUNT-SAMFORD E 404-501-5025 VP/CFO DEKALB MEDICAL CENTER, INC. 2022-03-30 US United States DOM 2701 N DECATUR RD DECATUR GA 300335918 404-501-1000 NA 282N00000X General Acute Care Hospital TRUE GA 044039 000000536A 05 MEDICAID GA EMORY DECATUR HOSPITAL 3 Doing Business As
LOCATION 1093716979 NPI-2 NO 2005-08-02 2022-03-30 A AVA DAUNT-SAMFORD E 404-501-5025 VP/CFO DEKALB MEDICAL CENTER, INC. 2022-03-30 US United States DOM 2701 N DECATUR RD DECATUR GA 300335918 404-501-1000 NA 282N00000X General Acute Care Hospital TRUE GA 044039 100047 01 Other GA BCBS PROVIDER NUMBER EMORY DECATUR HOSPITAL 3 Doing Business As
MAILING 1093716979 NPI-2 NO 2005-08-02 2022-03-30 A AVA DAUNT-SAMFORD E 404-501-5025 VP/CFO DEKALB MEDICAL CENTER, INC. 2022-03-30 US United States DOM 2701 N DECATUR RD STE 1003B DECATUR GA 300335918 404-501-5025 404-501-5627 282N00000X General Acute Care Hospital TRUE GA 044039 000000536A 05 MEDICAID GA EMORY DECATUR HOSPITAL 3 Doing Business As
MAILING 1093716979 NPI-2 NO 2005-08-02 2022-03-30 A AVA DAUNT-SAMFORD E 404-501-5025 VP/CFO DEKALB MEDICAL CENTER, INC. 2022-03-30 US United States DOM 2701 N DECATUR RD STE 1003B DECATUR GA 300335918 404-501-5025 404-501-5627 282N00000X General Acute Care Hospital TRUE GA 044039 100047 01 Other GA BCBS PROVIDER NUMBER EMORY DECATUR HOSPITAL 3 Doing Business As
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:57:32 PM 2022
standardize_names <- names(dekalb_final) |> tibble()

standardize_names |> gt()
names(dekalb_final)
number
enumeration_type
basic.organization_name
basic.organizational_subpart
basic.enumeration_date
basic.last_updated
basic.status
basic.authorized_official_first_name
basic.authorized_official_last_name
basic.authorized_official_middle_name
basic.authorized_official_telephone_number
basic.authorized_official_title_or_position
basic.name
basic.certification_date
addresses_country_code
addresses_country_name
addresses_address_purpose
addresses_address_type
addresses_address_1
addresses_address_2
addresses_city
addresses_state
addresses_postal_code
addresses_telephone_number
addresses_fax_number
taxonomies_code
taxonomies_desc
taxonomies_primary
taxonomies_state
taxonomies_license
identifiers_identifier
identifiers_code
identifiers_desc
identifiers_state
identifiers_issuer
other_names_organization_name
other_names_code
other_names_type

API Functions

One

# Assign URL to object
# jsarg_url <- "https://npiregistry.cms.hhs.gov/api/?version=2.1&first_name=John&last_name=Sargeant"

# Call API
jsarg_resp <- jsonlite::fromJSON(
  jsarg_url,
  simplifyDataFrame = FALSE,
  flatten = FALSE
)

# Inspect response
jsarg_resp |> lobstr::tree(max_depth = 2)
# <list>
# ├─result_count: 3
# └─results: <list>
#   ├─<list>...
#   ├─<list>...
#   └─<list>...
# Function: Number & Enumeration Type
clean_npi_one <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    tibble::enframe() |>
    dplyr::mutate(name = case_when(name == 1 ~ section))

  response_section$group <- "basic"

  return(response_section)
}

# Function: Basic
clean_npi_basic <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    tibble::enframe() |>
    tidyr::unnest(value)

  response_section$group <- section

  return(response_section)
}

# Function: Identifiers
clean_npi_id <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    tibble::enframe() |>
    tidyr::unnest_wider(value) |>
    dplyr::select(name = issuer, value = identifier)

  response_section$group <- section

  return(response_section)
}

# Function: Taxonomies
clean_npi_tax <- function(response, results, section) {
  response_section <- response |>
    purrr::pluck(results, 1, section) |>
    unlist() |>
    tibble::enframe()

  response_section$group <- section

  return(response_section)
}

# Function: Addresses
clean_npi_add <- function(response, results, section, purpose) {
  response_section <- response |>
    purrr::pluck(results, 1, section[[1]]) |>
    tibble::enframe() |>
    tidyr::unnest_wider(value) |>
    dplyr::group_split(name)

  response_subsection <- response_section[[purpose]] |>
    unlist() |>
    tibble::enframe()

  response_subsection$group <- section

  return(response_subsection)
}

# Bind Functions by Rows
function_test_final <- rbind(
  clean_npi_one(jsarg_resp, "results", "number"),
  clean_npi_one(jsarg_resp, "results", "enumeration_type"),
  clean_npi_basic(jsarg_resp, "results", "basic"),
  clean_npi_id(jsarg_resp, "results", "identifiers"),
  clean_npi_tax(jsarg_resp, "results", "taxonomies"),
  clean_npi_add(jsarg_resp, "results", "addresses", purpose = 1),
  clean_npi_add(jsarg_resp, "results", "addresses", purpose = 2)
)

function_test_final |> gt()
name value group
number 1528060837 basic
enumeration_type NPI-1 basic
name_prefix MR. basic
first_name JOHN basic
last_name SARGEANT basic
middle_name B basic
credential PT basic
sole_proprietor NO basic
gender M basic
enumeration_date 2005-06-01 basic
last_updated 2007-07-09 basic
status A basic
name SARGEANT JOHN basic
CIGNA 4074069 identifiers
UNITED HEALTHCARE 230033 identifiers
MDIPA/ALLIANCE/MLH/OC 38311 identifiers
AETNA HMO 0129008 identifiers
AETNA PPO 4296824 identifiers
BC/BS NON PROVIDER# K366 identifiers
code 225100000X taxonomies
desc Physical Therapist taxonomies
primary TRUE taxonomies
state MD taxonomies
license 14262 taxonomies
name 1 addresses
country_code US addresses
country_name United States addresses
address_purpose LOCATION addresses
address_type DOM addresses
address_1 6000 EXECUTIVE BLVD addresses
address_2 STE 201 addresses
city ROCKVILLE addresses
state MD addresses
postal_code 208523803 addresses
telephone_number 301-816-0020 addresses
fax_number 301-816-0334 addresses
name 2 addresses
country_code US addresses
country_name United States addresses
address_purpose MAILING addresses
address_type DOM addresses
address_1 1939 OLD ANNAPOLIS RD addresses
address_2 addresses
city WOODBINE addresses
state MD addresses
postal_code 217978201 addresses
telephone_number 301-854-6748 addresses
fax_number NA addresses

Two

# Function to search for a Single NPI
nppes_request_httr2 <- function(number) {
  request("https://npiregistry.cms.hhs.gov/api/?version=2.1") |>
    req_url_query(number = number) |>
    req_perform() |>
    resp_body_json(check_type = TRUE)
}

# Check the response
npi_httr2_resp <- nppes_request_httr2(1528060837)

npi_httr2_resp |> lobstr::ref()
# █ [1:0x1f7781c3da8] <named list> 
# ├─result_count = [2:0x1f776c9b4c0] <int> 
# └─results = █ [3:0x1f776c9b4f8] <list> 
#             └─█ [4:0x1f7745f4888] <named list> 
#               ├─enumeration_type = [5:0x1f776c9b568] <chr> 
#               ├─number = [6:0x1f776c9b5a0] <int> 
#               ├─last_updated_epoch = [7:0x1f776c9b5d8] <int> 
#               ├─created_epoch = [8:0x1f776c9b680] <int> 
#               ├─basic = █ [9:0x1f7745f4a98] <named list> 
#               │         ├─name_prefix = [10:0x1f776c9b6b8] <chr> 
#               │         ├─first_name = [11:0x1f776c9b6f0] <chr> 
#               │         ├─last_name = [12:0x1f776c9b728] <chr> 
#               │         ├─middle_name = [13:0x1f776c9b7d0] <chr> 
#               │         ├─credential = [14:0x1f776c9b808] <chr> 
#               │         ├─sole_proprietor = [15:0x1f776c9b840] <chr> 
#               │         ├─gender = [16:0x1f776c9b878] <chr> 
#               │         ├─enumeration_date = [17:0x1f776c9b8b0] <chr> 
#               │         ├─last_updated = [18:0x1f776c9b8e8] <chr> 
#               │         ├─status = [19:0x1f776c9b920] <chr> 
#               │         └─name = [20:0x1f776c9b958] <chr> 
#               ├─other_names = █ [21:0x1f771199c78] <list> 
#               ├─addresses = █ [22:0x1f7781c3ca8] <list> 
#               │             ├─█ [23:0x1f7745f4e08] <named list> 
#               │             │ ├─country_code = [24:0x1f776c9b990] <chr> 
#               │             │ ├─country_name = [25:0x1f776c9b9c8] <chr> 
#               │             │ ├─address_purpose = [26:0x1f776c9ba00] <chr> 
#               │             │ ├─address_type = [27:0x1f776c9ba38] <chr> 
#               │             │ ├─address_1 = [28:0x1f776c9ba70] <chr> 
#               │             │ ├─address_2 = [29:0x1f776c9bb50] <chr> 
#               │             │ ├─city = [30:0x1f776c9bb88] <chr> 
#               │             │ ├─state = [31:0x1f776c9bbc0] <chr> 
#               │             │ ├─postal_code = [32:0x1f776c9bbf8] <chr> 
#               │             │ ├─telephone_number = [33:0x1f776c9bc30] <chr> 
#               │             │ └─fax_number = [34:0x1f776c9bd48] <chr> 
#               │             └─█ [35:0x1f7745f5228] <named list> 
#               │               ├─country_code = [36:0x1f776c9bdb8] <chr> 
#               │               ├─country_name = [37:0x1f776c9bdf0] <chr> 
#               │               ├─address_purpose = [38:0x1f776c9be28] <chr> 
#               │               ├─address_type = [39:0x1f776c9be60] <chr> 
#               │               ├─address_1 = [40:0x1f776c9be98] <chr> 
#               │               ├─address_2 = [41:0x1f776c9bed0] <chr> 
#               │               ├─city = [42:0x1f776c9bf08] <chr> 
#               │               ├─state = [43:0x1f776c9bf40] <chr> 
#               │               ├─postal_code = [44:0x1f776c74190] <chr> 
#               │               └─telephone_number = [45:0x1f776c741c8] <chr> 
#               ├─taxonomies = █ [46:0x1f776c742a8] <list> 
#               │              └─█ [47:0x1f778018038] <named list> 
#               │                ├─code = [48:0x1f776c742e0] <chr> 
#               │                ├─desc = [49:0x1f776c74318] <chr> 
#               │                ├─primary = [50:0x1f76482ee40] <lgl> 
#               │                ├─state = [51:0x1f776c74350] <chr> 
#               │                └─license = [52:0x1f776c74388] <chr> 
#               └─identifiers = █ [53:0x1f778011278] <list> 
#                               ├─█ [54:0x1f7780119e8] <named list> 
#                               │ ├─identifier = [55:0x1f776c743c0] <chr> 
#                               │ ├─code = [56:0x1f776c743f8] <chr> 
#                               │ ├─desc = [57:0x1f776c74430] <chr> 
#                               │ ├─state = [58:0x1f776c74468] <chr> 
#                               │ └─issuer = [59:0x1f776c744a0] <chr> 
#                               ├─█ [60:0x1f778011c18] <named list> 
#                               │ ├─identifier = [61:0x1f776c744d8] <chr> 
#                               │ ├─code = [62:0x1f776c74510] <chr> 
#                               │ ├─desc = [63:0x1f776c74548] <chr> 
#                               │ ├─state = [64:0x1f776c74580] <chr> 
#                               │ └─issuer = [65:0x1f776c745b8] <chr> 
#                               ├─█ [66:0x1f778011e48] <named list> 
#                               │ ├─identifier = [67:0x1f776c745f0] <chr> 
#                               │ ├─code = [68:0x1f776c74628] <chr> 
#                               │ ├─desc = [69:0x1f776c74698] <chr> 
#                               │ ├─state = [70:0x1f776c746d0] <chr> 
#                               │ └─issuer = [71:0x1f776c74708] <chr> 
#                               ├─█ [72:0x1f778011f28] <named list> 
#                               │ ├─identifier = [73:0x1f776c74740] <chr> 
#                               │ ├─code = [74:0x1f776c74778] <chr> 
#                               │ ├─desc = [75:0x1f776c747b0] <chr> 
#                               │ ├─state = [76:0x1f776c747e8] <chr> 
#                               │ └─issuer = [77:0x1f776c74820] <chr> 
#                               ├─█ [78:0x1f778000158] <named list> 
#                               │ ├─identifier = [79:0x1f776c74858] <chr> 
#                               │ ├─code = [80:0x1f776c74890] <chr> 
#                               │ ├─desc = [81:0x1f776c748c8] <chr> 
#                               │ ├─state = [82:0x1f776c74900] <chr> 
#                               │ └─issuer = [83:0x1f776c74938] <chr> 
#                               └─█ [84:0x1f778000548] <named list> 
#                                 ├─identifier = [85:0x1f776c74970] <chr> 
#                                 ├─code = [86:0x1f776c749e0] <chr> 
#                                 ├─desc = [87:0x1f776c74a18] <chr> 
#                                 ├─state = [88:0x1f776c74ac0] <chr> 
#                                 └─issuer = [89:0x1f776c74af8] <chr>
# Query Datetime for reporting purposes
# query_date <- npi_httr2_resp$headers[["Date"]]
## Multiple Calls: NPI-1, NPI-2, Deactivated
npis_list <- list(1336413418, 1710975040, 1659781227)

npis_purr <- npis_list |> purrr::map(nppes_request_httr2)
Show Code
npis_final_1 <- rbind(
  clean_npi_one(npis_purr[[1]], "results", "number"),
  clean_npi_one(npis_purr[[1]], "results", "enumeration_type"),
  clean_npi_basic(npis_purr[[1]], "results", "basic"),
  # clean_npi_id(npis_purr[[1]], "results", "identifiers"),
  clean_npi_tax(npis_purr[[1]], "results", "taxonomies"),
  clean_npi_add(npis_purr[[1]], "results", "addresses", purpose = 1),
  clean_npi_add(npis_purr[[1]], "results", "addresses", purpose = 2)
)

# GT Table Output
npis_final_1 |>
  gt(
    rowname_col = "name",
    groupname_col = "group"
  ) |>
  gt_add_divider(
    columns = "value",
    sides = "left",
    style = "dotted",
    color = "lightgray",
    weight = px(2)
  ) |>
  tab_stubhead(label = "Description") |>
  tab_header(title = md("NPI Information for **LUMINUS DIAGNOSTICS, LLC**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y"))) |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
NPI Information for LUMINUS DIAGNOSTICS, LLC
Description value
basic
number 1336413418
enumeration_type NPI-2
organization_name LUMINUS DIAGNOSTICS, LLC
organizational_subpart NO
enumeration_date 2012-03-07
last_updated 2020-01-07
status A
authorized_official_first_name LAUREL
authorized_official_last_name GAMAGE
authorized_official_middle_name SMITH
authorized_official_telephone_number 229-238-0790
authorized_official_title_or_position MANAGER
name LUMINUS DIAGNOSTICS, LLC
certification_date 2020-01-07
authorized_official_name_prefix MRS.
taxonomies
code 291U00000X
desc Clinical Medical Laboratory
primary TRUE
state
license
addresses
name 1
country_code US
country_name United States
address_purpose LOCATION
address_type DOM
address_1 2773 MARSHALL DR
address_2 SUITE D
city TIFTON
state GA
postal_code 317938101
telephone_number 229-238-0790
fax_number 229-238-0791
name 2
country_code US
country_name United States
address_purpose MAILING
address_type DOM
address_1 2773 MARSHALL DR
address_2 SUITE D
city TIFTON
state GA
postal_code 317938101
telephone_number 229-238-0790
fax_number 229-238-0791
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:57:39 PM 2022
Show Code
npis_final_2 <- rbind(
  clean_npi_one(npis_purr[[2]], "results", "number"),
  clean_npi_one(npis_purr[[2]], "results", "enumeration_type"),
  clean_npi_basic(npis_purr[[2]], "results", "basic"),
  # clean_npi_id(npis_purr[[2]], "results", "identifiers"),
  clean_npi_tax(npis_purr[[2]], "results", "taxonomies"),
  clean_npi_add(npis_purr[[2]], "results", "addresses", purpose = 1),
  clean_npi_add(npis_purr[[2]], "results", "addresses", purpose = 2)
)

# GT Table Output
npis_final_2 |>
  gt(
    rowname_col = "name",
    groupname_col = "group"
  ) |>
  gt_add_divider(
    columns = "value",
    sides = "left",
    style = "dotted",
    color = "lightgray",
    weight = px(2)
  ) |>
  tab_stubhead(label = "Description") |>
  tab_header(title = md("NPI Information for **John Herring, M.D.**")) |>
  tab_source_note(source_note = md("*Source:* NPPES NPI Public Registry.")) |>
  tab_source_note(source_note = paste("Current as of:", format(Sys.time(), "%a %b %d %X %Y"))) |>
  gt_theme_538() |>
  opt_row_striping() |>
  opt_table_outline() |>
  opt_table_lines()
NPI Information for John Herring, M.D.
Description value
basic
number 1710975040
enumeration_type NPI-1
first_name JOHN
last_name HERRING
middle_name E
credential MD
sole_proprietor NO
gender M
enumeration_date 2005-10-11
last_updated 2007-07-08
status A
name HERRING JOHN
taxonomies
code 207R00000X
desc Internal Medicine
primary TRUE
state MD
license D0030414
addresses
name 1
country_code US
country_name United States
address_purpose LOCATION
address_type DOM
address_1 18101 PRINCE PHILIP DR
address_2
city OLNEY
state MD
postal_code 208321514
telephone_number 301-774-8900
fax_number 301-570-8574
name 2
country_code US
country_name United States
address_purpose MAILING
address_type DOM
address_1 1300 PICCARD DR
address_2 SUITE 202
city ROCKVILLE
state MD
postal_code 208504303
telephone_number 310-921-7900
fax_number 301-921-7915
Source: NPPES NPI Public Registry.
Current as of: Tue Aug 02 7:57:41 PM 2022

Three

BODY———————————————




Other Healthcare APIs

Resources

Citations

Package Version Citation
anytime 0.3.9 Eddelbuettel (2020)
attempt 0.3.1 Fay (2020)
base 4.2.1 R Core Team (2022)
distill 1.4 Dervieux et al. (2022)
grateful 0.1.11 Rodríguez-Sánchez, Jackson, and Hutchins (2022)
gt 0.6.0 Iannone, Cheng, and Schloerke (2022)
gtExtras 0.4.1 Mock (2022)
htmltools 0.5.3 Cheng et al. (2022)
httr2 0.2.1 Wickham (2022a)
insight 0.18.0 Lüdecke, Waggoner, and Makowski (2019)
janitor 2.1.0 Firke (2021)
knitr 1.39 Xie (2014); Xie (2015); Xie (2022)
lobstr 1.1.2 Wickham (2022b)
rmarkdown 2.14 Xie, Allaire, and Grolemund (2018); Xie, Dervieux, and Riederer (2020); Allaire et al. (2022)
sessioninfo 1.2.2 Wickham et al. (2021)
tidyverse 1.3.2 Wickham et al. (2019)
xaringanExtra 0.7.0 Aden-Buie and Warkentin (2022)

Last updated on

# [1] "2022-08-02 19:57:48 EDT"

Session Info

Session Info
session
# ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#  setting  value
#  version  R version 4.2.1 (2022-06-23 ucrt)
#  os       Windows 10 x64 (build 25169)
#  system   x86_64, mingw32
#  ui       RTerm
#  language (EN)
#  collate  English_United States.utf8
#  ctype    English_United States.utf8
#  tz       America/New_York
#  date     2022-08-02
#  pandoc   2.18 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
# 
# ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#  package       * version    date (UTC) lib source
#  anytime         0.3.9      2020-08-27 [1] CRAN (R 4.2.0)
#  askpass         1.1        2019-01-13 [1] CRAN (R 4.2.0)
#  assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.2.0)
#  attempt         0.3.1      2020-05-03 [1] CRAN (R 4.2.1)
#  backports       1.4.1      2021-12-13 [1] CRAN (R 4.2.0)
#  broom           1.0.0      2022-07-01 [1] CRAN (R 4.2.1)
#  bslib           0.4.0.9000 2022-08-02 [1] Github (rstudio/bslib@b26de80)
#  cachem          1.0.6      2021-08-19 [1] CRAN (R 4.2.0)
#  cellranger      1.1.0      2016-07-27 [1] CRAN (R 4.2.0)
#  checkmate       2.1.0      2022-04-21 [1] CRAN (R 4.2.0)
#  cli             3.3.0      2022-04-25 [1] CRAN (R 4.2.0)
#  colorspace      2.0-3      2022-02-21 [1] CRAN (R 4.2.0)
#  commonmark      1.8.0      2022-03-09 [1] CRAN (R 4.2.0)
#  crayon          1.5.1      2022-03-26 [1] CRAN (R 4.2.0)
#  curl            4.3.2      2021-06-23 [1] CRAN (R 4.2.1)
#  DBI             1.1.3      2022-06-18 [1] CRAN (R 4.2.0)
#  dbplyr          2.2.1      2022-06-27 [1] CRAN (R 4.2.0)
#  digest          0.6.29     2021-12-01 [1] CRAN (R 4.2.0)
#  distill         1.4        2022-05-12 [1] CRAN (R 4.2.0)
#  downlit         0.4.2      2022-07-05 [1] CRAN (R 4.2.0)
#  dplyr         * 1.0.9      2022-04-28 [1] CRAN (R 4.2.0)
#  ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.2.0)
#  evaluate        0.15       2022-02-18 [1] CRAN (R 4.2.0)
#  fansi           1.0.3      2022-03-24 [1] CRAN (R 4.2.0)
#  fastmap         1.1.0      2021-01-25 [1] CRAN (R 4.2.0)
#  fontawesome     0.3.0      2022-07-20 [1] CRAN (R 4.2.1)
#  forcats       * 0.5.1      2021-01-27 [1] CRAN (R 4.2.0)
#  fs              1.5.2      2021-12-08 [1] CRAN (R 4.2.0)
#  gargle          1.2.0.9002 2022-06-05 [1] Github (r-lib/gargle@1e67aa0)
#  generics        0.1.3.9000 2022-07-25 [1] Github (r-lib/generics@3873971)
#  ggplot2       * 3.3.6      2022-05-03 [1] CRAN (R 4.2.0)
#  glue            1.6.2      2022-02-24 [1] CRAN (R 4.2.0)
#  googledrive     2.0.0      2021-07-08 [1] CRAN (R 4.2.0)
#  googlesheets4 * 1.0.0      2021-07-21 [1] CRAN (R 4.2.0)
#  grateful      * 0.1.11     2022-05-07 [1] Github (Pakillo/grateful@ba9b003)
#  gt            * 0.6.0      2022-05-24 [1] CRAN (R 4.2.0)
#  gtable          0.3.0      2019-03-25 [1] CRAN (R 4.2.0)
#  gtExtras      * 0.4.1      2022-07-13 [1] CRAN (R 4.2.1)
#  haven           2.5.0      2022-04-15 [1] CRAN (R 4.2.0)
#  highr           0.9        2021-04-16 [1] CRAN (R 4.2.0)
#  hms             1.1.1      2021-09-26 [1] CRAN (R 4.2.0)
#  htmltools     * 0.5.3      2022-07-18 [1] CRAN (R 4.2.1)
#  httr          * 1.4.3      2022-05-04 [1] CRAN (R 4.2.1)
#  httr2         * 0.2.1      2022-05-10 [1] CRAN (R 4.2.0)
#  insight         0.18.0     2022-07-05 [1] CRAN (R 4.2.0)
#  janitor         2.1.0      2021-01-05 [1] CRAN (R 4.2.0)
#  jquerylib       0.1.4      2021-04-26 [1] CRAN (R 4.2.0)
#  jsonlite      * 1.8.0      2022-02-22 [1] CRAN (R 4.2.1)
#  knitr         * 1.39       2022-04-26 [1] CRAN (R 4.2.0)
#  lifecycle       1.0.1      2021-09-24 [1] CRAN (R 4.2.0)
#  lobstr          1.1.2      2022-06-22 [1] CRAN (R 4.2.0)
#  lubridate       1.8.0      2021-10-07 [1] CRAN (R 4.2.0)
#  magrittr        2.0.3      2022-03-30 [1] CRAN (R 4.2.0)
#  memoise         2.0.1      2021-11-26 [1] CRAN (R 4.2.1)
#  modelr          0.1.8      2020-05-19 [1] CRAN (R 4.2.0)
#  munsell         0.5.0      2018-06-12 [1] CRAN (R 4.2.0)
#  openssl         2.0.2      2022-05-24 [1] CRAN (R 4.2.0)
#  paletteer       1.4.0      2021-07-20 [1] CRAN (R 4.2.0)
#  pillar          1.8.0      2022-07-18 [1] CRAN (R 4.2.1)
#  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.2.0)
#  purrr         * 0.3.4      2020-04-17 [1] CRAN (R 4.2.1)
#  R.cache         0.16.0     2022-07-21 [1] CRAN (R 4.2.1)
#  R.methodsS3     1.8.2      2022-06-13 [1] CRAN (R 4.2.0)
#  R.oo            1.25.0     2022-06-12 [1] CRAN (R 4.2.0)
#  R.utils         2.12.0     2022-06-28 [1] CRAN (R 4.2.0)
#  R6              2.5.1      2021-08-19 [1] CRAN (R 4.2.0)
#  rappdirs        0.3.3      2021-01-31 [1] CRAN (R 4.2.0)
#  Rcpp            1.0.9      2022-07-08 [1] CRAN (R 4.2.1)
#  readr         * 2.1.2      2022-01-30 [1] CRAN (R 4.2.0)
#  readxl          1.4.0      2022-03-28 [1] CRAN (R 4.2.0)
#  rematch2        2.1.2      2020-05-01 [1] CRAN (R 4.2.0)
#  renv            0.15.5     2022-05-26 [1] CRAN (R 4.2.0)
#  reprex          2.0.1      2021-08-05 [1] CRAN (R 4.2.0)
#  rlang           1.0.4      2022-07-12 [1] CRAN (R 4.2.1)
#  rmarkdown       2.14       2022-04-25 [1] CRAN (R 4.2.0)
#  rstudioapi      0.13       2020-11-12 [1] CRAN (R 4.2.0)
#  rvest           1.0.2      2021-10-16 [1] CRAN (R 4.2.0)
#  sass            0.4.2      2022-07-16 [1] CRAN (R 4.2.1)
#  scales          1.2.0      2022-04-13 [1] CRAN (R 4.2.0)
#  sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.2.0)
#  snakecase       0.11.0     2019-05-25 [1] CRAN (R 4.2.0)
#  stringi         1.7.8      2022-07-11 [1] CRAN (R 4.2.1)
#  stringr       * 1.4.0      2019-02-10 [1] CRAN (R 4.2.0)
#  styler          1.7.0      2022-03-13 [1] CRAN (R 4.2.0)
#  tibble        * 3.1.8      2022-07-22 [1] CRAN (R 4.2.1)
#  tidyr         * 1.2.0      2022-02-01 [1] CRAN (R 4.2.0)
#  tidyselect      1.1.2      2022-02-21 [1] CRAN (R 4.2.0)
#  tidyverse     * 1.3.2      2022-07-18 [1] CRAN (R 4.2.1)
#  tzdb            0.3.0      2022-03-28 [1] CRAN (R 4.2.0)
#  utf8            1.2.2      2021-07-24 [1] CRAN (R 4.2.0)
#  uuid            1.1-0      2022-04-19 [1] CRAN (R 4.2.0)
#  vctrs           0.4.1      2022-04-13 [1] CRAN (R 4.2.0)
#  withr           2.5.0      2022-03-03 [1] CRAN (R 4.2.0)
#  xaringanExtra   0.7.0      2022-07-16 [1] CRAN (R 4.2.1)
#  xfun            0.31       2022-05-10 [1] CRAN (R 4.2.0)
#  xml2            1.3.3      2021-11-30 [1] CRAN (R 4.2.0)
#  yaml            2.3.5      2022-02-21 [1] CRAN (R 4.2.0)
# 
#  [1] C:/Users/andyb/AppData/Local/R/win-library/4.2
#  [2] C:/Program Files/R/R-4.2.1/library
# 
# ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Aden-Buie, Garrick, and Matthew T. Warkentin. 2022. xaringanExtra: Extras and Extensions for ’Xaringan’ Slides. https://CRAN.R-project.org/package=xaringanExtra.
Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2022. Rmarkdown: Dynamic Documents for r. https://github.com/rstudio/rmarkdown.
Cheng, Joe, Carson Sievert, Barret Schloerke, Winston Chang, Yihui Xie, and Jeff Allen. 2022. Htmltools: Tools for HTML. https://CRAN.R-project.org/package=htmltools.
Dervieux, Christophe, JJ Allaire, Rich Iannone, Alison Presmanes Hill, and Yihui Xie. 2022. Distill: ’R Markdown’ Format for Scientific and Technical Writing. https://CRAN.R-project.org/package=distill.
Eddelbuettel, Dirk. 2020. Anytime: Anything to ’POSIXct’ or ’Date’ Converter. https://CRAN.R-project.org/package=anytime.
Fay, Colin. 2020. Attempt: Tools for Defensive Programming. https://CRAN.R-project.org/package=attempt.
Firke, Sam. 2021. Janitor: Simple Tools for Examining and Cleaning Dirty Data. https://CRAN.R-project.org/package=janitor.
Iannone, Richard, Joe Cheng, and Barret Schloerke. 2022. Gt: Easily Create Presentation-Ready Display Tables. https://CRAN.R-project.org/package=gt.
Lüdecke, Daniel, Philip Waggoner, and Dominique Makowski. 2019. insight: A Unified Interface to Access Information from Model Objects in R.” Journal of Open Source Software 4 (38): 1412. https://doi.org/10.21105/joss.01412.
Mock, Thomas. 2022. gtExtras: Extending ’Gt’ for Beautiful HTML Tables. https://CRAN.R-project.org/package=gtExtras.
R Core Team. 2022. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Rodríguez-Sánchez, Francisco, Connor P. Jackson, and Shaurita D. Hutchins. 2022. Grateful: Facilitate Citation of r Packages. https://github.com/Pakillo/grateful.
Wickham, Hadley. 2022a. Httr2: Perform HTTP Requests and Process the Responses. https://CRAN.R-project.org/package=httr2.
———. 2022b. Lobstr: Visualize r Data Structures with Trees. https://CRAN.R-project.org/package=lobstr.
Wickham, Hadley, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D’Agostino McGowan, Romain François, Garrett Grolemund, et al. 2019. “Welcome to the tidyverse.” Journal of Open Source Software 4 (43): 1686. https://doi.org/10.21105/joss.01686.
Wickham, Hadley, Winston Chang, Robert Flight, Kirill Müller, and Jim Hester. 2021. Sessioninfo: R Session Information. https://CRAN.R-project.org/package=sessioninfo.
Xie, Yihui. 2014. “Knitr: A Comprehensive Tool for Reproducible Research in R.” In Implementing Reproducible Computational Research, edited by Victoria Stodden, Friedrich Leisch, and Roger D. Peng. Chapman; Hall/CRC. http://www.crcpress.com/product/isbn/9781466561595.
———. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. https://yihui.org/knitr/.
———. 2022. Knitr: A General-Purpose Package for Dynamic Report Generation in r. https://yihui.org/knitr/.
Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown.
Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook.

References

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/andrewallenbruce, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Bruce (2022, July 16). Andrew Bruce: Interacting with an API: NPPES NPI Registry. Retrieved from https://andrewbruce.netlify.app/posts/interacting-with-an-api-nppes-npi-registry/

BibTeX citation

@misc{bruce2022interacting,
  author = {Bruce, Andrew},
  title = {Andrew Bruce: Interacting with an API: NPPES NPI Registry},
  url = {https://andrewbruce.netlify.app/posts/interacting-with-an-api-nppes-npi-registry/},
  year = {2022}
}