Emergency · LIVE
Ottawa SAH Rule
Apply the Perry 2013 Ottawa SAH Rule and return whether investigation is indicated from age and five caller-assigned high-risk findings.
Markdown: /docs/ottawa-sah.md · Canonical: https://magentlab.com/docs/ottawa-sah
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Apply the Perry 2013 Ottawa SAH Rule and return whether investigation is indicated from age and five caller-assigned high-risk findings.
When to use
When an agent has caller-assigned findings for acute headache and needs the published six-variable investigation rule, not a diagnosis of SAH.
When not to use
- Not a diagnosis of subarachnoid hemorrhage. magent does not examine the neck.
- Not Hunt-Hess grade and not Fisher grade.
- Inclusion as published is alert, neurologically intact adults with nontraumatic headache peaking within 1 hour. magent does not take GCS or time-to-peak; the caller applies inclusion.
- Limited neck flexion is an examination finding assigned by the caller.
- Thunderclap headache means instantly peaking pain as published.
Formula
Investigation indicated iff age >= 40 or neck_pain_or_stiffness or witnessed_loc or onset_during_exertion or thunderclap_headache or limited_neck_flexion
Citation
- Authors
- Perry JJ, Stiell IG, Sivilotti MLA, et al.
- Source
- JAMA. 2013;310(12):1248-1255
Worked example
All findings absent
Given:
age=30limited_neck_flexion=falseneck_pain_or_stiffness=falseonset_during_exertion=falsethunderclap_headache=falsewitnessed_loc=false
- Age 30 (under 40) and all five clinical flags false
- Investigation is not indicated
Age 40 with no other findings
Given:
age=40limited_neck_flexion=falseneck_pain_or_stiffness=falseonset_during_exertion=falsethunderclap_headache=falsewitnessed_loc=false
- Age 40 meets the age criterion (39 does not)
- Investigation is indicated
Thunderclap headache alone
Given:
age=30limited_neck_flexion=falseneck_pain_or_stiffness=falseonset_during_exertion=falsethunderclap_headache=truewitnessed_loc=false
- Age 30 does not meet the age criterion
- Thunderclap headache (instantly peaking pain) is present
- Investigation is indicated
Also searched as
- Ottawa SAH Rule
- Ottawa subarachnoid hemorrhage rule
- Perry SAH rule
- thunderclap headache rule
- Ottawa SAH
- Perry 2013 JAMA headache
- SAH decision rule
- subarachnoid hemorrhage rule-out
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
Full URL: https://api.magentlab.com/api/calc/ottawa_sah?age=30&neck_pain_or_stiffness=false&witnessed_loc=false&onset_during_exertion=false&thunderclap_headache=false&limited_neck_flexion=false
Call
Expect HTTP 402 until you retry with PAYMENT-SIGNATURE. Incomplete query params
return HTTP 400 before any quote or charge.
curl -i -H "Accept: application/json" "https://api.magentlab.com/api/calc/ottawa_sah?age=30&neck_pain_or_stiffness=false&witnessed_loc=false&onset_during_exertion=false&thunderclap_headache=false&limited_neck_flexion=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
age |
integer | required | Age in years (18-120). Age ≥40 meets this criterion; 39 does not. |
neck_pain_or_stiffness |
boolean | required | Neck pain or stiffness as assigned by the caller. true or false. |
witnessed_loc |
boolean | required | Witnessed loss of consciousness. true or false as assigned by the caller. |
onset_during_exertion |
boolean | required | Onset during exertion. true or false as assigned by the caller. |
thunderclap_headache |
boolean | required | Thunderclap headache (instantly peaking pain as published). true or false as assigned by the caller. |
limited_neck_flexion |
boolean | required | Limited neck flexion on examination as assigned by the caller. true or false. magent does not examine the neck. |
Bulk (POST)
POST the same path with a JSON items array. Price is n times the GET unit. Invalid items return HTTP 400 before settlement.
- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- 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 (fixture)
{
"items": [
{
"age": "30",
"limited_neck_flexion": "false",
"neck_pain_or_stiffness": "false",
"onset_during_exertion": "false",
"thunderclap_headache": "false",
"witnessed_loc": "false"
},
{
"age": "30",
"limited_neck_flexion": "false",
"neck_pain_or_stiffness": "false",
"onset_during_exertion": "false",
"thunderclap_headache": "false",
"witnessed_loc": "false"
}
]
}
Opens a two-item fixture on the API host. Unpaid browsers get the same MetaMask paywall as GET; Pay retries POST with those items.
Example 200 (fixture)
{
"count": 2,
"path": "/api/calc/ottawa_sah",
"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": "Perry JJ, Stiell IG, Sivilotti MLA, et al.",
"doi": "10.1001/jama.2013.278018",
"id": "perry-2013",
"source": "JAMA. 2013;310(12):1248-1255",
"title": "Clinical decision rules to rule out subarachnoid hemorrhage for acute headache"
},
"formula": "ottawa_sah",
"formula_expression": "Investigation indicated iff age >= 40 or neck_pain_or_stiffness or witnessed_loc or onset_during_exertion or thunderclap_headache or limited_neck_flexion",
"age_years": 30,
"criteria": [
{
"value": 30,
"factor": "age_ge_40",
"met": false
},
{
"factor": "neck_pain_or_stiffness",
"met": false
},
{
"factor": "witnessed_loc",
"met": false
},
{
"factor": "onset_during_exertion",
"met": false
},
{
"factor": "thunderclap_headache",
"met": false
},
{
"factor": "limited_neck_flexion",
"met": false
}
],
"investigation_indicated": 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": "Perry JJ, Stiell IG, Sivilotti MLA, et al.",
"doi": "10.1001/jama.2013.278018",
"id": "perry-2013",
"source": "JAMA. 2013;310(12):1248-1255",
"title": "Clinical decision rules to rule out subarachnoid hemorrhage for acute headache"
},
"formula": "ottawa_sah",
"formula_expression": "Investigation indicated iff age >= 40 or neck_pain_or_stiffness or witnessed_loc or onset_during_exertion or thunderclap_headache or limited_neck_flexion",
"age_years": 30,
"criteria": [
{
"value": 30,
"factor": "age_ge_40",
"met": false
},
{
"factor": "neck_pain_or_stiffness",
"met": false
},
{
"factor": "witnessed_loc",
"met": false
},
{
"factor": "onset_during_exertion",
"met": false
},
{
"factor": "thunderclap_headache",
"met": false
},
{
"factor": "limited_neck_flexion",
"met": false
}
],
"investigation_indicated": false
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | ottawa_sah |
formula_expression |
string | Perry 2013 six-variable investigation rule |
investigation_indicated |
boolean | true when any published high-risk finding is present. Not a diagnosis of SAH. |
age_years |
integer | Age used for the ≥40 criterion |
criteria |
array | Per-factor rows with factor and met; age_ge_40 includes the age value |
citation |
object | Perry 2013 JAMA citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"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": "Perry JJ, Stiell IG, Sivilotti MLA, et al.",
"doi": "10.1001/jama.2013.278018",
"id": "perry-2013",
"source": "JAMA. 2013;310(12):1248-1255",
"title": "Clinical decision rules to rule out subarachnoid hemorrhage for acute headache"
},
"formula": "ottawa_sah",
"formula_expression": "Investigation indicated iff age >= 40 or neck_pain_or_stiffness or witnessed_loc or onset_during_exertion or thunderclap_headache or limited_neck_flexion",
"age_years": 30,
"criteria": [
{
"value": 30,
"factor": "age_ge_40",
"met": false
},
{
"factor": "neck_pain_or_stiffness",
"met": false
},
{
"factor": "witnessed_loc",
"met": false
},
{
"factor": "onset_during_exertion",
"met": false
},
{
"factor": "thunderclap_headache",
"met": false
},
{
"factor": "limited_neck_flexion",
"met": false
}
],
"investigation_indicated": false
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_age |
age must be an integer from 18 to 120 Returned before settlement; you are not charged. |
| 400 | invalid_flag |
boolean clinical flags must be true or false Returned before settlement; you are not charged. |
| 400 | invalid_items |
POST body must be a JSON object with only an items array Returned before settlement; you are not charged. |
| 400 | invalid_item_count |
items must be an array of 1 to 25 objects Returned before settlement; you are not charged. |
| 400 | invalid_item |
each items entry must be a JSON object Returned before settlement; you are not charged. |
Related tools
- Glasgow Coma Scale — Compute the Glasgow Coma Scale as the sum of caller-assigned eye, verbal, and motor integers. The 1974 or 1976 edition is required.
- ICH Score — Compute the Hemphill 2001 ICH Score from caller-assigned GCS, age, infratentorial origin, ICH volume, and IVH.
Payment
Required query parameters must be present and valid. 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. Unpaid valid requests return HTTP 402 with a base64
PAYMENT-REQUIRED
header. HTTP 503 is not a new quote: retry the same PAYMENT-SIGNATURE. Full handshake
and shared payment errors: Payments.
Stdio MCP: /docs/mcp.
Guarantees
- Invalid query parameters return HTTP 400 before settlement. You are not charged.
- Settlement finishes before the tool executes (paymentFlow upfront). 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.