# SCAP (España 2006)

SCAP

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

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

## What it computes

Apply the España 2006 SCAP major/minor rule from eight caller-assigned flags and return major_count, minor_count, score, and whether the published severe threshold is met.

## When to use

When an agent already has the published España 2006 predictors assigned as flags and needs the 1-major or ≥2-minor severe rule. magent does not measure pH, blood pressure, respiratory rate, BUN, or PaO2, and does not read radiographs.

## When not to use

- Not a medical device and not a diagnosis of pneumonia.
- Not an ICU-admission, site-of-care, or treatment order.
- España 2006 major/minor rule only. Not CURB-65, not PSI/PORT, and not SMART-COP.
- The caller assigns every flag. magent does not measure pH, blood pressure, respiratory rate, BUN, or PaO2, and does not interpret radiographs.
- hypoxemia is caller-assigned as PaO2 <54 mm Hg or PaO2/FiO2 <250. magent does not combine those measurements.
- Each true predictor scores 1 (max 8). This is the published 1-major or ≥2-minor rule, not secondary 13/11/9/6/5 integer cards or 0–9 / 10–19 / ≥20 classes.

## Formula

```
SCAP severe iff 1 major (ph_lt_7_30 or sbp_lt_90) OR >=2 minor (respiratory_rate_gt_30, altered_mental_status, bun_gt_30_mg_dl, hypoxemia, age_ge_80, multilobar_or_bilateral); 1 point per true predictor (España 2006 major/minor rule; not beta-derived integer cards); max 8
```

## Citation

[Development and validation of a clinical prediction rule for severe community-acquired pneumonia](https://doi.org/10.1164/rccm.200602-177OC)
España PP, Capelastegui A, Gorordo I, Esteban C, Oribe M, Ortega M, Bilbao A, Quintana JM
Am J Respir Crit Care Med. 2006;174(11):1249-1256
DOI: [10.1164/rccm.200602-177OC](https://doi.org/10.1164/rccm.200602-177OC)

## Worked example

### All eight flags absent

Given: `age_ge_80=false, altered_mental_status=false, bun_gt_30_mg_dl=false, hypoxemia=false, multilobar_or_bilateral=false, ph_lt_7_30=false, respiratory_rate_gt_30=false, sbp_lt_90=false`

1. Both major flags are false → major_count = 0
2. All six minor flags are false → minor_count = 0
3. score = 0; scap_severe is false (needs 1 major or ≥2 minor)


## Also searched as

- SCAP
- España 2006 SCAP
- severe community-acquired pneumonia
- SCAP rule
- CURXO80
- España severe CAP
- SCAP major minor criteria

## Parameters

- `ph_lt_7_30` (boolean, required): Arterial pH <7.30 (España 2006 major). true or false as assigned by the caller. magent does not measure pH.
- `sbp_lt_90` (boolean, required): Systolic blood pressure <90 mm Hg (España 2006 major). true or false as assigned by the caller. magent does not measure blood pressure.
- `respiratory_rate_gt_30` (boolean, required): Respiratory rate >30 breaths/min (España 2006 minor; strict greater-than, not ≥30). true or false as assigned by the caller. magent does not measure respiratory rate.
- `altered_mental_status` (boolean, required): Altered mental status (España 2006 minor). true or false as assigned by the caller. magent does not assess mental status.
- `bun_gt_30_mg_dl` (boolean, required): Blood urea nitrogen >30 mg/dL (España 2006 minor). true or false as assigned by the caller. magent does not convert urea or measure BUN.
- `hypoxemia` (boolean, required): Hypoxemia as PaO2 <54 mm Hg or PaO2/FiO2 <250 (España 2006 minor), as assigned by the caller. true or false. magent does not measure PaO2 or FiO2.
- `age_ge_80` (boolean, required): Age ≥80 years (España 2006 minor). true or false as assigned by the caller. magent does not compute age.
- `multilobar_or_bilateral` (boolean, required): Multilobar or bilateral lung involvement (España 2006 minor). true or false as assigned by the caller. magent does not interpret radiographs.

## 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/scap`
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_ge_80": "false",
      "altered_mental_status": "false",
      "bun_gt_30_mg_dl": "false",
      "hypoxemia": "false",
      "multilobar_or_bilateral": "false",
      "ph_lt_7_30": "false",
      "respiratory_rate_gt_30": "false",
      "sbp_lt_90": "false"
    },
    {
      "age_ge_80": "false",
      "altered_mental_status": "false",
      "bun_gt_30_mg_dl": "false",
      "hypoxemia": "false",
      "multilobar_or_bilateral": "false",
      "ph_lt_7_30": "false",
      "respiratory_rate_gt_30": "false",
      "sbp_lt_90": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/scap",
  "items": [
    {
      "components": [
        {
          "factor": "ph_lt_7_30",
          "points": 0,
          "present": false
        },
        {
          "factor": "sbp_lt_90",
          "points": 0,
          "present": false
        },
        {
          "factor": "respiratory_rate_gt_30",
          "points": 0,
          "present": false
        },
        {
          "factor": "altered_mental_status",
          "points": 0,
          "present": false
        },
        {
          "factor": "bun_gt_30_mg_dl",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypoxemia",
          "points": 0,
          "present": false
        },
        {
          "factor": "age_ge_80",
          "points": 0,
          "present": false
        },
        {
          "factor": "multilobar_or_bilateral",
          "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": "España PP, Capelastegui A, Gorordo I, Esteban C, Oribe M, Ortega M, Bilbao A, Quintana JM",
        "doi": "10.1164/rccm.200602-177OC",
        "id": "espana-2006",
        "pmid": "16973986",
        "source": "Am J Respir Crit Care Med. 2006;174(11):1249-1256",
        "title": "Development and validation of a clinical prediction rule for severe community-acquired pneumonia"
      },
      "formula": "scap",
      "formula_expression": "SCAP severe iff 1 major (ph_lt_7_30 or sbp_lt_90) OR >=2 minor (respiratory_rate_gt_30, altered_mental_status, bun_gt_30_mg_dl, hypoxemia, age_ge_80, multilobar_or_bilateral); 1 point per true predictor (España 2006 major/minor rule; not beta-derived integer cards); max 8",
      "max_score": 8,
      "score": 0,
      "major_count": 0,
      "minor_count": 0,
      "scap_severe": false
    },
    {
      "components": [
        {
          "factor": "ph_lt_7_30",
          "points": 0,
          "present": false
        },
        {
          "factor": "sbp_lt_90",
          "points": 0,
          "present": false
        },
        {
          "factor": "respiratory_rate_gt_30",
          "points": 0,
          "present": false
        },
        {
          "factor": "altered_mental_status",
          "points": 0,
          "present": false
        },
        {
          "factor": "bun_gt_30_mg_dl",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypoxemia",
          "points": 0,
          "present": false
        },
        {
          "factor": "age_ge_80",
          "points": 0,
          "present": false
        },
        {
          "factor": "multilobar_or_bilateral",
          "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": "España PP, Capelastegui A, Gorordo I, Esteban C, Oribe M, Ortega M, Bilbao A, Quintana JM",
        "doi": "10.1164/rccm.200602-177OC",
        "id": "espana-2006",
        "pmid": "16973986",
        "source": "Am J Respir Crit Care Med. 2006;174(11):1249-1256",
        "title": "Development and validation of a clinical prediction rule for severe community-acquired pneumonia"
      },
      "formula": "scap",
      "formula_expression": "SCAP severe iff 1 major (ph_lt_7_30 or sbp_lt_90) OR >=2 minor (respiratory_rate_gt_30, altered_mental_status, bun_gt_30_mg_dl, hypoxemia, age_ge_80, multilobar_or_bilateral); 1 point per true predictor (España 2006 major/minor rule; not beta-derived integer cards); max 8",
      "max_score": 8,
      "score": 0,
      "major_count": 0,
      "minor_count": 0,
      "scap_severe": false
    }
  ]
}
```

## Response fields

- `formula` (string): scap
- `formula_expression` (string): España 2006 1-major or ≥2-minor rule with 1 point per true predictor
- `score` (integer): Count of true predictors (0-8). Not a 13/11/9/6/5 weighted card.
- `max_score` (integer): Always 8
- `major_count` (integer): Count of true major flags: ph_lt_7_30 and sbp_lt_90 (0-2)
- `minor_count` (integer): Count of true minor flags: respiratory_rate_gt_30, altered_mental_status, bun_gt_30_mg_dl, hypoxemia, age_ge_80, multilobar_or_bilateral (0-6)
- `scap_severe` (boolean): true when major_count ≥1 or minor_count ≥2 (España 2006). Not a pneumonia diagnosis and not an ICU-admission order.
- `components` (array): Per-predictor points (1 if true, else 0)
- `citation` (object): España 2006 AJRCCM citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "ph_lt_7_30",
      "points": 0,
      "present": false
    },
    {
      "factor": "sbp_lt_90",
      "points": 0,
      "present": false
    },
    {
      "factor": "respiratory_rate_gt_30",
      "points": 0,
      "present": false
    },
    {
      "factor": "altered_mental_status",
      "points": 0,
      "present": false
    },
    {
      "factor": "bun_gt_30_mg_dl",
      "points": 0,
      "present": false
    },
    {
      "factor": "hypoxemia",
      "points": 0,
      "present": false
    },
    {
      "factor": "age_ge_80",
      "points": 0,
      "present": false
    },
    {
      "factor": "multilobar_or_bilateral",
      "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": "España PP, Capelastegui A, Gorordo I, Esteban C, Oribe M, Ortega M, Bilbao A, Quintana JM",
    "doi": "10.1164/rccm.200602-177OC",
    "id": "espana-2006",
    "pmid": "16973986",
    "source": "Am J Respir Crit Care Med. 2006;174(11):1249-1256",
    "title": "Development and validation of a clinical prediction rule for severe community-acquired pneumonia"
  },
  "formula": "scap",
  "formula_expression": "SCAP severe iff 1 major (ph_lt_7_30 or sbp_lt_90) OR >=2 minor (respiratory_rate_gt_30, altered_mental_status, bun_gt_30_mg_dl, hypoxemia, age_ge_80, multilobar_or_bilateral); 1 point per true predictor (España 2006 major/minor rule; not beta-derived integer cards); max 8",
  "max_score": 8,
  "score": 0,
  "major_count": 0,
  "minor_count": 0,
  "scap_severe": false
}
```

## Errors

- 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

- [CURB-65](https://magentlab.com/docs/curb65) — Compute the CURB-65 community-acquired pneumonia severity score from age and discrete flags.
- [PSI / PORT](https://magentlab.com/docs/psi-port) — Compute the Fine 1997 Pneumonia Severity Index (PORT) two-step risk class and Table 2 point total for community-acquired pneumonia.

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