# Lille score (Louvet 2007)

Lille score

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

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

## What it computes

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.

## When to use

When an agent needs the published Lille logistic and 0.45 cutoff and must not swap PT for INR or treat the band as a steroid order.

## When not to use

- Not a medical device. magent does not recommend starting, stopping, or continuing corticosteroids or any other therapy.
- formula=pt or formula=inr is required. PT seconds and INR are not interchangeable; magent does not convert one to the other.
- responder and nonresponder are the paper's 0.45 cutoff on the Lille score, not a steroid order.

## Formula

```
R = 3.19 - 0.101*age + 0.147*albumin_g_l + 0.0165*evolution_bilirubin_umol_l - 0.206*renal_insufficiency - 0.0065*bilirubin_day0_umol_l - 0.0096*pt_sec; lille_score = exp(-R)/(1+exp(-R))
```

## Citation

[The Lille model: a new tool for therapeutic strategy in patients with severe alcoholic hepatitis treated with steroids](https://doi.org/10.1002/hep.21607)
Louvet A, Naveau S, Abdelnour M, et al.
Hepatology. 2007;45(6):1348-1354
DOI: [10.1002/hep.21607](https://doi.org/10.1002/hep.21607)

## Worked example

### Age 50, albumin 35 g/L, bilirubin 200→150 µmol/L, creatinine 1.0, PT 18 s

Given: `age=50, albumin_g_l=35, bilirubin_day0_umol_l=200, bilirubin_day7_umol_l=150, creatinine_mg_dl=1.0, formula=pt, pt_sec=18`

1. evolution bilirubin = 200 − 150 = 50 µmol/L
2. renal insufficiency = 0 (creatinine 1.0 mg/dL is not > 1.3)
3. R = 3.19 − 0.101×50 + 0.147×35 + 0.0165×50 − 0.206×0 − 0.0065×200 − 0.0096×18 = 2.6372
4. lille_score = exp(−2.6372) / (1 + exp(−2.6372)) = 0.0668; 0.0668 < 0.45 → responder


### Same labs with formula=inr and INR 2.0

Given: `age=50, albumin_g_l=35, bilirubin_day0_umol_l=200, bilirubin_day7_umol_l=150, creatinine_mg_dl=1.0, formula=inr, inr=2.0`

1. PT term is replaced with −0.0096×INR; formula=inr is required
2. score is still < 0.45 → responder


## Also searched as

- Lille score
- Lille model
- Louvet Lille
- alcoholic hepatitis Lille
- Lille 0.45
- steroid response Lille
- Lille PT INR

## Parameters

- `formula` (string, required): pt (prothrombin time in seconds) or inr. Required; magent does not swap PT and INR.
- `age` (integer, required): Age in years (18-120).
- `albumin_g_l` (number, optional): Day-0 albumin in g/L (10-60). Provide this or albumin_g_dl, not both. Louvet 2007 uses g/L.
- `albumin_g_dl` (number, optional): Day-0 albumin in g/dL (1-6). Converted as g/L = g/dL × 10.
- `bilirubin_day0_umol_l` (number, optional): Day-0 total bilirubin in µmol/L (2-684). Provide this or bilirubin_day0_mg_dl.
- `bilirubin_day0_mg_dl` (number, optional): Day-0 total bilirubin in mg/dL (0.1-40). Converted as µmol/L = mg/dL × 17.1.
- `bilirubin_day7_umol_l` (number, optional): Day-7 total bilirubin in µmol/L (2-684). Provide this or bilirubin_day7_mg_dl.
- `bilirubin_day7_mg_dl` (number, optional): Day-7 total bilirubin in mg/dL (0.1-40). Converted as µmol/L = mg/dL × 17.1.
- `creatinine_mg_dl` (number, optional): Serum creatinine in mg/dL (0.1-20). Provide this or creatinine_umol_l. Renal insufficiency is 1 when > 1.3 mg/dL if this unit is used (Louvet 2007).
- `creatinine_umol_l` (number, optional): Serum creatinine in µmol/L (9-1768). Provide this or creatinine_mg_dl. Renal insufficiency is 1 when > 115 µmol/L if this unit is used (Louvet 2007).
- `pt_sec` (number, optional): Prothrombin time in seconds (8-120). Required when formula=pt. Ignored when formula=inr.
- `inr` (number, optional): INR (0.8-10). Required when formula=inr. Ignored when formula=pt.

## 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/lille`
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": [
    {
      "age": "50",
      "albumin_g_l": "35",
      "bilirubin_day0_umol_l": "200",
      "bilirubin_day7_umol_l": "150",
      "creatinine_mg_dl": "1.0",
      "formula": "pt",
      "pt_sec": "18"
    },
    {
      "age": "50",
      "albumin_g_l": "35",
      "bilirubin_day0_umol_l": "200",
      "bilirubin_day7_umol_l": "150",
      "creatinine_mg_dl": "1.0",
      "formula": "pt",
      "pt_sec": "18"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/lille",
  "items": [
    {
      "response": "responder",
      "r": 2.6372,
      "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": "Louvet A, Naveau S, Abdelnour M, et al.",
        "doi": "10.1002/hep.21607",
        "id": "louvet-2007",
        "pmid": "17518367",
        "source": "Hepatology. 2007;45(6):1348-1354",
        "title": "The Lille model: a new tool for therapeutic strategy in patients with severe alcoholic hepatitis treated with steroids"
      },
      "formula": "pt",
      "formula_expression": "R = 3.19 - 0.101*age + 0.147*albumin_g_l + 0.0165*evolution_bilirubin_umol_l - 0.206*renal_insufficiency - 0.0065*bilirubin_day0_umol_l - 0.0096*pt_sec; lille_score = exp(-R)/(1+exp(-R))",
      "age_years": 50,
      "creatinine_mg_dl": 1.0,
      "albumin_g_l": 35.0,
      "pt_sec": 18.0,
      "bilirubin_day0_umol_l": 200.0,
      "bilirubin_day7_umol_l": 150.0,
      "evolution_bilirubin_umol_l": 50.0,
      "lille_score": 0.0668,
      "renal_insufficiency": false
    },
    {
      "response": "responder",
      "r": 2.6372,
      "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": "Louvet A, Naveau S, Abdelnour M, et al.",
        "doi": "10.1002/hep.21607",
        "id": "louvet-2007",
        "pmid": "17518367",
        "source": "Hepatology. 2007;45(6):1348-1354",
        "title": "The Lille model: a new tool for therapeutic strategy in patients with severe alcoholic hepatitis treated with steroids"
      },
      "formula": "pt",
      "formula_expression": "R = 3.19 - 0.101*age + 0.147*albumin_g_l + 0.0165*evolution_bilirubin_umol_l - 0.206*renal_insufficiency - 0.0065*bilirubin_day0_umol_l - 0.0096*pt_sec; lille_score = exp(-R)/(1+exp(-R))",
      "age_years": 50,
      "creatinine_mg_dl": 1.0,
      "albumin_g_l": 35.0,
      "pt_sec": 18.0,
      "bilirubin_day0_umol_l": 200.0,
      "bilirubin_day7_umol_l": 150.0,
      "evolution_bilirubin_umol_l": 50.0,
      "lille_score": 0.0668,
      "renal_insufficiency": false
    }
  ]
}
```

## Response fields

- `formula` (string): pt or inr
- `formula_expression` (string): Exact expression used
- `r` (number): Linear predictor R, 4 decimal places
- `lille_score` (number): Lille score 0-1, 4 decimal places
- `response` (string): responder if score < 0.45; nonresponder if score ≥ 0.45 (Louvet 2007)
- `renal_insufficiency` (boolean): true when creatinine > 1.3 mg/dL
- `age_years` (integer): Age used
- `albumin_g_l` (number): Day-0 albumin in g/L
- `bilirubin_day0_umol_l` (number): Day-0 bilirubin in µmol/L
- `bilirubin_day7_umol_l` (number): Day-7 bilirubin in µmol/L
- `evolution_bilirubin_umol_l` (number): bilirubin_day0 − bilirubin_day7 in µmol/L
- `creatinine_mg_dl` (number): Normalized creatinine in mg/dL
- `pt_sec` (number): PT in seconds when formula=pt. Omitted when formula=inr.
- `inr` (number): INR when formula=inr. Omitted when formula=pt.
- `citation` (object): Louvet 2007 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "response": "responder",
  "r": 2.6372,
  "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": "Louvet A, Naveau S, Abdelnour M, et al.",
    "doi": "10.1002/hep.21607",
    "id": "louvet-2007",
    "pmid": "17518367",
    "source": "Hepatology. 2007;45(6):1348-1354",
    "title": "The Lille model: a new tool for therapeutic strategy in patients with severe alcoholic hepatitis treated with steroids"
  },
  "formula": "pt",
  "formula_expression": "R = 3.19 - 0.101*age + 0.147*albumin_g_l + 0.0165*evolution_bilirubin_umol_l - 0.206*renal_insufficiency - 0.0065*bilirubin_day0_umol_l - 0.0096*pt_sec; lille_score = exp(-R)/(1+exp(-R))",
  "age_years": 50,
  "creatinine_mg_dl": 1.0,
  "albumin_g_l": 35.0,
  "pt_sec": 18.0,
  "bilirubin_day0_umol_l": 200.0,
  "bilirubin_day7_umol_l": 150.0,
  "evolution_bilirubin_umol_l": 50.0,
  "lille_score": 0.0668,
  "renal_insufficiency": false
}
```

## Errors

- HTTP 400 `invalid_lille_formula`: formula must be pt or inr (Louvet 2007). Returned before settlement; you are not charged.
- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 Returned before settlement; you are not charged.
- HTTP 400 `invalid_albumin`: albumin_g_dl (1-6) or albumin_g_l (10-60) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_bilirubin`: bilirubin_mg_dl (0.1-40) or bilirubin_umol_l (2-684) is required Returned before settlement; you are not charged.
- HTTP 400 `invalid_creatinine`: creatinine_mg_dl (0.1-20) or creatinine_umol_l (9-1768) is required Returned before settlement; you are not charged.
- HTTP 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.
- HTTP 400 `invalid_inr`: inr must be a number from 0.8 to 10 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

- [Maddrey DF](https://magentlab.com/docs/maddrey) — Compute the 1978 Maddrey discriminant function from patient PT, control PT, and bilirubin.
- [GAHS](https://magentlab.com/docs/gahs) — Compute the Forrest 2005 Glasgow alcoholic hepatitis score (5-12) and the published ≥9 band.
- [MELD-Na](https://magentlab.com/docs/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.

- 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 echoing accepted, payload, and extensions when present).
- 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.
- 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.
