# Los Angeles classification of oesophagitis

LA grading

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/la_grading`
HTML: https://magentlab.com/docs/la-grading
Markdown: https://magentlab.com/docs/la-grading.md

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

## What it computes

Apply Lundell 1999 Table 1 Los Angeles classification of oesophagitis and return la_grade (none, A, B, C, or D) from four caller-assigned endoscopic flags.

## When to use

When an agent already has endoscopic mucosal-break flags as assigned at endoscopy (presence of a mucosal break, longest break more than 5 mm, continuity between fold tops, and at least 75% circumference) and needs the published 1999 LA grade. magent does not interpret endoscopy images.

## When not to use

- Not a medical device.
- Not a GERD diagnosis. magent does not diagnose gastro-oesophageal reflux disease.
- The caller assigns the four endoscopic flags. magent does not interpret endoscopy images.
- This tool is Lundell 1999 Table 1 Los Angeles classification only. Not Savary-Miller. Not Barrett or stricture grading (the paper records those separately). Not the 1994 proposed LA system (grade D was fully circumferential; 1999 changed D to at least 75% of circumference).
- Absence of a mucosal break returns none. That is not a minimal changes grade; Lundell 1999 found those changes unreliable.

## Formula

```
la_grade is none if mucosal_break is false (no LA A-D; not minimal changes); else D if circumference_ge_75_percent (mucosal break(s) involve at least 75% of the oesophageal circumference); else C if continuous_between_folds (continuous between the tops of two or more mucosal folds but less than 75% of circumference); else B if longest_break_gt_5_mm (one or more breaks more than 5 mm that do not extend between the tops of two mucosal folds); else A (one or more breaks no longer than 5 mm that do not extend between the tops of two mucosal folds) (Lundell 1999 Table 1 Los Angeles classification)
```

## Citation

[Endoscopic assessment of oesophagitis: clinical and functional correlates and further validation of the Los Angeles classification](https://doi.org/10.1136/gut.45.2.172)
Lundell LR, Dent J, Bennett JR, Blum AL, Armstrong D, Galmiche JP, Johnson F, Hongo M, Richter JE, Spechler SJ, Tytgat GN, Wallin L
Gut. 1999;45(2):172-180
DOI: [10.1136/gut.45.2.172](https://doi.org/10.1136/gut.45.2.172)

## Worked example

### No mucosal break

Given: `circumference_ge_75_percent=false, continuous_between_folds=false, longest_break_gt_5_mm=false, mucosal_break=false`

1. mucosal_break is false (no mucosal break as assigned)
2. longest_break_gt_5_mm, continuous_between_folds, and circumference_ge_75_percent are required and false; they do not change the result
3. la_grade is none (no LA A-D; not minimal changes)


### Mucosal breaks no longer than 5 mm, not between fold tops

Given: `circumference_ge_75_percent=false, continuous_between_folds=false, longest_break_gt_5_mm=false, mucosal_break=true`

1. mucosal_break is true
2. circumference_ge_75_percent is false (not D)
3. continuous_between_folds is false (not C)
4. longest_break_gt_5_mm is false (not B)
5. la_grade is A


## Also searched as

- Los Angeles classification
- LA grade oesophagitis
- Lundell 1999
- Los Angeles esophagitis
- LA classification A B C D
- mucosal break oesophagitis
- reflux oesophagitis LA grade
- LA 1999 oesophagitis
- Los Angeles grading

## Parameters

- `mucosal_break` (boolean, required): One or more mucosal breaks present, as assigned by the caller. Lundell 1999 defines a mucosal break as an area of slough or erythema with a discrete line of demarcation from adjacent more normal-looking mucosa. true or false. If false, la_grade is none (no LA A-D; not minimal changes). magent does not interpret endoscopy images.
- `longest_break_gt_5_mm` (boolean, required): Longest mucosal break more than 5 mm long, as assigned by the caller (Lundell 1999 Table 1 grade B vs A). true or false. Required even when mucosal_break is false (does not change none). magent does not measure lesions.
- `continuous_between_folds` (boolean, required): A mucosal break is continuous between the tops of two or more mucosal folds, as assigned by the caller (Lundell 1999 Table 1 grade C). true or false. Required even when mucosal_break is false (does not change none). magent does not interpret endoscopy images.
- `circumference_ge_75_percent` (boolean, required): Mucosal break(s) involve at least 75% of the oesophageal circumference, as assigned by the caller (Lundell 1999 Table 1 grade D; the 1999 revision, not the 1994 fully circumferential proposal). true or false. Required even when mucosal_break is false (does not change none). magent does not interpret endoscopy images.

## 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/la_grading`
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": [
    {
      "circumference_ge_75_percent": "false",
      "continuous_between_folds": "false",
      "longest_break_gt_5_mm": "false",
      "mucosal_break": "false"
    },
    {
      "circumference_ge_75_percent": "false",
      "continuous_between_folds": "false",
      "longest_break_gt_5_mm": "false",
      "mucosal_break": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/la_grading",
  "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": "Lundell LR, Dent J, Bennett JR, Blum AL, Armstrong D, Galmiche JP, Johnson F, Hongo M, Richter JE, Spechler SJ, Tytgat GN, Wallin L",
        "doi": "10.1136/gut.45.2.172",
        "id": "lundell-1999",
        "pmid": "10403727",
        "source": "Gut. 1999;45(2):172-180",
        "title": "Endoscopic assessment of oesophagitis: clinical and functional correlates and further validation of the Los Angeles classification"
      },
      "formula": "la_grading",
      "formula_expression": "la_grade is none if mucosal_break is false (no LA A-D; not minimal changes); else D if circumference_ge_75_percent (mucosal break(s) involve at least 75% of the oesophageal circumference); else C if continuous_between_folds (continuous between the tops of two or more mucosal folds but less than 75% of circumference); else B if longest_break_gt_5_mm (one or more breaks more than 5 mm that do not extend between the tops of two mucosal folds); else A (one or more breaks no longer than 5 mm that do not extend between the tops of two mucosal folds) (Lundell 1999 Table 1 Los Angeles classification)",
      "criteria": [
        {
          "factor": "mucosal_break",
          "met": false
        },
        {
          "factor": "longest_break_gt_5_mm",
          "met": false
        },
        {
          "factor": "continuous_between_folds",
          "met": false
        },
        {
          "factor": "circumference_ge_75_percent",
          "met": false
        },
        {
          "factor": "none",
          "met": true
        },
        {
          "factor": "A",
          "met": false
        },
        {
          "factor": "B",
          "met": false
        },
        {
          "factor": "C",
          "met": false
        },
        {
          "factor": "D",
          "met": false
        }
      ],
      "la_grade": "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": "Lundell LR, Dent J, Bennett JR, Blum AL, Armstrong D, Galmiche JP, Johnson F, Hongo M, Richter JE, Spechler SJ, Tytgat GN, Wallin L",
        "doi": "10.1136/gut.45.2.172",
        "id": "lundell-1999",
        "pmid": "10403727",
        "source": "Gut. 1999;45(2):172-180",
        "title": "Endoscopic assessment of oesophagitis: clinical and functional correlates and further validation of the Los Angeles classification"
      },
      "formula": "la_grading",
      "formula_expression": "la_grade is none if mucosal_break is false (no LA A-D; not minimal changes); else D if circumference_ge_75_percent (mucosal break(s) involve at least 75% of the oesophageal circumference); else C if continuous_between_folds (continuous between the tops of two or more mucosal folds but less than 75% of circumference); else B if longest_break_gt_5_mm (one or more breaks more than 5 mm that do not extend between the tops of two mucosal folds); else A (one or more breaks no longer than 5 mm that do not extend between the tops of two mucosal folds) (Lundell 1999 Table 1 Los Angeles classification)",
      "criteria": [
        {
          "factor": "mucosal_break",
          "met": false
        },
        {
          "factor": "longest_break_gt_5_mm",
          "met": false
        },
        {
          "factor": "continuous_between_folds",
          "met": false
        },
        {
          "factor": "circumference_ge_75_percent",
          "met": false
        },
        {
          "factor": "none",
          "met": true
        },
        {
          "factor": "A",
          "met": false
        },
        {
          "factor": "B",
          "met": false
        },
        {
          "factor": "C",
          "met": false
        },
        {
          "factor": "D",
          "met": false
        }
      ],
      "la_grade": "none"
    }
  ]
}
```

## Response fields

- `formula` (string): la_grading
- `formula_expression` (string): Published Lundell 1999 Table 1 Los Angeles classification rule
- `la_grade` (string): none, A, B, C, or D. none if no mucosal break; D if break(s) involve at least 75% of circumference; C if continuous between fold tops but less than 75%; B if longest break more than 5 mm and not between fold tops; A if break(s) no longer than 5 mm and not between fold tops. Not a GERD diagnosis.
- `criteria` (array): Per-factor rows with factor and met for the four caller-assigned flags and exclusive grades none, A, B, C, D; exactly one grade row is met
- `citation` (object): Lundell 1999 Gut citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "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": "Lundell LR, Dent J, Bennett JR, Blum AL, Armstrong D, Galmiche JP, Johnson F, Hongo M, Richter JE, Spechler SJ, Tytgat GN, Wallin L",
    "doi": "10.1136/gut.45.2.172",
    "id": "lundell-1999",
    "pmid": "10403727",
    "source": "Gut. 1999;45(2):172-180",
    "title": "Endoscopic assessment of oesophagitis: clinical and functional correlates and further validation of the Los Angeles classification"
  },
  "formula": "la_grading",
  "formula_expression": "la_grade is none if mucosal_break is false (no LA A-D; not minimal changes); else D if circumference_ge_75_percent (mucosal break(s) involve at least 75% of the oesophageal circumference); else C if continuous_between_folds (continuous between the tops of two or more mucosal folds but less than 75% of circumference); else B if longest_break_gt_5_mm (one or more breaks more than 5 mm that do not extend between the tops of two mucosal folds); else A (one or more breaks no longer than 5 mm that do not extend between the tops of two mucosal folds) (Lundell 1999 Table 1 Los Angeles classification)",
  "criteria": [
    {
      "factor": "mucosal_break",
      "met": false
    },
    {
      "factor": "longest_break_gt_5_mm",
      "met": false
    },
    {
      "factor": "continuous_between_folds",
      "met": false
    },
    {
      "factor": "circumference_ge_75_percent",
      "met": false
    },
    {
      "factor": "none",
      "met": true
    },
    {
      "factor": "A",
      "met": false
    },
    {
      "factor": "B",
      "met": false
    },
    {
      "factor": "C",
      "met": false
    },
    {
      "factor": "D",
      "met": false
    }
  ],
  "la_grade": "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

- [Forrest](https://magentlab.com/docs/forrest) — Return the Forrest 1974 endoscopic lesion class (ia, ib, iia, iib, iic, or iii) and published description from a caller-assigned token.
- [Rome IV FD](https://magentlab.com/docs/rome-iv-fd) — Apply the Stanghellini 2016 Rome IV B1 functional dyspepsia criteria and return whether PDS (B1a), EPS (B1b), and the published FD box hold (rome_iv_fd).
- [Travis criteria](https://magentlab.com/docs/travis) — Apply the Travis 1996 day-3 of intravenous corticosteroids rule for severe ulcerative colitis and return travis_high from stools_per_day and crp_mg_l.

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