# NIVO score (Hartley 2021)

NIVO

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

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

## What it computes

Sum Hartley 2021 NIVO points from chest radiograph consolidation, GCS ≤14, atrial fibrillation, pH <7.25, time to acidaemia >12 h, and eMRCD, and return the validation Table 4 grouped in-hospital mortality band.

## When to use

When an agent needs the published Hartley 2021 NIVO total and Table 4 grouped band for AECOPD with acidaemic hypercapnic respiratory failure treated with assisted ventilation, and must not invent HACOR, DECAF, APACHE II, a weaning prediction, or a per-integer mortality percent.

## When not to use

- Not a medical device. Not an intubation, NIV-failure, weaning, or escalation order. Not HACOR, DECAF, or APACHE II.
- Flags and eMRCD are caller-assigned. magent does not interpret the chest radiograph, measure GCS, interpret the ECG, measure arterial pH, or clock time from hospital arrival.
- In-hospital mortality percents are Hartley 2021 validation Table 4 grouped bands only (0–2 / 3–4 / 5–6 / 7–9: 5.0 / 16.8 / 41.2 / 71.4). Per-integer percents are not attached.
- eMRCD 5a and 5b are mutually exclusive; maximum score is 9.

## Formula

```
NIVO = chest_radiograph_consolidation + gcs_le_14 + atrial_fibrillation + ph_lt_7_25 + time_to_acidaemia_gt_12h + emrcd; consolidation true -> 1; GCS <=14 prior to ventilation -> 1; AF (persistent, new, or paroxysmal even if sinus at NIV start) true -> 1; pH <7.25 -> 1; time from hospital arrival to index acidaemia >12 h -> 2; eMRCD 1_to_4 -> 0, 5a -> 2, 5b -> 3; cannot score both 5a and 5b; Hartley 2021 validation Table 4 bands 0-2 / 3-4 / 5-6 / 7-9; max 9
```

## Citation

[The Noninvasive Ventilation Outcomes (NIVO) score: prediction of in-hospital mortality in exacerbations of COPD requiring assisted ventilation](https://doi.org/10.1183/13993003.04042-2020)
Hartley T, Lane ND, Steer J, et al.
Eur Respir J. 2021;58(2):2004042
DOI: [10.1183/13993003.04042-2020](https://doi.org/10.1183/13993003.04042-2020)

## Worked example

### No NIVO points (band 0_to_2)

Given: `atrial_fibrillation=false, chest_radiograph_consolidation=false, emrcd=1_to_4, gcs_le_14=false, ph_lt_7_25=false, time_to_acidaemia_gt_12h=false`

1. No consolidation, GCS ≤14, AF, pH <7.25, or time >12 h; eMRCD 1_to_4 → 0
2. Score = 0; band 0_to_2; validation Table 4 in-hospital mortality 5.0%


### Maximum points (band 7_to_9)

Given: `atrial_fibrillation=true, chest_radiograph_consolidation=true, emrcd=5b, gcs_le_14=true, ph_lt_7_25=true, time_to_acidaemia_gt_12h=true`

1. Consolidation → 1; GCS ≤14 → 1; AF → 1; pH <7.25 → 1; time >12 h → 2; eMRCD 5b → 3
2. Score = 9; band 7_to_9; validation Table 4 in-hospital mortality 71.4%


## Also searched as

- NIVO score
- noninvasive ventilation outcomes
- Hartley NIVO
- COPD NIV mortality
- eMRCD ventilation score
- AECOPD assisted ventilation
- NIVO Hartley 2021

## Parameters

- `chest_radiograph_consolidation` (boolean, required): Chest radiograph consolidation as assigned by the caller (Hartley 2021). true or false. 1 point if true. magent does not interpret radiographs.
- `gcs_le_14` (boolean, required): GCS ≤14 prior to ventilation as assigned by the caller (Hartley 2021). true or false. 1 point if true. magent does not measure GCS.
- `atrial_fibrillation` (boolean, required): Persistent AF, new AF, or paroxysmal AF even if in sinus rhythm at NIV start (Hartley 2021). true or false. 1 point if true. magent does not interpret the ECG.
- `ph_lt_7_25` (boolean, required): Arterial pH <7.25 as assigned by the caller (Hartley 2021). true or false. 1 point if true. magent does not measure pH.
- `time_to_acidaemia_gt_12h` (boolean, required): >12 h from hospital arrival to index acidaemia as assigned by the caller (Hartley 2021). true or false. 2 points if true. magent does not clock admission time.
- `emrcd` (string, required): Hartley 2021 extended MRC dyspnoea as assigned by the caller. 1_to_4 scores 0; 5a scores 2; 5b scores 3. 5a and 5b are mutually exclusive. magent does not interview the patient.

## 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/nivo`
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": [
    {
      "atrial_fibrillation": "false",
      "chest_radiograph_consolidation": "false",
      "emrcd": "1_to_4",
      "gcs_le_14": "false",
      "ph_lt_7_25": "false",
      "time_to_acidaemia_gt_12h": "false"
    },
    {
      "atrial_fibrillation": "false",
      "chest_radiograph_consolidation": "false",
      "emrcd": "1_to_4",
      "gcs_le_14": "false",
      "ph_lt_7_25": "false",
      "time_to_acidaemia_gt_12h": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/nivo",
  "items": [
    {
      "components": [
        {
          "factor": "chest_radiograph_consolidation",
          "points": 0,
          "present": false
        },
        {
          "factor": "gcs_le_14",
          "points": 0,
          "present": false
        },
        {
          "factor": "atrial_fibrillation",
          "points": 0,
          "present": false
        },
        {
          "factor": "ph_lt_7_25",
          "points": 0,
          "present": false
        },
        {
          "factor": "time_to_acidaemia_gt_12h",
          "points": 0,
          "present": false
        },
        {
          "value": "1_to_4",
          "factor": "emrcd",
          "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": "Hartley T, Lane ND, Steer J, et al.",
        "doi": "10.1183/13993003.04042-2020",
        "id": "hartley-2021",
        "pmid": "33479109",
        "source": "Eur Respir J. 2021;58(2):2004042",
        "title": "The Noninvasive Ventilation Outcomes (NIVO) score: prediction of in-hospital mortality in exacerbations of COPD requiring assisted ventilation"
      },
      "formula": "nivo",
      "formula_expression": "NIVO = chest_radiograph_consolidation + gcs_le_14 + atrial_fibrillation + ph_lt_7_25 + time_to_acidaemia_gt_12h + emrcd; consolidation true -> 1; GCS <=14 prior to ventilation -> 1; AF (persistent, new, or paroxysmal even if sinus at NIV start) true -> 1; pH <7.25 -> 1; time from hospital arrival to index acidaemia >12 h -> 2; eMRCD 1_to_4 -> 0, 5a -> 2, 5b -> 3; cannot score both 5a and 5b; Hartley 2021 validation Table 4 bands 0-2 / 3-4 / 5-6 / 7-9; max 9",
      "max_score": 9,
      "score": 0,
      "atrial_fibrillation": false,
      "emrcd": "1_to_4",
      "chest_radiograph_consolidation": false,
      "gcs_le_14": false,
      "in_hospital_mortality_percent": 5.0,
      "nivo_band": "0_to_2",
      "ph_lt_7_25": false,
      "time_to_acidaemia_gt_12h": false
    },
    {
      "components": [
        {
          "factor": "chest_radiograph_consolidation",
          "points": 0,
          "present": false
        },
        {
          "factor": "gcs_le_14",
          "points": 0,
          "present": false
        },
        {
          "factor": "atrial_fibrillation",
          "points": 0,
          "present": false
        },
        {
          "factor": "ph_lt_7_25",
          "points": 0,
          "present": false
        },
        {
          "factor": "time_to_acidaemia_gt_12h",
          "points": 0,
          "present": false
        },
        {
          "value": "1_to_4",
          "factor": "emrcd",
          "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": "Hartley T, Lane ND, Steer J, et al.",
        "doi": "10.1183/13993003.04042-2020",
        "id": "hartley-2021",
        "pmid": "33479109",
        "source": "Eur Respir J. 2021;58(2):2004042",
        "title": "The Noninvasive Ventilation Outcomes (NIVO) score: prediction of in-hospital mortality in exacerbations of COPD requiring assisted ventilation"
      },
      "formula": "nivo",
      "formula_expression": "NIVO = chest_radiograph_consolidation + gcs_le_14 + atrial_fibrillation + ph_lt_7_25 + time_to_acidaemia_gt_12h + emrcd; consolidation true -> 1; GCS <=14 prior to ventilation -> 1; AF (persistent, new, or paroxysmal even if sinus at NIV start) true -> 1; pH <7.25 -> 1; time from hospital arrival to index acidaemia >12 h -> 2; eMRCD 1_to_4 -> 0, 5a -> 2, 5b -> 3; cannot score both 5a and 5b; Hartley 2021 validation Table 4 bands 0-2 / 3-4 / 5-6 / 7-9; max 9",
      "max_score": 9,
      "score": 0,
      "atrial_fibrillation": false,
      "emrcd": "1_to_4",
      "chest_radiograph_consolidation": false,
      "gcs_le_14": false,
      "in_hospital_mortality_percent": 5.0,
      "nivo_band": "0_to_2",
      "ph_lt_7_25": false,
      "time_to_acidaemia_gt_12h": false
    }
  ]
}
```

## Response fields

- `formula` (string): nivo
- `formula_expression` (string): Exact Hartley 2021 expression
- `score` (integer): NIVO points 0-9
- `max_score` (integer): Always 9
- `nivo_band` (string): Hartley 2021 validation Table 4 grouped band: 0_to_2, 3_to_4, 5_to_6, or 7_to_9. Not a per-integer rate.
- `in_hospital_mortality_percent` (number): Hartley 2021 validation Table 4 grouped in-hospital mortality percent for that band (5.0 / 16.8 / 41.2 / 71.4). Not a per-integer percent.
- `chest_radiograph_consolidation` (boolean): Caller-assigned chest radiograph consolidation
- `gcs_le_14` (boolean): Caller-assigned GCS ≤14 prior to ventilation
- `atrial_fibrillation` (boolean): Caller-assigned atrial fibrillation (persistent, new, or paroxysmal)
- `ph_lt_7_25` (boolean): Caller-assigned arterial pH <7.25
- `time_to_acidaemia_gt_12h` (boolean): Caller-assigned >12 h from hospital arrival to index acidaemia
- `emrcd` (string): Caller-assigned eMRCD: 1_to_4, 5a, or 5b
- `components` (array): Per-factor points for the six Hartley 2021 NIVO items
- `citation` (object): Hartley et al. Eur Respir J 2021 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "chest_radiograph_consolidation",
      "points": 0,
      "present": false
    },
    {
      "factor": "gcs_le_14",
      "points": 0,
      "present": false
    },
    {
      "factor": "atrial_fibrillation",
      "points": 0,
      "present": false
    },
    {
      "factor": "ph_lt_7_25",
      "points": 0,
      "present": false
    },
    {
      "factor": "time_to_acidaemia_gt_12h",
      "points": 0,
      "present": false
    },
    {
      "value": "1_to_4",
      "factor": "emrcd",
      "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": "Hartley T, Lane ND, Steer J, et al.",
    "doi": "10.1183/13993003.04042-2020",
    "id": "hartley-2021",
    "pmid": "33479109",
    "source": "Eur Respir J. 2021;58(2):2004042",
    "title": "The Noninvasive Ventilation Outcomes (NIVO) score: prediction of in-hospital mortality in exacerbations of COPD requiring assisted ventilation"
  },
  "formula": "nivo",
  "formula_expression": "NIVO = chest_radiograph_consolidation + gcs_le_14 + atrial_fibrillation + ph_lt_7_25 + time_to_acidaemia_gt_12h + emrcd; consolidation true -> 1; GCS <=14 prior to ventilation -> 1; AF (persistent, new, or paroxysmal even if sinus at NIV start) true -> 1; pH <7.25 -> 1; time from hospital arrival to index acidaemia >12 h -> 2; eMRCD 1_to_4 -> 0, 5a -> 2, 5b -> 3; cannot score both 5a and 5b; Hartley 2021 validation Table 4 bands 0-2 / 3-4 / 5-6 / 7-9; max 9",
  "max_score": 9,
  "score": 0,
  "atrial_fibrillation": false,
  "emrcd": "1_to_4",
  "chest_radiograph_consolidation": false,
  "gcs_le_14": false,
  "in_hospital_mortality_percent": 5.0,
  "nivo_band": "0_to_2",
  "ph_lt_7_25": false,
  "time_to_acidaemia_gt_12h": false
}
```

## Errors

- HTTP 400 `invalid_nivo_emrcd`: emrcd must be 1_to_4, 5a, or 5b (Hartley 2021 NIVO; 5a and 5b are mutually exclusive). 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

- [HACOR](https://magentlab.com/docs/hacor) — Sum Duan 2017 HACOR (ESM Table 2) points from heart rate, pH, GCS, PaO2/FiO2, and respiratory rate and return low (≤5) or high (>5).
- [DECAF](https://magentlab.com/docs/decaf) — Sum Steer 2012 DECAF points from extended MRC dyspnoea, eosinophils, chest radiograph consolidation, arterial pH, and atrial fibrillation.
- [BAP-65](https://magentlab.com/docs/bap-65) — Apply Tabak 2009 BAP-65 and return class I–V from three caller-assigned main factors, using age >65 only to split class I from II when zero main factors are present.
- [GOLD spirometric grade](https://magentlab.com/docs/gold-copd) — Apply the 2017 GOLD executive summary spirometric classification: obstruction when post-bronchodilator FEV1/FVC is < 0.70, then GOLD grades 1-4 from FEV1 percent predicted.

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