# NUTRIC (Nutrition Risk in the Critically Ill)

NUTRIC

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

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

## What it computes

Sum Heyland 2011 original 6-variable NUTRIC (Nutrition Risk in the Critically Ill) Table 4 overall points, including IL-6, and return whether the total is high nutrition risk (score ≥6).

## When to use

When an agent has caller-supplied age, APACHE II, SOFA, comorbidity count, hospital days to ICU, and IL-6 and needs the published original NUTRIC total and high-risk flag, not a feeding order, and not Rahman 2015 mNUTRIC.

## When not to use

- Not a medical device.
- Not a feeding order or nutrition-therapy prescription.
- Heyland 2011 original 6-variable NUTRIC including IL-6 (Table 4 overall). high_risk is true iff score ≥ 6. This is not Rahman 2015 mNUTRIC (IL-6 omitted; do not use the 5–9 cutoff).
- magent does not compute APACHE II or SOFA; the caller supplies those integers. APACHE II 28 scores 2 (the 20–28 row, not the overlapping ≥28 row).

## Formula

```
NUTRIC = age (0–2) + apache_ii (0–3) + sofa (0–2) + comorbidities (0–1) + hospital_days_to_icu (0–1) + il6_pg_ml (0–1); Heyland 2011 Table 4 overall including IL-6; max 10; high_risk if score ≥ 6
```

## Citation

[Identifying critically ill patients who benefit the most from nutrition therapy: the development and initial validation of a novel risk assessment tool](https://doi.org/10.1186/cc10546)
Heyland DK, Dhaliwal R, Jiang X, Day AG
Crit Care. 2011;15(6):R268
DOI: [10.1186/cc10546](https://doi.org/10.1186/cc10546)

## Worked example

### All zero bands, age 40

Given: `age=40, apache_ii=10, comorbidities=0, hospital_days_to_icu=0, il6_pg_ml=100, sofa=4`

1. age 40 <50 → 0; apache_ii 10 <15 → 0; sofa 4 <6 → 0
2. comorbidities 0 → 0; hospital_days_to_icu 0 → 0; il6_pg_ml 100 <400 → 0
3. Score = 0 (max 10); high_risk false


### Age 75, APACHE II 20, SOFA 10 at the high-risk cutoff

Given: `age=75, apache_ii=20, comorbidities=0, hospital_days_to_icu=0, il6_pg_ml=100, sofa=10`

1. age ≥75 → 2; apache_ii 20–28 → 2; sofa ≥10 → 2
2. comorbidities, hospital days, and IL-6 stay 0
3. Score = 6 (max 10); high_risk true


## Also searched as

- NUTRIC
- Nutrition Risk in the Critically Ill
- Heyland NUTRIC
- NUTRIC score
- nutrition risk critically ill
- NUTRIC IL-6

## Parameters

- `age` (integer, required): Age in years (18-120). Heyland 2011 Table 4 overall: <50 → 0; 50–<75 → 1; ≥75 → 2. Age 50 scores 1. Age 74 scores 1. Age 75 scores 2.
- `apache_ii` (integer, required): Caller-supplied APACHE II total (integer 0-71). Heyland 2011 Table 4 overall: <15 → 0; 15–<20 → 1; 20–28 inclusive → 2; ≥29 → 3. APACHE II 28 scores 2 (the 20–28 row, not the overlapping ≥28 row). magent does not compute APACHE II.
- `sofa` (integer, required): Caller-supplied SOFA total (integer 0-24). Heyland 2011 Table 4 overall: <6 → 0; 6–<10 → 1; ≥10 → 2. magent does not compute SOFA.
- `comorbidities` (integer, required): Number of comorbidities (integer 0-20). Heyland 2011 Table 4 overall: 0–1 → 0; ≥2 → 1.
- `hospital_days_to_icu` (number, required): Days from hospital admission to ICU admission (0-365). Heyland 2011 Table 4 overall: 0–<1 → 0; ≥1 → 1. 0.9 scores 0. 1.0 scores 1.
- `il6_pg_ml` (number, required): Serum IL-6 in pg/mL (0-100000). Heyland 2011 Table 4 overall original 6-variable NUTRIC: 0–<400 → 0; ≥400 → 1. 399.9 scores 0. 400 scores 1. This is not Rahman 2015 mNUTRIC (IL-6 omitted).

## 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/nutric`
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": [
    {
      "age": "40",
      "apache_ii": "10",
      "comorbidities": "0",
      "hospital_days_to_icu": "0",
      "il6_pg_ml": "100",
      "sofa": "4"
    },
    {
      "age": "40",
      "apache_ii": "10",
      "comorbidities": "0",
      "hospital_days_to_icu": "0",
      "il6_pg_ml": "100",
      "sofa": "4"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/nutric",
  "items": [
    {
      "components": [
        {
          "value": 40,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 10,
          "factor": "apache_ii",
          "points": 0,
          "present": false
        },
        {
          "value": 4,
          "factor": "sofa",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "comorbidities",
          "points": 0,
          "present": false
        },
        {
          "value": 0.0,
          "factor": "hospital_days_to_icu",
          "points": 0,
          "present": false
        },
        {
          "value": 100.0,
          "factor": "il6_pg_ml",
          "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": "Heyland DK, Dhaliwal R, Jiang X, Day AG",
        "doi": "10.1186/cc10546",
        "id": "heyland-2011",
        "pmid": "22085762",
        "source": "Crit Care. 2011;15(6):R268",
        "title": "Identifying critically ill patients who benefit the most from nutrition therapy: the development and initial validation of a novel risk assessment tool"
      },
      "formula": "nutric",
      "formula_expression": "NUTRIC = age (0–2) + apache_ii (0–3) + sofa (0–2) + comorbidities (0–1) + hospital_days_to_icu (0–1) + il6_pg_ml (0–1); Heyland 2011 Table 4 overall including IL-6; max 10; high_risk if score ≥ 6",
      "age_years": 40,
      "max_score": 10,
      "score": 0,
      "high_risk": false,
      "apache_ii": 10,
      "comorbidities": 0,
      "hospital_days_to_icu": 0.0,
      "il6_pg_ml": 100.0,
      "sofa": 4
    },
    {
      "components": [
        {
          "value": 40,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 10,
          "factor": "apache_ii",
          "points": 0,
          "present": false
        },
        {
          "value": 4,
          "factor": "sofa",
          "points": 0,
          "present": false
        },
        {
          "value": 0,
          "factor": "comorbidities",
          "points": 0,
          "present": false
        },
        {
          "value": 0.0,
          "factor": "hospital_days_to_icu",
          "points": 0,
          "present": false
        },
        {
          "value": 100.0,
          "factor": "il6_pg_ml",
          "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": "Heyland DK, Dhaliwal R, Jiang X, Day AG",
        "doi": "10.1186/cc10546",
        "id": "heyland-2011",
        "pmid": "22085762",
        "source": "Crit Care. 2011;15(6):R268",
        "title": "Identifying critically ill patients who benefit the most from nutrition therapy: the development and initial validation of a novel risk assessment tool"
      },
      "formula": "nutric",
      "formula_expression": "NUTRIC = age (0–2) + apache_ii (0–3) + sofa (0–2) + comorbidities (0–1) + hospital_days_to_icu (0–1) + il6_pg_ml (0–1); Heyland 2011 Table 4 overall including IL-6; max 10; high_risk if score ≥ 6",
      "age_years": 40,
      "max_score": 10,
      "score": 0,
      "high_risk": false,
      "apache_ii": 10,
      "comorbidities": 0,
      "hospital_days_to_icu": 0.0,
      "il6_pg_ml": 100.0,
      "sofa": 4
    }
  ]
}
```

## Response fields

- `formula` (string): nutric
- `formula_expression` (string): Exact expression used
- `score` (integer): NUTRIC points 0-10
- `max_score` (integer): 10
- `high_risk` (boolean): true iff score ≥ 6 (Heyland 2011 original 6-variable NUTRIC with IL-6). Not a feeding order. Not the Rahman 2015 mNUTRIC 5–9 cutoff.
- `age_years` (integer): Age used for the 0–2 age points
- `apache_ii` (integer): Caller-supplied APACHE II total used for the 0–3 points
- `sofa` (integer): Caller-supplied SOFA total used for the 0–2 points
- `comorbidities` (integer): Comorbidity count used for the 0–1 points
- `hospital_days_to_icu` (number): Hospital days to ICU used for the 0–1 points
- `il6_pg_ml` (number): IL-6 pg/mL used for the 0–1 points
- `components` (array): Per-item Heyland 2011 Table 4 overall points
- `citation` (object): Heyland et al. Crit Care 2011 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 40,
      "factor": "age",
      "points": 0,
      "present": false
    },
    {
      "value": 10,
      "factor": "apache_ii",
      "points": 0,
      "present": false
    },
    {
      "value": 4,
      "factor": "sofa",
      "points": 0,
      "present": false
    },
    {
      "value": 0,
      "factor": "comorbidities",
      "points": 0,
      "present": false
    },
    {
      "value": 0.0,
      "factor": "hospital_days_to_icu",
      "points": 0,
      "present": false
    },
    {
      "value": 100.0,
      "factor": "il6_pg_ml",
      "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": "Heyland DK, Dhaliwal R, Jiang X, Day AG",
    "doi": "10.1186/cc10546",
    "id": "heyland-2011",
    "pmid": "22085762",
    "source": "Crit Care. 2011;15(6):R268",
    "title": "Identifying critically ill patients who benefit the most from nutrition therapy: the development and initial validation of a novel risk assessment tool"
  },
  "formula": "nutric",
  "formula_expression": "NUTRIC = age (0–2) + apache_ii (0–3) + sofa (0–2) + comorbidities (0–1) + hospital_days_to_icu (0–1) + il6_pg_ml (0–1); Heyland 2011 Table 4 overall including IL-6; max 10; high_risk if score ≥ 6",
  "age_years": 40,
  "max_score": 10,
  "score": 0,
  "high_risk": false,
  "apache_ii": 10,
  "comorbidities": 0,
  "hospital_days_to_icu": 0.0,
  "il6_pg_ml": 100.0,
  "sofa": 4
}
```

## Errors

- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 Returned before settlement; you are not charged.
- HTTP 400 `invalid_apache_ii`: apache_ii must be an integer from 0 to 71 (Heyland 2011 NUTRIC). Returned before settlement; you are not charged.
- HTTP 400 `invalid_sofa_total`: sofa must be an integer from 0 to 24 (Heyland 2011 NUTRIC). Returned before settlement; you are not charged.
- HTTP 400 `invalid_comorbidity_count`: comorbidities must be an integer from 0 to 20 (Heyland 2011 NUTRIC). Returned before settlement; you are not charged.
- HTTP 400 `invalid_hospital_days`: hospital_days_to_icu must be a number from 0 to 365 (Heyland 2011 NUTRIC). Returned before settlement; you are not charged.
- HTTP 400 `invalid_il6`: il6_pg_ml must be a number from 0 to 100000 (Heyland 2011 NUTRIC). 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

- [NRS-2002](https://magentlab.com/docs/nrs-2002) — Sum Kondrup 2003 NRS-2002 impaired nutritional status (0–3), disease severity (0–3), and 1 if age ≥70, and return whether the total is at nutritional risk (score ≥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.
