# Moledina AIN risk

AIN risk

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

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

[Development and external validation of a diagnostic model for biopsy-proven acute interstitial nephritis using electronic health record data](https://doi.org/10.1093/ndt/gfab346)
Moledina DG, Eadon MT, Calderon F, et al.
Nephrol Dial Transplant. 2022;37(11):2214-2222
DOI: [10.1093/ndt/gfab346](https://doi.org/10.1093/ndt/gfab346)

## Worked example

### Creatinine 2.1 mg/dL, BUN:Cr 15, SG 1.015, protein 0 or 1+

Given: `bun_cr_ratio=15, creatinine_mg_dl=2.1, protein=le_1, specific_gravity=1.015`

1. L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(15) − 0.0501203×15 + 0.9360127 (le_1)
2. 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=15, creatinine_mg_dl=4.0, protein=le_1, specific_gravity=1.015`

1. L = 0.770398 + 0.8367518×ln(4.0) − 0.9181938×ln(15) − 0.0501203×15 + 0.9360127 (le_1)
2. 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=25, creatinine_mg_dl=2.1, protein=le_1, specific_gravity=1.015`

1. L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(25) − 0.0501203×15 + 0.9360127 (le_1)
2. 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=15, creatinine_mg_dl=2.1, protein=le_1, specific_gravity=1.010`

1. L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(15) − 0.0501203×10 + 0.9360127 (le_1)
2. 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=15, creatinine_mg_dl=2.1, protein=ge_2, specific_gravity=1.015`

1. L = 0.770398 + 0.8367518×ln(2.1) − 0.9181938×ln(15) − 0.0501203×15 + 0 (ge_2)
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

## Parameters

- `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): 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.

Method: `POST /api/calc/ain_risk`
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": [
    {
      "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"
    }
  ]
}
```

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

Example 200:

```json
{
  "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 fields

- `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

Frozen fixture. Not a live lookup.

```json
{
  "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
}
```

## Errors

- HTTP 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.
- 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.

## 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.
