Using the concept of comorbidities is a good method to do this. This is done by my R package icd for standardized collections of diseases, such as "Diabetes," "Cancer," and "Heart Disease." There are several comorbidity maps to choose from, so you may find one that matches your interests, for example. The PCCC maps in icd can be used for children, while the others are for adults and cover a wide range of diseases.
As an example, see the vignette in the introduction. These are ICD-9 codes, although ICD-10 can be used instead.
data <- data.frame(
visit_id = c(1000, 1000, 1000, 1000, 1001, 1001, 1002),
icd9 = c("40201", "2258", "7208", "25001", "34400", "4011", "4011"),
poa = c("Y", NA, "N", "Y", "X", "Y", "E"),
stringsAsFactors = FALSE
)
data
visit_id icd9 poa
1 1000 40201 Y
2 1000 2258 <NA>
3 1000 7208 N
4 1000 25001 Y
5 1001 34400 X
6 1001 4011 Y
7 1002 4011 E
icd::comorbid_ahrq(data)
CHF Valvular PHTN PVD HTN Paralysis NeuroOther Pulmonary DM DMcx Hypothyroid Renal Liver
1000 TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE
1001 FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
1002 FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
PUD HIV Lymphoma Mets Tumor Rheumatic Coagulopathy Obesity WeightLoss FluidsLytes BloodLoss
1000 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
1001 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
1002 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
Anemia Alcohol Drugs Psychoses Depression
1000 FALSE FALSE FALSE FALSE FALSE
1001 FALSE FALSE FALSE FALSE FALSE
1002 FALSE FALSE FALSE FALSE FALSE
Diabetes Mellitus is represented by the letter "DM," whereas diabetes with complications, such as retinopathy or renal failure, is represented by the letter "DMcx." This is with the standard Elixhauser classifications as modified by the US AHRQ.
You can utilize binary flags for illness stages in any statistical or machine learning model if you have them.
Elevate your skills with our comprehensive AI ML Course.