# Berlin Definition of ARDS

Berlin Definition of ARDS

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

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

## What it computes

Apply the 2012 Berlin Definition of ARDS and return whether the clinical box holds, severity (none, mild, moderate, or severe), and berlin_ards.

## When to use

When an agent already has the five caller-assigned Berlin flags and a PaO2/FiO2 ratio and needs the published severity. magent does not read radiographs or echo.

## When not to use

- Not a medical device.
- Not a diagnosis. magent does not diagnose ARDS or set ventilator mode.
- The caller assigns timing, imaging, origin, PEEP, and CPAP. magent does not read radiographs or echocardiography.
- pf_ratio is the caller-supplied PaO2/FiO2 in mm Hg (20-800). magent does not recompute it from PaO2 and FiO2.
- Mild allows PEEP or CPAP ≥5 cm H2O; moderate and severe require PEEP ≥5. CPAP alone with PF ≤200 is not Berlin ARDS.
- This is the 2012 Berlin Definition (Ranieri et al.). Not the 1994 AECC definition, not Kigali (SpO2/FiO2), and not the oxygenation index.

## Formula

```
clinical_box iff onset_within_1_week and bilateral_opacities_not_fully_explained and origin_not_fully_hf_or_fluid; severe iff clinical_box and pf_ratio <= 100 and peep_ge_5; moderate iff clinical_box and 100 < pf_ratio <= 200 and peep_ge_5; mild iff clinical_box and 200 < pf_ratio <= 300 and (peep_ge_5 or cpap_ge_5); berlin_ards iff severity is mild, moderate, or severe; else none (Ranieri 2012 Berlin Definition)
```

## Citation

[Acute respiratory distress syndrome: the Berlin Definition](https://doi.org/10.1001/jama.2012.5669)
The ARDS Definition Task Force; Ranieri VM, Rubenfeld GD, Thompson BT, Ferguson ND, Caldwell E, Fan E, Camporota L, Slutsky AS
JAMA. 2012;307(23):2526-2533
DOI: [10.1001/jama.2012.5669](https://doi.org/10.1001/jama.2012.5669)

## Worked example

### Clinical box, PEEP ≥5, PaO2/FiO2 90

Given: `bilateral_opacities_not_fully_explained=true, cpap_ge_5=false, onset_within_1_week=true, origin_not_fully_hf_or_fluid=true, peep_ge_5=true, pf_ratio=90`

1. Onset within 1 week, bilateral opacities not fully explained, and origin not fully cardiac failure or fluid overload are all true (clinical box)
2. PEEP ≥5 is true; CPAP ≥5 is false
3. pf_ratio 90 ≤ 100 with PEEP → severity severe
4. berlin_ards is true


### Clinical box with CPAP only and PaO2/FiO2 150

Given: `bilateral_opacities_not_fully_explained=true, cpap_ge_5=true, onset_within_1_week=true, origin_not_fully_hf_or_fluid=true, peep_ge_5=false, pf_ratio=150`

1. Clinical box holds
2. PF 150 is in the moderate band, but moderate requires PEEP ≥5
3. CPAP without PEEP when PF ≤200 is severity none
4. berlin_ards is false


## Also searched as

- Berlin Definition ARDS
- Berlin ARDS criteria
- Ranieri 2012 ARDS
- PaO2/FiO2 ARDS severity
- ARDS mild moderate severe
- PEEP CPAP hypoxemia ARDS
- Berlin consensus ARDS 2012
- acute respiratory distress syndrome Berlin

## Parameters

- `onset_within_1_week` (boolean, required): Onset within 1 week of a known clinical insult or new or worsening respiratory symptoms (Ranieri 2012). true or false as assigned by the caller. magent does not take a history.
- `bilateral_opacities_not_fully_explained` (boolean, required): Bilateral opacities not fully explained by effusions, lobar/lung collapse, or nodules (Ranieri 2012). true or false as assigned by the caller. magent does not read radiographs.
- `origin_not_fully_hf_or_fluid` (boolean, required): Respiratory failure not fully explained by cardiac failure or fluid overload (Ranieri 2012). true or false as assigned by the caller. magent does not read echocardiography.
- `peep_ge_5` (boolean, required): PEEP >= 5 cm H2O as assigned by the caller (required for moderate and severe; either PEEP or CPAP for mild). magent does not set ventilator mode.
- `cpap_ge_5` (boolean, required): CPAP >= 5 cm H2O as assigned by the caller (counts for mild only; CPAP without PEEP is not moderate or severe). magent does not set ventilator mode.
- `pf_ratio` (number, required): PaO2/FiO2 ratio in mm Hg (20-800). Caller-supplied; magent does not recompute from PaO2 and FiO2.

## 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/berlin_ards`
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": [
    {
      "bilateral_opacities_not_fully_explained": "true",
      "cpap_ge_5": "false",
      "onset_within_1_week": "true",
      "origin_not_fully_hf_or_fluid": "true",
      "peep_ge_5": "true",
      "pf_ratio": "90"
    },
    {
      "bilateral_opacities_not_fully_explained": "true",
      "cpap_ge_5": "false",
      "onset_within_1_week": "true",
      "origin_not_fully_hf_or_fluid": "true",
      "peep_ge_5": "true",
      "pf_ratio": "90"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/berlin_ards",
  "items": [
    {
      "severity": "severe",
      "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": "The ARDS Definition Task Force; Ranieri VM, Rubenfeld GD, Thompson BT, Ferguson ND, Caldwell E, Fan E, Camporota L, Slutsky AS",
        "doi": "10.1001/jama.2012.5669",
        "id": "ranieri-2012",
        "pmid": "22797452",
        "source": "JAMA. 2012;307(23):2526-2533",
        "title": "Acute respiratory distress syndrome: the Berlin Definition"
      },
      "formula": "berlin_ards",
      "formula_expression": "clinical_box iff onset_within_1_week and bilateral_opacities_not_fully_explained and origin_not_fully_hf_or_fluid; severe iff clinical_box and pf_ratio <= 100 and peep_ge_5; moderate iff clinical_box and 100 < pf_ratio <= 200 and peep_ge_5; mild iff clinical_box and 200 < pf_ratio <= 300 and (peep_ge_5 or cpap_ge_5); berlin_ards iff severity is mild, moderate, or severe; else none (Ranieri 2012 Berlin Definition)",
      "criteria": [
        {
          "factor": "onset_within_1_week",
          "met": true
        },
        {
          "factor": "bilateral_opacities_not_fully_explained",
          "met": true
        },
        {
          "factor": "origin_not_fully_hf_or_fluid",
          "met": true
        },
        {
          "factor": "clinical_box",
          "met": true
        },
        {
          "factor": "peep_ge_5",
          "met": true
        },
        {
          "factor": "cpap_ge_5",
          "met": false
        },
        {
          "value": 90.0,
          "factor": "severe",
          "met": true
        },
        {
          "value": 90.0,
          "factor": "moderate",
          "met": false
        },
        {
          "value": 90.0,
          "factor": "mild",
          "met": false
        }
      ],
      "berlin_ards": true,
      "clinical_box": true,
      "pf_ratio": 90.0
    },
    {
      "severity": "severe",
      "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": "The ARDS Definition Task Force; Ranieri VM, Rubenfeld GD, Thompson BT, Ferguson ND, Caldwell E, Fan E, Camporota L, Slutsky AS",
        "doi": "10.1001/jama.2012.5669",
        "id": "ranieri-2012",
        "pmid": "22797452",
        "source": "JAMA. 2012;307(23):2526-2533",
        "title": "Acute respiratory distress syndrome: the Berlin Definition"
      },
      "formula": "berlin_ards",
      "formula_expression": "clinical_box iff onset_within_1_week and bilateral_opacities_not_fully_explained and origin_not_fully_hf_or_fluid; severe iff clinical_box and pf_ratio <= 100 and peep_ge_5; moderate iff clinical_box and 100 < pf_ratio <= 200 and peep_ge_5; mild iff clinical_box and 200 < pf_ratio <= 300 and (peep_ge_5 or cpap_ge_5); berlin_ards iff severity is mild, moderate, or severe; else none (Ranieri 2012 Berlin Definition)",
      "criteria": [
        {
          "factor": "onset_within_1_week",
          "met": true
        },
        {
          "factor": "bilateral_opacities_not_fully_explained",
          "met": true
        },
        {
          "factor": "origin_not_fully_hf_or_fluid",
          "met": true
        },
        {
          "factor": "clinical_box",
          "met": true
        },
        {
          "factor": "peep_ge_5",
          "met": true
        },
        {
          "factor": "cpap_ge_5",
          "met": false
        },
        {
          "value": 90.0,
          "factor": "severe",
          "met": true
        },
        {
          "value": 90.0,
          "factor": "moderate",
          "met": false
        },
        {
          "value": 90.0,
          "factor": "mild",
          "met": false
        }
      ],
      "berlin_ards": true,
      "clinical_box": true,
      "pf_ratio": 90.0
    }
  ]
}
```

## Response fields

- `formula` (string): berlin_ards
- `formula_expression` (string): Ranieri 2012 Berlin Definition clinical box and PaO2/FiO2 severity rule
- `pf_ratio` (number): Caller-supplied PaO2/FiO2 in mm Hg used for severity
- `clinical_box` (boolean): true when onset within 1 week, bilateral opacities not fully explained, and origin not fully cardiac failure or fluid overload all hold
- `severity` (string): none, mild, moderate, or severe. Mutually exclusive. Not a diagnosis.
- `berlin_ards` (boolean): true when severity is mild, moderate, or severe. Not a diagnosis.
- `criteria` (array): Per-factor rows with factor and met; severe, moderate, and mild rows include pf_ratio as value
- `citation` (object): Ranieri 2012 JAMA Berlin Definition citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "severity": "severe",
  "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": "The ARDS Definition Task Force; Ranieri VM, Rubenfeld GD, Thompson BT, Ferguson ND, Caldwell E, Fan E, Camporota L, Slutsky AS",
    "doi": "10.1001/jama.2012.5669",
    "id": "ranieri-2012",
    "pmid": "22797452",
    "source": "JAMA. 2012;307(23):2526-2533",
    "title": "Acute respiratory distress syndrome: the Berlin Definition"
  },
  "formula": "berlin_ards",
  "formula_expression": "clinical_box iff onset_within_1_week and bilateral_opacities_not_fully_explained and origin_not_fully_hf_or_fluid; severe iff clinical_box and pf_ratio <= 100 and peep_ge_5; moderate iff clinical_box and 100 < pf_ratio <= 200 and peep_ge_5; mild iff clinical_box and 200 < pf_ratio <= 300 and (peep_ge_5 or cpap_ge_5); berlin_ards iff severity is mild, moderate, or severe; else none (Ranieri 2012 Berlin Definition)",
  "criteria": [
    {
      "factor": "onset_within_1_week",
      "met": true
    },
    {
      "factor": "bilateral_opacities_not_fully_explained",
      "met": true
    },
    {
      "factor": "origin_not_fully_hf_or_fluid",
      "met": true
    },
    {
      "factor": "clinical_box",
      "met": true
    },
    {
      "factor": "peep_ge_5",
      "met": true
    },
    {
      "factor": "cpap_ge_5",
      "met": false
    },
    {
      "value": 90.0,
      "factor": "severe",
      "met": true
    },
    {
      "value": 90.0,
      "factor": "moderate",
      "met": false
    },
    {
      "value": 90.0,
      "factor": "mild",
      "met": false
    }
  ],
  "berlin_ards": true,
  "clinical_box": true,
  "pf_ratio": 90.0
}
```

## Errors

- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_pf_ratio`: pf_ratio must be a number from 20 to 800. 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

- [PaO2/FiO2 ratio](https://magentlab.com/docs/pf-ratio) — Compute the PaO2/FiO2 ratio as arterial PO2 in mm Hg divided by inspired oxygen fraction.
- [Murray lung injury score](https://magentlab.com/docs/murray) — Mean the four Murray 1988 lung injury score components (chest radiograph quadrants, PaO2/FiO2, PEEP, and compliance), each 0–4, and return LIS and injury_band.

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