This reads in the NSQIP data for all shunt cases and all peds cases from 2019
This finds all the unique cases of shunt placement and merges with record data. Then, we create our final working dataframe that only contains the factors of interest.
#2019
df0 <- merge(df_raw19,df_shunt19[,2:13], by="CaseID")
df19 <- df0[,c(1,3:6,19:20,22,81:82,94,348:350,357:358)]
NSQIP Cohort A: 1) needs to be all pediatric shunt patient who have
“PED_SHNT_1STPERM” (yes, no) = yes
2) AND have an entry for the variable: “PED_SHNT_HC_ETIOL” 3) AND have
an entry in the general NSQIP database for the variable: “PREM_BIRTH”
(any value acceptable, but need a value entered)
1739 cases had a value written. 47 cases had “Unknown” for PREM_BIRTH. 1692 cases had a known PREM_BIRTH and all other conditions satisfied.
cohortA <- df19[which(df19$PED_SHNT_1STPERM == "Yes"),]
cohortA <- cohortA[which(!cohortA$PREM_BIRTH == "Unknown"),]
#Add chronological age at surgery by subtracting Gest Birth age from Gest Surgery age.
cohortA$Chron_Age_Surgery <- cohortA$GESTATIONALAGE_SURGERY-cohortA$GESTATIONALAGE_BIRTH
df <- cohortA
df$Chron_Age_Surgery_Days <- df$Chron_Age_Surgery*7
In the NSQIP population, median gestational age at delivery was ________, with ________% born premature, median chronological age at time of surgery ________, and median gestational age at time of surgery ________.
In contrast, the 3 most common causes of hydrocephalus in the NSQIP population were: ______% Intraventricular hemorrhage (IVH) or prematurity without other cause, ______% Congenital Hydrocephalus, and ________% Spina Bifida with Chiari malformation/myelomeningocele (Table XX).
descriptive stats
#median ages in weeks
cohortA %>%
filter(!GESTATIONALAGE_BIRTH == -99) %>%
filter(!GESTATIONALAGE_SURGERY == -99) %>%
summarise(gest_age_delivery = median(GESTATIONALAGE_BIRTH), chron_age_surgery = median(GESTATIONALAGE_SURGERY), gest_age_surgery = median(Chron_Age_Surgery))
## gest_age_delivery chron_age_surgery gest_age_surgery
## 1 33 39 7
#most frequent etiologies
df %>%
group_by(PED_SHNT_HC_ETIOL) %>%
dplyr::summarise(n = n()) %>%
arrange(desc(n))
## # A tibble: 11 × 2
## PED_SHNT_HC_ETIOL n
## <chr> <int>
## 1 Congenital hydrocephalus 524
## 2 Intraventricular hemorrhage (IVH) of prematurity without other cause 373
## 3 Neoplastic 193
## 4 Other - insufficient information to classify type 149
## 5 Spina bifida with Chiari malformation / myelomeningocele 118
## 6 Intracranial cyst 109
## 7 Post infectious 73
## 8 Post hemorrhagic from other vascular lesion 58
## 9 Post traumatic 39
## 10 Syndromic, not otherwise specified 37
## 11 Vascular anomaly 19
#premature births
df %>%
group_by(PREM_BIRTH) %>%
dplyr::summarise(n = n()) %>%
arrange(desc(n))%>%
mutate(percentage = n / sum(n)*100)
## # A tibble: 9 × 3
## PREM_BIRTH n percentage
## <chr> <int> <dbl>
## 1 No 958 56.6
## 2 35-36 completed weeks gestation 158 9.34
## 3 25-26 completed weeks gestation 125 7.39
## 4 33-34 completed weeks gestation 104 6.15
## 5 27-28 completed weeks gestation 99 5.85
## 6 31-32 completed weeks gestation 65 3.84
## 7 29-30 completed weeks gestation 64 3.78
## 8 24 completed weeks gestation 63 3.72
## 9 Less than 24 completed weeks gestation 56 3.31
print("Percentage of patients born premature:")
## [1] "Percentage of patients born premature:"
nrow(cohortA[which(!cohortA$PREM_BIRTH == "No"),])/nrow(cohortA)*100
## [1] 43.38061
Within the 30 day NSQIP follow-up period, %% (n=) of patients experienced shunt failure. Median time to failure was _____. Causes of shunt failure were not reported in the NSQIP data set (is this confirmed? Its variable “PED_SHNT_INTRE1_RSN” but I think I recall this info only being filled out for like 9 pts)
#shunt failure within 30 days
df %>%
filter(!PED_SHNT_INTRE1_DAYS == -99) %>%
summarise(med_days_to_fail = median(PED_SHNT_INTRE1_DAYS))
## med_days_to_fail
## 1 17
#median time to failure 17 days for the 156 of cases (9.219858%) that failed within 30 days
nrow(cohortA[which(!cohortA$PED_SHNT_INTRE1_DAYS == -99),])
## [1] 156
nrow(cohortA[which(!cohortA$PED_SHNT_INTRE1_DAYS == -99),])/nrow(cohortA)*100
## [1] 9.219858
#Causes of shunt failure
df %>%
filter(!PED_SHNT_INTRE1_RSN == "NULL") %>%
group_by(PED_SHNT_INTRE1_RSN) %>%
dplyr::summarise(n = n()) %>%
arrange(desc(n))
## # A tibble: 7 × 2
## PED_SHNT_INTRE1_RSN n
## <chr> <int>
## 1 Shunt infection 50
## 2 Wound disruption or CSF leak 36
## 3 Mechanical issues 21
## 4 Other 17
## 5 Proximal catheter obstruction or malposition 17
## 6 Distal catheter obstruction or malposition 11
## 7 Loculated ventricle 6
#Most common reported causes: Shunt infection (n=50), Wound Disruption or CSF Leak (n=36), and Mechanical issues (n=21).
This section requires a calculated value of gestational age at surgery. In the NSQIP dataset it has to be calculated from “PREM_Birth” + “AGE_DAYS” to make a “gestational_age_surgery” variable. Using calculated “gestational_age_surgery”:
# of patients who had a shunt placed before 40 weeks gestational age: ______ Shunt failure rate in this group: _____ # of patients who had a shunt placed after 40 weeks gestational age: _____ Shunt failure rate in this group: ______ Odds ratio for shunts placed before/after 40 weeks gestational age: _____
nrow(df[which(!df$GESTATIONALAGE_SURGERY == -99),])
## [1] 721
#Cases for which we have gestational age at surgery (721)
df %>%
filter(!GESTATIONALAGE_SURGERY == -99) %>%
dplyr::summarise(n = n())
## n
## 1 721
#cases that had their surgery BEFORE 40 weeks of gestational age (302)
df_before40 <- df %>%
filter(!GESTATIONALAGE_SURGERY == -99) %>%
filter(!GESTATIONALAGE_SURGERY < 40)
#cases that had their surgery AT OR AFTER 40 weeks of gestational age (419)
df_after40 <- df %>%
filter(!GESTATIONALAGE_SURGERY == -99) %>%
filter(!GESTATIONALAGE_SURGERY > 39)
Failures for under/over 40 wks groups
#35 failures in the before40 weeks op group
df_before40 %>%
filter(!PED_SHNT_INTRE1_DAYS == -99) %>%
dplyr::summarise(n = n())
## n
## 1 35
#51 failures in the after40 weeks op group
df_after40 %>%
filter(!PED_SHNT_INTRE1_DAYS == -99) %>%
dplyr::summarise(n = n())
## n
## 1 51
#Both categories have a 12% failure rate:
35/302;51/419
## [1] 0.115894
## [1] 0.1217184
#Median of 19 days to failure in before40 group
df_before40 %>%
filter(!PED_SHNT_INTRE1_DAYS == -99) %>%
summarise(med_days_to_fail = median(PED_SHNT_INTRE1_DAYS))
## med_days_to_fail
## 1 19
#Median of 17 days to failure in before40 group
df_after40 %>%
filter(!PED_SHNT_INTRE1_DAYS == -99) %>%
summarise(med_days_to_fail = median(PED_SHNT_INTRE1_DAYS))
## med_days_to_fail
## 1 17
For this analysis we need the patients with hydrocephalus etiology of only Intraventricular Hemorrhage AND Born Prematurely (which I am calling NSQIP Cohort B). To identify this group in the NSQIP dataset - they have “Intraventricular hemorrhage (IVH) or prematurity or without cause” (PED_SHNT_HC_ETIOL) AND were born <37 weeks gestational age aka yes born pre-maturely in the (PREM_BIRTH) variable))
# of patients with “Intraventricular hemorrhage (IVH) or prematurity or without cause” (PED_SHNT_HC_ETIOL) = _______
unique(df19$PED_SHNT_HC_ETIOL)
## [1] "Intraventricular hemorrhage (IVH) of prematurity without other cause"
## [2] "Neoplastic"
## [3] "NULL"
## [4] "Congenital hydrocephalus"
## [5] "Post traumatic"
## [6] "Other - insufficient information to classify type"
## [7] "Spina bifida with Chiari malformation / myelomeningocele"
## [8] "Post infectious"
## [9] "Vascular anomaly"
## [10] "Intracranial cyst"
## [11] "Post hemorrhagic from other vascular lesion"
## [12] "Syndromic, not otherwise specified"
IVH <- df19[which(df19$PED_SHNT_HC_ETIOL == "Intraventricular hemorrhage (IVH) of prematurity without other cause"),]
cat("Number of patients with Intraventricular hemorrhage (IVH) of prematurity without other cause:",nrow(IVH)) #373
## Number of patients with Intraventricular hemorrhage (IVH) of prematurity without other cause: 373
Within IVH subset, how many are actually prematurely born: Within IVH category, # of patients with (PREM_BIRTH) variable any input other than “no” or “unknown” = ________
cohortB <- IVH[which(IVH$GESTATIONALAGE_BIRTH <37),]
cohortB <- cohortB[which(!cohortB$PREM_BIRTH == "No"),]
cat("\nnumber of patients prematurely born within IVH subset:",nrow(cohortB)) #343
##
## number of patients prematurely born within IVH subset: 343
#patients with (PREM_BIRTH) variable any input other than “no” or “unknown”
#this seems to be asking for the same info as the question immediately prior
#list of the different prem_birth categories and frequencies
cohortB %>%
group_by(PREM_BIRTH) %>%
dplyr::summarise(n = n()) %>%
arrange(desc(n))
## # A tibble: 8 × 2
## PREM_BIRTH n
## <chr> <int>
## 1 25-26 completed weeks gestation 89
## 2 27-28 completed weeks gestation 62
## 3 24 completed weeks gestation 54
## 4 Less than 24 completed weeks gestation 44
## 5 29-30 completed weeks gestation 32
## 6 35-36 completed weeks gestation 27
## 7 31-32 completed weeks gestation 19
## 8 33-34 completed weeks gestation 16
Now we have NSQIP Cohort B (patients with both IVH and were born prematurely)
Within NSQIP Cohort B: how many had shunt implant surgery before 40 weeks gestational age (this is that calculated variable): ________ how many had shunt implant surgery after 40 weeks gestational age (this is that calculated variable): ________
#IVH cases that had their surgery BEFORE 40 weeks of gestational age
ivh_before40 <- cohortB %>%
filter(!GESTATIONALAGE_SURGERY == -99) %>%
filter(!GESTATIONALAGE_SURGERY < 40)
cat("number of IVH patients with shunt implant surgery before 40 weeks gestational age:",nrow(ivh_before40)) #115
## number of IVH patients with shunt implant surgery before 40 weeks gestational age: 115
#IVH cases that had their surgery AT OR AFTER 40 weeks of gestational age
ivh_after40 <- cohortB %>%
filter(!GESTATIONALAGE_SURGERY == -99) %>%
filter(!GESTATIONALAGE_SURGERY > 39)
cat("\nnumber of IVH patients with shunt implant surgery at or after 40 weeks gestational age:",nrow(ivh_after40)) #166
##
## number of IVH patients with shunt implant surgery at or after 40 weeks gestational age: 166
Split NSQIP Cohort B into Before40Weeks and After40Weeks
In Before40Weeks gestational age surgery group: How many had a prior hydrocephalus procedure: ______ Variable “PED_SHNT_PRIOR_HCPROC” (yes, no), we want “yes”
ivh_hydro <- ivh_before40[which(ivh_before40$PED_SHNT_PRIOR_HCPROC == "Yes"),]
cat("\nnumber of IVH patients w surgery before 40 wks with propr hydro procedure:",nrow(ivh_hydro)) #76
##
## number of IVH patients w surgery before 40 wks with propr hydro procedure: 76
How many had a shunt failure: ______ Variable “PED_SHNT_INTRE1”, any entry other than “none”
ivh_fail<- ivh_before40[which(!ivh_before40$PED_SHNT_INTRE1_RSN == "NULL"),]
cat("\nnumber of IVH patients w surgery before 40 wks with shunt failure:",nrow(ivh_fail)) #12
##
## number of IVH patients w surgery before 40 wks with shunt failure: 12
In after 40 weeks gestational age surgery group: How many had a prior hydrocephalus procedure: ______
ivh_hydro <- ivh_after40[which(ivh_after40$PED_SHNT_PRIOR_HCPROC == "Yes"),]
cat("\nnumber of IVH patients w surgery after 40 wks with prev hydro procedure:",nrow(ivh_hydro)) #107
##
## number of IVH patients w surgery after 40 wks with prev hydro procedure: 107
How many had a shunt failure: ______ Variable “PED_SHNT_INTRE1”, any entry other than “none”
ivh_fail<- ivh_after40[which(!ivh_after40$PED_SHNT_INTRE1_RSN == "NULL"),]
cat("\nnumber of IVH patients w surgery after 40 wks with shunt failure:",nrow(ivh_fail)) #18
##
## number of IVH patients w surgery after 40 wks with shunt failure: 18
number of IVH patients with shunt implant surgery before 40 weeks gestational age: 115 number of IVH patients w surgery before 40 wks with shunt failure: 12
cat("Percentage of shunt failures in IVH patients w surgery BEFORE 40 weeks:",12/115)
## Percentage of shunt failures in IVH patients w surgery BEFORE 40 weeks: 0.1043478
number of IVH patients with shunt implant surgery at or after 40 weeks gestational age: 166 number of IVH patients w surgery after 40 wks with shunt failure: 18
cat("\nPercentage of shunt failures in IVH patients w surgery AT/AFTER 40 weeks:",18/166)
##
## Percentage of shunt failures in IVH patients w surgery AT/AFTER 40 weeks: 0.1084337