# Absolute lymphocyte count (ALC)

ALC

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

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

## What it computes

Compute absolute lymphocyte count from WBC and lymphocyte percent, plus Shapiro 1998 published ALC cutoffs that predict CD4 < 200 or CD4 ≥ 200.

## When to use

When an agent needs Shapiro 1998 ALC from a CBC differential and must not invent a CD4 count.

## When not to use

- Not a medical device. Not a CD4 count, HIV staging tool, or diagnosis. magent does not measure the CBC.
- Shapiro 1998 published ALC cutoffs only: ALC < 1000 cells/mm^3 predicts CD4 < 200; ALC ≥ 2000 predicts CD4 ≥ 200. magent does not estimate a CD4 count or invent other bands.
- ALC = WBC × lymphocyte percent / 100, rounded to the nearest integer cells/µL (same as ANC). Provide wbc_k_ul or wbc_ul, and lymphocyte_percent (0.1-99).

## Formula

```
ALC_per_uL = wbc_per_uL * lymphocyte_percent / 100
```

## Citation

[Absolute lymphocyte count as a predictor of CD4 count](https://doi.org/10.1016/s0196-0644(98)70008-3)
Shapiro NI, Karras DJ, Leech SH, Heilpern KL
Ann Emerg Med. 1998;32(3):323-328
DOI: [10.1016/s0196-0644(98)70008-3](https://doi.org/10.1016/s0196-0644(98)70008-3)

## Worked example

### 6.0 K/µL, 50% lymphocytes

Given: `lymphocyte_percent=50, wbc_k_ul=6.0`

1. wbc_per_uL = 6.0 × 1000 = 6000
2. ALC = 6000 × 50 / 100 = 3000
3. Shapiro band >=2000 (ALC ≥ 2000 predicts CD4 ≥ 200; not a CD4 measurement)


### 6000 cells/µL, 50% lymphocytes

Given: `lymphocyte_percent=50, wbc_ul=6000`

1. wbc_per_uL = 6000
2. ALC = 6000 × 50 / 100 = 3000
3. Shapiro band >=2000


## Also searched as

- absolute lymphocyte count
- ALC
- lymphocyte absolute count
- Shapiro ALC
- ALC CD4 predictor
- WBC times lymphocyte percent
- absolute lymph count

## Parameters

- `wbc_k_ul` (number, optional): WBC in 10^3/µL (same as 10^9/L). Provide wbc_k_ul or wbc_ul. Range 0.01-500.
- `wbc_ul` (number, optional): WBC in cells/µL (same as cells/mm^3). Provide wbc_k_ul or wbc_ul. Range 10-500000.
- `lymphocyte_percent` (number, required): Lymphocytes as a percent of WBC (0.1-99). Shapiro 1998 uses the CBC lymphocyte percentage.

## 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/alc`
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": [
    {
      "lymphocyte_percent": "50",
      "wbc_k_ul": "6.0"
    },
    {
      "lymphocyte_percent": "50",
      "wbc_k_ul": "6.0"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/alc",
  "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": "Shapiro NI, Karras DJ, Leech SH, Heilpern KL",
        "doi": "10.1016/s0196-0644(98)70008-3",
        "id": "shapiro-1998-alc",
        "pmid": "9737494",
        "source": "Ann Emerg Med. 1998;32(3):323-328",
        "title": "Absolute lymphocyte count as a predictor of CD4 count"
      },
      "formula": "alc",
      "formula_expression": "ALC_per_uL = wbc_per_uL * lymphocyte_percent / 100",
      "wbc_per_ul": 6.0e3,
      "alc_per_ul": 3000,
      "lymphocyte_percent": 50.0,
      "shapiro_alc_band": ">=2000"
    },
    {
      "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, Karras DJ, Leech SH, Heilpern KL",
        "doi": "10.1016/s0196-0644(98)70008-3",
        "id": "shapiro-1998-alc",
        "pmid": "9737494",
        "source": "Ann Emerg Med. 1998;32(3):323-328",
        "title": "Absolute lymphocyte count as a predictor of CD4 count"
      },
      "formula": "alc",
      "formula_expression": "ALC_per_uL = wbc_per_uL * lymphocyte_percent / 100",
      "wbc_per_ul": 6.0e3,
      "alc_per_ul": 3000,
      "lymphocyte_percent": 50.0,
      "shapiro_alc_band": ">=2000"
    }
  ]
}
```

## Response fields

- `formula` (string): alc
- `formula_expression` (string): Exact expression used
- `wbc_per_ul` (number): Normalized WBC in cells/µL
- `lymphocyte_percent` (number): Lymphocyte percent used
- `alc_per_ul` (integer): Absolute lymphocyte count in cells/µL
- `shapiro_alc_band` (string): Shapiro 1998 published ALC cutoffs (cells/mm^3 = cells/µL): <1000 predicts CD4 < 200; >=2000 predicts CD4 >= 200; 1000-1999 is between those cutoffs. Not a CD4 count or diagnosis.
- `citation` (object): Ann Emerg Med 1998 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": "Shapiro NI, Karras DJ, Leech SH, Heilpern KL",
    "doi": "10.1016/s0196-0644(98)70008-3",
    "id": "shapiro-1998-alc",
    "pmid": "9737494",
    "source": "Ann Emerg Med. 1998;32(3):323-328",
    "title": "Absolute lymphocyte count as a predictor of CD4 count"
  },
  "formula": "alc",
  "formula_expression": "ALC_per_uL = wbc_per_uL * lymphocyte_percent / 100",
  "wbc_per_ul": 6.0e3,
  "alc_per_ul": 3000,
  "lymphocyte_percent": 50.0,
  "shapiro_alc_band": ">=2000"
}
```

## Errors

- HTTP 400 `invalid_alc_inputs`: ALC needs wbc_k_ul or wbc_ul and lymphocyte_percent as used in Shapiro 1998 (WBC times lymphocyte percent). Returned before settlement; you are not charged.
- HTTP 400 `invalid_wbc`: wbc_k_ul (0.01-500) or wbc_ul (10-500000) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_lymphocyte_percent`: lymphocyte_percent must be a number from 0.1 to 99. 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

- [ANC](https://magentlab.com/docs/anc) — Compute absolute neutrophil count from WBC and neutrophil plus band percents, plus a Bodey 1966 granulocyte band.
- [NLR](https://magentlab.com/docs/nlr) — Compute the Zahorec 2001 neutrophil-to-lymphocyte ratio from relative neutrophil and lymphocyte percents.

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