# HE-MACS ACS probability

HE-MACS

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

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

## What it computes

Compute the Alghamdi 2019 History and Electrocardiogram-only Manchester Acute Coronary Syndromes (HE-MACS) logistic probability of ACS from age, sex, and caller-assigned observed sweating, acute ECG ischaemia, right-arm or shoulder radiation, vomiting, hypotension (SBP <100 mm Hg), and current tobacco smoking.

## When to use

When an agent already has those Alghamdi 2019 predictors as assigned by the caller and needs the published HE-MACS probability. magent does not interpret an ECG or take a history. Not a diagnosis, discharge protocol, MACS (Body 2014 biomarkers), or T-MACS.

## When not to use

- Not a medical device. Not a diagnosis of ACS.
- sweating_observed, acute_ecg_ischaemia, pain_radiation_right_arm_or_shoulder, vomiting, hypotension, and current_smoker are caller-assigned. magent does not interpret ECG or take a history.
- Age 18–100 years is an implementation clamp. Age enters as a continuous linear predictor (g).
- Alghamdi 2019 Table 2 printed HE-MACS coefficients only. Not MACS (Body 2014 biomarkers). Not T-MACS.
- Four-group ROC thresholds are in that paper's supplement and are not restated here.
- This tool returns the logistic probability only. It is not a discharge, observation, or rule-out protocol.

## Formula

```
p = 1/(1+e^(-λ)); λ = 1.426*a + 1.838*b + 0.734*c + 0.996*d + 1.353*e + 0.675*f + 0.024*g + 0.462*h - 4.416; a sweating observed 0/1; b acute ECG ischaemia 0/1; c pain radiating to right arm or shoulder 0/1; d vomiting associated with pain 0/1; e systolic BP <100 mmHg 0/1; f current tobacco smoker 0/1; g age in years (continuous); h male sex 1, female 0 (Alghamdi 2019 Table 2 printed values)
```

## Citation

[Enhanced triage for patients with suspected cardiac chest pain: the History and Electrocardiogram-only Manchester Acute Coronary Syndromes decision aid](https://doi.org/10.1097/MEJ.0000000000000575)
Alghamdi A, Howard L, Reynard C, et al.
Eur J Emerg Med. 2019;26(5):356-361
DOI: [10.1097/MEJ.0000000000000575](https://doi.org/10.1097/MEJ.0000000000000575)

## Worked example

### Age 40, female, all six flags false

Given: `acute_ecg_ischaemia=false, age=40, current_smoker=false, hypotension=false, pain_radiation_right_arm_or_shoulder=false, sex=female, sweating_observed=false, vomiting=false`

1. a=b=c=d=e=f=0; g=40; h=0
2. λ = 0.024×40 - 4.416 = -3.456
3. p = 1/(1+e^3.456) = 0.0306


## Also searched as

- HE-MACS
- History and Electrocardiogram-only MACS
- Alghamdi HE-MACS
- HE MACS decision aid
- ECG-only Manchester ACS
- HE-MACS chest pain
- History ECG MACS

## Parameters

- `age` (number, required): Age in years as a continuous linear predictor (g; 18-100, implementation clamp). Alghamdi 2019 Table 2. magent does not read an identity document.
- `sex` (string, required): Sex used as h in Alghamdi 2019 Table 2 (male = 1, female = 0). male or female, case-insensitive. magent does not examine the patient.
- `sweating_observed` (boolean, required): Sweating observed by the treating clinician as assigned by the caller (a; 1 if true, 0 if false). true or false. magent does not examine the patient.
- `acute_ecg_ischaemia` (boolean, required): Caller-assigned acute ECG ischaemia as used in Alghamdi 2019 (b): ST-deviation or abnormal T inversion (1 if true, 0 if false). magent does not interpret an ECG.
- `pain_radiation_right_arm_or_shoulder` (boolean, required): Pain radiating to the right arm or shoulder as assigned by the caller (c; Alghamdi 2019). true or false. magent does not take a pain history.
- `vomiting` (boolean, required): Vomiting associated with the pain as assigned by the caller (d; Alghamdi 2019). true or false.
- `hypotension` (boolean, required): Hypotension as assigned by the caller (e): systolic BP <100 mm Hg (Alghamdi 2019, dichotomised as in that paper). true or false.
- `current_smoker` (boolean, required): Current tobacco smoker as assigned by the caller (f; Alghamdi 2019). true or false. magent does not take a smoking history.

## 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/he_macs`
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": [
    {
      "acute_ecg_ischaemia": "false",
      "age": "40",
      "current_smoker": "false",
      "hypotension": "false",
      "pain_radiation_right_arm_or_shoulder": "false",
      "sex": "female",
      "sweating_observed": "false",
      "vomiting": "false"
    },
    {
      "acute_ecg_ischaemia": "false",
      "age": "40",
      "current_smoker": "false",
      "hypotension": "false",
      "pain_radiation_right_arm_or_shoulder": "false",
      "sex": "female",
      "sweating_observed": "false",
      "vomiting": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/he_macs",
  "items": [
    {
      "age": 40.0,
      "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": "Alghamdi A, Howard L, Reynard C, et al.",
        "doi": "10.1097/MEJ.0000000000000575",
        "id": "alghamdi-2019",
        "pmid": "30289775",
        "source": "Eur J Emerg Med. 2019;26(5):356-361",
        "title": "Enhanced triage for patients with suspected cardiac chest pain: the History and Electrocardiogram-only Manchester Acute Coronary Syndromes decision aid"
      },
      "formula": "he_macs",
      "formula_expression": "p = 1/(1+e^(-λ)); λ = 1.426*a + 1.838*b + 0.734*c + 0.996*d + 1.353*e + 0.675*f + 0.024*g + 0.462*h - 4.416; a sweating observed 0/1; b acute ECG ischaemia 0/1; c pain radiating to right arm or shoulder 0/1; d vomiting associated with pain 0/1; e systolic BP <100 mmHg 0/1; f current tobacco smoker 0/1; g age in years (continuous); h male sex 1, female 0 (Alghamdi 2019 Table 2 printed values)",
      "sex": "female",
      "vomiting": false,
      "hypotension": false,
      "linear_predictor": -3.456,
      "probability": 0.0306,
      "current_smoker": false,
      "acute_ecg_ischaemia": false,
      "pain_radiation_right_arm_or_shoulder": false,
      "sweating_observed": false
    },
    {
      "age": 40.0,
      "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": "Alghamdi A, Howard L, Reynard C, et al.",
        "doi": "10.1097/MEJ.0000000000000575",
        "id": "alghamdi-2019",
        "pmid": "30289775",
        "source": "Eur J Emerg Med. 2019;26(5):356-361",
        "title": "Enhanced triage for patients with suspected cardiac chest pain: the History and Electrocardiogram-only Manchester Acute Coronary Syndromes decision aid"
      },
      "formula": "he_macs",
      "formula_expression": "p = 1/(1+e^(-λ)); λ = 1.426*a + 1.838*b + 0.734*c + 0.996*d + 1.353*e + 0.675*f + 0.024*g + 0.462*h - 4.416; a sweating observed 0/1; b acute ECG ischaemia 0/1; c pain radiating to right arm or shoulder 0/1; d vomiting associated with pain 0/1; e systolic BP <100 mmHg 0/1; f current tobacco smoker 0/1; g age in years (continuous); h male sex 1, female 0 (Alghamdi 2019 Table 2 printed values)",
      "sex": "female",
      "vomiting": false,
      "hypotension": false,
      "linear_predictor": -3.456,
      "probability": 0.0306,
      "current_smoker": false,
      "acute_ecg_ischaemia": false,
      "pain_radiation_right_arm_or_shoulder": false,
      "sweating_observed": false
    }
  ]
}
```

## Response fields

- `formula` (string): he_macs
- `formula_expression` (string): Alghamdi 2019 Table 2 printed HE-MACS logistic expression
- `age` (number): Age in years used as g
- `sex` (string): female or male used as h
- `sweating_observed` (boolean): Caller-assigned observed sweating used as a
- `acute_ecg_ischaemia` (boolean): Caller-assigned acute ECG ischaemia used as b
- `pain_radiation_right_arm_or_shoulder` (boolean): Caller-assigned right-arm or shoulder radiation used as c
- `vomiting` (boolean): Caller-assigned vomiting used as d
- `hypotension` (boolean): Caller-assigned hypotension (SBP <100 mm Hg) used as e
- `current_smoker` (boolean): Caller-assigned current tobacco smoking used as f
- `linear_predictor` (number): Alghamdi 2019 Table 2 λ from the printed coefficients, 4 decimals
- `probability` (number): p = 1/(1+e^(-λ)) on 0-1, 4 decimals. Probability only; no risk band.
- `citation` (object): Alghamdi 2019 Eur J Emerg Med citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "age": 40.0,
  "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": "Alghamdi A, Howard L, Reynard C, et al.",
    "doi": "10.1097/MEJ.0000000000000575",
    "id": "alghamdi-2019",
    "pmid": "30289775",
    "source": "Eur J Emerg Med. 2019;26(5):356-361",
    "title": "Enhanced triage for patients with suspected cardiac chest pain: the History and Electrocardiogram-only Manchester Acute Coronary Syndromes decision aid"
  },
  "formula": "he_macs",
  "formula_expression": "p = 1/(1+e^(-λ)); λ = 1.426*a + 1.838*b + 0.734*c + 0.996*d + 1.353*e + 0.675*f + 0.024*g + 0.462*h - 4.416; a sweating observed 0/1; b acute ECG ischaemia 0/1; c pain radiating to right arm or shoulder 0/1; d vomiting associated with pain 0/1; e systolic BP <100 mmHg 0/1; f current tobacco smoker 0/1; g age in years (continuous); h male sex 1, female 0 (Alghamdi 2019 Table 2 printed values)",
  "sex": "female",
  "vomiting": false,
  "hypotension": false,
  "linear_predictor": -3.456,
  "probability": 0.0306,
  "current_smoker": false,
  "acute_ecg_ischaemia": false,
  "pain_radiation_right_arm_or_shoulder": false,
  "sweating_observed": false
}
```

## Errors

- HTTP 400 `invalid_he_macs`: HE-MACS inputs must match Alghamdi 2019 age, sex, and the six dichotomous history/ECG predictors from that paper. 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

- [MACS](https://magentlab.com/docs/macs) — Compute the Body 2014 Manchester Acute Coronary Syndromes (MACS) logistic probability of ACS from caller-assigned ECG ischaemia, worsening angina, right-arm or shoulder radiation, vomiting, observed sweating, hypotension, Roche Elecsys hs-cTnT in ng/L, and ELISA heart-type fatty acid-binding protein in ng/mL.
- [T-MACS](https://magentlab.com/docs/t-macs) — Compute the Body 2016 Troponin-only Manchester Acute Coronary Syndromes (T-MACS) logistic probability of ACS from caller-assigned ECG ischaemia, worsening angina, right-arm or shoulder radiation, vomiting, observed sweating, hypotension, and Roche Elecsys hs-cTnT in ng/L.
- [HEART score](https://magentlab.com/docs/heart) — Compute the HEART score as age points plus caller-assigned history, ECG, risk factors, and troponin (each 0-2).

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