# SOFA organ failure score

SOFA

## Also searched as

- SOFA score
- Sequential Organ Failure Assessment
- Sepsis-related Organ Failure Assessment
- Vincent SOFA
- organ failure score

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

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

## What it computes

Compute the Vincent 1996 SOFA score from PaO2/FiO2, platelets, bilirubin, MAP and adrenergic agents, GCS, and creatinine or urine output.

## When to use

When an agent needs the published six-organ SOFA total and must not invent points from a chart narrative or a later SOFA revision.

## When not to use

- Not a Sepsis-3 diagnosis and not a treatment recommendation.
- Respiration scores 3 and 4 require respiratory support (ventilated=true) as in Vincent 1996 Table 3. Unventilated PaO2/FiO2 <200 is capped at 2.
- Adrenergic doses are scored without the paper's ≥1 h duration. Only dopamine, epinephrine, norepinephrine, and dobutamine from Vincent 1996 Table 3 are scored.
- GCS is a caller-assigned integer 3-15. magent does not examine the patient.

## Formula

```
SOFA = respiration + coagulation + liver + cardiovascular + cns + renal; each 0-4; max 24
```

## Citation

[The SOFA (Sepsis-related Organ Failure Assessment) score to describe organ dysfunction/failure](https://doi.org/10.1007/BF01709751)
Vincent JL, Moreno R, Takala J, Willatts S, De Mendonça A, Bruining H, Reinhart CK, Suter PM, Thijs LG
Intensive Care Med. 1996;22(7):707-710
DOI: [10.1007/BF01709751](https://doi.org/10.1007/BF01709751)

## Worked example

### All organs 0

Given: `bilirubin_mg_dl=0.8, creatinine_mg_dl=1.0, fio2=0.21, gcs=15, map_mm_hg=80, pao2_mm_hg=96, platelets_10e9_l=200, ventilated=false`

1. PaO2/FiO2 96/0.21 ≥400 → 0; platelets 200 → 0; bilirubin 0.8 → 0; MAP 80, no pressors → 0; GCS 15 → 0; creatinine 1.0 → 0
2. Score = 0 (max 24)


### Unventilated PaO2/FiO2 80 stays 2

Given: `bilirubin_mg_dl=0.8, creatinine_mg_dl=1.0, fio2=1.0, gcs=15, map_mm_hg=80, pao2_mm_hg=80, platelets_10e9_l=200, ventilated=false`

1. PaO2/FiO2 80 without ventilation cannot score 3 or 4
2. Respiration → 2; other organs 0; score = 2


## Parameters

- `pao2_mm_hg` (number, required): Arterial PaO2 in mm Hg (20-700). Respiration uses PaO2/FiO2: ≥400 scores 0; <400 scores 1; <300 scores 2; <200 with ventilation scores 3; <100 with ventilation scores 4.
- `fio2` (number, required): Inspired oxygen as a fraction (0.21-1.0), not a percent.
- `ventilated` (boolean, required): Respiratory support (Vincent 1996). true or false. Scores 3 and 4 require ventilation; unventilated PaO2/FiO2 <200 is capped at 2.
- `platelets_10e9_l` (number, required): Platelets ×10^9/L, same as ×10^3/mm^3 (1-2000). ≥150 scores 0; <150 scores 1; <100 scores 2; <50 scores 3; <20 scores 4.
- `bilirubin_mg_dl` (number, optional): Total bilirubin in mg/dL (0.1-40). Provide this or bilirubin_umol_l. <1.2 scores 0; 1.2-1.9 scores 1; 2.0-5.9 scores 2; 6.0-11.9 scores 3; >12.0 scores 4.
- `bilirubin_umol_l` (number, optional): Total bilirubin in µmol/L. Converted as mg/dL = µmol/L / 17.1.
- `map_mm_hg` (number, required): Mean arterial pressure in mm Hg (30-180). MAP <70 scores 1 unless a higher cardiovascular band applies.
- `dopamine_ug_kg_min` (number, optional): Dopamine in µg/kg·min (0-50) when provided. Absent is 0. 0 < dose ≤5 scores 2; >5 scores 3; >15 scores 4.
- `dobutamine` (boolean, optional): Any dobutamine. true or false when provided; absent is false. true scores cardiovascular 2 unless a higher band applies.
- `epinephrine_ug_kg_min` (number, optional): Epinephrine in µg/kg·min (0-2) when provided. Absent is 0. 0 < dose ≤0.1 scores 3; >0.1 scores 4.
- `norepinephrine_ug_kg_min` (number, optional): Norepinephrine in µg/kg·min (0-2) when provided. Absent is 0. 0 < dose ≤0.1 scores 3; >0.1 scores 4.
- `gcs` (integer, required): Glasgow Coma Scale total as assigned by the caller (integer 3-15). 15 scores 0; 13-14 scores 1; 10-12 scores 2; 6-9 scores 3; <6 scores 4.
- `creatinine_mg_dl` (number, optional): Creatinine in mg/dL (0.1-20). Provide this, creatinine_umol_l, or urine_output_ml_day. <1.2 scores 0; 1.2-1.9 scores 1; 2.0-3.4 scores 2; 3.5-4.9 scores 3; ≥5.0 scores 4.
- `creatinine_umol_l` (number, optional): Creatinine in µmol/L. Converted as mg/dL = µmol/L / 88.42.
- `urine_output_ml_day` (number, optional): Urine output in mL/day (0-20000) when provided. <200 scores 4; <500 scores 3; otherwise urine does not add 1-2. Renal is the max of creatinine and urine when both are given.

## Bulk (POST)

POST the same path with a JSON items array. Price is n times the GET unit. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/sofa`
Max items: 25
Price: unit_amount * n (unit 5000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- 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": [
    {
      "bilirubin_mg_dl": "0.8",
      "creatinine_mg_dl": "1.0",
      "fio2": "0.21",
      "gcs": "15",
      "map_mm_hg": "80",
      "pao2_mm_hg": "96",
      "platelets_10e9_l": "200",
      "ventilated": "false"
    },
    {
      "bilirubin_mg_dl": "0.8",
      "creatinine_mg_dl": "1.0",
      "fio2": "0.21",
      "gcs": "15",
      "map_mm_hg": "80",
      "pao2_mm_hg": "96",
      "platelets_10e9_l": "200",
      "ventilated": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/sofa",
  "items": [
    {
      "components": [
        {
          "value": 457.14285714285717,
          "factor": "respiration",
          "points": 0,
          "present": false
        },
        {
          "value": 200.0,
          "factor": "coagulation",
          "points": 0,
          "present": false
        },
        {
          "value": 0.8,
          "factor": "liver",
          "points": 0,
          "present": false
        },
        {
          "value": 80.0,
          "factor": "cardiovascular",
          "points": 0,
          "present": false
        },
        {
          "value": 15,
          "factor": "cns",
          "points": 0,
          "present": false
        },
        {
          "value": 1.0,
          "factor": "renal",
          "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": "Vincent JL, Moreno R, Takala J, Willatts S, De Mendonça A, Bruining H, Reinhart CK, Suter PM, Thijs LG",
        "doi": "10.1007/BF01709751",
        "id": "vincent-1996",
        "source": "Intensive Care Med. 1996;22(7):707-710",
        "title": "The SOFA (Sepsis-related Organ Failure Assessment) score to describe organ dysfunction/failure"
      },
      "formula": "sofa",
      "formula_expression": "SOFA = respiration + coagulation + liver + cardiovascular + cns + renal; each 0-4; max 24",
      "max_score": 24,
      "score": 0
    },
    {
      "components": [
        {
          "value": 457.14285714285717,
          "factor": "respiration",
          "points": 0,
          "present": false
        },
        {
          "value": 200.0,
          "factor": "coagulation",
          "points": 0,
          "present": false
        },
        {
          "value": 0.8,
          "factor": "liver",
          "points": 0,
          "present": false
        },
        {
          "value": 80.0,
          "factor": "cardiovascular",
          "points": 0,
          "present": false
        },
        {
          "value": 15,
          "factor": "cns",
          "points": 0,
          "present": false
        },
        {
          "value": 1.0,
          "factor": "renal",
          "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": "Vincent JL, Moreno R, Takala J, Willatts S, De Mendonça A, Bruining H, Reinhart CK, Suter PM, Thijs LG",
        "doi": "10.1007/BF01709751",
        "id": "vincent-1996",
        "source": "Intensive Care Med. 1996;22(7):707-710",
        "title": "The SOFA (Sepsis-related Organ Failure Assessment) score to describe organ dysfunction/failure"
      },
      "formula": "sofa",
      "formula_expression": "SOFA = respiration + coagulation + liver + cardiovascular + cns + renal; each 0-4; max 24",
      "max_score": 24,
      "score": 0
    }
  ]
}
```

## Response fields

- `formula` (string): sofa
- `formula_expression` (string): Exact expression used
- `score` (integer): Total points 0-24
- `max_score` (integer): Always 24
- `components` (array): Per-organ 0-4 points
- `citation` (object): Vincent 1996 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 457.14285714285717,
      "factor": "respiration",
      "points": 0,
      "present": false
    },
    {
      "value": 200.0,
      "factor": "coagulation",
      "points": 0,
      "present": false
    },
    {
      "value": 0.8,
      "factor": "liver",
      "points": 0,
      "present": false
    },
    {
      "value": 80.0,
      "factor": "cardiovascular",
      "points": 0,
      "present": false
    },
    {
      "value": 15,
      "factor": "cns",
      "points": 0,
      "present": false
    },
    {
      "value": 1.0,
      "factor": "renal",
      "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": "Vincent JL, Moreno R, Takala J, Willatts S, De Mendonça A, Bruining H, Reinhart CK, Suter PM, Thijs LG",
    "doi": "10.1007/BF01709751",
    "id": "vincent-1996",
    "source": "Intensive Care Med. 1996;22(7):707-710",
    "title": "The SOFA (Sepsis-related Organ Failure Assessment) score to describe organ dysfunction/failure"
  },
  "formula": "sofa",
  "formula_expression": "SOFA = respiration + coagulation + liver + cardiovascular + cns + renal; each 0-4; max 24",
  "max_score": 24,
  "score": 0
}
```

## Errors

- HTTP 400 `invalid_pao2`: pao2_mm_hg must be a number from 20 to 700. Returned before settlement; you are not charged.
- HTTP 400 `invalid_fio2`: fio2 must be a fraction from 0.21 to 1.0. 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_platelets`: platelets_10e9_l must be a number from 1 to 2000 Returned before settlement; you are not charged.
- HTTP 400 `invalid_bilirubin`: bilirubin_mg_dl (0.1-40) or bilirubin_umol_l (2-684) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_map_mm_hg`: map_mm_hg must be a number from 30 to 180. Returned before settlement; you are not charged.
- HTTP 400 `invalid_dopamine`: dopamine_ug_kg_min must be a number from 0 to 50 when provided. Returned before settlement; you are not charged.
- HTTP 400 `invalid_epinephrine`: epinephrine_ug_kg_min must be a number from 0 to 2 when provided. Returned before settlement; you are not charged.
- HTTP 400 `invalid_norepinephrine`: norepinephrine_ug_kg_min must be a number from 0 to 2 when provided. Returned before settlement; you are not charged.
- HTTP 400 `invalid_sofa_gcs`: gcs must be an integer from 3 to 15. Returned before settlement; you are not charged.
- HTTP 400 `invalid_creatinine`: creatinine_mg_dl (0.1-20) or creatinine_umol_l (9-1768) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_urine_output`: urine_output_ml_day must be a number from 0 to 20000 when provided. 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

- [qSOFA](https://magentlab.com/docs/qsofa) — Compute the Sepsis-3 qSOFA score from respiratory rate, caller-assigned altered mentation, and systolic blood pressure.

## Payment

Required query parameters must be present and valid. 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 EIP-3009 (scheme exact, assetTransferMethod eip3009) with validBefore = now + accepts[0].maxTimeoutSeconds (600 seconds). That window starts when you sign and must cover wallet confirmation plus CDP verify and settle. Magent retries transient facilitator 429/5xx before answering. Do not send upto or batch-settlement payloads; magent does not offer those schemes.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON echoing accepted, payload, and extensions when present).
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. Settlement happens before the tool runs. HTTP 503 settlement_uncertain or settle_failed: retry the same PAYMENT-SIGNATURE. Mint a new 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.

- 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.
- not offered `batch-settlement`: Not offered. Payment-channel vouchers claimed later in batches. Not the same as POST {items} bulk (that is still exact).

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for n times the GET unit. 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

- Invalid query parameters return HTTP 400 before settlement. You are not charged.
- Settlement finishes before the tool executes (paymentFlow upfront). 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.
