# Thakar ARF score after cardiac surgery

Thakar ARF score

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

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

## What it computes

Sum the Thakar 2005 preoperative points for dialysis-requiring acute renal failure after open-heart surgery and return the integer score (max 17) and published category (0–2 / 3–5 / 6–8 / 9–13).

## When to use

When an agent has caller-assigned sex, surgery type, preoperative creatinine, and the published boolean risk factors and needs the Thakar 2005 point total. Not a dialysis order. magent does not examine the patient.

## When not to use

- Not a medical device and not a dialysis order.
- Not AKIN or RIFLE staging of a current creatinine change. This is a preoperative score for dialysis-requiring ARF after open-heart surgery.
- magent does not examine the patient. Sex, surgery type, CHF, LVEF <35%, preoperative IABP, COPD requiring medical therapy, insulin-requiring diabetes, previous cardiac surgery, and emergency surgery are caller-assigned.
- Creatinine bands follow the Thakar 2005 scoring table: <1.2 mg/dL scores 0; 1.2 to <2.1 scores 2; >=2.1 scores 5. 2.0 mg/dL scores 2. magent does not assay creatinine.
- Published categories are 0–2, 3–5, 6–8, and 9–13 (formed arbitrarily in the paper). Scores >=9 map to 9–13; the paper observed no patients above 13. Theoretical max is 17.

## Formula

```
Thakar 2005 = female(1) + congestive_heart_failure(1) + lvef_lt_35(1) + preoperative_iabp(2) + copd(1) + insulin_diabetes(1) + previous_cardiac_surgery(1) + emergency_surgery(2) + surgery_type(cabg 0, valve 1, cabg_valve 2, other 2) + creatinine_mg_dl(<1.2: 0, 1.2 to <2.1: 2, >=2.1: 5); max 17; categories 0-2 / 3-5 / 6-8 / 9-13
```

## Citation

[A clinical score to predict acute renal failure after cardiac surgery](https://doi.org/10.1681/ASN.2004040331)
Thakar CV, Arrigain S, Worley S, Yared JP, Paganini EP
J Am Soc Nephrol. 2005;16(1):162-168
DOI: [10.1681/ASN.2004040331](https://doi.org/10.1681/ASN.2004040331)

## Worked example

### Male CABG, creatinine 1.0 mg/dL, no flags

Given: `congestive_heart_failure=false, copd=false, creatinine_mg_dl=1.0, emergency_surgery=false, insulin_diabetes=false, lvef_lt_35=false, preoperative_iabp=false, previous_cardiac_surgery=false, sex=male, surgery_type=cabg`

1. Male 0; CABG-only 0; creatinine 1.0 <1.2 → 0; all flags false → 0
2. Score = 0 (max 17); thakar_category = 0_to_2


### Female CABG+valve, creatinine 2.1, IABP, emergency

Given: `congestive_heart_failure=false, copd=false, creatinine_mg_dl=2.1, emergency_surgery=true, insulin_diabetes=false, lvef_lt_35=false, preoperative_iabp=true, previous_cardiac_surgery=false, sex=female, surgery_type=cabg_valve`

1. Female +1; CABG+valve +2; creatinine 2.1 >=2.1 → +5; IABP +2; emergency +2
2. Score = 12 (max 17); thakar_category = 9_to_13


## Also searched as

- Thakar score
- Thakar ARF score
- cardiac surgery ARF score
- Thakar 2005
- acute renal failure after cardiac surgery
- dialysis risk after open-heart surgery
- Thakar renal failure score

## Parameters

- `sex` (string, required): female or male (Thakar 2005). Female scores 1. Male scores 0. Assigned by the caller.
- `surgery_type` (string, required): cabg (CABG only, reference, 0), valve (valve only, +1), cabg_valve (CABG + valve, +2), or other (other cardiac surgeries such as ventricular aneurysm repair or pericardiectomy, +2). Thakar 2005. Assigned by the caller.
- `creatinine_mg_dl` (number, optional): Preoperative serum creatinine in mg/dL (0.1-20). Provide this or creatinine_umol_l, not both. Thakar 2005 scoring table: <1.2 scores 0; 1.2 to <2.1 scores 2; >=2.1 scores 5. 2.0 mg/dL scores 2. magent does not assay creatinine.
- `creatinine_umol_l` (number, optional): Preoperative serum creatinine in µmol/L (9-1768). Converted as mg/dL = µmol/L / 88.42.
- `congestive_heart_failure` (boolean, required): Congestive heart failure as assigned by the caller (Thakar 2005). true scores 1. true or false. magent does not examine the patient.
- `lvef_lt_35` (boolean, required): Left-ventricular ejection fraction <35% as assigned by the caller (Thakar 2005). true scores 1. Flag only; do not send an LVEF number. magent does not measure ejection fraction.
- `preoperative_iabp` (boolean, required): Preoperative intra-aortic balloon pump as assigned by the caller (Thakar 2005). true scores 2. true or false.
- `copd` (boolean, required): COPD requiring medical therapy as assigned by the caller (Thakar 2005). true scores 1. true or false.
- `insulin_diabetes` (boolean, required): Insulin-requiring diabetes as assigned by the caller (Thakar 2005). true scores 1. true or false.
- `previous_cardiac_surgery` (boolean, required): Previous cardiac surgery as assigned by the caller (Thakar 2005). true scores 1. true or false.
- `emergency_surgery` (boolean, required): Emergency surgery as assigned by the caller (Thakar 2005). true scores 2. true or false.

## 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/thakar`
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": [
    {
      "congestive_heart_failure": "false",
      "copd": "false",
      "creatinine_mg_dl": "1.0",
      "emergency_surgery": "false",
      "insulin_diabetes": "false",
      "lvef_lt_35": "false",
      "preoperative_iabp": "false",
      "previous_cardiac_surgery": "false",
      "sex": "male",
      "surgery_type": "cabg"
    },
    {
      "congestive_heart_failure": "false",
      "copd": "false",
      "creatinine_mg_dl": "1.0",
      "emergency_surgery": "false",
      "insulin_diabetes": "false",
      "lvef_lt_35": "false",
      "preoperative_iabp": "false",
      "previous_cardiac_surgery": "false",
      "sex": "male",
      "surgery_type": "cabg"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/thakar",
  "items": [
    {
      "components": [
        {
          "factor": "female",
          "points": 0,
          "present": false
        },
        {
          "factor": "congestive_heart_failure",
          "points": 0,
          "present": false
        },
        {
          "factor": "lvef_lt_35",
          "points": 0,
          "present": false
        },
        {
          "factor": "preoperative_iabp",
          "points": 0,
          "present": false
        },
        {
          "factor": "copd",
          "points": 0,
          "present": false
        },
        {
          "factor": "insulin_diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "previous_cardiac_surgery",
          "points": 0,
          "present": false
        },
        {
          "factor": "emergency_surgery",
          "points": 0,
          "present": false
        },
        {
          "value": "cabg",
          "factor": "surgery_type",
          "points": 0,
          "present": false
        },
        {
          "value": 1.0,
          "factor": "creatinine_mg_dl",
          "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": "Thakar CV, Arrigain S, Worley S, Yared JP, Paganini EP",
        "doi": "10.1681/ASN.2004040331",
        "id": "thakar-2005",
        "pmid": "15563569",
        "source": "J Am Soc Nephrol. 2005;16(1):162-168",
        "title": "A clinical score to predict acute renal failure after cardiac surgery"
      },
      "formula": "thakar",
      "formula_expression": "Thakar 2005 = female(1) + congestive_heart_failure(1) + lvef_lt_35(1) + preoperative_iabp(2) + copd(1) + insulin_diabetes(1) + previous_cardiac_surgery(1) + emergency_surgery(2) + surgery_type(cabg 0, valve 1, cabg_valve 2, other 2) + creatinine_mg_dl(<1.2: 0, 1.2 to <2.1: 2, >=2.1: 5); max 17; categories 0-2 / 3-5 / 6-8 / 9-13",
      "max_score": 17,
      "score": 0,
      "creatinine_mg_dl": 1.0,
      "sex": "male",
      "surgery_type": "cabg",
      "thakar_category": "0_to_2"
    },
    {
      "components": [
        {
          "factor": "female",
          "points": 0,
          "present": false
        },
        {
          "factor": "congestive_heart_failure",
          "points": 0,
          "present": false
        },
        {
          "factor": "lvef_lt_35",
          "points": 0,
          "present": false
        },
        {
          "factor": "preoperative_iabp",
          "points": 0,
          "present": false
        },
        {
          "factor": "copd",
          "points": 0,
          "present": false
        },
        {
          "factor": "insulin_diabetes",
          "points": 0,
          "present": false
        },
        {
          "factor": "previous_cardiac_surgery",
          "points": 0,
          "present": false
        },
        {
          "factor": "emergency_surgery",
          "points": 0,
          "present": false
        },
        {
          "value": "cabg",
          "factor": "surgery_type",
          "points": 0,
          "present": false
        },
        {
          "value": 1.0,
          "factor": "creatinine_mg_dl",
          "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": "Thakar CV, Arrigain S, Worley S, Yared JP, Paganini EP",
        "doi": "10.1681/ASN.2004040331",
        "id": "thakar-2005",
        "pmid": "15563569",
        "source": "J Am Soc Nephrol. 2005;16(1):162-168",
        "title": "A clinical score to predict acute renal failure after cardiac surgery"
      },
      "formula": "thakar",
      "formula_expression": "Thakar 2005 = female(1) + congestive_heart_failure(1) + lvef_lt_35(1) + preoperative_iabp(2) + copd(1) + insulin_diabetes(1) + previous_cardiac_surgery(1) + emergency_surgery(2) + surgery_type(cabg 0, valve 1, cabg_valve 2, other 2) + creatinine_mg_dl(<1.2: 0, 1.2 to <2.1: 2, >=2.1: 5); max 17; categories 0-2 / 3-5 / 6-8 / 9-13",
      "max_score": 17,
      "score": 0,
      "creatinine_mg_dl": 1.0,
      "sex": "male",
      "surgery_type": "cabg",
      "thakar_category": "0_to_2"
    }
  ]
}
```

## Response fields

- `formula` (string): thakar
- `formula_expression` (string): Thakar 2005 scoring-table integer expression
- `score` (integer): Thakar points 0-17
- `max_score` (integer): 17
- `thakar_category` (string): Published Thakar 2005 risk category: 0_to_2, 3_to_5, 6_to_8, or 9_to_13. Scores >=9 map to 9_to_13. Not a dialysis order.
- `sex` (string): female or male used
- `surgery_type` (string): cabg, valve, cabg_valve, or other used
- `creatinine_mg_dl` (number): Preoperative serum creatinine used in mg/dL (after conversion)
- `components` (array): Per-factor Thakar 2005 points
- `citation` (object): Thakar 2005 JASN citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "female",
      "points": 0,
      "present": false
    },
    {
      "factor": "congestive_heart_failure",
      "points": 0,
      "present": false
    },
    {
      "factor": "lvef_lt_35",
      "points": 0,
      "present": false
    },
    {
      "factor": "preoperative_iabp",
      "points": 0,
      "present": false
    },
    {
      "factor": "copd",
      "points": 0,
      "present": false
    },
    {
      "factor": "insulin_diabetes",
      "points": 0,
      "present": false
    },
    {
      "factor": "previous_cardiac_surgery",
      "points": 0,
      "present": false
    },
    {
      "factor": "emergency_surgery",
      "points": 0,
      "present": false
    },
    {
      "value": "cabg",
      "factor": "surgery_type",
      "points": 0,
      "present": false
    },
    {
      "value": 1.0,
      "factor": "creatinine_mg_dl",
      "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": "Thakar CV, Arrigain S, Worley S, Yared JP, Paganini EP",
    "doi": "10.1681/ASN.2004040331",
    "id": "thakar-2005",
    "pmid": "15563569",
    "source": "J Am Soc Nephrol. 2005;16(1):162-168",
    "title": "A clinical score to predict acute renal failure after cardiac surgery"
  },
  "formula": "thakar",
  "formula_expression": "Thakar 2005 = female(1) + congestive_heart_failure(1) + lvef_lt_35(1) + preoperative_iabp(2) + copd(1) + insulin_diabetes(1) + previous_cardiac_surgery(1) + emergency_surgery(2) + surgery_type(cabg 0, valve 1, cabg_valve 2, other 2) + creatinine_mg_dl(<1.2: 0, 1.2 to <2.1: 2, >=2.1: 5); max 17; categories 0-2 / 3-5 / 6-8 / 9-13",
  "max_score": 17,
  "score": 0,
  "creatinine_mg_dl": 1.0,
  "sex": "male",
  "surgery_type": "cabg",
  "thakar_category": "0_to_2"
}
```

## Errors

- HTTP 400 `invalid_thakar_surgery`: surgery_type must be cabg, valve, cabg_valve, or other (Thakar 2005; CABG-only is the reference). Returned before settlement; you are not charged.
- HTTP 400 `invalid_sex`: sex must be female or male Returned before settlement; you are not charged.
- HTTP 400 `invalid_creatinine`: creatinine_mg_dl (0.1-20) or creatinine_umol_l (9-1768) is required Returned before settlement; you are not charged.
- 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

- [AKIN](https://magentlab.com/docs/akin) — Apply Mehta 2007 Table 2 AKIN staging and return stage 0-3 as the worse of the creatinine and urine-output limbs, with initiated renal replacement therapy mapping to stage 3.
- [RIFLE](https://magentlab.com/docs/rifle) — Apply Bellomo 2004 Fig. 1 RIFLE classification and return the worse of the creatinine and urine-output limbs (none, risk, injury, failure), with persistent ARF beyond 4 weeks mapping to loss and ESRD beyond 3 months mapping to esrd.
- [Mehran CIN risk score](https://magentlab.com/docs/mehran) — Sum the Mehran 2004 eGFR model B integer score for contrast-induced nephropathy after PCI and return low (≤5), moderate (6–10), high (11–15), or very_high (≥16) with the development-set CIN percent.

## 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. HTTP 402 never includes the tool JSON.
- 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.
