# HEADS-ED (Cappelli)

HEADS-ED

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

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

## What it computes

Sum seven caller-assigned Cappelli 2012 HEADS-ED integers (0-2) and return the published 0-14 total and per-item scores.

## When to use

When an agent has already assigned Cappelli 2012 0-2 integers for each HEADS-ED domain and needs the published total, not a psychiatric consult or admission order.

## When not to use

- Not a medical device and not a psychiatric admission order.
- Each of the seven domains is a caller-assigned integer 0, 1, or 2 from Cappelli 2012 (0 no action needed, 1 needs action but not immediately, 2 needs immediate action). magent does not interview a child.
- Cappelli 2012 reported that the total predicted psychiatric consult and admission (sensitivity 82%, specificity 87%, AUC 0.82). That paper does not publish labeled score bands. magent returns the 0-14 total and per-item scores only and does not apply a later website high-risk rule as a named class.
- This is Cappelli 2012 HEADS-ED only (seven domains; max 14). Not HEADS-ED Under 6. Not an unscored HEADSSS/HEEADSSS interview mnemonic.

## Formula

```
HEADS-ED = home + education + activities + drugs + suicidality + emotions + discharge_resources; each caller-assigned 0-2 (0 no action needed, 1 needs action but not immediately, 2 needs immediate action); max 14
```

## Citation

[The HEADS-ED: a rapid mental health screening tool for pediatric patients in the emergency department](https://doi.org/10.1542/peds.2011-3798)
Cappelli M, Gray C, Zemek R, Cloutier P, Kennedy A, Glennie E, Doucet G, Lyons JS
Pediatrics. 2012;130(2):e321-e327
DOI: [10.1542/peds.2011-3798](https://doi.org/10.1542/peds.2011-3798)

## Worked example

### All domains 0

Given: `activities=0, discharge_resources=0, drugs=0, education=0, emotions=0, home=0, suicidality=0`

1. home 0 + education 0 + activities 0 + drugs 0 + suicidality 0 + emotions 0 + discharge_resources 0
2. Score = 0 (max 14)


### High total with suicidality 2

Given: `activities=2, discharge_resources=1, drugs=1, education=2, emotions=2, home=2, suicidality=2`

1. home 2 + education 2 + activities 2 + drugs 1 + suicidality 2 + emotions 2 + discharge_resources 1
2. Score = 12 (max 14); suicidality 2. Cappelli 2012 does not name a labeled high-risk band.


## Also searched as

- HEADS-ED
- HEADS ED
- Cappelli HEADS-ED
- pediatric ED mental health screen
- home education activities drugs suicidality
- HEADS-ED score
- pediatric psychosocial screen ED

## Parameters

- `home` (integer, required): Caller-assigned Cappelli 2012 Home (integer 0-2): 0 no action needed (supportive); 1 needs action but not immediately (conflicts); 2 needs immediate action (chaotic/dysfunctional). magent does not interview a child.
- `education` (integer, required): Caller-assigned Cappelli 2012 Education (integer 0-2): 0 no action needed (on track); 1 needs action but not immediately (grades dropping or absenteeism); 2 needs immediate action (failing/not attending). magent does not interview a child.
- `activities` (integer, required): Caller-assigned Cappelli 2012 Activities/peers (integer 0-2): 0 no action needed (no change); 1 needs action but not immediately (reduction in activities/increased peer conflicts); 2 needs immediate action (increasingly to fully withdrawn/significant peer conflicts). magent does not interview a child.
- `drugs` (integer, required): Caller-assigned Cappelli 2012 Drugs/alcohol (integer 0-2): 0 no action needed (none or infrequent); 1 needs action but not immediately (occasional); 2 needs immediate action (frequent/daily). magent does not interview a child.
- `suicidality` (integer, required): Caller-assigned Cappelli 2012 Suicidality (integer 0-2): 0 no action needed (no thoughts); 1 needs action but not immediately (ideation); 2 needs immediate action (plan or gesture). magent does not interview a child.
- `emotions` (integer, required): Caller-assigned Cappelli 2012 Emotions/behavior (integer 0-2): 0 no action needed (mildly anxious/sad/acting out); 1 needs action but not immediately (moderately anxious/sad/acting out); 2 needs immediate action (significantly distressed/unable to function/out of control). magent does not interview a child.
- `discharge_resources` (integer, required): Caller-assigned Cappelli 2012 Discharge resources (integer 0-2): 0 no action needed (ongoing/well connected); 1 needs action but not immediately (some/not meeting needs); 2 needs immediate action (none/on waitlist). magent does not interview a child.

## 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/heads_ed`
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": [
    {
      "activities": "0",
      "discharge_resources": "0",
      "drugs": "0",
      "education": "0",
      "emotions": "0",
      "home": "0",
      "suicidality": "0"
    },
    {
      "activities": "0",
      "discharge_resources": "0",
      "drugs": "0",
      "education": "0",
      "emotions": "0",
      "home": "0",
      "suicidality": "0"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/heads_ed",
  "items": [
    {
      "home": 0,
      "components": [
        {
          "value": 0,
          "factor": "home",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "education",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "activities",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "drugs",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "suicidality",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "emotions",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "discharge_resources",
          "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": "Cappelli M, Gray C, Zemek R, Cloutier P, Kennedy A, Glennie E, Doucet G, Lyons JS",
        "doi": "10.1542/peds.2011-3798",
        "id": "cappelli-2012",
        "pmid": "22826567",
        "source": "Pediatrics. 2012;130(2):e321-e327",
        "title": "The HEADS-ED: a rapid mental health screening tool for pediatric patients in the emergency department"
      },
      "formula": "heads_ed",
      "formula_expression": "HEADS-ED = home + education + activities + drugs + suicidality + emotions + discharge_resources; each caller-assigned 0-2 (0 no action needed, 1 needs action but not immediately, 2 needs immediate action); max 14",
      "max_score": 14,
      "score": 0,
      "activities": 0,
      "discharge_resources": 0,
      "drugs": 0,
      "education": 0,
      "emotions": 0,
      "suicidality": 0
    },
    {
      "home": 0,
      "components": [
        {
          "value": 0,
          "factor": "home",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "education",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "activities",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "drugs",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "suicidality",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "emotions",
          "points": 0,
          "present": true
        },
        {
          "value": 0,
          "factor": "discharge_resources",
          "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": "Cappelli M, Gray C, Zemek R, Cloutier P, Kennedy A, Glennie E, Doucet G, Lyons JS",
        "doi": "10.1542/peds.2011-3798",
        "id": "cappelli-2012",
        "pmid": "22826567",
        "source": "Pediatrics. 2012;130(2):e321-e327",
        "title": "The HEADS-ED: a rapid mental health screening tool for pediatric patients in the emergency department"
      },
      "formula": "heads_ed",
      "formula_expression": "HEADS-ED = home + education + activities + drugs + suicidality + emotions + discharge_resources; each caller-assigned 0-2 (0 no action needed, 1 needs action but not immediately, 2 needs immediate action); max 14",
      "max_score": 14,
      "score": 0,
      "activities": 0,
      "discharge_resources": 0,
      "drugs": 0,
      "education": 0,
      "emotions": 0,
      "suicidality": 0
    }
  ]
}
```

## Response fields

- `formula` (string): heads_ed
- `formula_expression` (string): Exact expression used
- `score` (integer): HEADS-ED points 0-14
- `max_score` (integer): Always 14
- `home` (integer): Caller-assigned Home points 0-2
- `education` (integer): Caller-assigned Education points 0-2
- `activities` (integer): Caller-assigned Activities/peers points 0-2
- `drugs` (integer): Caller-assigned Drugs/alcohol points 0-2
- `suicidality` (integer): Caller-assigned Suicidality points 0-2
- `emotions` (integer): Caller-assigned Emotions/behavior points 0-2
- `discharge_resources` (integer): Caller-assigned Discharge resources points 0-2
- `components` (array): Per-item caller-assigned points
- `citation` (object): Cappelli et al. Pediatrics 2012 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "home": 0,
  "components": [
    {
      "value": 0,
      "factor": "home",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "education",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "activities",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "drugs",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "suicidality",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "emotions",
      "points": 0,
      "present": true
    },
    {
      "value": 0,
      "factor": "discharge_resources",
      "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": "Cappelli M, Gray C, Zemek R, Cloutier P, Kennedy A, Glennie E, Doucet G, Lyons JS",
    "doi": "10.1542/peds.2011-3798",
    "id": "cappelli-2012",
    "pmid": "22826567",
    "source": "Pediatrics. 2012;130(2):e321-e327",
    "title": "The HEADS-ED: a rapid mental health screening tool for pediatric patients in the emergency department"
  },
  "formula": "heads_ed",
  "formula_expression": "HEADS-ED = home + education + activities + drugs + suicidality + emotions + discharge_resources; each caller-assigned 0-2 (0 no action needed, 1 needs action but not immediately, 2 needs immediate action); max 14",
  "max_score": 14,
  "score": 0,
  "activities": 0,
  "discharge_resources": 0,
  "drugs": 0,
  "education": 0,
  "emotions": 0,
  "suicidality": 0
}
```

## Errors

- HTTP 400 `invalid_heads_ed`: HEADS-ED inputs must match Cappelli 2012 home, education, activities, drugs, suicidality, emotions, and discharge resource items 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

- [PEWS](https://magentlab.com/docs/pews) — Compute the Monaghan 2005 Brighton Paediatric Early Warning Score from caller-assigned behaviour, colour/CRT, respiratory effort, oxygen, quarter-hourly nebulisers, and persistent post-surgery vomiting, plus heart rate and respiratory rate against APLS 2005 age-group rest ranges used as that paper's normal rate and mean.
- [Paradise](https://magentlab.com/docs/paradise) — Apply the Paradise 1984 eligibility frequency for recurrent throat infection and return whether paradise_criteria holds (frequency met and qualifying episode features).
- [PECARN febrile infant](https://magentlab.com/docs/pecarn-febrile) — Apply the Kuppermann 2019 PECARN clinical prediction rule and return low_risk only when a febrile infant 60 days or younger has a caller-assigned negative urinalysis, ANC ≤4090/µL, and serum procalcitonin ≤1.71 ng/mL.

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