Kidney · LIVE
Kidney Failure Risk Equation
KFRE
Compute 2-year and 5-year risk of kidney failure (dialysis or preemptive transplant) from the Tangri 2011 4-variable Kidney Failure Risk Equation (age, sex, eGFR, urine ACR).
Markdown: /docs/kfre.md · Canonical: https://magentlab.com/docs/kfre
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Compute 2-year and 5-year risk of kidney failure (dialysis or preemptive transplant) from the Tangri 2011 4-variable Kidney Failure Risk Equation (age, sex, eGFR, urine ACR).
When to use
When an agent already has age, male/female, a caller-supplied eGFR, and urine ACR in mg/g and needs that paper's 4-variable 2- and 5-year risks. Not a dialysis or transplant order, not CKD-EPI, and not the 8-variable or 2016 country-recalibrated equations.
When not to use
- Not a medical device. Not a dialysis or transplant order or referral threshold. magent does not assay creatinine or ACR and does not compute CKD-EPI eGFR.
- Tangri 2011 4-variable model only (age, sex, eGFR, urine ACR). Does not ship the 8-variable model (calcium, phosphate, bicarbonate, albumin).
- Does not apply Tangri 2016 country recalibrations or North-America vs non-North-America S0 splits. No race input.
- Derivation was referred CKD stages 3-5 (eGFR about 10-59 mL/min/1.73 m2). Age 18-90 is a magent adult clamp. Caller supplies eGFR; magent does not estimate it.
- Emits 2-year and 5-year risk percents. Does not assign a named risk class; Tangri 2011 printed stage-specific NRI cutoffs, not a class field on this equation.
Formula
LP = -0.2201*(age_years/10 - 7.036) + 0.2467*(male - 0.5642) - 0.5567*(egfr_ml_min/5 - 7.222) + 0.4510*(ln(acr_mg_g) - 5.137); 2-year risk = 1 - 0.9750^exp(LP); 5-year risk = 1 - 0.9240^exp(LP); Tangri 2011 4-variable only; male is 1 if true else 0; ACR mg/g natural log; caller supplies eGFR; not 8-variable; not Tangri 2016 country S0; no race
Citation
- Authors
- Tangri N, Stevens LA, Griffith J, Tighiouart H, Djurdjev O, Naimark D, Levin A, Levey AS
- Source
- JAMA. 2011;305(15):1553-1559
Worked example
Age 55, male, eGFR 30, ACR 300 mg/g (CKD 3-5 range)
Given:
acr_mg_g=300age_years=55egfr_ml_min=30male=true
- age term = -0.2201 * (55/10 - 7.036) = 0.3380736
- male term = 0.2467 * (1 - 0.5642) = 0.10751186
- eGFR term = -0.5567 * (30/5 - 7.222) = 0.6802874
- ln(300) = 5.7037824747; ACR term = 0.4510 * (5.7037824747 - 5.137) = 0.2556189
- LP = 1.38149176 → 1.3815
- 2-year = 1 - 0.9750^exp(LP) → 9.6%
- 5-year = 1 - 0.9240^exp(LP) → 27.0%
Also searched as
- Kidney Failure Risk Equation
- KFRE
- Tangri 2011 KFRE
- 4-variable KFRE
- kidney failure risk
- CKD kidney failure risk
- Tangri 4-variable
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
/api/calc/kfre?age_years=55&male=true&egfr_ml_min=30&acr_mg_g=300
Full URL: https://api.magentlab.com/api/calc/kfre?age_years=55&male=true&egfr_ml_min=30&acr_mg_g=300
Call
Expect HTTP 402 until you retry with PAYMENT-SIGNATURE. Incomplete query params
return HTTP 400 before any quote or charge.
curl -i -H "Accept: application/json" "https://api.magentlab.com/api/calc/kfre?age_years=55&male=true&egfr_ml_min=30&acr_mg_g=300"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
age_years |
integer | required | Age in years (18-90, magent clamp). Tangri 2011 4-variable model uses age as a continuous predictor (per 10 years, centered at 7.036). Adult CKD 3-5 derivation. |
male |
boolean | required | true if male, false if female. Enters the linear predictor as 1 or 0 (centered at 0.5642). No race coefficient. |
egfr_ml_min |
number | required | Caller-supplied eGFR in mL/min/1.73 m2 (1-150, magent clamp; must be positive). Tangri 2011 derivation was CKD stages 3-5. magent does not compute CKD-EPI eGFR and does not assay creatinine. |
acr_mg_g |
number | required | Urine albumin-to-creatinine ratio in mg/g (0.1-10000, magent clamp; must be positive). Enters as natural log, centered at 5.137. magent does not assay ACR and does not convert from mg/mmol. |
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.
- 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 (fixture)
{
"items": [
{
"acr_mg_g": "300",
"age_years": "55",
"egfr_ml_min": "30",
"male": "true"
},
{
"acr_mg_g": "300",
"age_years": "55",
"egfr_ml_min": "30",
"male": "true"
}
]
}
Opens a two-item fixture on the API host. Unpaid browsers get the same MetaMask paywall as GET; Pay retries POST with those items.
Example 200 (fixture)
{
"count": 2,
"path": "/api/calc/kfre",
"items": [
{
"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": "Tangri N, Stevens LA, Griffith J, Tighiouart H, Djurdjev O, Naimark D, Levin A, Levey AS",
"doi": "10.1001/jama.2011.451",
"id": "tangri-2011",
"pmid": "21642682",
"source": "JAMA. 2011;305(15):1553-1559",
"title": "A predictive model for progression of chronic kidney disease to kidney failure"
},
"formula": "kfre",
"formula_expression": "LP = -0.2201*(age_years/10 - 7.036) + 0.2467*(male - 0.5642) - 0.5567*(egfr_ml_min/5 - 7.222) + 0.4510*(ln(acr_mg_g) - 5.137); 2-year risk = 1 - 0.9750^exp(LP); 5-year risk = 1 - 0.9240^exp(LP); Tangri 2011 4-variable only; male is 1 if true else 0; ACR mg/g natural log; caller supplies eGFR; not 8-variable; not Tangri 2016 country S0; no race",
"age_years": 55,
"linear_predictor": 1.3815,
"acr_mg_g": 300.0,
"egfr_ml_min": 30.0,
"five_year_risk_percent": 27.0,
"male": true,
"s0_2_year": 0.975,
"s0_5_year": 0.924,
"two_year_risk_percent": 9.6
},
{
"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": "Tangri N, Stevens LA, Griffith J, Tighiouart H, Djurdjev O, Naimark D, Levin A, Levey AS",
"doi": "10.1001/jama.2011.451",
"id": "tangri-2011",
"pmid": "21642682",
"source": "JAMA. 2011;305(15):1553-1559",
"title": "A predictive model for progression of chronic kidney disease to kidney failure"
},
"formula": "kfre",
"formula_expression": "LP = -0.2201*(age_years/10 - 7.036) + 0.2467*(male - 0.5642) - 0.5567*(egfr_ml_min/5 - 7.222) + 0.4510*(ln(acr_mg_g) - 5.137); 2-year risk = 1 - 0.9750^exp(LP); 5-year risk = 1 - 0.9240^exp(LP); Tangri 2011 4-variable only; male is 1 if true else 0; ACR mg/g natural log; caller supplies eGFR; not 8-variable; not Tangri 2016 country S0; no race",
"age_years": 55,
"linear_predictor": 1.3815,
"acr_mg_g": 300.0,
"egfr_ml_min": 30.0,
"five_year_risk_percent": 27.0,
"male": true,
"s0_2_year": 0.975,
"s0_5_year": 0.924,
"two_year_risk_percent": 9.6
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | kfre |
formula_expression |
string | Tangri 2011 4-variable LP and 2-year/5-year S0 |
age_years |
integer | Age in years used (18-90) |
male |
boolean | Caller-assigned male flag used |
egfr_ml_min |
number | Caller-supplied eGFR used, mL/min/1.73 m2 |
acr_mg_g |
number | Urine ACR used, mg/g |
linear_predictor |
number | Tangri 2011 4-variable centered LP, 4 decimals |
two_year_risk_percent |
number | 2-year kidney-failure risk percent, 1 decimal (1 - 0.9750^exp(LP)) |
five_year_risk_percent |
number | 5-year kidney-failure risk percent, 1 decimal (1 - 0.9240^exp(LP)) |
s0_2_year |
number | Tangri 2011 4-variable 2-year baseline survival (0.9750) |
s0_5_year |
number | Tangri 2011 4-variable 5-year baseline survival (0.9240) |
citation |
object | Tangri et al. JAMA 2011 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"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": "Tangri N, Stevens LA, Griffith J, Tighiouart H, Djurdjev O, Naimark D, Levin A, Levey AS",
"doi": "10.1001/jama.2011.451",
"id": "tangri-2011",
"pmid": "21642682",
"source": "JAMA. 2011;305(15):1553-1559",
"title": "A predictive model for progression of chronic kidney disease to kidney failure"
},
"formula": "kfre",
"formula_expression": "LP = -0.2201*(age_years/10 - 7.036) + 0.2467*(male - 0.5642) - 0.5567*(egfr_ml_min/5 - 7.222) + 0.4510*(ln(acr_mg_g) - 5.137); 2-year risk = 1 - 0.9750^exp(LP); 5-year risk = 1 - 0.9240^exp(LP); Tangri 2011 4-variable only; male is 1 if true else 0; ACR mg/g natural log; caller supplies eGFR; not 8-variable; not Tangri 2016 country S0; no race",
"age_years": 55,
"linear_predictor": 1.3815,
"acr_mg_g": 300.0,
"egfr_ml_min": 30.0,
"five_year_risk_percent": 27.0,
"male": true,
"s0_2_year": 0.975,
"s0_5_year": 0.924,
"two_year_risk_percent": 9.6
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_kfre |
Kidney failure risk inputs must be numeric age, eGFR, and urine ACR with a binary sex as used in Tangri 2011. Returned before settlement; you are not charged. |
| 400 | invalid_items |
POST body must be a JSON object with only an items array Returned before settlement; you are not charged. |
| 400 | invalid_item_count |
items must be an array of 1 to 25 objects Returned before settlement; you are not charged. |
| 400 | invalid_item |
each items entry must be a JSON object Returned before settlement; you are not charged. |
Related tools
- CKD-EPI 2021 eGFR — Compute race-free CKD-EPI 2021 creatinine eGFR in mL/min/1.73m2.
- Cockcroft–Gault CrCl — Compute Cockcroft–Gault creatinine clearance in mL/min using total body weight.
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. Unpaid valid requests return HTTP 402 with a base64
PAYMENT-REQUIRED
header. HTTP 503 is not a new quote: retry the same PAYMENT-SIGNATURE. Full handshake
and shared payment errors: Payments.
Stdio MCP: /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.