% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/charlson_index.R
\name{charlson_index}
\alias{charlson_index}
\title{Charlson Comorbidity Index (CCI)}
\usage{
charlson_index(
  data,
  col_map = list(mi = "mi", chf = "chf", pvd = "pvd", stroke = "stroke", dementia =
    "dementia", copd = "copd", rheum = "rheum", ulcer = "ulcer", mild_liver =
    "mild_liver", diabetes = "diabetes", diab_comp = "diab_comp", hemiplegia =
    "hemiplegia", renal = "renal", cancer = "cancer", leukemia = "leukemia", lymphoma =
    "lymphoma", sev_liver = "sev_liver", metastatic_cancer = "metastatic_cancer", hiv =
    "hiv"),
  verbose = TRUE,
  na_action = c("keep", "omit", "error", "ignore", "warn")
)
}
\arguments{
\item{data}{A data.frame or tibble with binary indicators (0/1) for each comorbidity.}

\item{col_map}{Named list mapping keys to columns in \code{data}:
mi, chf, pvd, stroke, dementia, copd, rheum, ulcer, mild_liver, diabetes, diab_comp,
hemiplegia, renal, cancer, leukemia, lymphoma, sev_liver, metastatic_cancer, hiv.}

\item{verbose}{Logical; if TRUE, emits progress messages.}

\item{na_action}{One of c("keep","omit","error","ignore","warn").}
}
\value{
A tibble with one column: charlson_index (integer total score; NA if any
required input is NA and na_action != "omit").
}
\description{
Computes the Charlson Comorbidity Index by summing weighted comorbidities.
}
\details{
The Charlson Index predicts 10-year mortality by summing weighted comorbidities.
We implement the canonical 19-condition, weight scheme:
\itemize{
\item 1 point: myocardial infarction, congestive heart failure, peripheral vascular disease,
cerebrovascular disease (stroke), dementia, chronic pulmonary disease (COPD),
rheumatologic disease, peptic ulcer disease
\item 2 points: hemiplegia/paraplegia, moderate/severe renal disease, any malignancy (non-metastatic),
leukemia, lymphoma, diabetes with complications
\item 3 points: moderate/severe liver disease
\item 6 points: metastatic solid tumor, AIDS/HIV
}

To avoid double counting paired conditions, the following use the maximum applicable weight:
\itemize{
\item Diabetes: max(1 * diabetes without complications, 2 * diabetes with complications)
\item Liver disease: max(1 * mild liver disease, 3 * moderate/severe liver disease)
\item Cancer: max(2 * non-metastatic solid tumor, 6 * metastatic solid tumor)
}

Age points are not included here and can be added separately if needed.
}
\examples{
patient <- tibble::tibble(
  mi=0, chf=0, pvd=0, stroke=0, dementia=0, copd=0, rheum=0, ulcer=0,
  mild_liver=0, diabetes=0, diab_comp=1, hemiplegia=0, renal=1,
  cancer=0, leukemia=0, lymphoma=0, sev_liver=0, metastatic_cancer=0, hiv=0
)
charlson_index(
  patient,
  col_map = as.list(stats::setNames(names(patient), names(patient)))
)

}
\references{
\insertRef{charlson1987cci}{HealthMarkers}
}
