# SAPS II Simplified Acute Physiology Score

SAPS II

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

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

## What it computes

Compute the Le Gall 1993 SAPS II integer from 12 physiology variables, age, type of admission, and one chronic disease, then the paper's logit hospital-mortality probability.

## When to use

When an agent needs the published 1993 SAPS II integer and hospital-mortality probability and must not invent SAPS 3 points, APACHE points, or unnamed class bands.

## When not to use

- Not a medical device. magent does not measure vitals and does not examine the patient.
- Each physiology item is the worst value in 24 hours as assigned by the caller. magent does not choose the worst from a time series.
- Not SAPS 3. Not APACHE II, APACHE III, or APACHE IV. Le Gall 1993 Table 1 bands and logit only.
- The 1993 derivation excluded patients younger than 18 years, burn patients, coronary care patients, and cardiac surgery patients. This tool still returns the published table for a valid adult input; it does not apply later customizations.
- PaO2/FiO2 is scored only if the caller assigns mechanical ventilation or CPAP. If ventilated is false, oxygenation points are 0 even when a ratio is sent. Ventilated or CPAP scores at least 6.
- Chronic diseases are one Table 1 row (none, metastatic cancer, hematologic malignancy, or AIDS), not additive.
- Hospital-mortality probability is the 1993 logit only. The paper publishes no named low/intermediate/high class bands.
- Temperature has no hypothermia points in the 1993 table (<39 °C is 0).

## Formula

```
SAPS II = sum of 17 Le Gall 1993 variables (worst values in 24h as assigned by the caller): heart_rate (<40 → 11, 40-69 → 2, 70-119 → 0, 120-159 → 4, ≥160 → 7), systolic_bp_mm_hg (<70 → 13, 70-99 → 5, 100-199 → 0, ≥200 → 2), temperature_c (<39 → 0, ≥39 → 3), PaO2/FiO2 mm Hg if ventilated or CPAP (<100 → 11, 100-199 → 9, ≥200 → 6) else 0, urine_output_l_day (<0.500 → 11, 0.500-0.999 → 4, ≥1.000 → 0), urea_mmol_l (<10.0 → 0, 10.0-29.9 → 6, ≥30.0 → 10) or bun_mg_dl (<28 → 0, 28-83 → 6, ≥84 → 10), wbc_k_ul (<1.0 → 12, 1.0-19.9 → 0, ≥20.0 → 3), potassium_mmol_l (<3.0 or ≥5.0 → 3, 3.0-4.9 → 0), sodium_mmol_l (<125 → 5, 125-144 → 0, ≥145 → 1), bicarbonate_meq_l (<15 → 6, 15-19 → 3, ≥20 → 0), bilirubin_mg_dl (<4.0 → 0, 4.0-5.9 → 4, ≥6.0 → 9) or bilirubin_umol_l (<68.4 → 0, 68.4-102.5 → 4, ≥102.6 → 9), gcs (<6 → 26, 6-8 → 13, 9-10 → 7, 11-13 → 5, 14-15 → 0), age (<40 → 0, 40-59 → 7, 60-69 → 12, 70-74 → 15, 75-79 → 16, ≥80 → 18), admission_type (scheduled_surgical → 0, medical → 6, unscheduled_surgical → 8), chronic_disease (none → 0, metastatic_cancer → 9, hematologic_malignancy → 10, aids → 17, one row not additive); logit = -7.7631 + 0.0737*SAPS_II + 0.9971*ln(SAPS_II+1); hospital_mortality_probability = exp(logit)/(1+exp(logit)); max 163
```

## Citation

[A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study](https://doi.org/10.1001/jama.270.24.2957)
Le Gall JR, Lemeshow S, Saulnier F
JAMA. 1993;270(24):2957-2963
DOI: [10.1001/jama.270.24.2957](https://doi.org/10.1001/jama.270.24.2957)

## Worked example

### All-normal physiology, age 35, scheduled surgical, no chronic disease

Given: `admission_type=scheduled_surgical, age=35, bicarbonate_meq_l=24, bilirubin_mg_dl=0.8, chronic_disease=none, gcs=15, heart_rate=80, potassium_mmol_l=4.0, sodium_mmol_l=140, systolic_bp_mm_hg=120, temperature_c=37.0, urea_mmol_l=5.0, urine_output_l_day=1.5, ventilated=false, wbc_k_ul=8.0`

1. Each of the 12 physiology rows is in a 0-point Le Gall 1993 band (not ventilated, so PaO2/FiO2 is not scored; GCS 15 → 0)
2. Age 35 → 0; scheduled_surgical → 0; chronic_disease none → 0
3. Score = 0 (max 163); logit = -7.7631; hospital_mortality_probability from exp(logit)/(1+exp(logit))


### Age 50 only

Given: `admission_type=scheduled_surgical, age=50, bicarbonate_meq_l=24, bilirubin_mg_dl=0.8, chronic_disease=none, gcs=15, heart_rate=80, potassium_mmol_l=4.0, sodium_mmol_l=140, systolic_bp_mm_hg=120, temperature_c=37.0, urea_mmol_l=5.0, urine_output_l_day=1.5, ventilated=false, wbc_k_ul=8.0`

1. Physiology, admission, and chronic disease remain 0
2. Age 40-59 → 7
3. Score = 7 (max 163) with the 1993 logit probability


## Also searched as

- SAPS II
- Simplified Acute Physiology Score II
- SAPS 2 score
- Le Gall SAPS II
- ICU hospital mortality score
- SAPSII

## Parameters

- `age` (integer, required): Age in years, integer 18-120 (Le Gall 1993 excluded patients younger than 18). <40 → 0; 40-59 → 7; 60-69 → 12; 70-74 → 15; 75-79 → 16; ≥80 → 18.
- `heart_rate` (integer, required): Heart rate in beats/min, integer 20-250, worst in 24h as assigned by the caller. <40 → 11; 40-69 → 2; 70-119 → 0; 120-159 → 4; ≥160 → 7. magent does not measure pulse.
- `systolic_bp_mm_hg` (number, required): Systolic blood pressure in mm Hg (20-300), worst in 24h as assigned by the caller. <70 → 13; 70-99 → 5; 100-199 → 0; ≥200 → 2. magent does not measure blood pressure.
- `temperature_c` (number, required): Body temperature in °C (20-46). <39 → 0; ≥39 → 3. The 1993 table has no hypothermia points. magent does not measure temperature or convert Fahrenheit.
- `ventilated` (boolean, required): true if the caller assigns mechanical ventilation or CPAP in the first 24h (Le Gall 1993 PaO2/FiO2 row). false → 0 oxygenation points and pao2_fio2 is ignored. Ventilated or CPAP scores at least 6 even when PaO2/FiO2 is ≥200.
- `pao2_fio2` (number, optional): PaO2/FiO2 ratio in mm Hg (10-800). Required when ventilated is true. <100 → 11; 100-199 → 9; ≥200 → 6. Ignored when ventilated is false. magent does not compute the ratio from PaO2 and FiO2.
- `urine_output_l_day` (number, required): Urine output in L/24h (0-20) as assigned by the caller. <0.500 → 11; 0.500-0.999 → 4; ≥1.000 → 0. magent does not measure urine.
- `urea_mmol_l` (number, optional): Serum urea in mmol/L (0.1-80). One of urea_mmol_l or bun_mg_dl is required. If both are sent, urea_mmol_l is scored and bun_mg_dl is ignored. <10.0 → 0; 10.0-29.9 → 6; ≥30.0 → 10.
- `bun_mg_dl` (number, optional): Blood urea nitrogen in mg/dL (1-250). Alternate to urea_mmol_l (Le Gall 1993 US column). Ignored when urea_mmol_l is present. <28 → 0; 28-83 → 6; ≥84 → 10. magent does not convert BUN to urea.
- `wbc_k_ul` (number, required): White blood count in thousands per mm^3 (0-100). <1.0 → 12; 1.0-19.9 → 0; ≥20.0 → 3.
- `potassium_mmol_l` (number, required): Serum potassium in mmol/L (1-12). <3.0 → 3; 3.0-4.9 → 0; ≥5.0 → 3.
- `sodium_mmol_l` (number, required): Serum sodium in mmol/L (90-200). <125 → 5; 125-144 → 0; ≥145 → 1.
- `bicarbonate_meq_l` (number, required): Serum bicarbonate in mEq/L (2-60). <15 → 6; 15-19 → 3; ≥20 → 0. Arterial pH is not a SAPS II variable.
- `bilirubin_mg_dl` (number, optional): Serum bilirubin in mg/dL (0-40). One of bilirubin_mg_dl or bilirubin_umol_l is required. If both are sent, bilirubin_mg_dl is scored and bilirubin_umol_l is ignored. <4.0 → 0; 4.0-5.9 → 4; ≥6.0 → 9.
- `bilirubin_umol_l` (number, optional): Serum bilirubin in µmol/L (0-684). Alternate to bilirubin_mg_dl (Le Gall 1993 SI column). Ignored when bilirubin_mg_dl is present. <68.4 → 0; 68.4-102.5 → 4; ≥102.6 → 9. magent does not convert units.
- `gcs` (integer, required): Glasgow Coma Scale total as assigned by the caller (integer 3-15). <6 → 26; 6-8 → 13; 9-10 → 7; 11-13 → 5; 14-15 → 0. magent does not examine the patient.
- `admission_type` (string, required): Le Gall 1993 type of admission as assigned by the caller: scheduled_surgical (0), medical (6), or unscheduled_surgical (8). magent does not classify the admission.
- `chronic_disease` (string, required): Le Gall 1993 chronic-disease row as assigned by the caller: none (0), metastatic_cancer (9), hematologic_malignancy (10), or aids (17). One token; the paper's table is not additive. magent does not diagnose.

## 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/saps_ii`
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": [
    {
      "admission_type": "scheduled_surgical",
      "age": "35",
      "bicarbonate_meq_l": "24",
      "bilirubin_mg_dl": "0.8",
      "chronic_disease": "none",
      "gcs": "15",
      "heart_rate": "80",
      "potassium_mmol_l": "4.0",
      "sodium_mmol_l": "140",
      "systolic_bp_mm_hg": "120",
      "temperature_c": "37.0",
      "urea_mmol_l": "5.0",
      "urine_output_l_day": "1.5",
      "ventilated": "false",
      "wbc_k_ul": "8.0"
    },
    {
      "admission_type": "scheduled_surgical",
      "age": "35",
      "bicarbonate_meq_l": "24",
      "bilirubin_mg_dl": "0.8",
      "chronic_disease": "none",
      "gcs": "15",
      "heart_rate": "80",
      "potassium_mmol_l": "4.0",
      "sodium_mmol_l": "140",
      "systolic_bp_mm_hg": "120",
      "temperature_c": "37.0",
      "urea_mmol_l": "5.0",
      "urine_output_l_day": "1.5",
      "ventilated": "false",
      "wbc_k_ul": "8.0"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/saps_ii",
  "items": [
    {
      "components": [
        {
          "value": 35,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 80,
          "factor": "heart_rate",
          "points": 0,
          "present": false
        },
        {
          "value": 120.0,
          "factor": "systolic_bp_mm_hg",
          "points": 0,
          "present": false
        },
        {
          "value": 37.0,
          "factor": "temperature_c",
          "points": 0,
          "present": false
        },
        {
          "value": null,
          "factor": "oxygenation",
          "branch": "not_ventilated",
          "points": 0,
          "present": false,
          "ventilated": false
        },
        {
          "value": 1.5,
          "factor": "urine_output_l_day",
          "points": 0,
          "present": false
        },
        {
          "value": 5.0,
          "factor": "urea",
          "branch": "urea_mmol_l",
          "points": 0,
          "present": false
        },
        {
          "value": 8.0,
          "factor": "wbc_k_ul",
          "points": 0,
          "present": false
        },
        {
          "value": 4.0,
          "factor": "potassium_mmol_l",
          "points": 0,
          "present": false
        },
        {
          "value": 140.0,
          "factor": "sodium_mmol_l",
          "points": 0,
          "present": false
        },
        {
          "value": 24.0,
          "factor": "bicarbonate_meq_l",
          "points": 0,
          "present": false
        },
        {
          "value": 0.8,
          "factor": "bilirubin",
          "branch": "bilirubin_mg_dl",
          "points": 0,
          "present": false
        },
        {
          "value": 15,
          "factor": "gcs",
          "points": 0,
          "present": false
        },
        {
          "value": "scheduled_surgical",
          "factor": "admission_type",
          "points": 0,
          "present": false
        },
        {
          "value": "none",
          "factor": "chronic_disease",
          "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": "Le Gall JR, Lemeshow S, Saulnier F",
        "doi": "10.1001/jama.270.24.2957",
        "id": "le-gall-1993",
        "pmid": "8254858",
        "source": "JAMA. 1993;270(24):2957-2963",
        "title": "A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study"
      },
      "formula": "saps_ii",
      "formula_expression": "SAPS II = sum of 17 Le Gall 1993 variables (worst values in 24h as assigned by the caller): heart_rate (<40 → 11, 40-69 → 2, 70-119 → 0, 120-159 → 4, ≥160 → 7), systolic_bp_mm_hg (<70 → 13, 70-99 → 5, 100-199 → 0, ≥200 → 2), temperature_c (<39 → 0, ≥39 → 3), PaO2/FiO2 mm Hg if ventilated or CPAP (<100 → 11, 100-199 → 9, ≥200 → 6) else 0, urine_output_l_day (<0.500 → 11, 0.500-0.999 → 4, ≥1.000 → 0), urea_mmol_l (<10.0 → 0, 10.0-29.9 → 6, ≥30.0 → 10) or bun_mg_dl (<28 → 0, 28-83 → 6, ≥84 → 10), wbc_k_ul (<1.0 → 12, 1.0-19.9 → 0, ≥20.0 → 3), potassium_mmol_l (<3.0 or ≥5.0 → 3, 3.0-4.9 → 0), sodium_mmol_l (<125 → 5, 125-144 → 0, ≥145 → 1), bicarbonate_meq_l (<15 → 6, 15-19 → 3, ≥20 → 0), bilirubin_mg_dl (<4.0 → 0, 4.0-5.9 → 4, ≥6.0 → 9) or bilirubin_umol_l (<68.4 → 0, 68.4-102.5 → 4, ≥102.6 → 9), gcs (<6 → 26, 6-8 → 13, 9-10 → 7, 11-13 → 5, 14-15 → 0), age (<40 → 0, 40-59 → 7, 60-69 → 12, 70-74 → 15, 75-79 → 16, ≥80 → 18), admission_type (scheduled_surgical → 0, medical → 6, unscheduled_surgical → 8), chronic_disease (none → 0, metastatic_cancer → 9, hematologic_malignancy → 10, aids → 17, one row not additive); logit = -7.7631 + 0.0737*SAPS_II + 0.9971*ln(SAPS_II+1); hospital_mortality_probability = exp(logit)/(1+exp(logit)); max 163",
      "max_score": 163,
      "score": 0,
      "logit": -7.7631,
      "hospital_mortality_probability": 4.25e-4
    },
    {
      "components": [
        {
          "value": 35,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 80,
          "factor": "heart_rate",
          "points": 0,
          "present": false
        },
        {
          "value": 120.0,
          "factor": "systolic_bp_mm_hg",
          "points": 0,
          "present": false
        },
        {
          "value": 37.0,
          "factor": "temperature_c",
          "points": 0,
          "present": false
        },
        {
          "value": null,
          "factor": "oxygenation",
          "branch": "not_ventilated",
          "points": 0,
          "present": false,
          "ventilated": false
        },
        {
          "value": 1.5,
          "factor": "urine_output_l_day",
          "points": 0,
          "present": false
        },
        {
          "value": 5.0,
          "factor": "urea",
          "branch": "urea_mmol_l",
          "points": 0,
          "present": false
        },
        {
          "value": 8.0,
          "factor": "wbc_k_ul",
          "points": 0,
          "present": false
        },
        {
          "value": 4.0,
          "factor": "potassium_mmol_l",
          "points": 0,
          "present": false
        },
        {
          "value": 140.0,
          "factor": "sodium_mmol_l",
          "points": 0,
          "present": false
        },
        {
          "value": 24.0,
          "factor": "bicarbonate_meq_l",
          "points": 0,
          "present": false
        },
        {
          "value": 0.8,
          "factor": "bilirubin",
          "branch": "bilirubin_mg_dl",
          "points": 0,
          "present": false
        },
        {
          "value": 15,
          "factor": "gcs",
          "points": 0,
          "present": false
        },
        {
          "value": "scheduled_surgical",
          "factor": "admission_type",
          "points": 0,
          "present": false
        },
        {
          "value": "none",
          "factor": "chronic_disease",
          "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": "Le Gall JR, Lemeshow S, Saulnier F",
        "doi": "10.1001/jama.270.24.2957",
        "id": "le-gall-1993",
        "pmid": "8254858",
        "source": "JAMA. 1993;270(24):2957-2963",
        "title": "A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study"
      },
      "formula": "saps_ii",
      "formula_expression": "SAPS II = sum of 17 Le Gall 1993 variables (worst values in 24h as assigned by the caller): heart_rate (<40 → 11, 40-69 → 2, 70-119 → 0, 120-159 → 4, ≥160 → 7), systolic_bp_mm_hg (<70 → 13, 70-99 → 5, 100-199 → 0, ≥200 → 2), temperature_c (<39 → 0, ≥39 → 3), PaO2/FiO2 mm Hg if ventilated or CPAP (<100 → 11, 100-199 → 9, ≥200 → 6) else 0, urine_output_l_day (<0.500 → 11, 0.500-0.999 → 4, ≥1.000 → 0), urea_mmol_l (<10.0 → 0, 10.0-29.9 → 6, ≥30.0 → 10) or bun_mg_dl (<28 → 0, 28-83 → 6, ≥84 → 10), wbc_k_ul (<1.0 → 12, 1.0-19.9 → 0, ≥20.0 → 3), potassium_mmol_l (<3.0 or ≥5.0 → 3, 3.0-4.9 → 0), sodium_mmol_l (<125 → 5, 125-144 → 0, ≥145 → 1), bicarbonate_meq_l (<15 → 6, 15-19 → 3, ≥20 → 0), bilirubin_mg_dl (<4.0 → 0, 4.0-5.9 → 4, ≥6.0 → 9) or bilirubin_umol_l (<68.4 → 0, 68.4-102.5 → 4, ≥102.6 → 9), gcs (<6 → 26, 6-8 → 13, 9-10 → 7, 11-13 → 5, 14-15 → 0), age (<40 → 0, 40-59 → 7, 60-69 → 12, 70-74 → 15, 75-79 → 16, ≥80 → 18), admission_type (scheduled_surgical → 0, medical → 6, unscheduled_surgical → 8), chronic_disease (none → 0, metastatic_cancer → 9, hematologic_malignancy → 10, aids → 17, one row not additive); logit = -7.7631 + 0.0737*SAPS_II + 0.9971*ln(SAPS_II+1); hospital_mortality_probability = exp(logit)/(1+exp(logit)); max 163",
      "max_score": 163,
      "score": 0,
      "logit": -7.7631,
      "hospital_mortality_probability": 4.25e-4
    }
  ]
}
```

## Response fields

- `formula` (string): saps_ii
- `formula_expression` (string): Exact expression used
- `score` (integer): SAPS II integer 0-163
- `max_score` (integer): Always 163
- `logit` (number): Le Gall 1993 logit, 4 decimal places
- `hospital_mortality_probability` (number): exp(logit)/(1+exp(logit)) from the unrounded logit, 6 decimal places. A probability, not a named class.
- `components` (array): Fifteen Table 1 rows (chronic diseases share one row)
- `citation` (object): Le Gall 1993 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": 35,
      "factor": "age",
      "points": 0,
      "present": false
    },
    {
      "value": 80,
      "factor": "heart_rate",
      "points": 0,
      "present": false
    },
    {
      "value": 120.0,
      "factor": "systolic_bp_mm_hg",
      "points": 0,
      "present": false
    },
    {
      "value": 37.0,
      "factor": "temperature_c",
      "points": 0,
      "present": false
    },
    {
      "value": null,
      "factor": "oxygenation",
      "branch": "not_ventilated",
      "points": 0,
      "present": false,
      "ventilated": false
    },
    {
      "value": 1.5,
      "factor": "urine_output_l_day",
      "points": 0,
      "present": false
    },
    {
      "value": 5.0,
      "factor": "urea",
      "branch": "urea_mmol_l",
      "points": 0,
      "present": false
    },
    {
      "value": 8.0,
      "factor": "wbc_k_ul",
      "points": 0,
      "present": false
    },
    {
      "value": 4.0,
      "factor": "potassium_mmol_l",
      "points": 0,
      "present": false
    },
    {
      "value": 140.0,
      "factor": "sodium_mmol_l",
      "points": 0,
      "present": false
    },
    {
      "value": 24.0,
      "factor": "bicarbonate_meq_l",
      "points": 0,
      "present": false
    },
    {
      "value": 0.8,
      "factor": "bilirubin",
      "branch": "bilirubin_mg_dl",
      "points": 0,
      "present": false
    },
    {
      "value": 15,
      "factor": "gcs",
      "points": 0,
      "present": false
    },
    {
      "value": "scheduled_surgical",
      "factor": "admission_type",
      "points": 0,
      "present": false
    },
    {
      "value": "none",
      "factor": "chronic_disease",
      "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": "Le Gall JR, Lemeshow S, Saulnier F",
    "doi": "10.1001/jama.270.24.2957",
    "id": "le-gall-1993",
    "pmid": "8254858",
    "source": "JAMA. 1993;270(24):2957-2963",
    "title": "A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study"
  },
  "formula": "saps_ii",
  "formula_expression": "SAPS II = sum of 17 Le Gall 1993 variables (worst values in 24h as assigned by the caller): heart_rate (<40 → 11, 40-69 → 2, 70-119 → 0, 120-159 → 4, ≥160 → 7), systolic_bp_mm_hg (<70 → 13, 70-99 → 5, 100-199 → 0, ≥200 → 2), temperature_c (<39 → 0, ≥39 → 3), PaO2/FiO2 mm Hg if ventilated or CPAP (<100 → 11, 100-199 → 9, ≥200 → 6) else 0, urine_output_l_day (<0.500 → 11, 0.500-0.999 → 4, ≥1.000 → 0), urea_mmol_l (<10.0 → 0, 10.0-29.9 → 6, ≥30.0 → 10) or bun_mg_dl (<28 → 0, 28-83 → 6, ≥84 → 10), wbc_k_ul (<1.0 → 12, 1.0-19.9 → 0, ≥20.0 → 3), potassium_mmol_l (<3.0 or ≥5.0 → 3, 3.0-4.9 → 0), sodium_mmol_l (<125 → 5, 125-144 → 0, ≥145 → 1), bicarbonate_meq_l (<15 → 6, 15-19 → 3, ≥20 → 0), bilirubin_mg_dl (<4.0 → 0, 4.0-5.9 → 4, ≥6.0 → 9) or bilirubin_umol_l (<68.4 → 0, 68.4-102.5 → 4, ≥102.6 → 9), gcs (<6 → 26, 6-8 → 13, 9-10 → 7, 11-13 → 5, 14-15 → 0), age (<40 → 0, 40-59 → 7, 60-69 → 12, 70-74 → 15, 75-79 → 16, ≥80 → 18), admission_type (scheduled_surgical → 0, medical → 6, unscheduled_surgical → 8), chronic_disease (none → 0, metastatic_cancer → 9, hematologic_malignancy → 10, aids → 17, one row not additive); logit = -7.7631 + 0.0737*SAPS_II + 0.9971*ln(SAPS_II+1); hospital_mortality_probability = exp(logit)/(1+exp(logit)); max 163",
  "max_score": 163,
  "score": 0,
  "logit": -7.7631,
  "hospital_mortality_probability": 4.25e-4
}
```

## Errors

- HTTP 400 `invalid_saps_ii`: SAPS II needs Le Gall 1993 physiologic, age, admission-type, and chronic-disease values in published ranges. 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

- [APACHE II](https://magentlab.com/docs/apache-ii) — Compute the Knaus 1985 APACHE II integer from 12 Acute Physiology Score items, age points, and chronic-health points.
- [SOFA](https://magentlab.com/docs/sofa) — Compute the Vincent 1996 SOFA score from PaO2/FiO2, platelets, bilirubin, MAP and adrenergic agents, GCS, and creatinine or urine output.

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