To describe the change in rates of major drug classess namely stimulants, cocaine, opioids, cannabis and sedative hypnotics detected in urine drug testing in the last 5 years.
For this objective, we collated the test reports of all toxicology tests done between 01.01.2017 and 01.01.2022. Each testing instance is coded as TRUE i.e. presence of drug or FALSE i.e. absence of drug combining the screening and confirmatory where available. We then calculated the proportion of tests that were positive for each drug class.
dataSetTestGroups <- dataSetLong %>%
group_by(UHID,DateofRequisition,testGroup,siteOfCollection)%>%
summarise(
result = any(result=="positive")
)
library(flextable)
tbl <- dataSetTestGroups %>%
group_by(testGroup)%>%
summarise(
"totalTests"= n(),
"positives"= sum(result,na.rm = TRUE),
"pos.rate"= round(mean(result,na.rm = TRUE),2)
)%>%
flextable()%>% theme_box()%>% autofit()
tbl
testGroup | totalTests | positives | pos.rate |
|---|---|---|---|
barbiturates | 2,928 | 86 | 0.03 |
benzodiazepines | 3,916 | 1,687 | 0.43 |
cannabinoids | 4,404 | 1,156 | 0.26 |
coughSyrupAdditives | 225 | 156 | 0.69 |
hallucinogens | 9 | 0 | 0.00 |
inhalants | 60 | 15 | 0.25 |
opiates | 4,914 | 430 | 0.09 |
opioidSubstitution | 571 | 498 | 0.87 |
stimulants | 2,962 | 50 | 0.02 |
syntheticOpioids | 658 | 139 | 0.21 |
zdrugs | 1 | 1 | 1.00 |
# Group by UHID and date of requisition and then report sitewise
dataSetLong %>%
group_by(UHID,DateofRequisition,siteOfCollection)%>%
summarise(
result = any(result=="positive")
)%>%
group_by(siteOfCollection)%>%
summarise(
"totalTests"= n(),
"positives"= sum(result,na.rm = TRUE),
"pos.rate"= round(mean(result,na.rm = TRUE),2)
)%>%
flextable()%>% theme_box()%>% autofit()
siteOfCollection | totalTests | positives | pos.rate |
|---|---|---|---|
emergency | 1,390 | 818 | 0.59 |
ipd | 3,200 | 1,975 | 0.62 |
opd | 853 | 487 | 0.57 |
# Give the same stats testgroup wise
dataSetTestGroups %>%
group_by(siteOfCollection,testGroup)%>%
summarise(
"totalTests"= n(),
"positives"= sum(result,na.rm = TRUE),
"pos.rate"= round(mean(result,na.rm = TRUE),2)
)%>%
flextable()%>% theme_box()%>% autofit()
siteOfCollection | testGroup | totalTests | positives | pos.rate |
|---|---|---|---|---|
emergency | barbiturates | 1,260 | 48 | 0.04 |
emergency | benzodiazepines | 1,344 | 613 | 0.46 |
emergency | cannabinoids | 1,370 | 319 | 0.23 |
emergency | coughSyrupAdditives | 31 | 18 | 0.58 |
emergency | hallucinogens | 3 | 0 | 0.00 |
emergency | inhalants | 10 | 1 | 0.10 |
emergency | opiates | 1,357 | 43 | 0.03 |
emergency | opioidSubstitution | 1 | 0 | 0.00 |
emergency | stimulants | 1,266 | 24 | 0.02 |
emergency | syntheticOpioids | 21 | 4 | 0.19 |
ipd | barbiturates | 1,312 | 36 | 0.03 |
ipd | benzodiazepines | 2,028 | 964 | 0.48 |
ipd | cannabinoids | 2,409 | 651 | 0.27 |
ipd | coughSyrupAdditives | 151 | 102 | 0.68 |
ipd | hallucinogens | 5 | 0 | 0.00 |
ipd | inhalants | 45 | 13 | 0.29 |
ipd | opiates | 2,781 | 289 | 0.10 |
ipd | opioidSubstitution | 388 | 340 | 0.88 |
ipd | stimulants | 1,336 | 19 | 0.01 |
ipd | syntheticOpioids | 414 | 93 | 0.22 |
ipd | zdrugs | 1 | 1 | 1.00 |
opd | barbiturates | 356 | 2 | 0.01 |
opd | benzodiazepines | 544 | 110 | 0.20 |
opd | cannabinoids | 625 | 186 | 0.30 |
opd | coughSyrupAdditives | 43 | 36 | 0.84 |
opd | hallucinogens | 1 | 0 | 0.00 |
opd | inhalants | 5 | 1 | 0.20 |
opd | opiates | 776 | 98 | 0.13 |
opd | opioidSubstitution | 182 | 158 | 0.87 |
opd | stimulants | 360 | 7 | 0.02 |
opd | syntheticOpioids | 223 | 42 | 0.19 |
This is our primary research question. We limit our analysis to substance groups that have more than 20 entries out of 60 months under study. Furthermore, we have to limit to months that have at least 20 tests conducted as otherwise a logistic regression model is not justified.
tbl <- readRDS(file.path(root,"output","dayaRaniModels.rds"))
#round to four digits all numerical cols
tbl <- tbl %>%
mutate_if(is.numeric,round,4)%>%
select(term,testGroup,numberOfObservations,everything())
tbl$term <- "Month on Month Change"
tbl <- tbl %>% flextable()%>% theme_box() %>% autofit()
# merge the cells that have term as Month on Month Change
tbl <- merge_v(tbl,part = "body",j = "term")
tbl
term | testGroup | numberOfObservations | estimate | std.error | statistic | p.value | conf.low | conf.high | expEstimate | expEstimateLower | expEstimateUpper |
|---|---|---|---|---|---|---|---|---|---|---|---|
Month on Month Change | barbiturates | 57 | -0.0047 | 0.0087 | -0.5374 | 0.5910 | -0.0219 | 0.0123 | 0.9953 | 0.9784 | 1.0123 |
benzodiazepines | 60 | -0.0025 | 0.0024 | -1.0094 | 0.3128 | -0.0072 | 0.0023 | 0.9975 | 0.9928 | 1.0023 | |
cannabinoids | 60 | -0.0091 | 0.0025 | -3.6378 | 0.0003 | -0.0140 | -0.0042 | 0.9909 | 0.9861 | 0.9958 | |
opiates | 60 | -0.0632 | 0.0043 | -14.7730 | 0.0000 | -0.0717 | -0.0549 | 0.9387 | 0.9308 | 0.9465 | |
opioidSubstitution | 48 | -0.0033 | 0.0098 | -0.3430 | 0.7316 | -0.0225 | 0.0159 | 0.9967 | 0.9777 | 1.0160 | |
stimulants | 57 | 0.0015 | 0.0114 | 0.1350 | 0.8926 | -0.0210 | 0.0238 | 1.0015 | 0.9793 | 1.0241 | |
syntheticOpioids | 47 | -0.0262 | 0.0078 | -3.3611 | 0.0008 | -0.0416 | -0.0110 | 0.9742 | 0.9593 | 0.9890 |
Surprisingly, the positivity rate has decreased for all groups of substances except stimulants. In them too, this change is not statistically significant.
This can be an artifact of more number of tests being ordered, so we look at the number of positive results graphically to see if the absolute number of positive tests has changed over time.
dataModels <- dataSetTestGroups %>%
mutate("yearMonth"= ceiling_date(DateofRequisition,"month"))%>%
group_by(testGroup,yearMonth)%>%
summarise(
"totalTests"=n(),
"positiveTests"=sum(result),
"month"= month(yearMonth,label=T)
)%>%
distinct(testGroup,yearMonth,.keep_all = TRUE)%>%
filter(totalTests>10)%>%
group_by(testGroup)%>%
mutate("n"=n())%>%
filter(n>20)
# Make a plot of total positive cases over time, color by testGroup
dataModels %>%
ggplot(aes(x=yearMonth,y=positiveTests))+
geom_point()+
geom_smooth(method = "lm",se=FALSE)+
scale_x_date(date_breaks = "1 year",date_labels = "%Y")+
theme_bw()+
labs(x="Year",y="Number of positive tests")+
facet_wrap(~testGroup,scales = "free_y")
The only clear trend is in decrease of opiates (morphine, codeine, heroin) positive tests.
dataSetTestGroups$age <- dataSetLong$age[match(
dataSetTestGroups$UHID,dataSetLong$UHID
)]
dataSetTestGroups$gender <- dataSetLong$patientGender[match(
dataSetTestGroups$UHID,dataSetLong$UHID
)]
tbl <- dataSetTestGroups %>%
group_by(testGroup)%>% # for each test group
summarise(
"mean.age"= round(mean(age,na.rm=T),2),
"sd.age"= round(sd(age,na.rm=T),2),
"prop.males"= round(mean(gender!="Female",na.rm=T),3)
)
tbl <- tbl %>% flextable()%>% theme_box() %>% autofit()
tbl
testGroup | mean.age | sd.age | prop.males |
|---|---|---|---|
barbiturates | 34.73 | 10.01 | 0.921 |
benzodiazepines | 35.08 | 10.25 | 0.922 |
cannabinoids | 34.79 | 9.96 | 0.925 |
coughSyrupAdditives | 37.35 | 11.03 | 0.893 |
hallucinogens | 41.89 | 10.84 | 0.889 |
inhalants | 34.80 | 12.88 | 0.933 |
opiates | 36.12 | 10.44 | 0.923 |
opioidSubstitution | 39.04 | 10.46 | 0.926 |
stimulants | 34.72 | 9.99 | 0.922 |
syntheticOpioids | 38.06 | 9.55 | 0.900 |
zdrugs | 38.00 | 0.000 |
The plot below shows the median age and interquartile range of patients tested for each substance group over time.
dataSetTestGroups %>%
mutate("yearMonth"= ceiling_date(DateofRequisition,"month"))%>%
group_by(testGroup,yearMonth)%>%
summarise(
"median.age"= median(age,na.rm=T),
"q1.age"= quantile(age,0.25,na.rm=T),
"q3.age"= quantile(age,0.75,na.rm=T)
)%>%
distinct(testGroup,yearMonth,.keep_all = TRUE)%>%
filter(testGroup %in% dataModels$testGroup)%>%
ggplot(aes(x=yearMonth,y=median.age))+
geom_point()+
geom_errorbar(aes(ymin=q1.age,ymax=q3.age))+
labs(
x="Year-Month",
y="Median age",
title="Median age over time"
)+
facet_wrap(~testGroup,scales = "free_y")
To calculate the agreement between self-reported substance use and results of urine drug testing.
Following considerations should be made while calculating the
agreement between self-reported substance use and results of urine drug
testing:
1. The unit of analysis is a testing instance i.e. all test results for
a patient at a given point in time.
2. Only instances where a substance other than Benzodiazepines and
Buprenorphine (as they are frequently given for therapeutic purposes) is
positive should be included to measure honest reporting of all substance
use.
3. We will attempt to report agreement with respect to the site of
collection.
dataSetWider <- dataSetTestGroups %>%
pivot_wider(
id_cols = c(UHID,DateofRequisition,siteOfCollection),
names_from = testGroup,
values_from = result,
values_fill = NA
)
We have 5443 unique testing instances. This comes from 3503 unique patients. When restricted to criteria number 2 above.
dataSetWider <- dataSetWider %>%
ungroup()%>%
select(-benzodiazepines,-opioidSubstitution)%>%
filter(rowSums(.[,4:12],na.rm=T)>0)
This leaves us with 1806 unique testing instances. This comes from 1165 unique patients.
These tests come from the following sites of collection:
# make a flextable table of site of collection
library(forcats)
tbl <- dataSetWider %>%
group_by(siteOfCollection)%>%
summarise(
"n"=n(),
"prop"=round(n()/nrow(dataSetWider),3)
)%>%
mutate("siteOfCollection"=fct_reorder(siteOfCollection,n))%>%
flextable()%>%
theme_box() %>% autofit()
tbl
siteOfCollection | n | prop |
|---|---|---|
emergency | 410 | 0.227 |
ipd | 1,065 | 0.590 |
opd | 331 | 0.183 |
And the detected substances for which the agreement needs to be checked are as follows:
# make a flextable of positivity rate by substance
dataSetWider %>%
ungroup()%>%
select(-UHID,-DateofRequisition,-siteOfCollection)%>%
summarise_all(sum,na.rm=T)%>%
mutate_all(function(x) round(x/nrow(dataSetWider),3))%>%
# transpose to make two columns one with name and one with val
t()%>%
as.data.frame()%>%
mutate("substance"=rownames(.))%>%
select(substance,1)%>%
flextable()%>%
theme_box() %>% autofit()
substance | V1 |
|---|---|
cannabinoids | 0.640 |
barbiturates | 0.048 |
opiates | 0.238 |
stimulants | 0.028 |
syntheticOpioids | 0.077 |
hallucinogens | 0.000 |
coughSyrupAdditives | 0.086 |
inhalants | 0.008 |
zdrugs | 0.001 |
We take 135 cases instances for patients on OST irrespective of the site of collection.
ostGroup <- dataSetTestGroups%>%
ungroup()%>%
filter(testGroup=="opioidSubstitution" &
DateofRequisition>dmy("01.01.2018"))%>%
group_by(UHID)%>%
summarise("N"=n())%>%
arrange(desc(N))%>%
ungroup()%>%
slice_head(n=135)
x <-sum(dataSetWider$UHID %in% ostGroup$UHID)
There are 351 testing instances from patients on OST. We have randomly sampled 135 of these.
# sample 150 testing instances from OST group
dataSetOST <- dataSetWider%>%
filter(UHID %in% ostGroup$UHID)%>%
sample_n(135)
dataSetWider <- dataSetWider %>%
filter(!(UHID %in% dataSetOST$UHID &
DateofRequisition %in% dataSetOST$DateofRequisition))
From, the remaining 1636 testing instances, we sample 270 instances from the remaining testing instances.Splitting the number 270 equally between emergency services, IPD and OPD i.e. 90 from each.
# sample 90 testing instances from emergency services
dataSetEmergency <- dataSetWider%>%
filter(siteOfCollection=="emergency")%>%
sample_n(90)
# sample 90 testing instances from IPD
dataSetIPD <- dataSetWider%>%
filter(siteOfCollection=="ipd")%>%
sample_n(90)
# sample 90 testing instances from OPD
dataSetOPD <- dataSetWider%>%
filter(siteOfCollection=="opd")%>%
sample_n(90)
These cases with thier UHID, date of requisition and site of collection are shared in the google sheet
dataSetOST <- readRDS(file.path(root,"output","dataSetOST.rds"))
dataSetEmergency <- readRDS(file.path(root,"output","dataSetEmergency.rds"))
dataSetIPD <- readRDS(file.path(root,"output","dataSetIPD.rds"))
dataSetOPD <- readRDS(file.path(root,"output","dataSetOPD.rds"))
temp <- rbind(dataSetOST,dataSetEmergency,
dataSetIPD,dataSetOPD)
We are finally reporting agreement of self-report and testing for 311 patients.