The goal of CMHSU is to detect Mental Health(MH), Substance Use(SU) and Concurrent MHSU status in North American Healthcare administrative databases given clinicians’ set of parameters of interest.
You can install the development version of CMHSU with:
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tidyr)
library(purrr)
#>
#> Attaching package: 'purrr'
#> The following object is masked from 'package:base':
#>
#> %||%
library(CMHSU)
Group | Size | VisitDate Span | Visit Length | SU (freq) | MH (freq) | Other (freq) |
---|---|---|---|---|---|---|
1 | 10 | 01.01.2024-31.01.2024 | One month | F100(1) | F060(2) | NA |
2 | 20 | 01.02.2024-31.03.2024 | Two months | T4041(2) | F063(4) | J10(4) |
3 | 30 | 01.04.2024-31.06.2024 | Three months | F120(3) | F064(6) | I10(3) |
4 | 40 | 01.07.2024-31.12.2024 | Six months | F140(6) | F067(12) | I10(6),J10(12) |
5 | 25 | 01.11.2024-31.12.2024 | Two months | F100(3) | NA | J10(6) |
6 | 25 | 01.11.2024-31.12.2024 | Two months | NA | F060(4) | I10(2) |
7 | 50 | 01.11.2024-31.12.2024 | Two months | NA | NA | I10(1),J10(2) |
#>
#> **Notes**: F100 (Alcohol); F060 (Psychotic); T4041 (Fentanyl); F063 (Mood); F120 (Cannabis);
#> F064 (Anxiety); F140 (Cocaine); F067 (Neurocognitive); I10 (Hypertension);
#> J10 (Influenza); NA (Not Applicable)
Mental Health status detection for clients with Psychotic, Mood, Anxiety, Neurocognitive disorders with minimum one hospital visit, minimum one physician visit in the maximum time span of two months(60 days).
data("SampleRWD")
myexample<-SampleRWD[,c(1:4)]
SampleMH_1=MH_status(myexample, n_MHH=1, n_MHP=1, t_MH=60,
ICD_MH=c("F060","F063","F064", "F067"))
head(SampleMH_1)
#> # A tibble: 6 × 4
#> ClientID earliestdate_MH latestdate_MH MH_status
#> <int> <chr> <chr> <chr>
#> 1 1 2024-01-15 2024-01-19 YES
#> 2 2 2024-01-03 2024-01-10 YES
#> 3 3 2024-01-11 2024-01-22 YES
#> 4 4 2024-01-14 2024-01-20 YES
#> 5 5 2024-01-25 2024-01-26 YES
#> 6 6 2024-01-05 2024-01-19 YES
Substance Use status detection for clients with Alcohol, Fentanyl, Cannabis, Cocaine consumption related disorders with minimum one hospital visit, minimum one physician visit in the maximum time span of two months(60 days).
myexample<-SampleRWD[,c(1:4)]
SampleSU_1=SU_status(myexample, n_SUH=1, n_SUP=1, t_SU=60,
ICD_SU=c("F100","T4041","F120","F140"))
head(SampleSU_1)
#> # A tibble: 6 × 4
#> ClientID earliestdate_SU latestdate_SU SU_status
#> <int> <chr> <chr> <chr>
#> 1 1 2024-01-31 2024-01-31 YES
#> 2 2 2024-01-14 2024-01-14 YES
#> 3 3 2024-01-18 2024-01-18 YES
#> 4 4 2024-01-05 2024-01-05 YES
#> 5 5 2024-01-22 2024-01-22 YES
#> 6 6 2024-01-27 2024-01-27 YES
Users can apply basic function to detect concurrent MHSU status when the maximum time span between MH status and SU status is equal or larger than given data time span.
Concurrent Mental Health and Substance Use status detection for clients with Psychotic, Mood, Anxiety, Neurocognitive disorders and their combination with Alcohol, Fentanyl, Cannabis, Cocaine consumption related disorders with minimum one hospital visit, minimum one physician visit in the maximum time span of two months(60 days) for each of MH and SU; and, maximum time span of one year(365 days) between MH status and SU status. Note: data time span is 363 days which is smaller than given span 365 days.
myexample<-SampleRWD[,c(1:4)]
SampleMHSU_1=MHSU_status_basic(myexample,
n_MHH=1, n_MHP=1, n_SUH=1, n_SUP=1,
t_MH=60, t_SU=60, t_MHSU=365,
ICD_MH=c("F060","F063","F064", "F067"),
ICD_SU=c("F100","T4041","F120","F140"))
head(SampleMHSU_1)
#> # A tibble: 6 × 8
#> ClientID earliestdate_MH latestdate_MH earliestdate_SU latestdate_SU MH_status
#> <int> <chr> <chr> <chr> <chr> <chr>
#> 1 1 2024-01-15 2024-01-19 2024-01-31 2024-01-31 YES
#> 2 2 2024-01-03 2024-01-10 2024-01-14 2024-01-14 YES
#> 3 3 2024-01-11 2024-01-22 2024-01-18 2024-01-18 YES
#> 4 4 2024-01-14 2024-01-20 2024-01-05 2024-01-05 YES
#> 5 5 2024-01-25 2024-01-26 2024-01-22 2024-01-22 YES
#> 6 6 2024-01-05 2024-01-19 2024-01-27 2024-01-27 YES
#> # ℹ 2 more variables: SU_status <chr>, MHSU_status <chr>
Users can apply broad function to detect concurrent MHSU status when the maximum time span between MH status and SU status is smaller than given data time span. In this case, there will be k=data time span(days)-given MHSU time span(days)+1 windows of detection status with each window with the time span of given MHSU time span(days).
Concurrent Mental Health and Substance Use status detection for clients with Psychotic, Mood, Anxiety, Neurocognitive disorders and their combination with Alcohol, Fentanyl, Cannabis, Cocaine consumption related disorders with minimum one hospital visit, minimum one physician visit in the maximum time span of two months(60 days) for each of MH and SU; and, maximum time span of one year(360 days) between MH status and SU status. Note: data time span is 363 days which is larger than given span 360 days. This yields k=363-360+1=4 windows.
SampleMHSU_2=MHSU_status_broad(myexample,
n_MHH=1, n_MHP=1, n_SUH=1, n_SUP=1,
t_MH=60, t_SU=60, t_MHSU=360,
ICD_MH=c("F060","F063","F064", "F067"),
ICD_SU=c("F100","T4041","F120","F140"))
#> Adding missing grouping variables: `Window`
head(SampleMHSU_2[c(1,201,401,601),])
#> # A tibble: 4 × 9
#> # Groups: Window [4]
#> Window ClientID earliestdate_MH latestdate_MH earliestdate_SU latestdate_SU
#> <int> <int> <chr> <chr> <chr> <chr>
#> 1 1 1 2024-01-15 2024-01-19 2024-01-31 2024-01-31
#> 2 2 1 2024-01-15 2024-01-19 2024-01-31 2024-01-31
#> 3 3 1 2024-01-15 2024-01-19 2024-01-31 2024-01-31
#> 4 4 1 2024-01-15 2024-01-19 2024-01-31 2024-01-31
#> # ℹ 3 more variables: MH_status <chr>, SU_status <chr>, MHSU_status <chr>