Title: | Harmonizing Various Comorbidity, Multimorbidity, and Frailty Measures |
---|---|
Description: | Identifying comorbidities, frailty, and multimorbidity in claims and administrative data is often a duplicative process. The functions contained in this package are meant to first prepare the data to a format acceptable by all other packages, then provide a uniform and simple approach to generate comorbidity and multimorbidity metrics based on these claims data. The package is ever evolving to include new metrics, and is always looking for new measures to include. The citations used in this package include the following publications: Anne Elixhauser, Claudia Steiner, D. Robert Harris, Rosanna M. Coffey (1998) <doi:10.1097/00005650-199801000-00004>, Brian J Moore, Susan White, Raynard Washington, et al. (2017) <doi:10.1097/MLR.0000000000000735>, Mary E. Charlson, Peter Pompei, Kathy L. Ales, C. Ronald MacKenzie (1987) <doi:10.1016/0021-9681(87)90171-8>, Richard A. Deyo, Daniel C. Cherkin, Marcia A. Ciol (1992) <doi:10.1016/0895-4356(92)90133-8>, Hude Quan, Vijaya Sundararajan, Patricia Halfon, et al. (2005) <doi:10.1097/01.mlr.0000182534.19832.83>, Dae Hyun Kim, Sebastian Schneeweiss, Robert J Glynn, et al. (2018) <doi:10.1093/gerona/glx229>, Melissa Y Wei, David Ratz, Kenneth J Mukamal (2020) <doi:10.1111/jgs.16310>, Kathryn Nicholson, Amanda L. Terry, Martin Fortin, et al. (2015) <doi:10.15256/joc.2015.5.61>, Martin Fortin, José Almirall, and Kathryn Nicholson (2017)<doi:10.15256/joc.2017.7.122>. |
Authors: | Wyatt Bensken [aut, cre] |
Maintainer: | Wyatt Bensken <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.1 |
Built: | 2025-02-05 03:24:58 UTC |
Source: | https://github.com/wyattbensken/multimorbidity |
cfi
returns a summary dataset containing the deficit-accumulation frailty index
for each patient.
cfi( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, hcpcs = "yes" )
cfi( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, hcpcs = "yes" )
dat |
dataset which has been properly prepared using 'prepare_data()' |
id |
variable of the unique patient identifier |
dx |
the column with the diagnoses and procedures (defaults to 'dx') |
version |
which version(s) of ICD your data contain (ICD-9 only: 9, ICD-10 only: 10, Both: 19) |
version_var |
variable which denotes if the diagnoses on that row are ICD-9 (9) or ICD-10 (10) |
hcpcs |
whether or not HCPCS variables are included ("yes" or "no", where "yes" is the default) |
This function uses data which has been properly prepared to calculate the claims-based frailty index (CFI) developed by Kim et al. for each patient. As this algorithm was never developed to require two diagnosis codes, and is weighted, we have excluded that feature from this function. See full package documentation for additional details. This function is based largely on the code available via the Harvard Dataverse.
dataframe with one row per patient, and a column for their patient id and a column with their frailty index.
cfi(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version)
cfi(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version)
A lookup dataset for CFI ICD-10.
data(cfi_dx10lookup)
data(cfi_dx10lookup)
An object of class data.frame
with 44807 rows and 2 columns.
This was created by Kim et al.
A lookup dataset for CFI ICD-9.
data(cfi_dx9lookup)
data(cfi_dx9lookup)
An object of class data.frame
with 107 rows and 3 columns.
This was created by Kim et al.
A lookup dataset for CFI Procedure Codes.
data(cfi_pxlookup)
data(cfi_pxlookup)
An object of class data.frame
with 90 rows and 3 columns.
This was created by Kim et al.
A lookup dataset for CFI weights.
data(cfi_weightlookup)
data(cfi_weightlookup)
An object of class data.frame
with 93 rows and 2 columns.
This was created by Kim et al.
charlson
returns a summary dataset containing the Charlson comorbidities for
each patient.
charlson( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, outpatient_two = "no" )
charlson( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, outpatient_two = "no" )
dat |
dataset which has been properly prepared using 'prepare_data()' |
id |
variable of the unique patient identifier |
dx |
the column with the diagnoses (defaults to 'dx') |
version |
which version(s) of ICD your data contain (ICD-9 only: 9, ICD-10 only: 10, Both: 19) |
version_var |
variable which denotes if the diagnoses on that row are ICD-9 (9) or ICD-10 (10) |
outpatient_two |
whether or not it should be required for there to be two outpatient claims for a diagnosis for a patient to be positively coded with that diagnosis. |
This function uses data which has been properly prepared to identify and flag the Charlson comorbidities. See full package documentation for additional details.
dataframe with one row per patient, and a column for their patient id, a column with each Charlson comorbidity, and a column with their Charlson score
charlson(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version, outpatient_two = "yes")
charlson(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version, outpatient_two = "yes")
comorbidity_window
returns a dataset of claims which fall within a specific timeframe.
comorbidity_window( dat = NULL, id_dat = NULL, id = NULL, id_date = NULL, claims_date = NULL, time_pre = Inf, time_post = Inf )
comorbidity_window( dat = NULL, id_dat = NULL, id = NULL, id_date = NULL, claims_date = NULL, time_pre = Inf, time_post = Inf )
dat |
dataset |
id_dat |
dataset with our other identifying variables, this should be 1 row per person |
id |
ID variable which will be used to match and merge |
id_date |
name of the date of interest from the identification dataset, for example a date of diagnosis |
claims_date |
name for the variable in the claims data (dat) which is the date of the claim |
time_pre |
number to limit how many days, pre diagnosis, should be included. Default will be infinity (all claims) |
time_post |
similar to time_pre, but this will be after the date of interest |
This function takes prepared data, using the 'prepare_data' function, along with an identification dataset to limit the claims of interest to a specific time window.
dataframe with which has limited the claims to a specific window
comorbidity_window(id_dat = id, dat = prepared_data, id = patient_id, id_date = date_of_interest9, claims_date = claim_date, time_pre = 60)
comorbidity_window(id_dat = id, dat = prepared_data, id = patient_id, id_date = date_of_interest9, claims_date = claim_date, time_pre = 60)
elixhauser
returns a summary dataset containing the Elixhauser comorbidities for
each patient.
elixhauser( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, outpatient_two = "no" )
elixhauser( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, outpatient_two = "no" )
dat |
dataset which has been properly prepared using 'prepare_data()' |
id |
variable of the unique patient identifier |
dx |
the column with the diagnoses (defaults to 'dx') |
version |
which version(s) of ICD your data contain (ICD-9 only: 9, ICD-10 only: 10, Both: 19) |
version_var |
variable which denotes if the diagnoses on that row are ICD-9 (9) or ICD-10 (10) |
outpatient_two |
whether or not it should be required for there to be two outpatient claims for a diagnosis for a patient to be positively coded with that diagnosis. |
This function uses data which has been properly prepared to identify and flag the Elixhauser comorbidities. See full package documentation for additional details.
dataframe with one row per patient, and a column for their patient id, a column with each Elixhauser comorbidity, and a column with their Elixhauser index for readmission and death
elixhauser(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version, outpatient_two = "yes")
elixhauser(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version, outpatient_two = "yes")
A dataset with fake patient data for 5 patients, with both inpatient and outpatient data, as well as HCPCS codes, and ICD9 and ICD10.
data(i9_i10_comb)
data(i9_i10_comb)
A data frame with 58 rows and 11 variables:
patient_id
patient's sex (male or female)
the date of service for the fake claim
inpatient (ip) or outpatient(ot)
first diagnosis
second diagnosis
third diagnosis
fourth diagnosis
fifth diagnosis
HCPCS code
Which version of ICD the row is. 9 = ICD-9, 0 = ICD-10
This was created by the package author.
A dataset with fake patient data, to match the diagnoses, that includes a date of interest to demonstrate how we can attach these dates and then subset the data to a specific time window around the date of interest.
data(id)
data(id)
A data frame with 5 rows and 3 variables:
patient_id
the date of interest, if you were to use only ICD-10 data
The date of interest, if you were to use only ICD-9 data
This was created by the package author.
cfi
returns a summary dataset containing the multimorbidity weighted index
for each patient.
mwi(dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL)
mwi(dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL)
dat |
dataset which has been properly prepared using 'prepare_data()' |
id |
variable of the unique patient identifier |
dx |
the column with the diagnoses and procedures (defaults to 'dx') |
version |
which version(s) of ICD your data contain (ICD-9 only: 9, ICD-10 only: 10, Both: 19) |
version_var |
variable which denotes if the diagnoses on that row are ICD-9 (9) or ICD-10 (10) |
This function uses data which has been properly prepared to calculate the multimorbidity weighted index developed by Wei et al. As this algorithm was never developed to require two diagnosis codes, and is weighted, we have excluded that feature from this function. See full package documentation for additional details.
mwi(dat = prepared_data, id = patient_id, dx = dx, version = 9, version_var = version)
mwi(dat = prepared_data, id = patient_id, dx = dx, version = 9, version_var = version)
elixhauser
returns a summary dataset containing the Nicholson and
Fortin Conditions for each patient.
nicholsonfortin( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, outpatient_two = "no" )
nicholsonfortin( dat = NULL, id = NULL, dx = "dx", version = 19, version_var = NULL, outpatient_two = "no" )
dat |
dataset which has been properly prepared using 'prepare_data()' |
id |
variable of the unique patient identifier |
dx |
the column with the diagnoses (defaults to 'dx') |
version |
which version(s) of ICD your data contain (ICD-9 only: 9, ICD-10 only: 10, Both: 19) |
version_var |
variable which denotes if the diagnoses on that row are ICD-9 (9) or ICD-10 (10) |
outpatient_two |
whether or not it should be required for there to be two outpatient claims for a diagnosis for a patient to be positively coded with that diagnosis. |
This function uses data which has been properly prepared to identify and flag the Nicholson and Fortin conditions See full package documentation for additional details.
dataframe with one row per patient, and a column for their patient id, a column with each Nicholson/Fortin comorbidity
nicholsonfortin(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version, outpatient_two = "yes")
nicholsonfortin(dat = prepared_data, id = patient_id, dx = dx, version = 19, version_var = version, outpatient_two = "yes")
prepare_data
returns a dataset which has been transformed and prepared for subsequent functions in this
package.
prepare_data( dat = NULL, style = "long", id = NULL, prefix_dx = "dx", hcpcs = "no", prefix_hcpcs, version_var, type_name, date )
prepare_data( dat = NULL, style = "long", id = NULL, prefix_dx = "dx", hcpcs = "no", prefix_hcpcs, version_var, type_name, date )
dat |
dataset |
style |
long, the default, is one diagnosis column per row whereas wide is multiple diagnosis columns |
id |
unique patient identifier variable name |
prefix_dx |
the variable prefix for the diagnosis columns (defaults to "dx"), in quotes |
hcpcs |
whether or not HCPCS variables are included ("yes" or "no", where "no" is the default) |
prefix_hcpcs |
if HCPCS are included, the variable prefix in quotes |
version_var |
variable which denotes if the diagnoses on that row are ICD-9 (9) or ICD-10 (10) |
type_name |
variable to denote if the claim is inpatient (ip) or outpatient (ot) |
date |
variable with the date of the claim |
This function takes our raw claims data, in a number of different forms, and prepares it in a way which allows the other functions in this package to easily work with it. It is recommended to run this package on all data regardless of setup.
dataframe with multiple rows per patient, which has re-structured their claims
prepare_data(dat = i9_i10_comb, id = patient_id, style = "wide", prefix_dx = "dx", hcpcs = "yes", prefix_hcpcs = "hcpcs", version_var = icd_version, type_name = visit_type, date = date_of_serv)
prepare_data(dat = i9_i10_comb, id = patient_id, style = "wide", prefix_dx = "dx", hcpcs = "yes", prefix_hcpcs = "hcpcs", version_var = icd_version, type_name = visit_type, date = date_of_serv)
A dataset which has been prepared using the prepare_data function in this package.
data(prepared_data)
data(prepared_data)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 242 rows and 5 columns.
Built using the packages in this code.