# Surgical Apgar score (Gawande)

Surgical Apgar

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

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

## What it computes

Compute the Gawande 2007 intraoperative Surgical Apgar score from estimated blood loss, lowest mean arterial pressure, and lowest heart rate.

## When to use

When an agent needs the published intraoperative Surgical Apgar total and must not substitute Virginia Apgar or treat the score as operative clearance.

## When not to use

- Not a medical device and not an operative-clearance, cancellation, or monitoring order. magent does not observe the operation.
- This is the Gawande 2007 intraoperative Surgical Apgar (Table 1) only. It is not the Virginia Apgar newborn score.
- Estimated blood loss, lowest MAP, and lowest heart rate are caller-supplied intraoperative values. magent does not read an anesthesia record.
- score_le_4 follows the validation-cohort association of scores ≤4 with 58.6% 30-day death or major complication (9–10 with 3.6%). It is not an operative-clearance decision.

## Formula

```
Surgical Apgar = ebl_points + lowest_map_points + lowest_hr_points; Gawande 2007 Table 1; max 10
```

## Citation

[An Apgar score for surgery](https://doi.org/10.1016/j.jamcollsurg.2006.11.011)
Gawande AA, Kwaan MR, Regenbogen SE, Lipsitz SA, Zinner MJ
J Am Coll Surg. 2007;204(2):201-208
DOI: [10.1016/j.jamcollsurg.2006.11.011](https://doi.org/10.1016/j.jamcollsurg.2006.11.011)

## Worked example

### EBL 50 mL, lowest MAP 80, lowest HR 60

Given: `ebl_ml=50, lowest_heart_rate_bpm=60, lowest_map_mm_hg=80`

1. EBL 50 → 3; lowest MAP 80 → 3; lowest HR 60 → 3
2. Score = 9 (max 10); score_le_4 = false


### EBL 1500 mL, lowest MAP 35, lowest HR 90

Given: `ebl_ml=1500, lowest_heart_rate_bpm=90, lowest_map_mm_hg=35`

1. EBL 1500 → 0; lowest MAP 35 → 0; lowest HR 90 → 0
2. Score = 0 (max 10); score_le_4 = true


## Also searched as

- surgical apgar
- gawande
- intraoperative
- surgical apgar score
- Gawande Apgar
- intraoperative apgar
- SAS surgery

## Parameters

- `ebl_ml` (number, required): Estimated intraoperative blood loss in mL (0.0-20000.0). Gawande 2007 Table 1: >1000 → 0, 601-1000 → 1, 101-600 → 2, ≤100 → 3.
- `lowest_map_mm_hg` (number, required): Lowest intraoperative mean arterial pressure in mm Hg (30.0-180.0). Gawande 2007 Table 1: <40 → 0, 40-54 → 1, 55-69 → 2, ≥70 → 3.
- `lowest_heart_rate_bpm` (integer, required): Lowest intraoperative heart rate in beats/min (integer 30-220). Gawande 2007 Table 1: >85 → 0, 76-85 → 1, 66-75 → 2, 56-65 → 3, ≤55 → 4.

## 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/surgical_apgar`
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": [
    {
      "ebl_ml": "50",
      "lowest_heart_rate_bpm": "60",
      "lowest_map_mm_hg": "80"
    },
    {
      "ebl_ml": "50",
      "lowest_heart_rate_bpm": "60",
      "lowest_map_mm_hg": "80"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/surgical_apgar",
  "items": [
    {
      "components": [
        {
          "value": 50.0,
          "factor": "ebl_ml",
          "points": 3,
          "present": true
        },
        {
          "value": 80.0,
          "factor": "lowest_map_mm_hg",
          "points": 3,
          "present": true
        },
        {
          "value": 60,
          "factor": "lowest_heart_rate_bpm",
          "points": 3,
          "present": true
        }
      ],
      "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": "Gawande AA, Kwaan MR, Regenbogen SE, Lipsitz SA, Zinner MJ",
        "doi": "10.1016/j.jamcollsurg.2006.11.011",
        "id": "gawande-2007",
        "pmid": "17254927",
        "source": "J Am Coll Surg. 2007;204(2):201-208",
        "title": "An Apgar score for surgery"
      },
      "formula": "surgical_apgar",
      "formula_expression": "Surgical Apgar = ebl_points + lowest_map_points + lowest_hr_points; Gawande 2007 Table 1; max 10",
      "max_score": 10,
      "score": 9,
      "ebl_ml": 50.0,
      "lowest_heart_rate_bpm": 60,
      "lowest_map_mm_hg": 80.0,
      "score_le_4": false
    },
    {
      "components": [
        {
          "value": 50.0,
          "factor": "ebl_ml",
          "points": 3,
          "present": true
        },
        {
          "value": 80.0,
          "factor": "lowest_map_mm_hg",
          "points": 3,
          "present": true
        },
        {
          "value": 60,
          "factor": "lowest_heart_rate_bpm",
          "points": 3,
          "present": true
        }
      ],
      "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": "Gawande AA, Kwaan MR, Regenbogen SE, Lipsitz SA, Zinner MJ",
        "doi": "10.1016/j.jamcollsurg.2006.11.011",
        "id": "gawande-2007",
        "pmid": "17254927",
        "source": "J Am Coll Surg. 2007;204(2):201-208",
        "title": "An Apgar score for surgery"
      },
      "formula": "surgical_apgar",
      "formula_expression": "Surgical Apgar = ebl_points + lowest_map_points + lowest_hr_points; Gawande 2007 Table 1; max 10",
      "max_score": 10,
      "score": 9,
      "ebl_ml": 50.0,
      "lowest_heart_rate_bpm": 60,
      "lowest_map_mm_hg": 80.0,
      "score_le_4": false
    }
  ]
}
```

## Response fields

- `formula` (string): surgical_apgar
- `formula_expression` (string): Exact expression used
- `score` (integer): Surgical Apgar points 0-10
- `max_score` (integer): Always 10
- `score_le_4` (boolean): true when score is ≤4. Gawande 2007 validation cohort associated scores ≤4 with 58.6% 30-day death or major complication, and scores 9-10 with 3.6%. Not an operative-clearance decision.
- `ebl_ml` (number): Estimated blood loss used, mL
- `lowest_map_mm_hg` (number): Lowest intraoperative MAP used, mm Hg
- `lowest_heart_rate_bpm` (integer): Lowest intraoperative heart rate used, bpm
- `components` (array): Per-factor points
- `citation` (object): Gawande 2007 J Am Coll Surg citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 50.0,
      "factor": "ebl_ml",
      "points": 3,
      "present": true
    },
    {
      "value": 80.0,
      "factor": "lowest_map_mm_hg",
      "points": 3,
      "present": true
    },
    {
      "value": 60,
      "factor": "lowest_heart_rate_bpm",
      "points": 3,
      "present": true
    }
  ],
  "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": "Gawande AA, Kwaan MR, Regenbogen SE, Lipsitz SA, Zinner MJ",
    "doi": "10.1016/j.jamcollsurg.2006.11.011",
    "id": "gawande-2007",
    "pmid": "17254927",
    "source": "J Am Coll Surg. 2007;204(2):201-208",
    "title": "An Apgar score for surgery"
  },
  "formula": "surgical_apgar",
  "formula_expression": "Surgical Apgar = ebl_points + lowest_map_points + lowest_hr_points; Gawande 2007 Table 1; max 10",
  "max_score": 10,
  "score": 9,
  "ebl_ml": 50.0,
  "lowest_heart_rate_bpm": 60,
  "lowest_map_mm_hg": 80.0,
  "score_le_4": false
}
```

## Errors

- HTTP 400 `invalid_ebl_ml`: ebl_ml must be a number from 0 to 20000. 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_heart_rate`: heart_rate_bpm must be an integer from 30 to 220 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

- [Apgar score](https://magentlab.com/docs/apgar) — Compute the Apgar newborn evaluation score as the sum of five caller-assigned 0-2 signs.
- [RCRI](https://magentlab.com/docs/rcri) — Sum the six Lee 1999 revised cardiac risk index factors and return class I–IV.
- [MAP](https://magentlab.com/docs/map) — Compute conventional estimated mean arterial pressure from cuff systolic and diastolic pressures.

## 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 echoing accepted, payload, and extensions when present).
- 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.
