# qCSI (quick COVID-19 Severity Index)

qCSI

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

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

## What it computes

Sum Haimovich 2020 qCSI bedside points (Table 2) from respiratory rate, lowest SpO2, and nasal-cannula oxygen flow and return the integer total (max 12).

## When to use

When an agent needs the published qCSI bedside point total and must not invent risk classes, treat the score as a COVID-19 diagnosis or triage order, or substitute the 12-variable CSI model.

## When not to use

- Not a medical device and not a COVID-19 diagnosis or triage order. magent does not measure vitals.
- This is the Haimovich 2020 qCSI bedside points score (Table 2; max 12) only. It is not the 12-variable gradient-boosting CSI model.
- Derivation included nasal cannula oxygen ≤6 L/min and excluded higher flows. oxygen_l_min >6 is rejected.
- Respiratory rate, SpO2, and oxygen flow are caller-supplied. magent does not measure them. The paper associated a low score with <5% decompensation; magent returns the integer total only and does not emit named risk classes.

## Formula

```
qCSI = RR(≤22→0, 23–28→1, >28→2) + SpO2(>92→0, 89–92→2, ≤88→5) + O2_L_min(≤2→0, 3–4→4, 5–6→5); Haimovich 2020 Table 2 bedside; max 12
```

## Citation

[Development and Validation of the Quick COVID-19 Severity Index: A Prognostic Tool for Early Clinical Decompensation](https://doi.org/10.1016/j.annemergmed.2020.07.022)
Haimovich AD, Ravindra NG, Stoytchev S, Young HP, Wilson FP, van Dijk D, Schulz WL, Taylor RA
Ann Emerg Med. 2020;76(4):442-453
DOI: [10.1016/j.annemergmed.2020.07.022](https://doi.org/10.1016/j.annemergmed.2020.07.022)

## Worked example

### All zero-point bands

Given: `oxygen_l_min=0, respiratory_rate=16, spo2_percent=98`

1. RR 16 → 0; SpO2 98 → 0; O2 0 L/min → 0
2. Score = 0 (max 12). Integer total only; no named risk class.


## Also searched as

- qCSI
- quick COVID-19 Severity Index
- Haimovich qCSI
- qCSI score
- quick CSI
- COVID-19 severity index
- Haimovich 2020 qCSI
- bedside qCSI

## Parameters

- `respiratory_rate` (integer, required): Respiratory rate in breaths/min (integer 4-80). Haimovich 2020 Table 2: ≤22 → 0, 23-28 → 1, >28 → 2. magent does not measure vitals.
- `spo2_percent` (number, required): Lowest SpO2 percent as assigned by the caller (50-100). Haimovich 2020 Table 2: >92 → 0, 89-92 → 2, ≤88 → 5. magent does not measure SpO2.
- `oxygen_l_min` (number, required): Nasal-cannula oxygen flow in L/min (0-6). Haimovich 2020 Table 2: ≤2 → 0, 3-4 → 4, 5-6 → 5. Derivation excluded >6 L/min. magent does not measure flow.

## 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/qcsi`
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": [
    {
      "oxygen_l_min": "0",
      "respiratory_rate": "16",
      "spo2_percent": "98"
    },
    {
      "oxygen_l_min": "0",
      "respiratory_rate": "16",
      "spo2_percent": "98"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/qcsi",
  "items": [
    {
      "components": [
        {
          "value": 16,
          "factor": "respiratory_rate",
          "points": 0,
          "present": false
        },
        {
          "value": 98.0,
          "factor": "spo2_percent",
          "points": 0,
          "present": false
        },
        {
          "value": 0.0,
          "factor": "oxygen_l_min",
          "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": "Haimovich AD, Ravindra NG, Stoytchev S, Young HP, Wilson FP, van Dijk D, Schulz WL, Taylor RA",
        "doi": "10.1016/j.annemergmed.2020.07.022",
        "id": "haimovich-2020",
        "pmid": "33012378",
        "source": "Ann Emerg Med. 2020;76(4):442-453",
        "title": "Development and Validation of the Quick COVID-19 Severity Index: A Prognostic Tool for Early Clinical Decompensation"
      },
      "formula": "qcsi",
      "formula_expression": "qCSI = RR(≤22→0, 23–28→1, >28→2) + SpO2(>92→0, 89–92→2, ≤88→5) + O2_L_min(≤2→0, 3–4→4, 5–6→5); Haimovich 2020 Table 2 bedside; max 12",
      "max_score": 12,
      "score": 0,
      "spo2_percent": 98.0,
      "respiratory_rate": 16,
      "oxygen_l_min": 0.0
    },
    {
      "components": [
        {
          "value": 16,
          "factor": "respiratory_rate",
          "points": 0,
          "present": false
        },
        {
          "value": 98.0,
          "factor": "spo2_percent",
          "points": 0,
          "present": false
        },
        {
          "value": 0.0,
          "factor": "oxygen_l_min",
          "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": "Haimovich AD, Ravindra NG, Stoytchev S, Young HP, Wilson FP, van Dijk D, Schulz WL, Taylor RA",
        "doi": "10.1016/j.annemergmed.2020.07.022",
        "id": "haimovich-2020",
        "pmid": "33012378",
        "source": "Ann Emerg Med. 2020;76(4):442-453",
        "title": "Development and Validation of the Quick COVID-19 Severity Index: A Prognostic Tool for Early Clinical Decompensation"
      },
      "formula": "qcsi",
      "formula_expression": "qCSI = RR(≤22→0, 23–28→1, >28→2) + SpO2(>92→0, 89–92→2, ≤88→5) + O2_L_min(≤2→0, 3–4→4, 5–6→5); Haimovich 2020 Table 2 bedside; max 12",
      "max_score": 12,
      "score": 0,
      "spo2_percent": 98.0,
      "respiratory_rate": 16,
      "oxygen_l_min": 0.0
    }
  ]
}
```

## Response fields

- `formula` (string): qcsi
- `formula_expression` (string): Exact expression used
- `score` (integer): qCSI points 0-12
- `max_score` (integer): Always 12
- `respiratory_rate` (integer): Respiratory rate used, breaths/min
- `spo2_percent` (number): Caller-assigned lowest SpO2 used, %
- `oxygen_l_min` (number): Caller-assigned nasal-cannula oxygen flow used, L/min
- `components` (array): Per-factor points
- `citation` (object): Haimovich 2020 Ann Emerg Med citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 16,
      "factor": "respiratory_rate",
      "points": 0,
      "present": false
    },
    {
      "value": 98.0,
      "factor": "spo2_percent",
      "points": 0,
      "present": false
    },
    {
      "value": 0.0,
      "factor": "oxygen_l_min",
      "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": "Haimovich AD, Ravindra NG, Stoytchev S, Young HP, Wilson FP, van Dijk D, Schulz WL, Taylor RA",
    "doi": "10.1016/j.annemergmed.2020.07.022",
    "id": "haimovich-2020",
    "pmid": "33012378",
    "source": "Ann Emerg Med. 2020;76(4):442-453",
    "title": "Development and Validation of the Quick COVID-19 Severity Index: A Prognostic Tool for Early Clinical Decompensation"
  },
  "formula": "qcsi",
  "formula_expression": "qCSI = RR(≤22→0, 23–28→1, >28→2) + SpO2(>92→0, 89–92→2, ≤88→5) + O2_L_min(≤2→0, 3–4→4, 5–6→5); Haimovich 2020 Table 2 bedside; max 12",
  "max_score": 12,
  "score": 0,
  "spo2_percent": 98.0,
  "respiratory_rate": 16,
  "oxygen_l_min": 0.0
}
```

## Errors

- HTTP 400 `invalid_respiratory_rate`: respiratory_rate must be an integer from 4 to 80. Returned before settlement; you are not charged.
- HTTP 400 `invalid_spo2`: spo2_percent must be a number from 50 to 100. Returned before settlement; you are not charged.
- HTTP 400 `invalid_o2_flow_l_min`: oxygen_l_min must be a number from 0 to 6 (Haimovich 2020 qCSI; derivation excluded >6 L/min). 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).

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