# REST-LGS Lennox-Gastaut screening

REST-LGS

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

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

## What it computes

Sum Wolf 2024 REST-LGS major (+3) and minor (+1) caller-assigned flags and return the unlikely, possible, or likely LGS screening band.

## When to use

When an agent already has the eight REST-LGS items assigned as present or absent and needs the published Wolf 2024 point total and screening band, not a diagnosis of Lennox-Gastaut syndrome.

## When not to use

- Not a medical device. Not a diagnosis of Lennox-Gastaut syndrome. Screening only.
- magent does not read EEG or charts. Each of the eight items is a caller-assigned true/false flag. There is no unknown or unavailable input; Wolf 2024 missing EEG rates are not modeled.
- Scoring is Wolf 2024: each major criterion +3, each minor +1, then sum. The 2019 CRF 3-major plus 2–3-minor count threshold is not scored here.

## Formula

```
REST-LGS = 3*two_or_more_seizure_types + 3*seizure_onset_before_12 + 3*slow_spike_wave + 3*cognitive_impairment_since_childhood + persistent_seizures_despite_two_asms + vns_keto_or_surgery + helmet_or_head_face_injury + other_eeg_abnormalities; each major 3, each minor 1; max 16; likely if score > 11; possible if 8-11; unlikely if score < 8 (Wolf 2024)
```

## Citation

[Real-world use of the updated refractory epilepsy screening tool for Lennox-Gastaut syndrome](https://doi.org/10.1002/epi4.12952)
Wolf SM, Boyce D, Peña P, Piña-Garza JE, Roland JJ, Thomas B, Zogejani D, McGoldrick PE
Epilepsia Open. 2024;9(4):1277-1286
DOI: [10.1002/epi4.12952](https://doi.org/10.1002/epi4.12952)

## Worked example

### All eight flags false

Given: `cognitive_impairment_since_childhood=false, helmet_or_head_face_injury=false, other_eeg_abnormalities=false, persistent_seizures_despite_two_asms=false, seizure_onset_before_12=false, slow_spike_wave=false, two_or_more_seizure_types=false, vns_keto_or_surgery=false`

1. All four major flags false → 0; all four minor flags false → 0
2. Score = 0 (max 16); lgs_screen is unlikely because score < 8


### Four major criteria, no minor criteria

Given: `cognitive_impairment_since_childhood=true, helmet_or_head_face_injury=false, other_eeg_abnormalities=false, persistent_seizures_despite_two_asms=false, seizure_onset_before_12=true, slow_spike_wave=true, two_or_more_seizure_types=true, vns_keto_or_surgery=false`

1. Four majors true → 3+3+3+3 = 12; four minors false → 0
2. Score = 12 (max 16); lgs_screen is likely because score > 11


### Three major criteria, no minor criteria

Given: `cognitive_impairment_since_childhood=false, helmet_or_head_face_injury=false, other_eeg_abnormalities=false, persistent_seizures_despite_two_asms=false, seizure_onset_before_12=true, slow_spike_wave=true, two_or_more_seizure_types=true, vns_keto_or_surgery=false`

1. Three majors true → 9; cognitive_impairment_since_childhood false; four minors false → 0
2. Score = 9 (max 16); lgs_screen is possible because score is 8-11


## Also searched as

- REST-LGS
- refractory epilepsy screening tool
- Lennox-Gastaut screening
- Wolf 2024 LGS score
- slow spike-wave LGS screen
- updated refractory epilepsy screening tool

## Parameters

- `two_or_more_seizure_types` (boolean, required): Two or more seizure types (Wolf 2024 major, +3). true or false as assigned by the caller.
- `seizure_onset_before_12` (boolean, required): Seizure onset at younger than 12 years of age (Wolf 2024 major, +3). Age 12 does not meet. true or false as assigned by the caller. magent does not take numeric age.
- `slow_spike_wave` (boolean, required): History of slow spike-wave (SSW, <2.5 Hz) on EEG (Wolf 2024 major, +3). true or false as assigned by the caller. magent does not read EEG.
- `cognitive_impairment_since_childhood` (boolean, required): Cognitive impairment since childhood (Wolf 2024 major, +3), which may include past or current learning difficulties, special education, autism, intellectual disabilities, or developmental delays. true or false as assigned by the caller.
- `persistent_seizures_despite_two_asms` (boolean, required): Persistent seizures despite a trial of two or more antiseizure medications (Wolf 2024 minor, +1). true or false as assigned by the caller.
- `vns_keto_or_surgery` (boolean, required): History of vagal nerve stimulation, ketogenic diet therapy, or epilepsy surgery (Wolf 2024 minor, +1). true or false as assigned by the caller.
- `helmet_or_head_face_injury` (boolean, required): Evidence of seizure-related helmet use or head/face injury (Wolf 2024 minor, +1). true or false as assigned by the caller.
- `other_eeg_abnormalities` (boolean, required): Other EEG abnormalities: multifocal spikes, symptomatic generalized discharges, generalized periods of attenuation of background/electrodecrement, or paroxysmal fast activity (Wolf 2024 minor, +1). true or false as assigned by the caller. magent does not read EEG.

## 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/rest_lgs`
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": [
    {
      "cognitive_impairment_since_childhood": "false",
      "helmet_or_head_face_injury": "false",
      "other_eeg_abnormalities": "false",
      "persistent_seizures_despite_two_asms": "false",
      "seizure_onset_before_12": "false",
      "slow_spike_wave": "false",
      "two_or_more_seizure_types": "false",
      "vns_keto_or_surgery": "false"
    },
    {
      "cognitive_impairment_since_childhood": "false",
      "helmet_or_head_face_injury": "false",
      "other_eeg_abnormalities": "false",
      "persistent_seizures_despite_two_asms": "false",
      "seizure_onset_before_12": "false",
      "slow_spike_wave": "false",
      "two_or_more_seizure_types": "false",
      "vns_keto_or_surgery": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/rest_lgs",
  "items": [
    {
      "components": [
        {
          "factor": "two_or_more_seizure_types",
          "points": 0,
          "present": false
        },
        {
          "factor": "seizure_onset_before_12",
          "points": 0,
          "present": false
        },
        {
          "factor": "slow_spike_wave",
          "points": 0,
          "present": false
        },
        {
          "factor": "cognitive_impairment_since_childhood",
          "points": 0,
          "present": false
        },
        {
          "factor": "persistent_seizures_despite_two_asms",
          "points": 0,
          "present": false
        },
        {
          "factor": "vns_keto_or_surgery",
          "points": 0,
          "present": false
        },
        {
          "factor": "helmet_or_head_face_injury",
          "points": 0,
          "present": false
        },
        {
          "factor": "other_eeg_abnormalities",
          "points": 0,
          "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": "Wolf SM, Boyce D, Peña P, Piña-Garza JE, Roland JJ, Thomas B, Zogejani D, McGoldrick PE",
        "doi": "10.1002/epi4.12952",
        "id": "wolf-2024",
        "pmid": "38726917",
        "source": "Epilepsia Open. 2024;9(4):1277-1286",
        "title": "Real-world use of the updated refractory epilepsy screening tool for Lennox-Gastaut syndrome"
      },
      "formula": "rest_lgs",
      "formula_expression": "REST-LGS = 3*two_or_more_seizure_types + 3*seizure_onset_before_12 + 3*slow_spike_wave + 3*cognitive_impairment_since_childhood + persistent_seizures_despite_two_asms + vns_keto_or_surgery + helmet_or_head_face_injury + other_eeg_abnormalities; each major 3, each minor 1; max 16; likely if score > 11; possible if 8-11; unlikely if score < 8 (Wolf 2024)",
      "max_score": 16,
      "score": 0,
      "major_count": 0,
      "minor_count": 0,
      "lgs_screen": "unlikely"
    },
    {
      "components": [
        {
          "factor": "two_or_more_seizure_types",
          "points": 0,
          "present": false
        },
        {
          "factor": "seizure_onset_before_12",
          "points": 0,
          "present": false
        },
        {
          "factor": "slow_spike_wave",
          "points": 0,
          "present": false
        },
        {
          "factor": "cognitive_impairment_since_childhood",
          "points": 0,
          "present": false
        },
        {
          "factor": "persistent_seizures_despite_two_asms",
          "points": 0,
          "present": false
        },
        {
          "factor": "vns_keto_or_surgery",
          "points": 0,
          "present": false
        },
        {
          "factor": "helmet_or_head_face_injury",
          "points": 0,
          "present": false
        },
        {
          "factor": "other_eeg_abnormalities",
          "points": 0,
          "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": "Wolf SM, Boyce D, Peña P, Piña-Garza JE, Roland JJ, Thomas B, Zogejani D, McGoldrick PE",
        "doi": "10.1002/epi4.12952",
        "id": "wolf-2024",
        "pmid": "38726917",
        "source": "Epilepsia Open. 2024;9(4):1277-1286",
        "title": "Real-world use of the updated refractory epilepsy screening tool for Lennox-Gastaut syndrome"
      },
      "formula": "rest_lgs",
      "formula_expression": "REST-LGS = 3*two_or_more_seizure_types + 3*seizure_onset_before_12 + 3*slow_spike_wave + 3*cognitive_impairment_since_childhood + persistent_seizures_despite_two_asms + vns_keto_or_surgery + helmet_or_head_face_injury + other_eeg_abnormalities; each major 3, each minor 1; max 16; likely if score > 11; possible if 8-11; unlikely if score < 8 (Wolf 2024)",
      "max_score": 16,
      "score": 0,
      "major_count": 0,
      "minor_count": 0,
      "lgs_screen": "unlikely"
    }
  ]
}
```

## Response fields

- `formula` (string): rest_lgs
- `formula_expression` (string): Exact expression used
- `score` (integer): Wolf 2024 REST-LGS points 0-16 (major +3, minor +1)
- `max_score` (integer): 16
- `lgs_screen` (string): Wolf 2024 screening band: likely if score > 11 (12-16), possible if 8-11, unlikely if score < 8 (0-7). Not a diagnosis.
- `major_count` (integer): Count of true major criteria (two_or_more_seizure_types, seizure_onset_before_12, slow_spike_wave, cognitive_impairment_since_childhood); 0-4
- `minor_count` (integer): Count of true minor criteria (persistent_seizures_despite_two_asms, vns_keto_or_surgery, helmet_or_head_face_injury, other_eeg_abnormalities); 0-4
- `components` (array): Per-item points
- `citation` (object): Wolf et al. Epilepsia Open 2024 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "two_or_more_seizure_types",
      "points": 0,
      "present": false
    },
    {
      "factor": "seizure_onset_before_12",
      "points": 0,
      "present": false
    },
    {
      "factor": "slow_spike_wave",
      "points": 0,
      "present": false
    },
    {
      "factor": "cognitive_impairment_since_childhood",
      "points": 0,
      "present": false
    },
    {
      "factor": "persistent_seizures_despite_two_asms",
      "points": 0,
      "present": false
    },
    {
      "factor": "vns_keto_or_surgery",
      "points": 0,
      "present": false
    },
    {
      "factor": "helmet_or_head_face_injury",
      "points": 0,
      "present": false
    },
    {
      "factor": "other_eeg_abnormalities",
      "points": 0,
      "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": "Wolf SM, Boyce D, Peña P, Piña-Garza JE, Roland JJ, Thomas B, Zogejani D, McGoldrick PE",
    "doi": "10.1002/epi4.12952",
    "id": "wolf-2024",
    "pmid": "38726917",
    "source": "Epilepsia Open. 2024;9(4):1277-1286",
    "title": "Real-world use of the updated refractory epilepsy screening tool for Lennox-Gastaut syndrome"
  },
  "formula": "rest_lgs",
  "formula_expression": "REST-LGS = 3*two_or_more_seizure_types + 3*seizure_onset_before_12 + 3*slow_spike_wave + 3*cognitive_impairment_since_childhood + persistent_seizures_despite_two_asms + vns_keto_or_surgery + helmet_or_head_face_injury + other_eeg_abnormalities; each major 3, each minor 1; max 16; likely if score > 11; possible if 8-11; unlikely if score < 8 (Wolf 2024)",
  "max_score": 16,
  "score": 0,
  "major_count": 0,
  "minor_count": 0,
  "lgs_screen": "unlikely"
}
```

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

- [Glasgow Coma Scale](https://magentlab.com/docs/gcs) — Compute the Glasgow Coma Scale as the sum of caller-assigned eye, verbal, and motor integers. The 1974 or 1976 edition is required.
- [TDN Grade](https://magentlab.com/docs/tdn-grade) — Apply the Terrapon 2021 Therapy-Disability-Neurology grade and return tdn_grade 1-5 as the maximum of caller-assigned therapy, mapped mRS disability, and new-deficit neurology grades.

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