# TG18 acute cholecystitis

Tokyo cholecystitis

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

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

## What it computes

Apply Yokoe 2018 Tokyo Guidelines 2018 diagnostic criteria and severity grading of acute cholecystitis (unchanged from TG13) and return diagnosis (definite, suspected, or none) and severity (grade_i, grade_ii, grade_iii, or none) from caller-assigned flags.

## When to use

When an agent already has caller-assigned local signs, systemic signs, imaging findings, and organ-dysfunction or Grade II flags and needs the published TG18 (=TG13) cholecystitis classification. magent does not examine the patient, assay CRP or WBC, or read imaging. Not TG18 cholangitis. Not Alvarado or RIPASA.

## When not to use

- Not a medical device and not a diagnosis of acute cholecystitis that replaces imaging.
- TG18 diagnostic criteria and severity grading of acute cholecystitis are unchanged from TG13 (Yokoe 2018).
- This tool is acute cholecystitis only. It is not TG18 acute cholangitis and not Alvarado or RIPASA (appendicitis scores).
- magent does not examine the patient, assay CRP or WBC, or read imaging. The caller assigns every flag.
- Not a cholecystectomy order. Severity is none when diagnosis is none. Grade III beats Grade II.

## Formula

```
definite iff local_signs and systemic_signs and imaging_findings; suspected iff local_signs and systemic_signs without imaging_findings; else none. local_signs iff murphy or ruq_mass_pain_tenderness; systemic_signs iff fever or elevated_crp or elevated_wbc. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any Grade II flag (wbc_gt_18000, palpable_tender_ruq_mass, duration_gt_72h, marked_local_inflammation), else grade_i. When diagnosis is none, severity is none (Yokoe 2018 TG18 = TG13 unmodified)
```

## Citation

[Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholecystitis (with videos).](https://doi.org/10.1002/jhbp.515)
Yokoe M, Hata J, Takada T, et al.
J Hepatobiliary Pancreat Sci. 2018;25(1):41-54
DOI: [10.1002/jhbp.515](https://doi.org/10.1002/jhbp.515)

## Worked example

### No local, systemic, or imaging findings

Given: `decreased_consciousness=false, duration_gt_72h=false, elevated_crp=false, elevated_wbc=false, fever=false, hypotension_vasopressors=false, imaging_findings=false, marked_local_inflammation=false, murphy=false, oliguria_or_creatinine_gt_2=false, palpable_tender_ruq_mass=false, pfr_lt_300=false, platelets_lt_100k=false, pt_inr_gt_1_5=false, ruq_mass_pain_tenderness=false, wbc_gt_18000=false`

1. local_signs, systemic_signs, and imaging_findings are all false
2. diagnosis is none; severity is none (Grade I is not reported without cholecystitis)


### Murphy and fever without imaging is suspected Grade I

Given: `decreased_consciousness=false, duration_gt_72h=false, elevated_crp=false, elevated_wbc=false, fever=true, hypotension_vasopressors=false, imaging_findings=false, marked_local_inflammation=false, murphy=true, oliguria_or_creatinine_gt_2=false, palpable_tender_ruq_mass=false, pfr_lt_300=false, platelets_lt_100k=false, pt_inr_gt_1_5=false, ruq_mass_pain_tenderness=false, wbc_gt_18000=false`

1. local_signs and systemic_signs hold; imaging_findings is false
2. diagnosis is suspected; no Grade II or Grade III flag, so severity is grade_i


## Also searched as

- Tokyo Guidelines 2018 cholecystitis
- TG18 acute cholecystitis
- TG13 cholecystitis
- Yokoe 2018
- acute cholecystitis diagnostic criteria
- Tokyo cholecystitis severity grade
- Murphy sign cholecystitis
- TG18 Grade III cholecystitis

## Parameters

- `murphy` (boolean, required): Murphy's sign as assigned by the caller (Yokoe 2018 TG18 local sign of inflammation A). true or false. magent does not examine the patient.
- `ruq_mass_pain_tenderness` (boolean, required): Right upper quadrant mass, pain, or tenderness as assigned by the caller (Yokoe 2018 TG18 local sign of inflammation A). true or false. magent does not examine the patient.
- `fever` (boolean, required): Fever as assigned by the caller (Yokoe 2018 TG18 systemic sign of inflammation B). true or false. magent does not measure temperature.
- `elevated_crp` (boolean, required): Elevated C-reactive protein as assigned by the caller (Yokoe 2018 TG18 systemic sign of inflammation B). true or false. magent does not assay CRP.
- `elevated_wbc` (boolean, required): Elevated white blood cell count as assigned by the caller (Yokoe 2018 TG18 systemic sign of inflammation B). true or false. magent does not assay WBC.
- `imaging_findings` (boolean, required): Imaging findings characteristic of acute cholecystitis as assigned by the caller (Yokoe 2018 TG18 diagnostic criterion C). true or false. magent does not read imaging.
- `hypotension_vasopressors` (boolean, required): Hypotension requiring dopamine ≥5 µg/kg/min or any norepinephrine as assigned by the caller (Yokoe 2018 TG18 Grade III cardiovascular dysfunction). true or false. magent does not measure blood pressure or order vasopressors.
- `decreased_consciousness` (boolean, required): Decreased level of consciousness as assigned by the caller (Yokoe 2018 TG18 Grade III neurological dysfunction). true or false. magent does not examine the patient.
- `pfr_lt_300` (boolean, required): PaO2/FiO2 <300 as assigned by the caller (Yokoe 2018 TG18 Grade III respiratory dysfunction). true or false. magent does not interpret blood gas or ventilator settings.
- `oliguria_or_creatinine_gt_2` (boolean, required): Oliguria or creatinine >2.0 mg/dL as assigned by the caller (Yokoe 2018 TG18 Grade III renal dysfunction). true or false. magent does not assay creatinine or measure urine output.
- `pt_inr_gt_1_5` (boolean, required): PT-INR >1.5 as assigned by the caller (Yokoe 2018 TG18 Grade III hepatic dysfunction). true or false. magent does not interpret coagulation assays.
- `platelets_lt_100k` (boolean, required): Platelet count <100,000/mm³ as assigned by the caller (Yokoe 2018 TG18 Grade III hematological dysfunction). true or false. magent does not assay platelets.
- `wbc_gt_18000` (boolean, required): White blood cell count >18,000/mm³ as assigned by the caller (Yokoe 2018 TG18 Grade II). true or false. magent does not assay WBC.
- `palpable_tender_ruq_mass` (boolean, required): Palpable tender mass in the right upper quadrant as assigned by the caller (Yokoe 2018 TG18 Grade II). true or false. magent does not examine the patient.
- `duration_gt_72h` (boolean, required): Duration of complaints >72 h as assigned by the caller (Yokoe 2018 TG18 Grade II). true or false. magent does not take a history.
- `marked_local_inflammation` (boolean, required): Marked local inflammation (gangrenous cholecystitis, pericholecystic abscess, hepatic abscess, biliary peritonitis, or emphysematous cholecystitis) as assigned by the caller (Yokoe 2018 TG18 Grade II). true or false. magent does not interpret imaging or operative findings.

## 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/tokyo_cholecystitis`
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": [
    {
      "decreased_consciousness": "false",
      "duration_gt_72h": "false",
      "elevated_crp": "false",
      "elevated_wbc": "false",
      "fever": "false",
      "hypotension_vasopressors": "false",
      "imaging_findings": "false",
      "marked_local_inflammation": "false",
      "murphy": "false",
      "oliguria_or_creatinine_gt_2": "false",
      "palpable_tender_ruq_mass": "false",
      "pfr_lt_300": "false",
      "platelets_lt_100k": "false",
      "pt_inr_gt_1_5": "false",
      "ruq_mass_pain_tenderness": "false",
      "wbc_gt_18000": "false"
    },
    {
      "decreased_consciousness": "false",
      "duration_gt_72h": "false",
      "elevated_crp": "false",
      "elevated_wbc": "false",
      "fever": "false",
      "hypotension_vasopressors": "false",
      "imaging_findings": "false",
      "marked_local_inflammation": "false",
      "murphy": "false",
      "oliguria_or_creatinine_gt_2": "false",
      "palpable_tender_ruq_mass": "false",
      "pfr_lt_300": "false",
      "platelets_lt_100k": "false",
      "pt_inr_gt_1_5": "false",
      "ruq_mass_pain_tenderness": "false",
      "wbc_gt_18000": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/tokyo_cholecystitis",
  "items": [
    {
      "severity": "none",
      "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": "Yokoe M, Hata J, Takada T, et al.",
        "doi": "10.1002/jhbp.515",
        "id": "yokoe-2018",
        "pmid": "29032636",
        "source": "J Hepatobiliary Pancreat Sci. 2018;25(1):41-54",
        "title": "Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholecystitis (with videos)."
      },
      "formula": "tokyo_cholecystitis",
      "formula_expression": "definite iff local_signs and systemic_signs and imaging_findings; suspected iff local_signs and systemic_signs without imaging_findings; else none. local_signs iff murphy or ruq_mass_pain_tenderness; systemic_signs iff fever or elevated_crp or elevated_wbc. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any Grade II flag (wbc_gt_18000, palpable_tender_ruq_mass, duration_gt_72h, marked_local_inflammation), else grade_i. When diagnosis is none, severity is none (Yokoe 2018 TG18 = TG13 unmodified)",
      "criteria": [
        {
          "factor": "local_signs",
          "met": false
        },
        {
          "factor": "systemic_signs",
          "met": false
        },
        {
          "factor": "imaging_findings",
          "met": false
        },
        {
          "factor": "grade_iii_any",
          "met": false
        },
        {
          "factor": "grade_ii_any",
          "met": false
        },
        {
          "factor": "murphy",
          "met": false
        },
        {
          "factor": "ruq_mass_pain_tenderness",
          "met": false
        },
        {
          "factor": "fever",
          "met": false
        },
        {
          "factor": "elevated_crp",
          "met": false
        },
        {
          "factor": "elevated_wbc",
          "met": false
        },
        {
          "factor": "hypotension_vasopressors",
          "met": false
        },
        {
          "factor": "decreased_consciousness",
          "met": false
        },
        {
          "factor": "pfr_lt_300",
          "met": false
        },
        {
          "factor": "oliguria_or_creatinine_gt_2",
          "met": false
        },
        {
          "factor": "pt_inr_gt_1_5",
          "met": false
        },
        {
          "factor": "platelets_lt_100k",
          "met": false
        },
        {
          "factor": "wbc_gt_18000",
          "met": false
        },
        {
          "factor": "palpable_tender_ruq_mass",
          "met": false
        },
        {
          "factor": "duration_gt_72h",
          "met": false
        },
        {
          "factor": "marked_local_inflammation",
          "met": false
        }
      ],
      "diagnosis": "none"
    },
    {
      "severity": "none",
      "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": "Yokoe M, Hata J, Takada T, et al.",
        "doi": "10.1002/jhbp.515",
        "id": "yokoe-2018",
        "pmid": "29032636",
        "source": "J Hepatobiliary Pancreat Sci. 2018;25(1):41-54",
        "title": "Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholecystitis (with videos)."
      },
      "formula": "tokyo_cholecystitis",
      "formula_expression": "definite iff local_signs and systemic_signs and imaging_findings; suspected iff local_signs and systemic_signs without imaging_findings; else none. local_signs iff murphy or ruq_mass_pain_tenderness; systemic_signs iff fever or elevated_crp or elevated_wbc. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any Grade II flag (wbc_gt_18000, palpable_tender_ruq_mass, duration_gt_72h, marked_local_inflammation), else grade_i. When diagnosis is none, severity is none (Yokoe 2018 TG18 = TG13 unmodified)",
      "criteria": [
        {
          "factor": "local_signs",
          "met": false
        },
        {
          "factor": "systemic_signs",
          "met": false
        },
        {
          "factor": "imaging_findings",
          "met": false
        },
        {
          "factor": "grade_iii_any",
          "met": false
        },
        {
          "factor": "grade_ii_any",
          "met": false
        },
        {
          "factor": "murphy",
          "met": false
        },
        {
          "factor": "ruq_mass_pain_tenderness",
          "met": false
        },
        {
          "factor": "fever",
          "met": false
        },
        {
          "factor": "elevated_crp",
          "met": false
        },
        {
          "factor": "elevated_wbc",
          "met": false
        },
        {
          "factor": "hypotension_vasopressors",
          "met": false
        },
        {
          "factor": "decreased_consciousness",
          "met": false
        },
        {
          "factor": "pfr_lt_300",
          "met": false
        },
        {
          "factor": "oliguria_or_creatinine_gt_2",
          "met": false
        },
        {
          "factor": "pt_inr_gt_1_5",
          "met": false
        },
        {
          "factor": "platelets_lt_100k",
          "met": false
        },
        {
          "factor": "wbc_gt_18000",
          "met": false
        },
        {
          "factor": "palpable_tender_ruq_mass",
          "met": false
        },
        {
          "factor": "duration_gt_72h",
          "met": false
        },
        {
          "factor": "marked_local_inflammation",
          "met": false
        }
      ],
      "diagnosis": "none"
    }
  ]
}
```

## Response fields

- `formula` (string): tokyo_cholecystitis
- `formula_expression` (string): Yokoe 2018 TG18 (=TG13) acute cholecystitis diagnostic criteria and severity grading
- `diagnosis` (string): definite when local_signs, systemic_signs, and imaging_findings all hold; suspected when local_signs and systemic_signs hold without imaging_findings; otherwise none. Not a diagnosis that replaces imaging.
- `severity` (string): none when diagnosis is none; otherwise grade_iii if any organ-dysfunction flag, else grade_ii if any Grade II flag, else grade_i. Grade III beats Grade II. Not a cholecystectomy order.
- `criteria` (array): Rows for local_signs (A), systemic_signs (B), imaging_findings (C), grade_iii_any, grade_ii_any, then each remaining caller-assigned flag (factor and met)
- `citation` (object): Yokoe 2018 J Hepatobiliary Pancreat Sci citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "severity": "none",
  "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": "Yokoe M, Hata J, Takada T, et al.",
    "doi": "10.1002/jhbp.515",
    "id": "yokoe-2018",
    "pmid": "29032636",
    "source": "J Hepatobiliary Pancreat Sci. 2018;25(1):41-54",
    "title": "Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholecystitis (with videos)."
  },
  "formula": "tokyo_cholecystitis",
  "formula_expression": "definite iff local_signs and systemic_signs and imaging_findings; suspected iff local_signs and systemic_signs without imaging_findings; else none. local_signs iff murphy or ruq_mass_pain_tenderness; systemic_signs iff fever or elevated_crp or elevated_wbc. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any Grade II flag (wbc_gt_18000, palpable_tender_ruq_mass, duration_gt_72h, marked_local_inflammation), else grade_i. When diagnosis is none, severity is none (Yokoe 2018 TG18 = TG13 unmodified)",
  "criteria": [
    {
      "factor": "local_signs",
      "met": false
    },
    {
      "factor": "systemic_signs",
      "met": false
    },
    {
      "factor": "imaging_findings",
      "met": false
    },
    {
      "factor": "grade_iii_any",
      "met": false
    },
    {
      "factor": "grade_ii_any",
      "met": false
    },
    {
      "factor": "murphy",
      "met": false
    },
    {
      "factor": "ruq_mass_pain_tenderness",
      "met": false
    },
    {
      "factor": "fever",
      "met": false
    },
    {
      "factor": "elevated_crp",
      "met": false
    },
    {
      "factor": "elevated_wbc",
      "met": false
    },
    {
      "factor": "hypotension_vasopressors",
      "met": false
    },
    {
      "factor": "decreased_consciousness",
      "met": false
    },
    {
      "factor": "pfr_lt_300",
      "met": false
    },
    {
      "factor": "oliguria_or_creatinine_gt_2",
      "met": false
    },
    {
      "factor": "pt_inr_gt_1_5",
      "met": false
    },
    {
      "factor": "platelets_lt_100k",
      "met": false
    },
    {
      "factor": "wbc_gt_18000",
      "met": false
    },
    {
      "factor": "palpable_tender_ruq_mass",
      "met": false
    },
    {
      "factor": "duration_gt_72h",
      "met": false
    },
    {
      "factor": "marked_local_inflammation",
      "met": false
    }
  ],
  "diagnosis": "none"
}
```

## Errors

- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false 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

- [Alvarado score](https://magentlab.com/docs/alvarado) — Compute the Alvarado 1986 MANTRELS score from caller-assigned findings, temperature, WBC, and neutrophil percent.
- [RIPASA score](https://magentlab.com/docs/ripasa) — Sum the Chong 2010 RIPASA points from 15 caller-assigned findings and return below_cutoff (<7.5) or at_or_above_cutoff (≥7.5) from the derivation ROC only.

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