knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(nsqipPancreatectomy)
r nrow(df)
records were retrieved from the NSQIP database by querying for records with a primary CPT of 48140
. This database was left-joined to the targeted pancreatectomy dataset by the variable caseid
. To prove there is only a single primary CPT code in this dataset:
unique(df$cpt)
We can take a look at the various approaches used in the dataset:
df$pan_approach <- factor(df$pan_approach, labels = c("Hybrid","Laparoscopic","NOTES","Open (planned)","Other","Other MIS","Robotic","SILS")) table(df$pan_approach)
We can select out only the approaches we are interested in and then further clarify the number by each approach with unplanned conversion. We will add in how many also have open assist.
df %>% dplyr::filter(pan_approach %in% c("Laparoscopic","Robotic","Open (planned)")) %>% dplyr::group_by(pan_approach) %>% dplyr::summarise( n = dplyr::n(), unplan_open = sum(pan_unplanned_conversion), rate = unplan_open/n, open_assist = sum(pan_open_assist))
We can see what it looks like by removing the patients with open assist:
df <- df %>% dplyr::filter(pan_approach %in% c("Laparoscopic","Robotic","Open (planned)"), !pan_open_assist) df %>% dplyr::group_by(pan_approach) %>% dplyr::summarise( n = dplyr::n(), unplan_open = sum(pan_unplanned_conversion), rate = unplan_open/n)
This would seem to imply that no cases with open assist had unplanned conversion to open but you have to look at how the original data is coded to understand why: the approach data was originally coded as either "Laparoscopic w/ open assist" or "Laparoscopic w/ unplanned conversion to open" - there is no "laparoscopic w/ open assist w/ unplanned conversion to open". So if you are interested in that, then I can go looking for it in concurrent/other procedures but I'll hold on that for now.
So we now have r nrow(df)
patients to work with. We can form three groups - laparoscopic and robotic (MIS) with no conversion vs. MIS with conversion vs. planned open.
df <- df %>% dplyr::mutate(group = ((pan_approach %in% c("Robotic", "Laparoscopic")) + pan_unplanned_conversion), group = forcats::as_factor(group), group = forcats::fct_recode(group, "Open" = "0","MIS" = "1", "MIS w/ unplanned conversion" = "2")) df %>% dplyr::group_by(group) %>% dplyr::summarise(n = dplyr::n())
Take a look at the NSQIP Pancreatectomy PUF and the NSQIP ACS PUF (both can be found here) and let me know the following:
48140
includes "with or without splenectomies". Some records will include a CPT code for splenectomy as a concurrent procedure. I can show you exactly how many below.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.