MAGENT

Liver · LIVE

King's College criteria

Apply the O'Grady 1989 King's College poor-prognosis criteria for fulminant hepatic failure, with separate acetaminophen and non-acetaminophen trees using prothrombin time in seconds.

LIVE $0.005 USDC GET /api/calc/kings_college

Markdown: /docs/kings-college.md · Canonical: https://magentlab.com/docs/kings-college

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

What it computes

Apply the O'Grady 1989 King's College poor-prognosis criteria for fulminant hepatic failure, with separate acetaminophen and non-acetaminophen trees using prothrombin time in seconds.

When to use

When an agent has caller-assigned labs and encephalopathy grade in fulminant hepatic failure and needs the 1989 King's College criteria, not later INR restatements or a transplant-allocation score.

When not to use

  • Not a medical device. magent does not examine the patient.
  • Not a transplant listing, organ-allocation order, or UNOS/MELD substitute.
  • Uses prothrombin time in seconds as published in 1989. Does not accept, convert, or restate INR (no INR>6.5 / INR>3.5).
  • This is the O'Grady 1989 Gastroenterology paper only. Later reviews and age <10 restatements are not this tool. Age cutoffs are <11 or >40 as in the 1989 abstract.
  • The acetaminophen arterial pH <7.30 rule is independent of encephalopathy. The PT>100 s plus creatinine >300 umol/L plus grade III/IV package is the 1989 selection model.

Formula

acetaminophen: arterial_ph < 7.30, or (pt_sec > 100 and creatinine_umol_l > 300 and encephalopathy_grade >= 3); non_acetaminophen: pt_sec > 100, or at least 3 of (age_years < 11 or > 40; unfavorable_etiology; jaundice_to_encephalopathy_days > 7; bilirubin_umol_l > 300; pt_sec > 50)

Citation

Title
Early indicators of prognosis in fulminant hepatic failure
Authors
O'Grady JG, Alexander GJ, Hayllar KM, Williams R
Source
Gastroenterology. 1989;97(2):439-445
DOI
10.1016/0016-5085(89)90081-4

Worked example

Acetaminophen, labs not meeting either rule

Given: age_years=30arterial_ph=7.40bilirubin_umol_l=50creatinine_umol_l=80encephalopathy_grade=1etiology=acetaminophenjaundice_to_encephalopathy_days=2pt_sec=20unfavorable_etiology=false

  1. Acetaminophen tree: arterial pH 7.40 is not < 7.30
  2. PT 20 s is not > 100, creatinine 80 umol/L is not > 300, grade 1 is not >= 3
  3. criteria_met is false

Acetaminophen arterial pH < 7.30

Given: age_years=30arterial_ph=7.20bilirubin_umol_l=50creatinine_umol_l=80encephalopathy_grade=1etiology=acetaminophenjaundice_to_encephalopathy_days=2pt_sec=20unfavorable_etiology=false

  1. Acetaminophen tree: arterial pH 7.20 < 7.30
  2. pH rule is independent of encephalopathy
  3. criteria_met is true

Non-acetaminophen any three of five

Given: age_years=10arterial_ph=7.40bilirubin_umol_l=50creatinine_umol_l=80encephalopathy_grade=1etiology=non_acetaminophenjaundice_to_encephalopathy_days=8pt_sec=20unfavorable_etiology=true

  1. Non-acetaminophen tree: PT 20 s is not > 100
  2. Age 10 < 11, unfavorable etiology, jaundice-to-encephalopathy 8 > 7 (three of five)
  3. criteria_met is true

Also searched as

  • kings college
  • acetaminophen
  • fulminant hepatic failure
  • King's College criteria
  • O'Grady 1989
  • paracetamol hepatotoxicity criteria
  • King's College Hospital criteria
  • non-acetaminophen FHF

Try

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

/api/calc/kings_college?etiology=acetaminophen&arterial_ph=7.40&pt_sec=20&creatinine_umol_l=80&encephalopathy_grade=1&age_years=30&unfavorable_etiology=false&jaundice_to_encephalopathy_days=2&bilirubin_umol_l=50

Full URL: https://api.magentlab.com/api/calc/kings_college?etiology=acetaminophen&arterial_ph=7.40&pt_sec=20&creatinine_umol_l=80&encephalopathy_grade=1&age_years=30&unfavorable_etiology=false&jaundice_to_encephalopathy_days=2&bilirubin_umol_l=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/kings_college?etiology=acetaminophen&arterial_ph=7.40&pt_sec=20&creatinine_umol_l=80&encephalopathy_grade=1&age_years=30&unfavorable_etiology=false&jaundice_to_encephalopathy_days=2&bilirubin_umol_l=50"

Parameters

Name Type Required Description
etiology string required · acetaminophen, non_acetaminophen acetaminophen or non_acetaminophen (O'Grady 1989). Selects the paracetamol or non-paracetamol poor-prognosis tree. Required on every request.
arterial_ph number required Arterial pH (6.80-7.80). Acetaminophen criterion met when pH < 7.30, independent of encephalopathy. Required even on the non-acetaminophen tree; not scored there.
pt_sec number required Prothrombin time in seconds (8-120) as published in 1989. INR is not accepted. Acetaminophen combo uses PT > 100; non-acetaminophen uses PT > 100 alone or PT > 50 as one of five factors.
creatinine_umol_l number required Serum creatinine in umol/L (9-1768). Acetaminophen combo criterion met when > 300. Required even on the non-acetaminophen tree; not scored there.
encephalopathy_grade integer required Hepatic encephalopathy grade 0-4 as assigned by the caller (Conn 1977 / West Haven). Acetaminophen combo uses grade >= 3 (grade III/IV). Required even on the non-acetaminophen tree; not scored there. magent does not examine the patient.
age_years integer required Age in years (0-120). Non-acetaminophen factor met when age < 11 or age > 40 (1989 abstract, not a later <10 restatement). Required even on the acetaminophen tree; not scored there.
unfavorable_etiology boolean required Unfavorable etiology as assigned by the caller (paper: non-A non-B hepatitis or drug reaction). true or false. Non-acetaminophen any-3 factor. Required even on the acetaminophen tree; not scored there.
jaundice_to_encephalopathy_days integer required Days from jaundice to encephalopathy (integer 0-90). Non-acetaminophen factor met when > 7. Required even on the acetaminophen tree; not scored there.
bilirubin_umol_l number required Serum bilirubin in umol/L (2-684). Non-acetaminophen factor met when > 300. Required even on the acetaminophen tree; not scored there.

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/kings_college 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_years": "30",
      "arterial_ph": "7.40",
      "bilirubin_umol_l": "50",
      "creatinine_umol_l": "80",
      "encephalopathy_grade": "1",
      "etiology": "acetaminophen",
      "jaundice_to_encephalopathy_days": "2",
      "pt_sec": "20",
      "unfavorable_etiology": "false"
    },
    {
      "age_years": "30",
      "arterial_ph": "7.40",
      "bilirubin_umol_l": "50",
      "creatinine_umol_l": "80",
      "encephalopathy_grade": "1",
      "etiology": "acetaminophen",
      "jaundice_to_encephalopathy_days": "2",
      "pt_sec": "20",
      "unfavorable_etiology": "false"
    }
  ]
}

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/kings_college",
  "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": "O'Grady JG, Alexander GJ, Hayllar KM, Williams R",
        "doi": "10.1016/0016-5085(89)90081-4",
        "id": "ogrady-1989",
        "pmid": "2490426",
        "source": "Gastroenterology. 1989;97(2):439-445",
        "title": "Early indicators of prognosis in fulminant hepatic failure"
      },
      "formula": "kings_college",
      "formula_expression": "acetaminophen: arterial_ph < 7.30, or (pt_sec > 100 and creatinine_umol_l > 300 and encephalopathy_grade >= 3); non_acetaminophen: pt_sec > 100, or at least 3 of (age_years < 11 or > 40; unfavorable_etiology; jaundice_to_encephalopathy_days > 7; bilirubin_umol_l > 300; pt_sec > 50)",
      "criteria": [
        {
          "value": 7.4,
          "factor": "arterial_ph_lt_7_30",
          "met": false
        },
        {
          "value": 20.0,
          "factor": "pt_sec_gt_100",
          "met": false
        },
        {
          "value": 80.0,
          "factor": "creatinine_umol_l_gt_300",
          "met": false
        },
        {
          "value": 1,
          "factor": "encephalopathy_grade_ge_3",
          "met": false
        }
      ],
      "criteria_met": false,
      "etiology": "acetaminophen"
    },
    {
      "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": "O'Grady JG, Alexander GJ, Hayllar KM, Williams R",
        "doi": "10.1016/0016-5085(89)90081-4",
        "id": "ogrady-1989",
        "pmid": "2490426",
        "source": "Gastroenterology. 1989;97(2):439-445",
        "title": "Early indicators of prognosis in fulminant hepatic failure"
      },
      "formula": "kings_college",
      "formula_expression": "acetaminophen: arterial_ph < 7.30, or (pt_sec > 100 and creatinine_umol_l > 300 and encephalopathy_grade >= 3); non_acetaminophen: pt_sec > 100, or at least 3 of (age_years < 11 or > 40; unfavorable_etiology; jaundice_to_encephalopathy_days > 7; bilirubin_umol_l > 300; pt_sec > 50)",
      "criteria": [
        {
          "value": 7.4,
          "factor": "arterial_ph_lt_7_30",
          "met": false
        },
        {
          "value": 20.0,
          "factor": "pt_sec_gt_100",
          "met": false
        },
        {
          "value": 80.0,
          "factor": "creatinine_umol_l_gt_300",
          "met": false
        },
        {
          "value": 1,
          "factor": "encephalopathy_grade_ge_3",
          "met": false
        }
      ],
      "criteria_met": false,
      "etiology": "acetaminophen"
    }
  ]
}

Response

Field Type Description
formula string kings_college
formula_expression string O'Grady 1989 acetaminophen and non-acetaminophen poor-prognosis trees
criteria_met boolean true when the selected 1989 tree indicates poor prognosis. Not a transplant listing or organ-allocation order.
etiology string acetaminophen or non_acetaminophen tree used
criteria array Selected-tree factors only, each with factor, met, and value when numeric
citation object O'Grady 1989 Gastroenterology 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": "O'Grady JG, Alexander GJ, Hayllar KM, Williams R",
    "doi": "10.1016/0016-5085(89)90081-4",
    "id": "ogrady-1989",
    "pmid": "2490426",
    "source": "Gastroenterology. 1989;97(2):439-445",
    "title": "Early indicators of prognosis in fulminant hepatic failure"
  },
  "formula": "kings_college",
  "formula_expression": "acetaminophen: arterial_ph < 7.30, or (pt_sec > 100 and creatinine_umol_l > 300 and encephalopathy_grade >= 3); non_acetaminophen: pt_sec > 100, or at least 3 of (age_years < 11 or > 40; unfavorable_etiology; jaundice_to_encephalopathy_days > 7; bilirubin_umol_l > 300; pt_sec > 50)",
  "criteria": [
    {
      "value": 7.4,
      "factor": "arterial_ph_lt_7_30",
      "met": false
    },
    {
      "value": 20.0,
      "factor": "pt_sec_gt_100",
      "met": false
    },
    {
      "value": 80.0,
      "factor": "creatinine_umol_l_gt_300",
      "met": false
    },
    {
      "value": 1,
      "factor": "encephalopathy_grade_ge_3",
      "met": false
    }
  ],
  "criteria_met": false,
  "etiology": "acetaminophen"
}

Client errors (HTTP 400)

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

HTTP Code When
400 invalid_kings_etiology etiology must be acetaminophen or non_acetaminophen (O'Grady 1989). Returned before settlement; you are not charged.
400 invalid_arterial_ph arterial_ph must be a number from 6.80 to 7.80. Returned before settlement; you are not charged.
400 invalid_prothrombin_time pt_sec (8-120) is required, or pt_patient_sec (8-120) and pt_control_sec (8-20) are required. Returned before settlement; you are not charged.
400 invalid_creatinine creatinine_mg_dl (0.1-20) or creatinine_umol_l (9-1768) is required Returned before settlement; you are not charged.
400 invalid_west_haven_grade grade must be an integer from 0 to 4 (Conn 1977). Returned before settlement; you are not charged.
400 invalid_kings_age age_years must be a number from 0 to 120 (O'Grady 1989 includes children). 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_jaundice_days jaundice_to_encephalopathy_days must be an integer from 0 to 90. 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

  • Lille score — Compute the Louvet 2007 Lille score from age, day-0 albumin, bilirubin on day 0 and day 7, creatinine, and PT seconds or INR. formula is required.
  • Maddrey DF — Compute the 1978 Maddrey discriminant function from patient PT, control PT, and bilirubin.
  • MELD-Na — Compute OPTN/UNOS 2016 MELD and MELD-Na from creatinine, bilirubin, INR, sodium, and dialysis.
  • West Haven — Return the Conn 1977 (West Haven / Conn score) hepatic encephalopathy grade 0-4 from a caller-assigned integer.

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.