# Charlson comorbidity index (Charlson)

Charlson CCI

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/charlson`
HTML: https://magentlab.com/docs/charlson
Markdown: https://magentlab.com/docs/charlson.md

Not a medical device. Not a diagnosis, dose, or listing recommendation.

## What it computes

Sum the nineteen Charlson 1987 original comorbidity weights and return the published 1-year mortality group.

## When to use

When an agent needs the Charlson 1987 original weighted index from caller-assigned flags and must not invent Deyo, Quan, ICD mapping, or age points.

## When not to use

- Not a medical device and not a diagnosis. magent does not assign comorbidities from a chart or ICD codes.
- This is the Charlson 1987 original weighted index only. It is not Deyo, not Quan, not ICD mapping, and not age-adjusted Charlson.
- The nineteen flags are independent. Overlapping pairs (for example both diabetes flags) are summed as published weights, not silently dropped.
- Age is not added. 1-year mortality groups follow Charlson 1987 (0 / 1–2 / 3–4 / ≥5) and are not a treatment order.
- LACE takes a caller-supplied Charlson integer; this tool computes that integer from flags.

## Formula

```
CCI = myocardial_infarction 1 + congestive_heart_failure 1 + peripheral_vascular_disease 1 + cerebrovascular_disease 1 + dementia 1 + chronic_pulmonary_disease 1 + connective_tissue_disease 1 + peptic_ulcer_disease 1 + mild_liver_disease 1 + diabetes 1 + hemiplegia 2 + moderate_severe_renal_disease 2 + diabetes_end_organ 2 + any_tumor 2 + leukemia 2 + lymphoma 2 + moderate_severe_liver_disease 3 + metastatic_solid_tumor 6 + aids 6; Charlson 1987 original weighted index; max 37; 1-year mortality groups 0 / 1-2 / 3-4 / >=5; flags independent
```

## Citation

[A new method of classifying prognostic comorbidity in longitudinal studies: development and validation](https://doi.org/10.1016/0021-9681(87)90171-8)
Charlson ME, Pompei P, Ales KL, MacKenzie CR
J Chronic Dis. 1987;40(5):373-383
DOI: [10.1016/0021-9681(87)90171-8](https://doi.org/10.1016/0021-9681(87)90171-8)

## Worked example

### No comorbidities

Given: `aids=false, any_tumor=false, cerebrovascular_disease=false, chronic_pulmonary_disease=false, congestive_heart_failure=false, connective_tissue_disease=false, dementia=false, diabetes=false, diabetes_end_organ=false, hemiplegia=false, leukemia=false, lymphoma=false, metastatic_solid_tumor=false, mild_liver_disease=false, moderate_severe_liver_disease=false, moderate_severe_renal_disease=false, myocardial_infarction=false, peptic_ulcer_disease=false, peripheral_vascular_disease=false`

1. All 19 flags false
2. score = 0
3. charlson_band = score_0


### Metastatic solid tumor only

Given: `aids=false, any_tumor=false, cerebrovascular_disease=false, chronic_pulmonary_disease=false, congestive_heart_failure=false, connective_tissue_disease=false, dementia=false, diabetes=false, diabetes_end_organ=false, hemiplegia=false, leukemia=false, lymphoma=false, metastatic_solid_tumor=true, mild_liver_disease=false, moderate_severe_liver_disease=false, moderate_severe_renal_disease=false, myocardial_infarction=false, peptic_ulcer_disease=false, peripheral_vascular_disease=false`

1. metastatic_solid_tumor → 6
2. score = 6
3. charlson_band = score_ge_5


## Also searched as

- Charlson comorbidity index
- CCI
- Charlson score
- Charlson 1987
- Charlson weighted index
- original Charlson index
- comorbidity index Charlson

## Parameters

- `myocardial_infarction` (boolean, required): Myocardial infarction as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose infarction.
- `congestive_heart_failure` (boolean, required): Congestive heart failure as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose heart failure.
- `peripheral_vascular_disease` (boolean, required): Peripheral vascular disease as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose vascular disease.
- `cerebrovascular_disease` (boolean, required): Cerebrovascular disease as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose stroke or TIA.
- `dementia` (boolean, required): Dementia as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose dementia.
- `chronic_pulmonary_disease` (boolean, required): Chronic pulmonary disease as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose lung disease.
- `connective_tissue_disease` (boolean, required): Connective tissue disease as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose connective-tissue disease.
- `peptic_ulcer_disease` (boolean, required): Peptic ulcer disease as assigned by the caller (Charlson 1987). true scores 1. magent does not diagnose ulcer disease.
- `mild_liver_disease` (boolean, required): Mild liver disease as assigned by the caller (Charlson 1987). true scores 1. magent does not grade liver disease.
- `diabetes` (boolean, required): Diabetes without end-organ damage as assigned by the caller (Charlson 1987). true scores 1. Independent of diabetes_end_organ. magent does not diagnose diabetes.
- `hemiplegia` (boolean, required): Hemiplegia as assigned by the caller (Charlson 1987). true scores 2. magent does not diagnose hemiplegia.
- `moderate_severe_renal_disease` (boolean, required): Moderate or severe renal disease as assigned by the caller (Charlson 1987). true scores 2. magent does not grade kidney disease.
- `diabetes_end_organ` (boolean, required): Diabetes with end-organ damage as assigned by the caller (Charlson 1987). true scores 2. Independent of diabetes. magent does not diagnose diabetes.
- `any_tumor` (boolean, required): Any tumor (solid tumor without metastasis) as assigned by the caller (Charlson 1987). true scores 2. Independent of metastatic_solid_tumor. magent does not diagnose cancer.
- `leukemia` (boolean, required): Leukemia as assigned by the caller (Charlson 1987). true scores 2. magent does not diagnose leukemia.
- `lymphoma` (boolean, required): Lymphoma as assigned by the caller (Charlson 1987). true scores 2. magent does not diagnose lymphoma.
- `moderate_severe_liver_disease` (boolean, required): Moderate or severe liver disease as assigned by the caller (Charlson 1987). true scores 3. Independent of mild_liver_disease. magent does not grade liver disease.
- `metastatic_solid_tumor` (boolean, required): Metastatic solid tumor as assigned by the caller (Charlson 1987). true scores 6. Independent of any_tumor. magent does not diagnose cancer.
- `aids` (boolean, required): AIDS as assigned by the caller (Charlson 1987). true scores 6. magent does not diagnose AIDS.

## Bulk (POST)

POST the same path with a JSON items array. The first item is the GET unit; each additional item is $0.002. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/charlson`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- POST of 1 item costs the same as GET. Lists longer than 25: chunk into multiple POSTs. Extra items still execute; do not pad dummy rows.
- The first invalid item fails the whole request (index in the 400 JSON). You are not charged.
- HTTP 200 is {count, path, items}. Each items[i] is the GET 200 body for that row.
- Catalog misses (empty matches, found=false) stay paid 200s inside that slot.
- x402 resource URL is this path plus n and body_sha256. Browsers that prefer text/html get the same paywall as GET; Pay retries POST with the same items.

Example request:

```json
{
  "items": [
    {
      "aids": "false",
      "any_tumor": "false",
      "cerebrovascular_disease": "false",
      "chronic_pulmonary_disease": "false",
      "congestive_heart_failure": "false",
      "connective_tissue_disease": "false",
      "dementia": "false",
      "diabetes": "false",
      "diabetes_end_organ": "false",
      "hemiplegia": "false",
      "leukemia": "false",
      "lymphoma": "false",
      "metastatic_solid_tumor": "false",
      "mild_liver_disease": "false",
      "moderate_severe_liver_disease": "false",
      "moderate_severe_renal_disease": "false",
      "myocardial_infarction": "false",
      "peptic_ulcer_disease": "false",
      "peripheral_vascular_disease": "false"
    },
    {
      "aids": "false",
      "any_tumor": "false",
      "cerebrovascular_disease": "false",
      "chronic_pulmonary_disease": "false",
      "congestive_heart_failure": "false",
      "connective_tissue_disease": "false",
      "dementia": "false",
      "diabetes": "false",
      "diabetes_end_organ": "false",
      "hemiplegia": "false",
      "leukemia": "false",
      "lymphoma": "false",
      "metastatic_solid_tumor": "false",
      "mild_liver_disease": "false",
      "moderate_severe_liver_disease": "false",
      "moderate_severe_renal_disease": "false",
      "myocardial_infarction": "false",
      "peptic_ulcer_disease": "false",
      "peripheral_vascular_disease": "false"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/charlson

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/charlson",
  "items": [
    {
      "components": [
        {
          "factor": "myocardial_infarction",
          "points": 0,
          "present": false
        },
        {
          "factor": "congestive_heart_failure",
          "points": 0,
          "present": false
        },
        {
          "factor": "peripheral_vascular_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "cerebrovascular_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "dementia",
          "points": 0,
          "present": false
        },
        {
          "factor": "chronic_pulmonary_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "connective_tissue_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "peptic_ulcer_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "mild_liver_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "hemiplegia",
          "points": 0,
          "present": false
        },
        {
          "factor": "moderate_severe_renal_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes_end_organ",
          "points": 0,
          "present": false
        },
        {
          "factor": "any_tumor",
          "points": 0,
          "present": false
        },
        {
          "factor": "leukemia",
          "points": 0,
          "present": false
        },
        {
          "factor": "lymphoma",
          "points": 0,
          "present": false
        },
        {
          "factor": "moderate_severe_liver_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "metastatic_solid_tumor",
          "points": 0,
          "present": false
        },
        {
          "factor": "aids",
          "points": 0,
          "present": false
        }
      ],
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Charlson ME, Pompei P, Ales KL, MacKenzie CR",
        "doi": "10.1016/0021-9681(87)90171-8",
        "id": "charlson-1987",
        "pmid": "3558716",
        "source": "J Chronic Dis. 1987;40(5):373-383",
        "title": "A new method of classifying prognostic comorbidity in longitudinal studies: development and validation"
      },
      "formula": "charlson",
      "formula_expression": "CCI = myocardial_infarction 1 + congestive_heart_failure 1 + peripheral_vascular_disease 1 + cerebrovascular_disease 1 + dementia 1 + chronic_pulmonary_disease 1 + connective_tissue_disease 1 + peptic_ulcer_disease 1 + mild_liver_disease 1 + diabetes 1 + hemiplegia 2 + moderate_severe_renal_disease 2 + diabetes_end_organ 2 + any_tumor 2 + leukemia 2 + lymphoma 2 + moderate_severe_liver_disease 3 + metastatic_solid_tumor 6 + aids 6; Charlson 1987 original weighted index; max 37; 1-year mortality groups 0 / 1-2 / 3-4 / >=5; flags independent",
      "max_score": 37,
      "score": 0,
      "charlson_band": "score_0"
    },
    {
      "components": [
        {
          "factor": "myocardial_infarction",
          "points": 0,
          "present": false
        },
        {
          "factor": "congestive_heart_failure",
          "points": 0,
          "present": false
        },
        {
          "factor": "peripheral_vascular_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "cerebrovascular_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "dementia",
          "points": 0,
          "present": false
        },
        {
          "factor": "chronic_pulmonary_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "connective_tissue_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "peptic_ulcer_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "mild_liver_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "hemiplegia",
          "points": 0,
          "present": false
        },
        {
          "factor": "moderate_severe_renal_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "diabetes_end_organ",
          "points": 0,
          "present": false
        },
        {
          "factor": "any_tumor",
          "points": 0,
          "present": false
        },
        {
          "factor": "leukemia",
          "points": 0,
          "present": false
        },
        {
          "factor": "lymphoma",
          "points": 0,
          "present": false
        },
        {
          "factor": "moderate_severe_liver_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "metastatic_solid_tumor",
          "points": 0,
          "present": false
        },
        {
          "factor": "aids",
          "points": 0,
          "present": false
        }
      ],
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Charlson ME, Pompei P, Ales KL, MacKenzie CR",
        "doi": "10.1016/0021-9681(87)90171-8",
        "id": "charlson-1987",
        "pmid": "3558716",
        "source": "J Chronic Dis. 1987;40(5):373-383",
        "title": "A new method of classifying prognostic comorbidity in longitudinal studies: development and validation"
      },
      "formula": "charlson",
      "formula_expression": "CCI = myocardial_infarction 1 + congestive_heart_failure 1 + peripheral_vascular_disease 1 + cerebrovascular_disease 1 + dementia 1 + chronic_pulmonary_disease 1 + connective_tissue_disease 1 + peptic_ulcer_disease 1 + mild_liver_disease 1 + diabetes 1 + hemiplegia 2 + moderate_severe_renal_disease 2 + diabetes_end_organ 2 + any_tumor 2 + leukemia 2 + lymphoma 2 + moderate_severe_liver_disease 3 + metastatic_solid_tumor 6 + aids 6; Charlson 1987 original weighted index; max 37; 1-year mortality groups 0 / 1-2 / 3-4 / >=5; flags independent",
      "max_score": 37,
      "score": 0,
      "charlson_band": "score_0"
    }
  ]
}
```

## Response fields

- `formula` (string): charlson
- `formula_expression` (string): Exact expression used
- `score` (integer): Charlson 1987 points 0-37
- `max_score` (integer): 37
- `charlson_band` (string): Charlson 1987 1-year mortality group: score_0 (0), score_1_2 (1-2), score_3_4 (3-4), or score_ge_5 (≥5). A group, not a diagnosis.
- `components` (array): Per-flag points
- `citation` (object): Charlson et al. J Chronic Dis 1987 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "myocardial_infarction",
      "points": 0,
      "present": false
    },
    {
      "factor": "congestive_heart_failure",
      "points": 0,
      "present": false
    },
    {
      "factor": "peripheral_vascular_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "cerebrovascular_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "dementia",
      "points": 0,
      "present": false
    },
    {
      "factor": "chronic_pulmonary_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "connective_tissue_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "peptic_ulcer_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "mild_liver_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "diabetes",
      "points": 0,
      "present": false
    },
    {
      "factor": "hemiplegia",
      "points": 0,
      "present": false
    },
    {
      "factor": "moderate_severe_renal_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "diabetes_end_organ",
      "points": 0,
      "present": false
    },
    {
      "factor": "any_tumor",
      "points": 0,
      "present": false
    },
    {
      "factor": "leukemia",
      "points": 0,
      "present": false
    },
    {
      "factor": "lymphoma",
      "points": 0,
      "present": false
    },
    {
      "factor": "moderate_severe_liver_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "metastatic_solid_tumor",
      "points": 0,
      "present": false
    },
    {
      "factor": "aids",
      "points": 0,
      "present": false
    }
  ],
  "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
  "citation": {
    "authors": "Charlson ME, Pompei P, Ales KL, MacKenzie CR",
    "doi": "10.1016/0021-9681(87)90171-8",
    "id": "charlson-1987",
    "pmid": "3558716",
    "source": "J Chronic Dis. 1987;40(5):373-383",
    "title": "A new method of classifying prognostic comorbidity in longitudinal studies: development and validation"
  },
  "formula": "charlson",
  "formula_expression": "CCI = myocardial_infarction 1 + congestive_heart_failure 1 + peripheral_vascular_disease 1 + cerebrovascular_disease 1 + dementia 1 + chronic_pulmonary_disease 1 + connective_tissue_disease 1 + peptic_ulcer_disease 1 + mild_liver_disease 1 + diabetes 1 + hemiplegia 2 + moderate_severe_renal_disease 2 + diabetes_end_organ 2 + any_tumor 2 + leukemia 2 + lymphoma 2 + moderate_severe_liver_disease 3 + metastatic_solid_tumor 6 + aids 6; Charlson 1987 original weighted index; max 37; 1-year mortality groups 0 / 1-2 / 3-4 / >=5; flags independent",
  "max_score": 37,
  "score": 0,
  "charlson_band": "score_0"
}
```

## Errors

- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [LACE](https://magentlab.com/docs/lace) — Sum van Walraven 2010 Table 3 LACE points from length of stay, acute (emergent) admission, a caller-supplied Charlson integer, and ED visits in the previous 6 months.

## Payment

Unpaid requests return HTTP 402 even if query parameters or POST items are missing or invalid, so CDP and agents can index the path. After a PAYMENT-SIGNATURE, invalid params return HTTP 400 JSON before settlement. magent does not charge. Fix the params, then request a new 402 quote for that complete URL. Catalog misses (empty matches, found=false) are valid paid 200s.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/docs/mcp

## Guarantees

- HTTP 402 is unpaid, including a missing query. After PAYMENT-SIGNATURE, invalid parameters return HTTP 400 before settlement. You are not charged.
- exact: settlement finishes before the tool (paymentFlow upfront). batch-settlement: verify/deposit before the tool; chargedCumulativeAmount commits after HTTP 2xx. Uncertain or failed settlement fails closed (HTTP 503). Retry the same PAYMENT-SIGNATURE.
- HTTP 402 is unpaid only. Do not sign a second authorization because of a 503.
- Execution is timeout-bounded and concurrency-capped.
- Calculator inputs are stored encrypted for allowlisted operators (Magent Console). They are not in public logs, SSH lookups, catalog, or rollups. Request logs store path without query.
