# Sickle RBC exchange

Sickle RBC exchange

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/sickle_rbc_exchange`
HTML: https://magentlab.com/docs/sickle-rbc-exchange
Markdown: https://magentlab.com/docs/sickle-rbc-exchange.md

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

## What it computes

Compute replacement packed-RBC volume for sickle red-cell exchange from Nadler 1962 adult blood volume and exponential remaining-fraction washout Y/Y0 = e^(−X), with caller-supplied hematocrits and HbS percents.

## When to use

When an agent needs published Nadler TBV plus remaining-fraction washout and must not invent a replacement volume, force a 30% HbS target, or write an apheresis order.

## When not to use

- Not a medical device. magent does not write an apheresis prescription, choose a machine protocol, or run vendor FCR or end-hematocrit software.
- AABB 2018 usual acute-exchange language is HbS not more than 30% and avoiding hyperviscosity. That is not a forced target; the caller sends target_hbs_percent.
- Adult Nadler 1962 blood volume only (male and female equations; H meters, W kg). Not a 70 mL/kg rule. Exponential remaining-fraction washout only; not a linear (1 − FCR) volume.
- Replacement hematocrit is caller-supplied (typical additive units about 60 percent). magent does not assay the unit or choose a product.

## Formula

```
TBV_L male = 0.3669 * H^3 + 0.03219 * W + 0.6041; female = 0.3561 * H^3 + 0.03308 * W + 0.1833 (H meters, W kg). patient_rbc_volume_ml = TBV_mL * hematocrit_percent/100. FCR = target_hbs_percent/initial_hbs_percent. X = -ln(FCR). replacement_prbc_ml = patient_rbc_volume_ml * X / (replacement_hct_percent/100)
```

## Citation

[Prediction of blood volume in normal human adults](https://pubmed.ncbi.nlm.nih.gov/21936146)
Nadler SB, Hidalgo JH, Bloch T
Surgery. 1962;51(2):224-232
DOI: none

## Worked example

### Male 170 cm, 70 kg, Hct 30, HbS 90 to 30, replacement Hct 60

Given: `height_cm=170, hematocrit_percent=30, initial_hbs_percent=90, replacement_hct_percent=60, sex=male, target_hbs_percent=30, weight_kg=70`

1. H = 170 / 100 = 1.7 m; H^3 = 4.913
2. TBV_L = 0.3669 * 4.913 + 0.03219 * 70 + 0.6041 = 4.660 L; blood_volume_ml = 4660
3. patient_rbc_volume_ml = 4660 * 30 / 100 = 1398
4. FCR = 30 / 90 = 1/3
5. X = -ln(1/3) = ln(3) ≈ 1.0986
6. replacement_prbc_ml = 1398 * ln(3) / 0.60 ≈ 2559.8


## Also searched as

- sickle cell RBC exchange
- red cell exchange volume
- HbS washout
- Nadler RBC exchange
- sickle cell exchange transfusion
- remaining fraction washout
- pRBC replacement volume
- HbS fraction remaining

## Parameters

- `sex` (string, required): Sex used by Nadler 1962 (separate male and female equations).
- `height_cm` (number, optional): Height in centimeters. Provide height_cm or height_in.
- `height_in` (number, optional): Height in inches. Converted as cm = in * 2.54.
- `weight_kg` (number, optional): Weight in kilograms. Provide weight_kg or weight_lb.
- `weight_lb` (number, optional): Weight in pounds. Converted as kg = lb * 0.45359237.
- `hematocrit_percent` (number, required): Patient hematocrit as a percent (10-70). Required. Not a 0-1 fraction.
- `initial_hbs_percent` (number, required): Initial HbS percent (1-100). Required. Must be greater than target_hbs_percent.
- `target_hbs_percent` (number, required): Target HbS percent (1-100). Required. Must be strictly less than initial_hbs_percent. AABB 2018 usual goal language is HbS not more than 30%; the caller sends this value.
- `replacement_hct_percent` (number, required): Replacement packed-RBC hematocrit as a percent (50-80). Required. Typical additive units are about 60. magent does not assay the unit.
- `unit_volume_ml` (number, optional): Optional caller-assigned unit volume in mL (50-500). When sent, response includes approx_units = replacement_prbc_ml / unit_volume_ml.

## 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/sickle_rbc_exchange`
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": [
    {
      "height_cm": "170",
      "hematocrit_percent": "30",
      "initial_hbs_percent": "90",
      "replacement_hct_percent": "60",
      "sex": "male",
      "target_hbs_percent": "30",
      "weight_kg": "70"
    },
    {
      "height_cm": "170",
      "hematocrit_percent": "30",
      "initial_hbs_percent": "90",
      "replacement_hct_percent": "60",
      "sex": "male",
      "target_hbs_percent": "30",
      "weight_kg": "70"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/sickle_rbc_exchange",
  "items": [
    {
      "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": "Nadler SB, Hidalgo JH, Bloch T",
        "id": "nadler-1962",
        "pmid": "21936146",
        "source": "Surgery. 1962;51(2):224-232",
        "title": "Prediction of blood volume in normal human adults"
      },
      "formula": "nadler_exponential_washout",
      "formula_expression": "TBV_L male = 0.3669 * H^3 + 0.03219 * W + 0.6041; female = 0.3561 * H^3 + 0.03308 * W + 0.1833 (H meters, W kg). patient_rbc_volume_ml = TBV_mL * hematocrit_percent/100. FCR = target_hbs_percent/initial_hbs_percent. X = -ln(FCR). replacement_prbc_ml = patient_rbc_volume_ml * X / (replacement_hct_percent/100)",
      "hematocrit_percent": 30.0,
      "sex": "male",
      "weight_kg": 70.0,
      "height_cm": 170.0,
      "blood_volume_ml": 4660,
      "blood_volume_l": 4.66,
      "fcr": 0.3333,
      "initial_hbs_percent": 90.0,
      "patient_rbc_volume_ml": 1398.0,
      "rbc_volumes_exchanged": 1.0986,
      "replacement_hct_percent": 60.0,
      "replacement_prbc_ml": 2559.8,
      "target_hbs_percent": 30.0
    },
    {
      "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": "Nadler SB, Hidalgo JH, Bloch T",
        "id": "nadler-1962",
        "pmid": "21936146",
        "source": "Surgery. 1962;51(2):224-232",
        "title": "Prediction of blood volume in normal human adults"
      },
      "formula": "nadler_exponential_washout",
      "formula_expression": "TBV_L male = 0.3669 * H^3 + 0.03219 * W + 0.6041; female = 0.3561 * H^3 + 0.03308 * W + 0.1833 (H meters, W kg). patient_rbc_volume_ml = TBV_mL * hematocrit_percent/100. FCR = target_hbs_percent/initial_hbs_percent. X = -ln(FCR). replacement_prbc_ml = patient_rbc_volume_ml * X / (replacement_hct_percent/100)",
      "hematocrit_percent": 30.0,
      "sex": "male",
      "weight_kg": 70.0,
      "height_cm": 170.0,
      "blood_volume_ml": 4660,
      "blood_volume_l": 4.66,
      "fcr": 0.3333,
      "initial_hbs_percent": 90.0,
      "patient_rbc_volume_ml": 1398.0,
      "rbc_volumes_exchanged": 1.0986,
      "replacement_hct_percent": 60.0,
      "replacement_prbc_ml": 2559.8,
      "target_hbs_percent": 30.0
    }
  ]
}
```

## Response fields

- `formula` (string): nadler_exponential_washout
- `formula_expression` (string): Nadler TBV plus exponential remaining-fraction washout
- `sex` (string): female or male
- `height_cm` (number): Normalized height in cm
- `weight_kg` (number): Normalized weight in kg
- `blood_volume_l` (number): Nadler predicted blood volume in liters, 3 decimals
- `blood_volume_ml` (integer): Nadler predicted blood volume in milliliters, integer
- `hematocrit_percent` (number): Patient hematocrit percent used
- `initial_hbs_percent` (number): Initial HbS percent used
- `target_hbs_percent` (number): Target HbS percent used
- `replacement_hct_percent` (number): Replacement packed-RBC hematocrit percent used
- `patient_rbc_volume_ml` (number): Patient RBC volume in mL (TBV_mL * hematocrit_percent/100), 1 decimal
- `fcr` (number): Fraction of cells remaining (target_hbs / initial_hbs), 4 decimals
- `rbc_volumes_exchanged` (number): RBC volumes to exchange X = -ln(FCR), 4 decimals
- `replacement_prbc_ml` (number): Replacement packed-RBC volume in mL, 1 decimal
- `unit_volume_ml` (number): Caller-assigned unit volume in mL. Omitted when unit_volume_ml is not sent.
- `approx_units` (number): replacement_prbc_ml / unit_volume_ml, 2 decimals. Omitted when unit_volume_ml is not sent.
- `citation` (object): Nadler Surgery 1962 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "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": "Nadler SB, Hidalgo JH, Bloch T",
    "id": "nadler-1962",
    "pmid": "21936146",
    "source": "Surgery. 1962;51(2):224-232",
    "title": "Prediction of blood volume in normal human adults"
  },
  "formula": "nadler_exponential_washout",
  "formula_expression": "TBV_L male = 0.3669 * H^3 + 0.03219 * W + 0.6041; female = 0.3561 * H^3 + 0.03308 * W + 0.1833 (H meters, W kg). patient_rbc_volume_ml = TBV_mL * hematocrit_percent/100. FCR = target_hbs_percent/initial_hbs_percent. X = -ln(FCR). replacement_prbc_ml = patient_rbc_volume_ml * X / (replacement_hct_percent/100)",
  "hematocrit_percent": 30.0,
  "sex": "male",
  "weight_kg": 70.0,
  "height_cm": 170.0,
  "blood_volume_ml": 4660,
  "blood_volume_l": 4.66,
  "fcr": 0.3333,
  "initial_hbs_percent": 90.0,
  "patient_rbc_volume_ml": 1398.0,
  "rbc_volumes_exchanged": 1.0986,
  "replacement_hct_percent": 60.0,
  "replacement_prbc_ml": 2559.8,
  "target_hbs_percent": 30.0
}
```

## Errors

- HTTP 400 `invalid_rbc_exchange`: RBC exchange needs hematocrit, HbS fractions, and replacement hematocrit in published ranges. Returned before settlement; you are not charged.
- HTTP 400 `invalid_sex`: sex must be female or male Returned before settlement; you are not charged.
- HTTP 400 `invalid_height`: height_cm (50-250) or height_in (20-98) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_weight`: weight_kg (1-500) or weight_lb (2-1100) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_hbs`: initial_hbs_percent and target_hbs_percent must be 1-100 with target below initial. 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

- [Nadler blood volume](https://magentlab.com/docs/nadler) — Compute Nadler 1962 predicted blood volume in liters and milliliters from height, weight, and sex.
- [Allowable blood loss](https://magentlab.com/docs/allowable-blood-loss) — Compute Gross 1983 dilution-corrected allowable blood loss from a caller-supplied estimated blood volume and initial versus target hematocrit.
- [Kaplan plasma volume](https://magentlab.com/docs/tpe) — Compute Kaplan 1990 estimated plasma volume for therapeutic plasma exchange from weight and hematocrit as a percent, returning one plasma volume in liters and milliliters.

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