Skip to contents
#> Error in library(tidyverse): there is no package called 'tidyverse'


Individual Provider

vctrs::vec_rbind(
  display_long(providers(pac = 7810891009)) |> tibble::add_column(source = "`providers()`"),
  display_long(reassignments(pac = 7810891009)) |> tibble::add_column(source = "`reassignments()`"),
  display_long(clinicians(pac = 7810891009)) |> tibble::add_column(source = "`clinicians()`"),
  display_long(nppes(npi = 1043245657)) |> tibble::add_column(source = "`nppes()`"),
  display_long(order_refer(npi = 1043245657)) |> tibble::add_column(source = "`order_refer()`")) |> 
  distinct(name, value, .keep_all = TRUE) |> 
  gt(groupname_col = "source", 
     row_group_as_column = TRUE, process_md = TRUE) |> 
  opt_table_font(font = google_font(name = "JetBrains Mono")) |> 
  tab_options(column_labels.hidden = TRUE, 
              table.width = px(600),
              heading.background.color = "black",
              heading.align = "left", 
              stub_row_group.font.weight = "bold") |> 
  tab_header(title = md("**PROVIDER**: Mark, K. Fung, M.D.")) |> 
  opt_horizontal_padding(scale = 2) |> 
  opt_all_caps()
#> Error in distinct(vctrs::vec_rbind(tibble::add_column(display_long(providers(pac = 7810891009)), : could not find function "distinct"


affiliations(pac = 7810891009) |> 
  pull(facility_ccn) |>
  map_dfr(~hospitals(facility_ccn = .x)) |> 
  select(-reh_conversion) |> 
  display_long(cols = !organization) |> 
  filter(!is.na(value)) |> 
  gt(groupname_col = "organization", 
     row_group_as_column = TRUE) |> 
  opt_table_font(font = google_font(name = "JetBrains Mono")) |> 
  tab_options(column_labels.hidden = TRUE, 
              table.width = px(800),
              heading.background.color = "black",
              heading.align = "left", 
              stub_row_group.font.weight = "bold") |> 
  tab_header(title = md("**FACILITY** AFFILIATIONS")) |> 
  opt_horizontal_padding(scale = 2) |> 
  opt_all_caps()
#> Error in select(map_dfr(pull(affiliations(pac = 7810891009), facility_ccn), : could not find function "select"


Exploring links between providers can lead to many interesting insights. For example, there is a hospital in New York named Elizabethtown Community Hospital.

providers(organization = "Elizabethtown Community Hospital") |> 
  gt_preview(top_n = 10) |> 
  opt_table_font(font = google_font(name = "JetBrains Mono"))
npi pac enid specialty_code specialty_description state organization
1 1891785184 3577554138 O20040521000534 12-70 PART B SUPPLIER - CLINIC/GROUP PRACTICE NY ELIZABETHTOWN COMMUNITY HOSPITAL
2 1891785184 3577554138 O20101110000259 00-85 PART A PROVIDER - CRITICAL ACCESS HOSPITAL NY ELIZABETHTOWN COMMUNITY HOSPITAL
3 1487923637 3577554138 O20190719002511 12-59 PART B SUPPLIER - AMBULANCE SERVICE SUPPLIER NY ELIZABETHTOWN COMMUNITY HOSPITAL
4 1407061591 3577554138 O20220827000145 00-85 PART A PROVIDER - CRITICAL ACCESS HOSPITAL NY ELIZABETHTOWN COMMUNITY HOSPITAL
hospitals(organization = "Elizabethtown Community Hospital") |> 
  gt_preview(top_n = 10) |> 
  opt_table_font(font = google_font(name = "JetBrains Mono"))
npi_org pac_org enid_org enid_state facility_ccn organization specialty_code specialty incorp_date incorp_state structure address city state zip location_type multi_npi reh_conversion subgroup
1 1891785184 3577554138 O20101110000259 NY 331302 ELIZABETHTOWN COMMUNITY HOSPITAL 00-85 PART A PROVIDER - CRITICAL ACCESS HOSPITAL 1926-05-08 NY CORPORATION 75 PARK ST ELIZABETHTOWN NY 129322300 OTHER HOSPITAL PRACTICE LOCATION TRUE FALSE None
2 1407061591 3577554138 O20220827000145 NY 33Z302 ELIZABETHTOWN COMMUNITY HOSPITAL 00-85 PART A PROVIDER - CRITICAL ACCESS HOSPITAL 1926-05-08 NY CORPORATION 75 PARK ST ELIZABETHTOWN NY 129322300 OTHER HOSPITAL PRACTICE LOCATION FALSE FALSE None


The Hospital Enrollment API includes only Medicare Part A (hospital) providers, so we only get two rows back, but those include a new data point: two facility CCNs. Plugging those into the Facility Affiliations API, we can retrieve information on the individual providers practicing at this hospital. First, the all-numeric CCN (331302):


affiliations(facility_ccn = 331302) |> 
  gt_preview(top_n = 20) |> 
  opt_table_font(font = google_font(name = "JetBrains Mono"))
npi pac first middle last suffix facility_type facility_ccn
1 1003815184 4082693676 ARMIN NA AFSAR KESHMIRI NA Hospital 331302
2 1023076643 5698798452 JOHN N HENRY NA Hospital 331302
3 1023377843 6901115278 LINDSEY B WILHELM NA Hospital 331302
4 1043245657 7810891009 MARK K FUNG NA Hospital 331302
5 1043397656 4183764558 ANTHONY F TRAMONTANO NA Hospital 331302
6 1043630510 2365749389 RYAN NA WOLFE NA Hospital 331302
7 1043672140 7214229350 VANESSA NA FIORINI FURTADO NA Hospital 331302
8 1053596122 5193802213 TANYA JEAN FINCH NA Hospital 331302
9 1053863100 8729362207 MATTHEW D FARNSWORTH NA Hospital 331302
10 1063536886 0941434435 ELENA NA BOLAND NA Hospital 331302
11 1063824894 2668690512 JASMINE N TUCKER NA Hospital 331302
12 1063851673 1557630613 TERRENCE NA O CONNOR NA Hospital 331302
13 1073099172 0547519381 BROOKE A MAGGY NA Hospital 331302
14 1073133484 7214328921 CASEY M O'BRIEN NA Hospital 331302
15 1073585055 0749217313 TODD J WHITMAN NA Hospital 331302
16 1073660684 1759418007 GAYLEN M BIGELOW NA Hospital 331302
17 1083052252 9931491792 AHMED A HARHASH NA Hospital 331302
18 1083148837 0042564882 NEIL A KRULEWITZ NA Hospital 331302
19 1083771927 7012087018 JOSEPH C MIHINDUKULASURYIA NA Hospital 331302
20 1093796898 5597848077 ANDREW C MAHONEY NA Hospital 331302
21..174
175 1992261887 4486981958 SERGIO NA APUZZO NA Hospital 331302


That returns individual providers affiliated with the hospital. Now to search the alphanumeric CCN (33Z302):

affiliations(facility_ccn = "33Z302") |> 
  gt_preview(top_n = 10) |> 
  opt_table_font(font = google_font(name = "JetBrains Mono"))
npi pac first middle last facility_type facility_ccn parent_ccn
1 1396989059 8921259557 MARY K HALLORAN Nursing home 33Z302 331302
2 1538173869 0547299091 IL JUN CHON Nursing home 33Z302 331302
3 1801893318 3577568724 ROB L DEMURO Nursing home 33Z302 331302


That returns more affiliated individual providers that practice in the Hospital’s nursing home..


An alphanumeric CCN represents a sub-unit of the hospital, here a nursing home. We would get the same result if we’d set the parent_ccn argument to the numeric CCN, i.e. affiliations(parent_ccn = 331302)