Skip to contents


Provider’s Current Practice Address


address <- nppes_npi(npi = 1760485387) |> 
  dplyr::select(street, city, state, zipcode) |>
  dplyr::filter(dplyr::row_number() %in% 1) |> 
  dplyr::mutate(street = stringr::str_remove_all(street, "\\."),
                street = stringr::str_replace(street, "CTY", "COUNTY")) |> 
  tidyr::unite("addr", street:zipcode, sep = ", ", remove = TRUE) |> 
  tidygeocoder::geocode(addr, 
                        method = "osm", 
                        lat = latitude, 
                        long = longitude, 
                        full_results = TRUE)

address |> 
  dplyr::select(addr, latitude, longitude, display_name, type) |> 
  dplyr::glimpse()


leaflet::leaflet() |> 
  leaflet::addTiles() |> 
  leaflet::addMarkers(lng = address$longitude, 
                      lat = address$latitude, 
                      popup = address$display_name)

Organizational Provider Locations

orgs <- nppes_npi(last_name = "Smith", purpose_name = "AO", city = "Atlanta")

orgs_add <- orgs |> 
  dplyr::filter(purpose %in% c("PRACTICE", "LOCATION")) |> 
  dplyr::select(street, city, state, zipcode) |> 
  dplyr::mutate(zipcode = campfin::normal_zip(zipcode)) |> 
  tidyr::unite("addr", street:zipcode, sep = ", ", remove = TRUE) |> 
  tidygeocoder::geocode(addr, 
                        method = "osm", 
                        lat = latitude, 
                        long = longitude, 
                        full_results = TRUE)
org <- orgs_add |> 
  dplyr::filter(!is.na(latitude))

orgs_add |> 
  dplyr::filter(is.na(latitude))


leaflet::leaflet() |> 
  leaflet::addTiles() |> 
  leaflet::addMarkers(lng = org$longitude, 
                      lat = org$latitude, 
                      popup = org$display_name)