Introduction

In this section we will: * identify which Appendectomy procedures were excluded and why * identify which different Appendectomy subgroups were created and why

If you have questions or concerns about this data please contact Alexander Nielson ()

Load Libraries

Load Libraries

library(data.table)
library(tidyverse)
## Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
## when loading 'dplyr'
library(stringi)
library(ggridges)
library(broom)
library(disk.frame)
library(RecordLinkage)
library(googlesheets4)
library(bigrquery)
library(DBI)
devtools::install_github("utah-osa/hcctools2", upgrade="never" )
library(hcctools2)

Establish color palettes

cust_color_pal1 <- c(
        "Anesthesia" = "#f3476f",
        "Facility" = "#e86a33",
        "Medicine Proc" = "#e0a426",
        "Pathology" = "#77bf45",
        "Radiology" = "#617ff7",
        "Surgery" = "#a974ee"
    )

cust_color_pal2 <- c(
        "TRUE" = "#617ff7",
        "FALSE" = "#e0a426"
    )

cust_color_pal3 <- c(
        "above avg" = "#f3476f",
        "avg" = "#77bf45",
        "below avg" = "#a974ee"
    )



  fac_ref_regex <- "(UTAH)|(IHC)|(HOSP)|(HOSPITAL)|(CLINIC)|(ANESTH)|(SCOPY)|(SURG)|(LLC)|(ASSOC)|(MEDIC)|(CENTER)|(ASSOCIATES)|(U OF U)|(HEALTH)|(OLOGY)|(OSCOPY)|(FAMILY)|(VAMC)|(SLC)|(SALT LAKE)|(CITY)|(PROVO)|(OGDEN)|(ENDO )|( VALLEY)|( REGIONAL)|( CTR)|(GRANITE)|( INSTITUTE)|(INSTACARE)|(WASATCH)|(COUNTY)|(PEDIATRIC)|(CORP)|(CENTRAL)|(URGENT)|(CARE)|(UNIV)|(ODYSSEY)|(MOUNTAINSTAR)|( ORTHOPEDIC)|(INSTITUT)|(PARTNERSHIP)|(PHYSICIAN)|(CASTLEVIEW)|(CONSULTING)|(MAGEMENT)|(PRACTICE)|(EMERGENCY)|(SPECIALISTS)|(DIVISION)|(GUT WHISPERER)|(INTERMOUNTAIN)|(OBGYN)"

Connect to GCP database

bigrquery::bq_auth(path = 'D:/gcp_keys/healthcare-compare-prod-95b3b7349c32.json')

# set my project ID and dataset name
project_id <- 'healthcare-compare-prod'
dataset_name <- 'healthcare_compare'

con <- dbConnect(
  bigrquery::bigquery(),
  project = project_id,
  dataset = dataset_name,
  billing = project_id
)

Get NPI table

query <-  paste0("SELECT npi, clean_name, osa_group, osa_class, osa_specialization
                 FROM `healthcare-compare-prod.healthcare_compare.npi_full`")

#bq_project_query(billing, query) # uncomment to determine billing price for above query.

npi_full <- dbGetQuery(con, query) %>%
  data.table()

get a subset of the NPI providers based upon taxonomy groups

gs4_auth(email="alexnielson@utah.gov")
surgery <- read_sheet("https://docs.google.com/spreadsheets/d/1GY8lKwUJuPHtpUl4EOw9eriLUDG9KkNWrMbaSnA5hOU/edit#gid=0",
                    sheet="major_surgery") %>% as.data.table
## Reading from "Doctor Types to Keep"
## Range "'major_surgery'"
surgery <-  surgery[is.na(Remove) ] %>% .[["NUCC Classification"]]
  npi_prov_pair <-  npi_full[osa_class %in% surgery] %>%
    .[,.(npi=npi,
         clean_name = clean_name
         )
      ]

Load Data

bun_proc <-  disk.frame("full_apcd.df")
apendx <- bun_proc[surg_bun_t_appendectomy==T]
apendx <-  apendx[,`:=`(
  surg_sp_name_clean = surg_sp_npi %>% map_chr(get_npi_standard_name),
  surg_bp_name_clean = surg_bp_npi %>% map_chr(get_npi_standard_name),

  medi_sp_name_clean = medi_sp_npi %>% map_chr(get_npi_standard_name),
  medi_bp_name_clean = medi_bp_npi %>% map_chr(get_npi_standard_name),

  radi_sp_name_clean = radi_sp_npi %>% map_chr(get_npi_standard_name),
  radi_bp_name_clean = radi_bp_npi %>% map_chr(get_npi_standard_name),

  path_sp_name_clean = path_sp_npi %>% map_chr(get_npi_standard_name),
  path_bp_name_clean = path_bp_npi %>% map_chr(get_npi_standard_name),

  anes_sp_name_clean = anes_sp_npi %>% map_chr(get_npi_standard_name),
  anes_bp_name_clean = anes_bp_npi %>% map_chr(get_npi_standard_name),

  faci_sp_name_clean = faci_sp_npi %>% map_chr(get_npi_standard_name),
  faci_bp_name_clean = faci_bp_npi %>% map_chr(get_npi_standard_name)
  )]
apendx %>% saveRDS("apendx.RDS")
apendx <- readRDS("apendx.RDS")

examine appendectomy median price distribution and get the highly correlated tags

apendx %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 304 x 2
##    name                 correlation
##    <chr>                      <dbl>
##  1 surg_bun_t_lung            0.686
##  2 surg_bun_t_percut          0.686
##  3 medi_bun_t_establish       0.686
##  4 medi_bun_t_eye_exam        0.686
##  5 radi_bun_t_ct_scan         0.686
##  6 radi_bun_t_head            0.686
##  7 radi_bun_t_scan            0.686
##  8 radi_bun_t_brain           0.664
##  9 duration_max               0.656
## 10 surg_bun_t_pancreas        0.587
## # ... with 294 more rows
apendx[surg_bun_t_lung==T] %>% nrow()
## [1] 1
apendx[radi_bun_t_brain==T] %>% nrow()
## [1] 2
apendx[cnt > 4 & faci_bun_sum_med > 1000 & surg_bun_t_lung==F & radi_bun_t_brain==F] %>% nrow()
## [1] 826
apendx[cnt > 4 & faci_bun_sum_med > 1000 & surg_bun_t_lung==F & radi_bun_t_brain==F] %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx[cnt > 4 & faci_bun_sum_med > 1000 & surg_bun_t_lung==F & radi_bun_t_brain==F] %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 281 x 2
##    name                   correlation
##    <chr>                        <dbl>
##  1 duration_mean                0.615
##  2 duration_max                 0.594
##  3 medi_bun_t_sodium            0.402
##  4 medi_bun_t_inject            0.393
##  5 surg_bun_t_gallbladder       0.324
##  6 surg_bun_t_removal           0.321
##  7 faci_bun_t_hospital          0.318
##  8 medi_bun_t_cathet            0.308
##  9 surg_bun_t_bladder           0.288
## 10 surg_bun_t_lap               0.280
## # ... with 271 more rows
apendx <- apendx[cnt > 4 & faci_bun_sum_med > 1000 & surg_bun_t_lung==F & radi_bun_t_brain==F]
apendx %>% get_tag_density_information("medi_bun_t_sodium") %>% print()
## Scale for 'y' is already present. Adding another scale for 'y', which will
## replace the existing scale.
## Scale for 'x' is already present. Adding another scale for 'x', which will
## replace the existing scale.
## [1] "tp_med ~ medi_bun_t_sodium"
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to
## factor.
## Picking joint bandwidth of 1430
## $dist_plots

## 
## $stat_tables

apendx_w_sodium <- apendx[medi_bun_t_sodium == T & medi_bun_t_inject == T]
apendx_n_sodium <- apendx[medi_bun_t_sodium == F & medi_bun_t_inject == F]

appendectomy with sodium injection

-usually antibiotics or anesthesia

examine the median price density and the highly correlated tags

apendx_w_sodium %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_w_sodium %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 211 x 2
##    name                correlation
##    <chr>                     <dbl>
##  1 medi_bun_t_cathet         0.381
##  2 medi_bun_t_flu            0.381
##  3 medi_bun_t_wound          0.381
##  4 path_bun_t_embryo         0.381
##  5 duration_max              0.368
##  6 surg_bun_t_removal        0.344
##  7 duration_mean             0.343
##  8 path_bun_t_anti           0.320
##  9 faci_bun_t_critical       0.314
## 10 path_bun_t_blood          0.273
## # ... with 201 more rows
apendx_w_sodium[medi_bun_t_flu==T] %>% nrow()
## [1] 1
apendx_w_sodium[surg_bun_t_removal==T] %>% nrow()
## [1] 2
apendx_w_sodium[faci_bun_t_critical==T] %>% nrow()
## [1] 2
apendx_w_sodium[path_bun_t_immuno==T] %>% nrow()
## [1] 9
apendx_w_sodium <- apendx_w_sodium[medi_bun_t_flu==F& surg_bun_t_removal==F & faci_bun_t_critical==F & path_bun_t_immuno==F ]

examine the median price density and the highly correlated tags

apendx_w_sodium %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_w_sodium %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 197 x 2
##    name                    correlation
##    <chr>                         <dbl>
##  1 faci_bun_t_dept               0.321
##  2 faci_bun_t_emergency          0.321
##  3 medi_bun_t_puncture           0.275
##  4 medi_bun_t_routine            0.275
##  5 medi_bun_t_venipuncture       0.275
##  6 duration_max                  0.258
##  7 faci_bun_t_visit              0.235
##  8 medi_bun_t_observ             0.234
##  9 radi_bun_t_contrast           0.232
## 10 path_bun_t_comprehen          0.229
## # ... with 187 more rows
apendx_w_sodium %>% get_tag_density_information("faci_bun_t_emergency") %>% print()
## Scale for 'y' is already present. Adding another scale for 'y', which will
## replace the existing scale.
## Scale for 'x' is already present. Adding another scale for 'x', which will
## replace the existing scale.
## [1] "tp_med ~ faci_bun_t_emergency"
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to
## factor.
## Picking joint bandwidth of 969
## $dist_plots

## 
## $stat_tables

at emergency department

apendx_w_sodium_at_emerg <- apendx_w_sodium[faci_bun_t_emergency==T]

examine the median price density and the highly correlated tags

apendx_w_sodium_at_emerg %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_w_sodium_at_emerg %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 140 x 2
##    name                    correlation
##    <chr>                         <dbl>
##  1 medi_bun_t_observ             0.321
##  2 medi_bun_t_puncture           0.299
##  3 medi_bun_t_routine            0.299
##  4 medi_bun_t_venipuncture       0.299
##  5 duration_max                  0.274
##  6 duration_mean                 0.228
##  7 path_bun_t_alkaline           0.226
##  8 path_bun_t_amino              0.226
##  9 path_bun_t_phosphatase        0.226
## 10 medi_bun_t_solution           0.203
## # ... with 130 more rows
apendx_w_sodium_at_emerg[path_bun_t_alkaline==T] %>% nrow()
## [1] 1
apendx_w_sodium_at_emerg[medi_bun_t_solution==T] %>% nrow()
## [1] 23
apendx_w_sodium_at_emerg[path_bun_t_typing==T] %>% nrow()
## [1] 6
apendx_w_sodium_at_emerg[surg_bun_t_bowel==T] %>% nrow()
## [1] 1
apendx_w_sodium_at_emerg[path_bun_t_antibod==T] %>% nrow()
## [1] 7
apendx_w_sodium_at_emerg[radi_bun_t_mri==T] %>% nrow()
## [1] 10
apendx_w_sodium_at_emerg[faci_bun_t_consultation==T] %>% nrow()
## [1] 2
apendx_w_sodium_at_emerg <- apendx_w_sodium_at_emerg[path_bun_t_alkaline==F & path_bun_t_typing==F & surg_bun_t_bowel==F & faci_bun_t_consultation==F ]

examine the median price density and the highly correlated tags

apendx_w_sodium_at_emerg %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_w_sodium_at_emerg %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 130 x 2
##    name                    correlation
##    <chr>                         <dbl>
##  1 duration_max                  0.324
##  2 medi_bun_t_observ             0.288
##  3 duration_mean                 0.273
##  4 medi_bun_t_puncture           0.258
##  5 medi_bun_t_routine            0.258
##  6 medi_bun_t_venipuncture       0.258
##  7 radi_bun_t_mri                0.207
##  8 radi_bun_t_without_dye        0.207
##  9 radi_bun_t_ct                 0.199
## 10 radi_bun_t_contrast           0.193
## # ... with 120 more rows
apendx_w_sodium_at_emerg_btbv4 <- apendx_w_sodium_at_emerg %>% btbv4()
apendx_w_sodium_at_emerg_bq <- apendx_w_sodium_at_emerg_btbv4[,
                     primary_doctor := pmap(.l=list(doctor_npi1=doctor_npi_str1,
                                  doctor_npi2=doctor_npi_str2,
                                  class_reqs="Surgery"#,
                                  # specialization_reqs = ""
                                  ),
                                                .f=calculate_primary_doctor) %>% as.character()
                     ] %>%
  #Filter out any procedures where our doctors fail both criteria.
  .[!(primary_doctor %in% c("BOTH_DOC_FAIL_CRIT", "TWO_FIT_ALL_SPECS", "NONE_FIT_SPEC_REQ"))] %>%
  .[,primary_doctor_npi := fifelse(primary_doctor==doctor_str1,
                                   doctor_npi_str1,
                                   doctor_npi_str2)] %>%
  .[,`:=`(procedure_type=7, procedure_modifier="At Emergency Department")]
## [1] "multiple meet class req"
## [1] "BRAD A MYERS"     "DARRELL L WILSON"
## [1] "multiple meet class req"
## [1] "REBECKA L MEYERS"    "ERIC RICHARD SCAIFE"
apendx_w_sodium_at_emerg_bq <- apendx_w_sodium_at_emerg_bq[,.(
primary_doctor,
primary_doctor_npi,
most_important_fac  ,
most_important_fac_npi,
procedure_type,
procedure_modifier,
tp_med_med,
tp_med_surg,
tp_med_medi,
tp_med_path,
tp_med_radi,
tp_med_anes,
tp_med_faci,
ingest_date = Sys.Date()
)]
bq_table_upload(x=procedure_table, values= apendx_w_sodium_at_emerg_bq, create_disposition='CREATE_IF_NEEDED', write_disposition='WRITE_APPEND')

not at emergecny department

apendx_w_sodium_n_emerg <- apendx_w_sodium[faci_bun_t_emergency==F]

examine the median price density and the highly correlated tags

apendx_w_sodium_n_emerg %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_w_sodium_n_emerg %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 145 x 2
##    name               correlation
##    <chr>                    <dbl>
##  1 path_bun_t_typing        0.373
##  2 path_bun_t_screen        0.343
##  3 path_bun_t_anti          0.322
##  4 path_bun_t_antibod       0.322
##  5 path_bun_t_blood         0.303
##  6 surg_bun_t_remov         0.288
##  7 surg_bun_t_remove        0.288
##  8 surg_bun_t_excise        0.264
##  9 surg_bun_t_lesion        0.264
## 10 surg_bun_t_exc           0.243
## # ... with 135 more rows

appendectomy no sodium injection

apendx_n_sodium %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_n_sodium %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 205 x 2
##    name                   correlation
##    <chr>                        <dbl>
##  1 duration_mean                0.591
##  2 duration_max                 0.56 
##  3 surg_bun_t_bladder           0.370
##  4 surg_bun_t_gallbladder       0.370
##  5 surg_bun_t_cysto             0.368
##  6 surg_bun_t_cystoscopy        0.368
##  7 surg_bun_t_treat             0.368
##  8 surg_bun_t_removal           0.322
##  9 surg_bun_t_cyst              0.316
## 10 surg_bun_t_add-on            0.312
## # ... with 195 more rows
apendx_n_sodium[surg_bun_t_bladder==T] %>% nrow()
## [1] 4
apendx_n_sodium[surg_bun_t_gallbladder==T] %>% nrow()
## [1] 4
apendx_n_sodium[surg_bun_t_cystoscopy==T] %>% nrow()
## [1] 2
apendx_n_sodium[surg_bun_t_bowel==T] %>% nrow()
## [1] 3
apendx_n_sodium[surg_bun_t_removal==T] %>% nrow()
## [1] 8
apendx_n_sodium[surg_bun_t_cyst==T] %>% nrow()
## [1] 6
apendx_n_sodium[`surg_bun_t_add-on`==T] %>% nrow()
## [1] 13
apendx_n_sodium[surg_bun_t_pancreas==T] %>% nrow()
## [1] 1
apendx_n_sodium[surg_bun_t_renal==T] %>% nrow()
## [1] 1
apendx_n_sodium[surg_bun_t_pancreas==T] %>% nrow()
## [1] 1
apendx_n_sodium[surg_bun_t_lap==F] %>% nrow()
## [1] 19
apendx_n_sodium[surg_bun_t_fluid==T] %>% nrow()
## [1] 2
apendx_n_sodium[surg_bun_t_imag==T] %>% nrow()
## [1] 1
apendx_n_sodium[surg_bun_t_colon==T] %>% nrow()
## [1] 1
apendx_n_sodium[surg_bun_t_partial==T] %>% nrow()
## [1] 1
apendx_n_sodium[surg_bun_t_ovarian==T] %>% nrow()
## [1] 2
apendx_n_sodium[surg_bun_t_implant==T] %>% nrow()
## [1] 2
apendx_n_sodium <- apendx_n_sodium[surg_bun_t_bladder==F &
                   surg_bun_t_gallbladder==F &
                   surg_bun_t_cystoscopy==F &
                   surg_bun_t_bowel==F &
                   surg_bun_t_removal==F &
                   surg_bun_t_cyst==F &
                   `surg_bun_t_add-on`==F &
                   surg_bun_t_pancreas==F &
                   surg_bun_t_renal==F &
                   surg_bun_t_pancreas==F &
                   surg_bun_t_lap==T &
                   surg_bun_t_fluid==F &
                   surg_bun_t_imag==F &
                   surg_bun_t_colon==F &
                   surg_bun_t_partial==F &
                   surg_bun_t_partial==F &
                   surg_bun_t_implant==F
                   ]
apendx_n_sodium %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_n_sodium %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 130 x 2
##    name                correlation
##    <chr>                     <dbl>
##  1 duration_mean             0.558
##  2 duration_max              0.481
##  3 medi_bun_t_choline        0.174
##  4 radi_bun_t_with_dye       0.153
##  5 radi_bun_t_ct             0.140
##  6 radi_bun_t_echo           0.139
##  7 faci_bun_t_care           0.128
##  8 radi_bun_t_imag           0.113
##  9 radi_bun_t_imaging        0.113
## 10 radi_bun_t_mri            0.113
## # ... with 120 more rows
apendx_n_sodium %>% plot_price_vs_duration() %>% print()

apendx_n_sodium[duration_mean<2] %>% plot_price_vs_duration() %>% print()

apendx_n_sodium[duration_mean<2] %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_n_sodium[duration_mean<2] %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 125 x 2
##    name                   correlation
##    <chr>                        <dbl>
##  1 medi_bun_t_choline           0.275
##  2 duration_max                 0.269
##  3 duration_mean                0.241
##  4 radi_bun_t_echo              0.200
##  5 radi_bun_t_imag              0.183
##  6 radi_bun_t_imaging           0.183
##  7 radi_bun_t_mri               0.183
##  8 radi_bun_t_without_dye       0.183
##  9 anes_bun_t_mod_sed           0.183
## 10 radi_bun_t_exam              0.182
## # ... with 115 more rows
apendx_n_sodium <- apendx_n_sodium[duration_mean<2]
apendx_n_sodium [medi_bun_t_choline==T] %>% nrow()
## [1] 1
apendx_n_sodium[radi_bun_t_imaging==T] %>% nrow()
## [1] 1
apendx_n_sodium[medi_bun_t_saline==T] %>% nrow()
## [1] 3
apendx_n_sodium <- apendx_n_sodium[medi_bun_t_choline==F & radi_bun_t_imaging==F & medi_bun_t_saline==F]
apendx_n_sodium %>% plot_med_density() %>% print()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

apendx_n_sodium %>% get_tag_cor() %>% print()
## Warning in stats::cor(cor_data): the standard deviation is zero
## # A tibble: 116 x 2
##    name                correlation
##    <chr>                     <dbl>
##  1 duration_max              0.281
##  2 duration_mean             0.245
##  3 radi_bun_t_echo           0.188
##  4 radi_bun_t_ct             0.181
##  5 radi_bun_t_contrast       0.173
##  6 radi_bun_t_exam           0.164
##  7 radi_bun_t_abdom          0.153
##  8 faci_bun_t_est            0.135
##  9 surg_bun_t_dev            0.129
## 10 surg_bun_t_device         0.129
## # ... with 106 more rows
apendx_n_sodium[radi_bun_t_echo==T] %>% nrow()
## [1] 106
apendx_n_sodium[radi_bun_t_exam==T] %>% nrow()
## [1] 128
apendx_n_sodium[radi_bun_t_ct==T] %>% nrow()
## [1] 174
apendx_n_sodium_btbv4 <- apendx_n_sodium %>% btbv4()
apendx_n_sodium_bq <- apendx_n_sodium_btbv4[,
                     primary_doctor := pmap(.l=list(doctor_npi1=doctor_npi_str1,
                                  doctor_npi2=doctor_npi_str2,
                                  class_reqs="Surgery"#,
                                  # specialization_reqs = ""
                                  ),
                                                .f=calculate_primary_doctor) %>% as.character()
                     ] %>%
  #Filter out any procedures where our doctors fail both criteria.
  .[!(primary_doctor %in% c("BOTH_DOC_FAIL_CRIT", "TWO_FIT_ALL_SPECS", "NONE_FIT_SPEC_REQ"))] %>%
  .[,primary_doctor_npi := fifelse(primary_doctor==doctor_str1,
                                   doctor_npi_str1,
                                   doctor_npi_str2)] %>%
  .[,`:=`(procedure_type=7, procedure_modifier="Standard")]
## [1] "multiple meet class req"
## [1] "KELLY D NOLAN"       "MARK RYAN MAWHINNEY"
## [1] "multiple meet class req"
## [1] "DAVID E SKARDA"      "BRIAN THOMAS BUCHER"
## [1] "multiple meet class req"
## [1] "MILDA  SHAPIRO"     "WILLIAM NOEL PEUGH"
## [1] "multiple meet class req"
## [1] "ROBERT SHELDON PRICE" "NICKOLAS RAY BYRGE"  
## [1] "multiple meet class req"
## [1] "STEPHEN JOSEPH FENTON" "DOUGLAS C BARNHART"
apendx_n_sodium_bq <- apendx_n_sodium_bq[,.(
primary_doctor,
primary_doctor_npi,
most_important_fac  ,
most_important_fac_npi,
procedure_type,
procedure_modifier,
tp_med_med,
tp_med_surg,
tp_med_medi,
tp_med_path,
tp_med_radi,
tp_med_anes,
tp_med_faci,
ingest_date = Sys.Date()
)]
apendx_n_sodium_bq <- apendx_n_sodium_bq[,
                            primary_doctor_npi := fifelse(primary_doctor=="ALEXANDER LORENZO COLONNA",
                                         "1568659324",
                                         primary_doctor_npi)]
bq_table_upload(x=procedure_table, values= apendx_n_sodium_bq, create_disposition='CREATE_IF_NEEDED', write_disposition='WRITE_APPEND')