# PHASES aneurysm rupture score (Greving 2014)

PHASES

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

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

## What it computes

Sum Greving 2014 PHASES points (population, hypertension, age, size, earlier SAH, site; max 22) and return the published grouped 5-year rupture risk percent.

## When to use

When an agent already has caller-assigned PHASES factors for an unruptured intracranial aneurysm and needs the published 5-year rupture-risk percent, not a treatment order or PHASES of care.

## When not to use

- Not a medical device, not a diagnosis of rupture, and not a treatment, clipping, or coiling order.
- Not PHASES of care. Geographic population is caller-assigned (north_america_europe, japanese, or finnish as in Greving 2014). magent does not assign ancestry.
- Size bands and site groups follow Greving 2014 only (ica 0; mca 2; aca_pcom_posterior 4). magent does not read imaging.
- five_year_rupture_risk_percent is the paper's grouped table (score ≤2 → 0.4%; 3 → 0.7%; 4 → 0.9%; 5 → 1.3%; 6 → 1.7%; 7 → 2.4%; 8 → 3.2%; 9 → 4.3%; 10 → 5.3%; 11 → 7.2%; ≥12 → 17.8%). Scores 0 and 1 use the ≤2 row. The paper does not split ≥12 further.

## Formula

```
PHASES = population (north_america_europe 0, japanese 3, finnish 5) + hypertension 1 + age>=70 1 + size (<7.0 0, 7.0-9.9 3, 10.0-19.9 6, >=20.0 10) + earlier_sah 1 + site (ica 0, mca 2, aca_pcom_posterior 4); max 22
```

## Citation

[Development of the PHASES score for prediction of risk of rupture of intracranial aneurysms: a pooled analysis of six prospective cohort studies](https://doi.org/10.1016/S1474-4422(13)70263-1)
Greving JP, Wermer MJH, Brown RD Jr, et al.
Lancet Neurol. 2014;13(1):59-66
DOI: [10.1016/S1474-4422(13)70263-1](https://doi.org/10.1016/S1474-4422(13)70263-1)

## Worked example

### North America/Europe, small ICA aneurysm

Given: `age=50, aneurysm_mm=5, earlier_sah=false, hypertension=false, population=north_america_europe, site=ica`

1. population north_america_europe 0; hypertension false 0; age 50 (<70) 0; aneurysm_mm 5 (<7.0) 0; earlier_sah false 0; site ica 0
2. Score = 0 (max 22); five_year_rupture_risk_percent 0.4 (Greving 2014 ≤2 row)


### Japanese population, otherwise the same small ICA aneurysm

Given: `age=50, aneurysm_mm=5, earlier_sah=false, hypertension=false, population=japanese, site=ica`

1. japanese 3; remaining factors 0
2. Score = 3; five_year_rupture_risk_percent 0.7


## Also searched as

- PHASES score
- Greving PHASES
- aneurysm rupture risk
- unruptured intracranial aneurysm
- PHASES aneurysm
- 5-year aneurysm rupture

## Parameters

- `population` (string, required): Caller-assigned Greving 2014 geographic study population: north_america_europe (0; North America and Europe other than Finland), japanese (3), or finnish (5). magent does not assign ancestry.
- `hypertension` (boolean, required): Caller-assigned history of hypertension (Greving 2014). true scores 1. magent does not take a blood-pressure reading.
- `age` (integer, required): Age in years (integer 18-120). <70 scores 0; ≥70 scores 1 (Greving 2014).
- `aneurysm_mm` (number, required): Caller-assigned maximum aneurysm diameter in millimetres (1.0-50.0). <7.0 scores 0; 7.0-9.9 scores 3; 10.0-19.9 scores 6; ≥20.0 scores 10. magent does not read imaging.
- `earlier_sah` (boolean, required): Earlier subarachnoid hemorrhage from another aneurysm (Greving 2014). true scores 1. Not a diagnosis of current rupture.
- `site` (string, required): Caller-assigned aneurysm site as grouped in Greving 2014: ica (0), mca (2), or aca_pcom_posterior (4; anterior cerebral, anterior communicating, posterior communicating, or posterior circulation). magent does not read imaging.

## 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/phases`
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",
      "aneurysm_mm": "5",
      "earlier_sah": "false",
      "hypertension": "false",
      "population": "north_america_europe",
      "site": "ica"
    },
    {
      "age": "50",
      "aneurysm_mm": "5",
      "earlier_sah": "false",
      "hypertension": "false",
      "population": "north_america_europe",
      "site": "ica"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/phases",
  "items": [
    {
      "components": [
        {
          "value": "north_america_europe",
          "factor": "population",
          "points": 0,
          "present": true
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "value": 50,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 5.0,
          "factor": "aneurysm_mm",
          "points": 0,
          "present": true
        },
        {
          "factor": "earlier_sah",
          "points": 0,
          "present": false
        },
        {
          "value": "ica",
          "factor": "site",
          "points": 0,
          "present": true
        }
      ],
      "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": "Greving JP, Wermer MJH, Brown RD Jr, et al.",
        "doi": "10.1016/S1474-4422(13)70263-1",
        "id": "greving-2014",
        "pmid": "24290159",
        "source": "Lancet Neurol. 2014;13(1):59-66",
        "title": "Development of the PHASES score for prediction of risk of rupture of intracranial aneurysms: a pooled analysis of six prospective cohort studies"
      },
      "formula": "phases",
      "formula_expression": "PHASES = population (north_america_europe 0, japanese 3, finnish 5) + hypertension 1 + age>=70 1 + size (<7.0 0, 7.0-9.9 3, 10.0-19.9 6, >=20.0 10) + earlier_sah 1 + site (ica 0, mca 2, aca_pcom_posterior 4); max 22",
      "age_years": 50,
      "max_score": 22,
      "score": 0,
      "site": "ica",
      "aneurysm_mm": 5.0,
      "five_year_rupture_risk_percent": 0.4,
      "population": "north_america_europe"
    },
    {
      "components": [
        {
          "value": "north_america_europe",
          "factor": "population",
          "points": 0,
          "present": true
        },
        {
          "factor": "hypertension",
          "points": 0,
          "present": false
        },
        {
          "value": 50,
          "factor": "age",
          "points": 0,
          "present": false
        },
        {
          "value": 5.0,
          "factor": "aneurysm_mm",
          "points": 0,
          "present": true
        },
        {
          "factor": "earlier_sah",
          "points": 0,
          "present": false
        },
        {
          "value": "ica",
          "factor": "site",
          "points": 0,
          "present": true
        }
      ],
      "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": "Greving JP, Wermer MJH, Brown RD Jr, et al.",
        "doi": "10.1016/S1474-4422(13)70263-1",
        "id": "greving-2014",
        "pmid": "24290159",
        "source": "Lancet Neurol. 2014;13(1):59-66",
        "title": "Development of the PHASES score for prediction of risk of rupture of intracranial aneurysms: a pooled analysis of six prospective cohort studies"
      },
      "formula": "phases",
      "formula_expression": "PHASES = population (north_america_europe 0, japanese 3, finnish 5) + hypertension 1 + age>=70 1 + size (<7.0 0, 7.0-9.9 3, 10.0-19.9 6, >=20.0 10) + earlier_sah 1 + site (ica 0, mca 2, aca_pcom_posterior 4); max 22",
      "age_years": 50,
      "max_score": 22,
      "score": 0,
      "site": "ica",
      "aneurysm_mm": 5.0,
      "five_year_rupture_risk_percent": 0.4,
      "population": "north_america_europe"
    }
  ]
}
```

## Response fields

- `formula` (string): phases
- `formula_expression` (string): Exact expression used
- `score` (integer): PHASES points 0-22
- `max_score` (integer): 22
- `five_year_rupture_risk_percent` (number): Greving 2014 grouped 5-year rupture risk percent (≤2 → 0.4 through ≥12 → 17.8). Not a treatment order.
- `population` (string): Caller-assigned population token used for scoring
- `age_years` (integer): Age used for the ≥70 criterion
- `aneurysm_mm` (number): Aneurysm diameter in millimetres used for size points
- `site` (string): Caller-assigned site token used for scoring
- `components` (array): Per-factor PHASES points
- `citation` (object): Greving et al. Lancet Neurol 2014 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "north_america_europe",
      "factor": "population",
      "points": 0,
      "present": true
    },
    {
      "factor": "hypertension",
      "points": 0,
      "present": false
    },
    {
      "value": 50,
      "factor": "age",
      "points": 0,
      "present": false
    },
    {
      "value": 5.0,
      "factor": "aneurysm_mm",
      "points": 0,
      "present": true
    },
    {
      "factor": "earlier_sah",
      "points": 0,
      "present": false
    },
    {
      "value": "ica",
      "factor": "site",
      "points": 0,
      "present": true
    }
  ],
  "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": "Greving JP, Wermer MJH, Brown RD Jr, et al.",
    "doi": "10.1016/S1474-4422(13)70263-1",
    "id": "greving-2014",
    "pmid": "24290159",
    "source": "Lancet Neurol. 2014;13(1):59-66",
    "title": "Development of the PHASES score for prediction of risk of rupture of intracranial aneurysms: a pooled analysis of six prospective cohort studies"
  },
  "formula": "phases",
  "formula_expression": "PHASES = population (north_america_europe 0, japanese 3, finnish 5) + hypertension 1 + age>=70 1 + size (<7.0 0, 7.0-9.9 3, 10.0-19.9 6, >=20.0 10) + earlier_sah 1 + site (ica 0, mca 2, aca_pcom_posterior 4); max 22",
  "age_years": 50,
  "max_score": 22,
  "score": 0,
  "site": "ica",
  "aneurysm_mm": 5.0,
  "five_year_rupture_risk_percent": 0.4,
  "population": "north_america_europe"
}
```

## Errors

- HTTP 400 `invalid_phases_population`: population must be north_america_europe, japanese, or finnish (Greving 2014 PHASES). Returned before settlement; you are not charged.
- HTTP 400 `invalid_phases_size`: aneurysm_mm must be a number from 1.0 to 50.0 (Greving 2014 PHASES). Returned before settlement; you are not charged.
- HTTP 400 `invalid_phases_site`: site must be ica, mca, or aca_pcom_posterior (Greving 2014 PHASES). 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_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

- [Hunt-Hess](https://magentlab.com/docs/hunt-hess) — Return the Hunt and Hess 1968 subarachnoid-hemorrhage surgical-risk grade from a caller-assigned grade 1-5, applying the paper's next-less-favorable bump when serious systemic disease is present.
- [Modified Fisher](https://magentlab.com/docs/modified-fisher) — Return the Frontera 2006 modified Fisher CT grade 0-4 from a caller-assigned grade, with the published grade description.
- [Ottawa SAH Rule](https://magentlab.com/docs/ottawa-sah) — Apply the Perry 2013 Ottawa SAH Rule and return whether investigation is indicated from age and five caller-assigned high-risk findings.

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