Kidney · LIVE
Moledina AIN risk
AIN risk
Compute the Moledina 2022 development-model logistic probability of biopsy-proven acute interstitial nephritis from serum creatinine, BUN:creatinine ratio, urine dipstick specific gravity, and dipstick protein.
Markdown: /docs/ain-risk.md · Canonical: https://magentlab.com/docs/ain-risk
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Compute the Moledina 2022 development-model logistic probability of biopsy-proven acute interstitial nephritis from serum creatinine, BUN:creatinine ratio, urine dipstick specific gravity, and dipstick protein.
When to use
When an agent needs the published Moledina 2022 EHR-model probability and must not invent a biopsy decision, a diagnosis, urine cytokine inputs, or a low/high cutoff.
When not to use
- Not a medical device. Not a diagnosis and not a kidney biopsy.
- Moledina 2022 development-model coefficients only (Table 4 intercept and supplement weights). This is not the urine IL-9 and TNF-α biomarker model.
- magent does not apply a later intercept-correction for local AIN prevalence.
- Moledina 2022 does not publish a named low or high probability cutoff; magent does not invent one.
- protein is the published binary dipstick category (0 or 1+ versus 2+ or higher) as assigned by the caller. magent does not interpret the dipstick.
- Derived and validated in patients selected for native-kidney biopsy. External validity outside that population is unknown.
Formula
L = 0.770398 + 0.8367518*ln(creatinine_mg_dl) - 0.9181938*ln(bun_cr_ratio) - 0.0501203*1000*(specific_gravity - 1) + protein (Moledina 2022 development model; Table 4 aORs / supplement weights); protein le_1 (0 or 1+) 0.9360127, ge_2 (2+ or higher, reference) 0; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))
Citation
- Authors
- Moledina DG, Eadon MT, Calderon F, et al.
- Source
- Nephrol Dial Transplant. 2022;37(11):2214-2222
Worked example
Creatinine 2.1 mg/dL, BUN:Cr 15, SG 1.015, protein 0 or 1+
Given:
bun_cr_ratio=15creatinine_mg_dl=2.1protein=le_1specific_gravity=1.015
- L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(15) − 0.0501203×15 + 0.9360127 (le_1)
- estimated_probability_percent = 100 × e^L / (1 + e^L) from the unrounded logit
Creatinine 4.0 mg/dL, BUN:Cr 15, SG 1.015, protein 0 or 1+
Given:
bun_cr_ratio=15creatinine_mg_dl=4.0protein=le_1specific_gravity=1.015
- L = 0.770398 + 0.8367518×ln(4.0) − 0.9181938×ln(15) − 0.0501203×15 + 0.9360127 (le_1)
- estimated_probability_percent from the unrounded logit, two decimals
Creatinine 2.1 mg/dL, BUN:Cr 25, SG 1.015, protein 0 or 1+
Given:
bun_cr_ratio=25creatinine_mg_dl=2.1protein=le_1specific_gravity=1.015
- L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(25) − 0.0501203×15 + 0.9360127 (le_1)
- estimated_probability_percent from the unrounded logit, two decimals
Creatinine 2.1 mg/dL, BUN:Cr 15, SG 1.010, protein 0 or 1+
Given:
bun_cr_ratio=15creatinine_mg_dl=2.1protein=le_1specific_gravity=1.010
- L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(15) − 0.0501203×10 + 0.9360127 (le_1)
- estimated_probability_percent from the unrounded logit, two decimals
Creatinine 2.1 mg/dL, BUN:Cr 15, SG 1.015, protein 2+ or higher
Given:
bun_cr_ratio=15creatinine_mg_dl=2.1protein=ge_2specific_gravity=1.015
- L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(15) − 0.0501203×15 + 0 (ge_2)
- estimated_probability_percent from the unrounded logit, two decimals
Also searched as
- AIN risk
- acute interstitial nephritis probability
- Moledina AIN model
- biopsy-proven AIN
- AIN diagnostic model
- tubulointerstitial nephritis
- AIN EHR model
- acute tubulointerstitial nephritis
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
/api/calc/ain_risk?creatinine_mg_dl=2.1&bun_cr_ratio=15&specific_gravity=1.015&protein=le_1
Full URL: https://api.magentlab.com/api/calc/ain_risk?creatinine_mg_dl=2.1&bun_cr_ratio=15&specific_gravity=1.015&protein=le_1
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/ain_risk?creatinine_mg_dl=2.1&bun_cr_ratio=15&specific_gravity=1.015&protein=le_1"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
creatinine_mg_dl |
number | required | Serum creatinine in mg/dL (0.1-20). Moledina 2022 Table 4: +0.8367518 per natural log. µmol/L is not accepted on this tool. magent does not assay creatinine. |
bun_cr_ratio |
number | required | BUN:creatinine ratio (mg/dL : mg/dL, 0.5-200) as computed by the caller. Moledina 2022 Table 4: -0.9181938 per natural log. magent does not compute BUN from other labs. |
specific_gravity |
number | required | Urine dipstick specific gravity (1.000-1.050) as assigned by the caller, e.g. 1.015. Moledina 2022 Table 4: -0.0501203 per 0.001 unit. magent does not read the dipstick. |
protein |
string | required · le_1, ge_2 | Moledina 2022 dipstick protein category as assigned by the caller: le_1 (0 or 1+, +0.9360127) or ge_2 (2+ or higher, reference, 0). magent does not interpret the dipstick. |
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": [
{
"bun_cr_ratio": "15",
"creatinine_mg_dl": "2.1",
"protein": "le_1",
"specific_gravity": "1.015"
},
{
"bun_cr_ratio": "15",
"creatinine_mg_dl": "2.1",
"protein": "le_1",
"specific_gravity": "1.015"
}
]
}
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/ain_risk",
"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": "Moledina DG, Eadon MT, Calderon F, et al.",
"doi": "10.1093/ndt/gfab346",
"id": "moledina-2022",
"pmid": "34865148",
"source": "Nephrol Dial Transplant. 2022;37(11):2214-2222",
"title": "Development and external validation of a diagnostic model for biopsy-proven acute interstitial nephritis using electronic health record data"
},
"formula": "ain_risk",
"formula_expression": "L = 0.770398 + 0.8367518*ln(creatinine_mg_dl) - 0.9181938*ln(bun_cr_ratio) - 0.0501203*1000*(specific_gravity - 1) + protein (Moledina 2022 development model; Table 4 aORs / supplement weights); protein le_1 (0 or 1+) 0.9360127, ge_2 (2+ or higher, reference) 0; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
"creatinine_mg_dl": 2.1,
"bun_cr_ratio": 15.0,
"estimated_probability_percent": 28.68,
"logit": -0.9111,
"protein": "le_1",
"specific_gravity": 1.015
},
{
"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": "Moledina DG, Eadon MT, Calderon F, et al.",
"doi": "10.1093/ndt/gfab346",
"id": "moledina-2022",
"pmid": "34865148",
"source": "Nephrol Dial Transplant. 2022;37(11):2214-2222",
"title": "Development and external validation of a diagnostic model for biopsy-proven acute interstitial nephritis using electronic health record data"
},
"formula": "ain_risk",
"formula_expression": "L = 0.770398 + 0.8367518*ln(creatinine_mg_dl) - 0.9181938*ln(bun_cr_ratio) - 0.0501203*1000*(specific_gravity - 1) + protein (Moledina 2022 development model; Table 4 aORs / supplement weights); protein le_1 (0 or 1+) 0.9360127, ge_2 (2+ or higher, reference) 0; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
"creatinine_mg_dl": 2.1,
"bun_cr_ratio": 15.0,
"estimated_probability_percent": 28.68,
"logit": -0.9111,
"protein": "le_1",
"specific_gravity": 1.015
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | ain_risk |
formula_expression |
string | Moledina 2022 development-model logistic expression |
creatinine_mg_dl |
number | Input serum creatinine in mg/dL |
bun_cr_ratio |
number | Input BUN:creatinine ratio (mg/dL : mg/dL) |
specific_gravity |
number | Input urine dipstick specific gravity |
protein |
string | le_1 (0 or 1+) or ge_2 (2+ or higher) |
logit |
number | Moledina 2022 development-model linear predictor L, 4 decimal places |
estimated_probability_percent |
number | 100 * exp(L) / (1 + exp(L)) from the unrounded logit, 2 decimal places. A probability, not a biopsy and not a diagnosis. |
citation |
object | Moledina et al. Nephrol Dial Transplant 2022 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": "Moledina DG, Eadon MT, Calderon F, et al.",
"doi": "10.1093/ndt/gfab346",
"id": "moledina-2022",
"pmid": "34865148",
"source": "Nephrol Dial Transplant. 2022;37(11):2214-2222",
"title": "Development and external validation of a diagnostic model for biopsy-proven acute interstitial nephritis using electronic health record data"
},
"formula": "ain_risk",
"formula_expression": "L = 0.770398 + 0.8367518*ln(creatinine_mg_dl) - 0.9181938*ln(bun_cr_ratio) - 0.0501203*1000*(specific_gravity - 1) + protein (Moledina 2022 development model; Table 4 aORs / supplement weights); protein le_1 (0 or 1+) 0.9360127, ge_2 (2+ or higher, reference) 0; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
"creatinine_mg_dl": 2.1,
"bun_cr_ratio": 15.0,
"estimated_probability_percent": 28.68,
"logit": -0.9111,
"protein": "le_1",
"specific_gravity": 1.015
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_ain_risk |
AIN risk needs Moledina 2022 creatinine, BUN:creatinine, urine specific gravity, and dipstick protein in published ranges. 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
- 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.
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.