MAGENT

Liver · LIVE

Glasgow alcoholic hepatitis score

GAHS

Compute the Forrest 2005 Glasgow alcoholic hepatitis score (5-12) and the published ≥9 band.

LIVE $0.005 USDC GET /api/calc/gahs

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

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

What it computes

Compute the Forrest 2005 Glasgow alcoholic hepatitis score (5-12) and the published ≥9 band.

When to use

When an agent needs the published GAHS total and must not invent a corticosteroid decision.

When not to use

  • Not a diagnosis or a steroid/pentoxifylline order. Forrest 2005 associated day-1 GAHS ≥9 with poorer outcome; magent returns lt_9 or ge_9 as a band.
  • PT ratio is the paper variable (not INR). Age uses magent's adult 18-120 clamp. Urea may be entered as mmol/L or BUN mg/dL (÷ 2.8).

Formula

GAHS = age_points + wbc_points + urea_points + pt_ratio_points + bilirubin_points; range 5-12

Citation

Title
Analysis of factors predictive of mortality in alcoholic hepatitis and derivation and validation of the Glasgow alcoholic hepatitis score
Authors
Forrest EH, Evans CD, Stewart S, et al.
Source
Gut. 2005;54(8):1174-1179
DOI
10.1136/gut.2004.050781

Worked example

Age 40, WBC 8, urea 4, PT ratio 1.2, bilirubin 80 µmol/L

Given: age=40bilirubin_umol_l=80pt_ratio=1.2urea_mmol_l=4wbc_k_ul=8

  1. age <50 → 1; WBC <15 → 1; urea <5 → 1; PT ratio <1.5 → 1; bilirubin <125 → 1
  2. score = 5
  3. band lt_9

Age 55, WBC 16, urea 8, PT ratio 2.2, bilirubin 300 µmol/L

Given: age=55bilirubin_umol_l=300pt_ratio=2.2urea_mmol_l=8wbc_k_ul=16

  1. age ≥50 → 2; WBC ≥15 → 2; urea ≥5 → 2; PT ratio >2.0 → 3; bilirubin >250 → 3
  2. score = 12
  3. band ge_9

Also searched as

  • Glasgow alcoholic hepatitis score
  • GAHS
  • Forrest score
  • alcoholic hepatitis score
  • GAHS ≥9

Try

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

/api/calc/gahs?age=40&wbc_k_ul=8&urea_mmol_l=4&pt_ratio=1.2&bilirubin_umol_l=80

Full URL: https://api.magentlab.com/api/calc/gahs?age=40&wbc_k_ul=8&urea_mmol_l=4&pt_ratio=1.2&bilirubin_umol_l=80

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/gahs?age=40&wbc_k_ul=8&urea_mmol_l=4&pt_ratio=1.2&bilirubin_umol_l=80"

Parameters

Name Type Required Description
age integer required Age in years (18-120). <50 scores 1; ≥50 scores 2 (Forrest 2005).
wbc_k_ul number optional WBC in 10^3/µL (same as 10^9/L). Provide wbc_k_ul or wbc_ul. <15 scores 1; ≥15 scores 2.
wbc_ul number optional WBC in cells/µL. Converted as K/µL = cells/µL / 1000.
urea_mmol_l number optional Urea in mmol/L (1-50). Provide this or bun_mg_dl, not both. <5 scores 1; ≥5 scores 2.
bun_mg_dl number optional BUN in mg/dL (3-140). Converted as urea_mmol_l = bun_mg_dl / 2.8.
pt_ratio number required Prothrombin-time ratio (0.8-10). <1.5 scores 1; 1.5-2.0 scores 2; >2.0 scores 3.
bilirubin_umol_l number optional Total bilirubin in µmol/L (2-684). Provide this or bilirubin_mg_dl. <125 scores 1; 125-250 scores 2; >250 scores 3.
bilirubin_mg_dl number optional Total bilirubin in mg/dL (0.1-40). Converted as µmol/L = mg/dL × 17.1.

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/gahs 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": "40",
      "bilirubin_umol_l": "80",
      "pt_ratio": "1.2",
      "urea_mmol_l": "4",
      "wbc_k_ul": "8"
    },
    {
      "age": "40",
      "bilirubin_umol_l": "80",
      "pt_ratio": "1.2",
      "urea_mmol_l": "4",
      "wbc_k_ul": "8"
    }
  ]
}

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/gahs",
  "items": [
    {
      "components": [
        {
          "value": 40,
          "factor": "age",
          "points": 1,
          "present": false
        },
        {
          "value": 8.0,
          "factor": "wbc",
          "points": 1,
          "present": false
        },
        {
          "value": 4.0,
          "factor": "urea",
          "points": 1,
          "present": false
        },
        {
          "value": 1.2,
          "factor": "pt_ratio",
          "points": 1,
          "present": false
        },
        {
          "value": 80.0,
          "factor": "bilirubin",
          "points": 1,
          "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.",
      "citation": {
        "authors": "Forrest EH, Evans CD, Stewart S, et al.",
        "doi": "10.1136/gut.2004.050781",
        "id": "forrest-2005",
        "source": "Gut. 2005;54(8):1174-1179",
        "title": "Analysis of factors predictive of mortality in alcoholic hepatitis and derivation and validation of the Glasgow alcoholic hepatitis score"
      },
      "formula": "gahs",
      "formula_expression": "GAHS = age_points + wbc_points + urea_points + pt_ratio_points + bilirubin_points; range 5-12",
      "max_score": 12,
      "score": 5,
      "age_years": 40,
      "bilirubin_umol_l": 80.0,
      "gahs_band": "lt_9",
      "min_score": 5,
      "pt_ratio": 1.2,
      "urea_mmol_l": 4.0,
      "wbc_k_ul": 8.0
    },
    {
      "components": [
        {
          "value": 40,
          "factor": "age",
          "points": 1,
          "present": false
        },
        {
          "value": 8.0,
          "factor": "wbc",
          "points": 1,
          "present": false
        },
        {
          "value": 4.0,
          "factor": "urea",
          "points": 1,
          "present": false
        },
        {
          "value": 1.2,
          "factor": "pt_ratio",
          "points": 1,
          "present": false
        },
        {
          "value": 80.0,
          "factor": "bilirubin",
          "points": 1,
          "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.",
      "citation": {
        "authors": "Forrest EH, Evans CD, Stewart S, et al.",
        "doi": "10.1136/gut.2004.050781",
        "id": "forrest-2005",
        "source": "Gut. 2005;54(8):1174-1179",
        "title": "Analysis of factors predictive of mortality in alcoholic hepatitis and derivation and validation of the Glasgow alcoholic hepatitis score"
      },
      "formula": "gahs",
      "formula_expression": "GAHS = age_points + wbc_points + urea_points + pt_ratio_points + bilirubin_points; range 5-12",
      "max_score": 12,
      "score": 5,
      "age_years": 40,
      "bilirubin_umol_l": 80.0,
      "gahs_band": "lt_9",
      "min_score": 5,
      "pt_ratio": 1.2,
      "urea_mmol_l": 4.0,
      "wbc_k_ul": 8.0
    }
  ]
}

Response

Field Type Description
formula string gahs
formula_expression string Exact expression used
score integer GAHS 5-12
max_score integer 12
min_score integer 5
gahs_band string lt_9 or ge_9 (Forrest 2005 day-1 cutoff). A band, not a steroid order.
age_years integer Age used
wbc_k_ul number WBC in 10^9/L used
urea_mmol_l number Urea in mmol/L used
pt_ratio number PT ratio used
bilirubin_umol_l number Bilirubin in µmol/L used
components array Per-variable points
citation object Forrest et al. Gut 2005 citation
disclaimer string Not-a-device notice

Example JSON

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

{
  "components": [
    {
      "value": 40,
      "factor": "age",
      "points": 1,
      "present": false
    },
    {
      "value": 8.0,
      "factor": "wbc",
      "points": 1,
      "present": false
    },
    {
      "value": 4.0,
      "factor": "urea",
      "points": 1,
      "present": false
    },
    {
      "value": 1.2,
      "factor": "pt_ratio",
      "points": 1,
      "present": false
    },
    {
      "value": 80.0,
      "factor": "bilirubin",
      "points": 1,
      "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.",
  "citation": {
    "authors": "Forrest EH, Evans CD, Stewart S, et al.",
    "doi": "10.1136/gut.2004.050781",
    "id": "forrest-2005",
    "source": "Gut. 2005;54(8):1174-1179",
    "title": "Analysis of factors predictive of mortality in alcoholic hepatitis and derivation and validation of the Glasgow alcoholic hepatitis score"
  },
  "formula": "gahs",
  "formula_expression": "GAHS = age_points + wbc_points + urea_points + pt_ratio_points + bilirubin_points; range 5-12",
  "max_score": 12,
  "score": 5,
  "age_years": 40,
  "bilirubin_umol_l": 80.0,
  "gahs_band": "lt_9",
  "min_score": 5,
  "pt_ratio": 1.2,
  "urea_mmol_l": 4.0,
  "wbc_k_ul": 8.0
}

Client errors (HTTP 400)

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

HTTP Code When
400 invalid_age age must be an integer from 18 to 120 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_urea urea_mmol_l (1-50) or bun_mg_dl (3-140) is required, not both. Returned before settlement; you are not charged.
400 invalid_gahs_pt_ratio pt_ratio must be a number from 0.8 to 10. Returned before settlement; you are not charged.
400 invalid_bilirubin bilirubin_mg_dl (0.1-40) or bilirubin_umol_l (2-684) is required 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

  • Maddrey DF — Compute the 1978 Maddrey discriminant function from patient PT, control PT, and bilirubin.
  • Child–Pugh — Compute the Child–Turcotte–Pugh cirrhosis severity score from bilirubin, albumin, INR, encephalopathy, and ascites.
  • MELD-Na — Compute OPTN/UNOS 2016 MELD and MELD-Na from creatinine, bilirubin, INR, sodium, and dialysis.

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