MAGENT

Hematology · LIVE

Absolute lymphocyte count (ALC)

ALC

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

LIVE $0.005 USDC GET /api/calc/alc

Markdown: /docs/alc.md · Canonical: https://magentlab.com/docs/alc

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

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

Worked example

6.0 K/µL, 50% lymphocytes

Given: lymphocyte_percent=50wbc_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=50wbc_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

Try

Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.

/api/calc/alc?wbc_k_ul=6.0&lymphocyte_percent=50

Full URL: https://api.magentlab.com/api/calc/alc?wbc_k_ul=6.0&lymphocyte_percent=50

Call

Expect HTTP 402 until you retry with PAYMENT-SIGNATURE. Incomplete query params return HTTP 400 before any quote or charge.

curl -i -H "Accept: application/json" "https://api.magentlab.com/api/calc/alc?wbc_k_ul=6.0&lymphocyte_percent=50"

Parameters

Name Type Required Description
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.

POST /api/calc/alc Max 25 unit_amount + extra_item_amount * (n - 1) extra $0.002 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 (fixture)

{
  "items": [
    {
      "lymphocyte_percent": "50",
      "wbc_k_ul": "6.0"
    },
    {
      "lymphocyte_percent": "50",
      "wbc_k_ul": "6.0"
    }
  ]
}

Open bulk paywall →

Opens a two-item fixture on the API host. Unpaid browsers get the same MetaMask paywall as GET; Pay retries POST with those items.

Example 200 (fixture)

{
  "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

Field Type Description
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

Machine form of the same example. Frozen fixture. Not a live lookup.

{
  "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"
}

Client errors (HTTP 400)

Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.

HTTP Code When
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.
400 invalid_wbc wbc_k_ul (0.01-500) or wbc_ul (10-500000) is required Returned before settlement; you are not charged.
400 invalid_lymphocyte_percent lymphocyte_percent must be a number from 0.1 to 99. Returned before settlement; you are not charged.
400 invalid_items POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
400 invalid_item_count items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
400 invalid_item each items entry must be a JSON object Returned before settlement; you are not charged.

Related tools

  • ANC — Compute absolute neutrophil count from WBC and neutrophil plus band percents, plus a Bodey 1966 granulocyte band.
  • 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. Unpaid valid requests return HTTP 402 with a base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote: retry the same PAYMENT-SIGNATURE. Full handshake and shared payment errors: Payments. Stdio MCP: /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.