# HACOR Score Calculator (Duan 2017)

> HACOR Score Calculator (Duan 2017) is a paid API for AI agents from api.magentlab.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-15).

Computes the HACOR score (Heart rate, Acidosis, Consciousness, Oxygenation, Respiratory rate) to predict NIV failure risk, returning a total score and low/high risk classification.

## Facts

- Endpoint: GET https://api.magentlab.com/api/calc/hacor
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hacor-score-calculator-duan-2017-3f349441
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_dEkaj0ZKd13qsYq0xBDG-

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability hacor-score-calculator-duan-2017-3f349441
```

Example prompt: Compute the HACOR score for a patient with heart rate 128, arterial pH 7.31, GCS 13, P/F ratio 165, and respiratory rate 34 — and tell me whether they're low or high risk for NIV failure.

## When to prefer this

Use this endpoint when you need to programmatically compute the validated Duan 2017 HACOR score for a patient on or being considered for NIV and all five required clinical values (HR, pH, GCS, P/F ratio, RR) are already known. It is not a substitute for clinical judgment, does not issue intubation orders, and does not replace direct ABG reading or bedside GCS assessment.

## Known failure modes

- Missing any required parameter (heart_rate_bpm, ph, gcs, pf_ratio, respiratory_rate) returns an error
- Out-of-range values (e.g. pH outside 6.80–7.80, GCS outside 3–15) may be rejected or return validation errors
- Non-integer GCS or respiratory_rate values will fail schema validation
- Caller must supply clinician-assessed GCS and measured ABG/ventilator values; the endpoint cannot obtain them independently

## How this service works

Duan 2017 HACOR (ESM Table 2): HR ≤120 → 0, ≥121 → 1; pH ≥7.35 → 0, 7.30–7.34 → 2, 7.25–7.29 → 3, <7.25 → 4; GCS 15 → 0, 13–14 → 2, 11–12 → 5, ≤10 → 10; P/F ≥201 → 0, 176–200 → 2, 151–175 → 3, 126–150 → 4, 101–125 → 5, ≤100 → 6; RR ≤30 → 0, 31–35 → 1, 36–40 → 2, 41–45 → 3, ≥46 → 4. Max 25. Low ≤5, high >5. Not an intubation or NIV-failure order. magent does not read an ABG, GCS the patient, or a ventilator.

## Output

Returns the total HACOR score (integer 0–25) computed from the five weighted components per Duan 2017 ESM Table 2, plus a risk tier: low (≤5) or high (>5). The endpoint does not read ABG values, assess GCS, or interrogate ventilator data — all inputs must be supplied by the caller.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "heart_rate_bpm",
      "ph",
      "gcs",
      "pf_ratio",
      "respiratory_rate"
     ],
     "properties": {
      "ph": {
       "type": "number",
       "description": "Arterial pH (6.80-7.80). Duan 2017 ESM Table 2: ≥7.35 → 0, 7.30-7.34 → 2, 7.25-7.29 → 3, <7.25 → 4. magent does not read an ABG."
      },
      "gcs": {
       "type": "integer",
       "description": "Total Glasgow Coma Scale 3-15 as assigned by the caller. Duan 2017 ESM Table 2: 15 → 0, 13-14 → 2, 11-12 → 5, ≤10 → 10. Not a GCS 10-12 / ≤9 table. magent does not GCS the patient."
      },
      "pf_ratio": {
       "type": "number",
       "description": "PaO2/FiO2 ratio (20-800). Duan 2017 ESM Table 2: ≥201 → 0, 176-200 → 2, 151-175 → 3, 126-150 → 4, 101-125 → 5, ≤100 → 6. magent does not read an ABG or a ventilator."
      },
      "heart_rate_bpm": {
       "type": "integer",
       "description": "Heart rate in beats/min (integer 30-220). Duan 2017 ESM Table 2: ≤120 → 0, ≥121 → 1."
      },
      "respiratory_rate": {
       "type": "integer",
       "description": "Respiratory rate in breaths/min (integer 4-80). Duan 2017 ESM Table 2: ≤30 → 0, 31-35 → 1, 36-40 → 2, 41-45 → 3, ≥46 → 4."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "path": "/api/calc/hacor",
  "count": 2,
  "items": [
   {
    "ph": 7.4,
    "gcs": 15,
    "score": 0,
    "formula": "hacor",
    "citation": {
     "id": "duan-2017",
     "doi": "10.1007/s00134-016-4601-3",
     "pmid": "27812731",
     "title": "Assessment of heart rate, acidosis, consciousness, oxygenation, and respiratory rate to predict noninvasive ventilation failure in hypoxemic patients",
     "source": "Intensive Care Med. 2017;43(2):192-199",
     "authors": "Duan J, Han X, Bai L, Zhou L, Huang S"
    },
    "pf_ratio": 300,
    "max_score": 25,
    "components": [
     {
      "value": 80,
      "factor": "heart_rate_bpm",
      "points": 0,
      "present": false
     },
     {
      "value": 7.4,
      "factor": "ph",
      "points": 0,
      "present": false
     },
     {
      "value": 15,
      "factor": "gcs",
      "points": 0,
      "present": false
     },
     {
      "value": 300,
      "factor": "pf_ratio",
      "points": 0,
      "present": false
     },
     {
      "value": 18,
      "factor": "respiratory_rate",
      "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.",
    "hacor_band": "low",
    "heart_rate_bpm": 80,
    "respiratory_rate": 18,
    "formula_expression": "HACOR = HR(≤120→0, ≥121→1) + pH(≥7.35→0, 7.30–7.34→2, 7.25–7.29→3, <7.25→4) + GCS(15→0, 13–14→2, 11–12→5, ≤10→10) + P/F(≥201→0, 176–200→2, 151–175→3, 126–150→4, 101–125→5, ≤100→6) + RR(≤30→0, 31–35→1, 36–40→2, 41–45→3, ≥46→4); Duan 2017 ESM Table 2; max 25; low ≤5, high >5"
   },
   {
    "ph": 7.4,
    "gcs": 15,
    "score": 0,
    "formula": "hacor",
    "citation": {
     "id": "duan-2017",
     "doi": "10.1007/s00134-016-4601-3",
     "pmid": "27812731",
     "title": "Assessment of heart rate, acidosis, consciousness, oxygenation, and respiratory rate to predict noninvasive ventilation failure in hypoxemic patients",
     "source": "Intensive Care Med. 2017;43(2):192-199",
     "authors": "Duan J, Han X, Bai L, Zhou L, Huang S"
    },
    "pf_ratio": 300,
    "max_score": 25,
    "components": [
     {
      "value": 80,
      "factor": "heart_rate_bpm",
      "points": 0,
      "present": false
     },
     {
      "value": 7.4,
      "factor": "ph",
      "points": 0,
      "present": false
     },
     {
      "
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hacor-score-calculator-duan-2017-3f349441/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.magentlab.com](https://www.zero.xyz/host/api.magentlab.com/llms.txt)
