MAGENT

Liver · LIVE

REACH-B HCC risk

REACH-B

Sum the Yang 2011 REACH-B 17-point score (sex, age 30-65, ALT, HBeAg, HBV DNA copies/mL) and return the published 3-, 5-, and 10-year HCC risk percents.

LIVE $0.005 USDC GET /api/calc/reach_b

Markdown: /docs/reach-b.md · Canonical: https://magentlab.com/docs/reach-b

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

What it computes

Sum the Yang 2011 REACH-B 17-point score (sex, age 30-65, ALT, HBeAg, HBV DNA copies/mL) and return the published 3-, 5-, and 10-year HCC risk percents.

When to use

When an agent has caller-assigned sex, age 30-65, ALT, HBeAg, and HBV DNA in copies/mL as in Yang 2011, and needs the published non-cirrhotic REVEAL-HBV score and table risks, not an IU/mL conversion and not a cirrhosis instrument.

When not to use

  • Not a medical device.
  • Not a diagnosis of HCC and not a biopsy order.
  • Yang 2011 derivation excluded cirrhosis. Not for patients with cirrhosis. Not the later modified REACH-B that scores age >=65 as 7.
  • Age must be 30-65 as in the derivation cohort. magent does not assay ALT or HBV DNA. HBV DNA is copies/mL as published; this tool does not convert IU/mL.
  • HBV DNA >=1000000 copies/mL scores 4; 100000-999999 scores 5 (Yang 2011 table, non-monotonic).

Formula

REACH-B = sex + age + ALT + HBeAg + HBV DNA copies/mL; female 0, male 2; age 30-34 -> 0, 35-39 -> 1, 40-44 -> 2, 45-49 -> 3, 50-54 -> 4, 55-59 -> 5, 60-65 -> 6; ALT <15 -> 0, 15-44 -> 1, >=45 -> 2; HBeAg positive 2; HBV DNA copies/mL <300 -> 0, 300-9999 -> 0, 10000-99999 -> 3, 100000-999999 -> 5, >=1000000 -> 4; max 17; 3/5/10-year HCC percent from Yang 2011 score table

Citation

Title
Risk estimation for hepatocellular carcinoma in chronic hepatitis B (REACH-B): development and validation of a predictive score
Authors
Yang HI, Yuen MF, Chan HL, et al
Source
Lancet Oncol. 2011;12(6):568-574
DOI
10.1016/S1470-2045(11)70077-8

Worked example

Female age 30, ALT 14, HBeAg negative, HBV DNA 200 copies/mL

Given: age=30alt_u_l=14hbeag_positive=falsehbv_dna_copies_per_ml=200sex=female

  1. Female -> 0; age 30 (30-34) -> 0; ALT 14 (<15) -> 0; HBeAg false -> 0; HBV DNA 200 (<300) -> 0
  2. Score = 0 (max 17); 3/5/10-year HCC risks 0.0 / 0.0 / 0.0. Not a diagnosis.

Also searched as

  • REACH-B
  • REACH-B score
  • Yang HCC risk score
  • REVEAL-HBV HCC score
  • hepatitis B HCC risk
  • REACH B
  • Yang 2011 REACH-B
  • chronic hepatitis B hepatocellular carcinoma risk

Try

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

/api/calc/reach_b?sex=female&age=30&alt_u_l=14&hbeag_positive=false&hbv_dna_copies_per_ml=200

Full URL: https://api.magentlab.com/api/calc/reach_b?sex=female&age=30&alt_u_l=14&hbeag_positive=false&hbv_dna_copies_per_ml=200

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/reach_b?sex=female&age=30&alt_u_l=14&hbeag_positive=false&hbv_dna_copies_per_ml=200"

Parameters

Name Type Required Description
sex string required · female, male female or male. Yang 2011: female scores 0; male scores 2.
age integer required Age in years. Yang 2011 derivation 30-65 only: 30-34 scores 0; 35-39 scores 1; 40-44 scores 2; 45-49 scores 3; 50-54 scores 4; 55-59 scores 5; 60-65 scores 6. Age 34 scores 0; 35 scores 1; 65 scores 6. Age outside 30-65 is rejected. This tool does not score age >=65 as 7.
alt_u_l number required Alanine aminotransferase in U/L (1-10000). Caller-assigned; magent does not assay ALT. Yang 2011: <15 scores 0; 15-44 scores 1; >=45 scores 2. ALT 14 scores 0; 15 and 44 score 1; 45 scores 2.
hbeag_positive boolean required HBeAg positive as assigned by the caller (Yang 2011). true scores 2; false scores 0. magent does not assay HBeAg.
hbv_dna_copies_per_ml integer required HBV DNA in copies/mL (integer 0-10000000000). Yang 2011 uses copies/mL, not IU/mL. magent does not assay HBV DNA and does not convert units. <300 scores 0; 300-9999 scores 0; 10000-99999 scores 3; 100000-999999 scores 5; >=1000000 scores 4 (non-monotonic: 10^6 scores 4, 10^5 to 10^6-1 scores 5).

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/reach_b 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": [
    {
      "age": "30",
      "alt_u_l": "14",
      "hbeag_positive": "false",
      "hbv_dna_copies_per_ml": "200",
      "sex": "female"
    },
    {
      "age": "30",
      "alt_u_l": "14",
      "hbeag_positive": "false",
      "hbv_dna_copies_per_ml": "200",
      "sex": "female"
    }
  ]
}

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/reach_b",
  "items": [
    {
      "components": [
        {
          "value": "female",
          "factor": "sex",
          "points": 0,
          "present": false
        },
        {
          "value": 30,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 14.0,
          "factor": "alt",
          "points": 0,
          "present": false
        },
        {
          "factor": "hbeag",
          "points": 0,
          "present": false
        },
        {
          "value": 200,
          "factor": "hbv_dna",
          "points": 0,
          "present": false
        }
      ],
      "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.",
      "age_years": 30,
      "citation": {
        "authors": "Yang HI, Yuen MF, Chan HL, et al",
        "doi": "10.1016/S1470-2045(11)70077-8",
        "id": "yang-2011",
        "pmid": "21497551",
        "source": "Lancet Oncol. 2011;12(6):568-574",
        "title": "Risk estimation for hepatocellular carcinoma in chronic hepatitis B (REACH-B): development and validation of a predictive score"
      },
      "formula": "reach_b",
      "formula_expression": "REACH-B = sex + age + ALT + HBeAg + HBV DNA copies/mL; female 0, male 2; age 30-34 -> 0, 35-39 -> 1, 40-44 -> 2, 45-49 -> 3, 50-54 -> 4, 55-59 -> 5, 60-65 -> 6; ALT <15 -> 0, 15-44 -> 1, >=45 -> 2; HBeAg positive 2; HBV DNA copies/mL <300 -> 0, 300-9999 -> 0, 10000-99999 -> 3, 100000-999999 -> 5, >=1000000 -> 4; max 17; 3/5/10-year HCC percent from Yang 2011 score table",
      "max_score": 17,
      "score": 0,
      "sex": "female",
      "alt_u_l": 14.0,
      "hbeag_positive": false,
      "hbv_dna_copies_per_ml": 200,
      "risk_10y_percent": 0.0,
      "risk_3y_percent": 0.0,
      "risk_5y_percent": 0.0
    },
    {
      "components": [
        {
          "value": "female",
          "factor": "sex",
          "points": 0,
          "present": false
        },
        {
          "value": 30,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 14.0,
          "factor": "alt",
          "points": 0,
          "present": false
        },
        {
          "factor": "hbeag",
          "points": 0,
          "present": false
        },
        {
          "value": 200,
          "factor": "hbv_dna",
          "points": 0,
          "present": false
        }
      ],
      "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.",
      "age_years": 30,
      "citation": {
        "authors": "Yang HI, Yuen MF, Chan HL, et al",
        "doi": "10.1016/S1470-2045(11)70077-8",
        "id": "yang-2011",
        "pmid": "21497551",
        "source": "Lancet Oncol. 2011;12(6):568-574",
        "title": "Risk estimation for hepatocellular carcinoma in chronic hepatitis B (REACH-B): development and validation of a predictive score"
      },
      "formula": "reach_b",
      "formula_expression": "REACH-B = sex + age + ALT + HBeAg + HBV DNA copies/mL; female 0, male 2; age 30-34 -> 0, 35-39 -> 1, 40-44 -> 2, 45-49 -> 3, 50-54 -> 4, 55-59 -> 5, 60-65 -> 6; ALT <15 -> 0, 15-44 -> 1, >=45 -> 2; HBeAg positive 2; HBV DNA copies/mL <300 -> 0, 300-9999 -> 0, 10000-99999 -> 3, 100000-999999 -> 5, >=1000000 -> 4; max 17; 3/5/10-year HCC percent from Yang 2011 score table",
      "max_score": 17,
      "score": 0,
      "sex": "female",
      "alt_u_l": 14.0,
      "hbeag_positive": false,
      "hbv_dna_copies_per_ml": 200,
      "risk_10y_percent": 0.0,
      "risk_3y_percent": 0.0,
      "risk_5y_percent": 0.0
    }
  ]
}

Response

Field Type Description
formula string reach_b
formula_expression string Exact Yang 2011 17-point expression
score integer REACH-B points; published range 0-17
max_score integer 17 (2+6+2+2+5; DNA max is 5, not 4)
risk_3y_percent number Published 3-year HCC percent for this score (Yang 2011 table). Not a diagnosis.
risk_5y_percent number Published 5-year HCC percent for this score (Yang 2011 table). Not a diagnosis.
risk_10y_percent number Published 10-year HCC percent for this score (Yang 2011 table). Not a diagnosis.
sex string female or male used for the sex points
age_years integer Age in years used for the age band
alt_u_l number Caller-assigned ALT in U/L used
hbeag_positive boolean Caller-assigned HBeAg flag used
hbv_dna_copies_per_ml integer Caller-assigned HBV DNA in copies/mL used
components array Per-factor Yang 2011 points
citation object Yang 2011 Lancet Oncol citation
disclaimer string Not-a-device notice

Example JSON

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

{
  "components": [
    {
      "value": "female",
      "factor": "sex",
      "points": 0,
      "present": false
    },
    {
      "value": 30,
      "factor": "age",
      "points": 0,
      "present": false
    },
    {
      "value": 14.0,
      "factor": "alt",
      "points": 0,
      "present": false
    },
    {
      "factor": "hbeag",
      "points": 0,
      "present": false
    },
    {
      "value": 200,
      "factor": "hbv_dna",
      "points": 0,
      "present": false
    }
  ],
  "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.",
  "age_years": 30,
  "citation": {
    "authors": "Yang HI, Yuen MF, Chan HL, et al",
    "doi": "10.1016/S1470-2045(11)70077-8",
    "id": "yang-2011",
    "pmid": "21497551",
    "source": "Lancet Oncol. 2011;12(6):568-574",
    "title": "Risk estimation for hepatocellular carcinoma in chronic hepatitis B (REACH-B): development and validation of a predictive score"
  },
  "formula": "reach_b",
  "formula_expression": "REACH-B = sex + age + ALT + HBeAg + HBV DNA copies/mL; female 0, male 2; age 30-34 -> 0, 35-39 -> 1, 40-44 -> 2, 45-49 -> 3, 50-54 -> 4, 55-59 -> 5, 60-65 -> 6; ALT <15 -> 0, 15-44 -> 1, >=45 -> 2; HBeAg positive 2; HBV DNA copies/mL <300 -> 0, 300-9999 -> 0, 10000-99999 -> 3, 100000-999999 -> 5, >=1000000 -> 4; max 17; 3/5/10-year HCC percent from Yang 2011 score table",
  "max_score": 17,
  "score": 0,
  "sex": "female",
  "alt_u_l": 14.0,
  "hbeag_positive": false,
  "hbv_dna_copies_per_ml": 200,
  "risk_10y_percent": 0.0,
  "risk_3y_percent": 0.0,
  "risk_5y_percent": 0.0
}

Client errors (HTTP 400)

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

HTTP Code When
400 invalid_sex sex must be female or male Returned before settlement; you are not charged.
400 invalid_age age must be an integer from 18 to 120 Returned before settlement; you are not charged.
400 invalid_alt alt_u_l must be a number from 1 to 10000 Returned before settlement; you are not charged.
400 invalid_flag boolean clinical flags must be true or false Returned before settlement; you are not charged.
400 invalid_hbv_dna hbv_dna_copies_per_ml must be an integer from 0 to 10000000000 (Yang 2011 copies/mL). Returned before settlement; you are not charged.
400 invalid_reach_b age must be 30-65, and each other REACH-B 2011 item must be a published category. 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

  • FIB-4 — Compute the FIB-4 fibrosis index from age, AST, ALT, and platelets.

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.