# Shapiro blood culture rule

Shapiro blood culture rule

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

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

## What it computes

Apply the Shapiro 2008 major/minor blood-culture prediction rule and return whether culture is indicated from caller-assigned findings and labs.

## When to use

When an agent has caller-assigned adult ED findings and labs and needs the Shapiro 2008 prediction rule for whether blood culture is indicated, not a culture order and not a sepsis diagnosis.

## When not to use

- Not a medical device. Not a diagnosis of bacteremia, sepsis, or endocarditis. magent does not examine the patient.
- magent does not draw blood cultures or order cultures. culture_indicated is the published 2008 rule only.
- Shapiro 2008 major/minor rule only (indicated if ≥1 major or ≥2 minor). Not a later point encoding of the same items.
- Temperature major (>39.5 °C) and minor (38.3–39.4 °C) are derived from one temperature_c; they cannot both be true. 39.5 °C is neither band.
- Age >65 is a minor; 65 is not. Hypotension is a caller-assigned flag for systolic blood pressure <90 mm Hg; magent does not take a blood pressure.
- The caller assigns every flag and lab. magent does not inspect catheters, diagnose endocarditis, or assay a CBC or creatinine.
- Published for adults ≥18 years undergoing ED blood-culture decisions. Not SIRS, not qSOFA, and not a sepsis protocol.

## Formula

```
culture indicated if ≥1 major (temperature_c > 39.5, catheter, suspected_endocarditis) or ≥2 minor (temperature_c 38.3–39.4, age > 65, chills, vomiting, hypotension, neutrophil_percent > 80, wbc_k > 18, bands_percent > 5, platelets_k < 150, creatinine_mg_dl > 2.0) (Shapiro 2008)
```

## Citation

[Who needs a blood culture? A prospectively derived and validated prediction rule](https://doi.org/10.1016/j.jemermed.2008.04.001)
Shapiro NI, Wolfe RE, Wright SB, Moore R, Bates DW
J Emerg Med. 2008;35(3):255-264
DOI: [10.1016/j.jemermed.2008.04.001](https://doi.org/10.1016/j.jemermed.2008.04.001)

## Worked example

### No major or minor criteria

Given: `age=40, bands_percent=2, catheter=false, chills=false, creatinine_mg_dl=1.0, hypotension=false, neutrophil_percent=70, platelets_k=250, suspected_endocarditis=false, temperature_c=37.0, vomiting=false, wbc_k=10`

1. Age 40 is not >65; temperature 37.0 °C is neither >39.5 nor 38.3–39.4
2. Catheter, endocarditis suspicion, chills, vomiting, and hypotension are false
3. Labs are outside every minor cutoff (0 major, 0 minor)
4. Culture is not indicated


### One major (indwelling catheter)

Given: `age=40, bands_percent=2, catheter=true, chills=false, creatinine_mg_dl=1.0, hypotension=false, neutrophil_percent=70, platelets_k=250, suspected_endocarditis=false, temperature_c=37.0, vomiting=false, wbc_k=10`

1. Indwelling vascular catheter is a major criterion
2. Culture is indicated (≥1 major)


### Two minors without a major

Given: `age=40, bands_percent=2, catheter=false, chills=true, creatinine_mg_dl=1.0, hypotension=false, neutrophil_percent=70, platelets_k=250, suspected_endocarditis=false, temperature_c=37.0, vomiting=true, wbc_k=10`

1. No major criterion
2. Chills and vomiting are two minor criteria
3. Culture is indicated (≥2 minor)


## Also searched as

- Shapiro blood culture rule
- Shapiro bacteremia rule
- who needs a blood culture
- blood culture prediction rule
- Shapiro 2008 criteria
- major minor blood culture criteria
- ED blood culture rule

## Parameters

- `age` (integer, required): Age in years (integer 18-120). Age >65 is a Shapiro 2008 minor criterion; 65 is not. The published rule is for adults ≥18 years.
- `temperature_c` (number, required): Temperature in °C (30.0-45.0). Major when >39.5 (39.5 is not). Minor when 38.3–39.4 inclusive. magent does not measure temperature.
- `catheter` (boolean, required): Indwelling vascular catheter (Shapiro 2008 major). true or false as assigned by the caller. magent does not inspect lines.
- `suspected_endocarditis` (boolean, required): Clinical suspicion of endocarditis (Shapiro 2008 major). true or false as assigned by the caller. magent does not diagnose endocarditis.
- `chills` (boolean, required): Chills (Shapiro 2008 minor). true or false as assigned by the caller. magent does not take a history.
- `vomiting` (boolean, required): Vomiting (Shapiro 2008 minor). true or false as assigned by the caller. magent does not observe vomiting.
- `hypotension` (boolean, required): Hypotension (Shapiro 2008 minor: systolic blood pressure < 90 mm Hg). true or false as assigned by the caller. magent does not measure blood pressure.
- `neutrophil_percent` (number, required): Neutrophil percent (0-100). Shapiro 2008 minor when >80 (80 does not). magent does not assay a CBC.
- `wbc_k` (number, required): White blood cell count in thousands (0-500; same as 10^3/µL). Shapiro 2008 minor when >18 (18 does not). magent does not assay a CBC.
- `bands_percent` (number, required): Band percent (0-100). Shapiro 2008 minor when >5 (5 does not). magent does not assay a CBC.
- `platelets_k` (number, required): Platelet count in thousands (0-2000; same as 10^3/µL). Shapiro 2008 minor when <150 (150 does not). magent does not assay a CBC.
- `creatinine_mg_dl` (number, required): Creatinine in mg/dL (0.1-20.0). Shapiro 2008 minor when >2.0 (2.0 does not). magent does not assay creatinine.

## 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/shapiro`
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": "40",
      "bands_percent": "2",
      "catheter": "false",
      "chills": "false",
      "creatinine_mg_dl": "1.0",
      "hypotension": "false",
      "neutrophil_percent": "70",
      "platelets_k": "250",
      "suspected_endocarditis": "false",
      "temperature_c": "37.0",
      "vomiting": "false",
      "wbc_k": "10"
    },
    {
      "age": "40",
      "bands_percent": "2",
      "catheter": "false",
      "chills": "false",
      "creatinine_mg_dl": "1.0",
      "hypotension": "false",
      "neutrophil_percent": "70",
      "platelets_k": "250",
      "suspected_endocarditis": "false",
      "temperature_c": "37.0",
      "vomiting": "false",
      "wbc_k": "10"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/shapiro",
  "items": [
    {
      "age": 40,
      "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": "Shapiro NI, Wolfe RE, Wright SB, Moore R, Bates DW",
        "doi": "10.1016/j.jemermed.2008.04.001",
        "id": "shapiro-2008",
        "pmid": "18486413",
        "source": "J Emerg Med. 2008;35(3):255-264",
        "title": "Who needs a blood culture? A prospectively derived and validated prediction rule"
      },
      "formula": "shapiro",
      "formula_expression": "culture indicated if ≥1 major (temperature_c > 39.5, catheter, suspected_endocarditis) or ≥2 minor (temperature_c 38.3–39.4, age > 65, chills, vomiting, hypotension, neutrophil_percent > 80, wbc_k > 18, bands_percent > 5, platelets_k < 150, creatinine_mg_dl > 2.0) (Shapiro 2008)",
      "temperature_c": 37.0,
      "criteria": [
        {
          "value": 37.0,
          "factor": "temperature_gt_39_5",
          "met": false
        },
        {
          "factor": "catheter",
          "met": false
        },
        {
          "factor": "suspected_endocarditis",
          "met": false
        },
        {
          "value": 37.0,
          "factor": "temperature_38_3_to_39_4",
          "met": false
        },
        {
          "value": 40,
          "factor": "age_gt_65",
          "met": false
        },
        {
          "factor": "chills",
          "met": false
        },
        {
          "factor": "vomiting",
          "met": false
        },
        {
          "factor": "hypotension",
          "met": false
        },
        {
          "value": 70.0,
          "factor": "neutrophil_gt_80",
          "met": false
        },
        {
          "value": 10.0,
          "factor": "wbc_gt_18k",
          "met": false
        },
        {
          "value": 2.0,
          "factor": "bands_gt_5",
          "met": false
        },
        {
          "value": 250.0,
          "factor": "platelets_lt_150k",
          "met": false
        },
        {
          "value": 1.0,
          "factor": "creatinine_gt_2",
          "met": false
        }
      ],
      "major_count": 0,
      "minor_count": 0,
      "culture_indicated": false
    },
    {
      "age": 40,
      "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": "Shapiro NI, Wolfe RE, Wright SB, Moore R, Bates DW",
        "doi": "10.1016/j.jemermed.2008.04.001",
        "id": "shapiro-2008",
        "pmid": "18486413",
        "source": "J Emerg Med. 2008;35(3):255-264",
        "title": "Who needs a blood culture? A prospectively derived and validated prediction rule"
      },
      "formula": "shapiro",
      "formula_expression": "culture indicated if ≥1 major (temperature_c > 39.5, catheter, suspected_endocarditis) or ≥2 minor (temperature_c 38.3–39.4, age > 65, chills, vomiting, hypotension, neutrophil_percent > 80, wbc_k > 18, bands_percent > 5, platelets_k < 150, creatinine_mg_dl > 2.0) (Shapiro 2008)",
      "temperature_c": 37.0,
      "criteria": [
        {
          "value": 37.0,
          "factor": "temperature_gt_39_5",
          "met": false
        },
        {
          "factor": "catheter",
          "met": false
        },
        {
          "factor": "suspected_endocarditis",
          "met": false
        },
        {
          "value": 37.0,
          "factor": "temperature_38_3_to_39_4",
          "met": false
        },
        {
          "value": 40,
          "factor": "age_gt_65",
          "met": false
        },
        {
          "factor": "chills",
          "met": false
        },
        {
          "factor": "vomiting",
          "met": false
        },
        {
          "factor": "hypotension",
          "met": false
        },
        {
          "value": 70.0,
          "factor": "neutrophil_gt_80",
          "met": false
        },
        {
          "value": 10.0,
          "factor": "wbc_gt_18k",
          "met": false
        },
        {
          "value": 2.0,
          "factor": "bands_gt_5",
          "met": false
        },
        {
          "value": 250.0,
          "factor": "platelets_lt_150k",
          "met": false
        },
        {
          "value": 1.0,
          "factor": "creatinine_gt_2",
          "met": false
        }
      ],
      "major_count": 0,
      "minor_count": 0,
      "culture_indicated": false
    }
  ]
}
```

## Response fields

- `formula` (string): shapiro
- `formula_expression` (string): Shapiro 2008 rule: culture if ≥1 major or ≥2 minor
- `culture_indicated` (boolean): true when ≥1 major criterion or ≥2 minor criteria are met (Shapiro 2008). Not a diagnosis and not a culture order.
- `major_count` (integer): Count of major criteria met (0-3)
- `minor_count` (integer): Count of minor criteria met (0-10)
- `age` (integer): Age used for the age >65 minor criterion
- `temperature_c` (number): Temperature in °C used for the >39.5 major and 38.3–39.4 minor bands
- `criteria` (array): Per-factor rows with factor and met; temperature, age, and lab rows include value
- `citation` (object): Shapiro 2008 J Emerg Med citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "age": 40,
  "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": "Shapiro NI, Wolfe RE, Wright SB, Moore R, Bates DW",
    "doi": "10.1016/j.jemermed.2008.04.001",
    "id": "shapiro-2008",
    "pmid": "18486413",
    "source": "J Emerg Med. 2008;35(3):255-264",
    "title": "Who needs a blood culture? A prospectively derived and validated prediction rule"
  },
  "formula": "shapiro",
  "formula_expression": "culture indicated if ≥1 major (temperature_c > 39.5, catheter, suspected_endocarditis) or ≥2 minor (temperature_c 38.3–39.4, age > 65, chills, vomiting, hypotension, neutrophil_percent > 80, wbc_k > 18, bands_percent > 5, platelets_k < 150, creatinine_mg_dl > 2.0) (Shapiro 2008)",
  "temperature_c": 37.0,
  "criteria": [
    {
      "value": 37.0,
      "factor": "temperature_gt_39_5",
      "met": false
    },
    {
      "factor": "catheter",
      "met": false
    },
    {
      "factor": "suspected_endocarditis",
      "met": false
    },
    {
      "value": 37.0,
      "factor": "temperature_38_3_to_39_4",
      "met": false
    },
    {
      "value": 40,
      "factor": "age_gt_65",
      "met": false
    },
    {
      "factor": "chills",
      "met": false
    },
    {
      "factor": "vomiting",
      "met": false
    },
    {
      "factor": "hypotension",
      "met": false
    },
    {
      "value": 70.0,
      "factor": "neutrophil_gt_80",
      "met": false
    },
    {
      "value": 10.0,
      "factor": "wbc_gt_18k",
      "met": false
    },
    {
      "value": 2.0,
      "factor": "bands_gt_5",
      "met": false
    },
    {
      "value": 250.0,
      "factor": "platelets_lt_150k",
      "met": false
    },
    {
      "value": 1.0,
      "factor": "creatinine_gt_2",
      "met": false
    }
  ],
  "major_count": 0,
  "minor_count": 0,
  "culture_indicated": false
}
```

## Errors

- HTTP 400 `invalid_shapiro`: Shapiro-rule inputs must be the 2008 major and minor bacteremia criteria (temperature, catheter, endocarditis suspicion, age, chills, vomiting, hypotension, and listed labs). 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

- [SIRS](https://magentlab.com/docs/sirs) — Compute the Bone 1992 ACCP/SCCM SIRS criteria from temperature, heart rate, respiratory rate, and WBC, with optional PaCO2 and band percent.
- [qSOFA](https://magentlab.com/docs/qsofa) — Compute the Sepsis-3 qSOFA score from respiratory rate, caller-assigned altered mentation, and systolic blood pressure.

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