Electrolytes / glucose · LIVE
DKA mortality prediction model (Efstathiou)
DKA-MPM
Sum the Efstathiou 2002 DKA-MPM flags (max 25) and return the published in-hospital death percents only for scores 0–14 (0.86%) and 19–25 (93.3%).
Markdown: /docs/dka-mpm.md · Canonical: https://magentlab.com/docs/dka-mpm
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum the Efstathiou 2002 DKA-MPM flags (max 25) and return the published in-hospital death percents only for scores 0–14 (0.86%) and 19–25 (93.3%).
When to use
When an agent already has the six Efstathiou 2002 presentation and first-day flags and needs the published point total, not a DKA treatment order, insulin dose, pH or glucose assay, later 72-hour DKA score, or invented percents for scores 15–18.
When not to use
- Not a medical device and not a DKA treatment, fluid, or insulin-dose order.
- magent does not assay pH or glucose. All six predictors are caller-assigned flags.
- Efstathiou 2002 published in-hospital death of 0.86% for scores 0–14 and 93.3% for scores 19–25. Scores 15–18 return the point total without a percent.
- Does not implement later 72-hour DKA mortality scores. Does not invent Low/High labels or intermediate percents that paper did not publish.
Formula
DKA-MPM = severe_comorbidity 6 + ph_lt_7 4 + insulin_gt_50_12h 4 + glucose_gt_16_7_12h 4 + depressed_mental_24h 4 + fever_24h 3; Efstathiou 2002; max 25; published in-hospital death 0.86% scores 0-14 and 93.3% scores 19-25
Citation
- Authors
- Efstathiou SP, Tsioulos DI, Tsiakou AG, Gratsias YG, Pefanis AV, Mountokalakis TD
- Source
- Clin Endocrinol (Oxf). 2002;57(5):595-601
Worked example
All flags false (score 0, published 0.86%)
Given:
depressed_mental_24h=falsefever_24h=falseglucose_gt_16_7_12h=falseinsulin_gt_50_12h=falseph_lt_7=falsesevere_comorbidity=false
- All six Efstathiou 2002 flags false → 0
- score = 0 (max 25); scores 0-14 publish 0.86% in-hospital death
Score 18 (no published percent)
Given:
depressed_mental_24h=falsefever_24h=falseglucose_gt_16_7_12h=trueinsulin_gt_50_12h=trueph_lt_7=truesevere_comorbidity=true
- severe_comorbidity 6 + ph_lt_7 4 + insulin_gt_50_12h 4 + glucose_gt_16_7_12h 4
- score = 18 (max 25); scores 15-18 omit observed_mortality_percent
All flags true (score 25, published 93.3%)
Given:
depressed_mental_24h=truefever_24h=trueglucose_gt_16_7_12h=trueinsulin_gt_50_12h=trueph_lt_7=truesevere_comorbidity=true
- 6 + 4 + 4 + 4 + 4 + 3
- score = 25 (max 25); scores 19-25 publish 93.3% in-hospital death
Also searched as
- DKA-MPM
- DKA mortality prediction model
- Efstathiou DKA score
- diabetic ketoacidosis mortality score
- DKA MPM
- Efstathiou 2002
- ketoacidosis mortality prediction
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/dka_mpm?severe_comorbidity=false&ph_lt_7=false&insulin_gt_50_12h=false&glucose_gt_16_7_12h=false&depressed_mental_24h=false&fever_24h=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/dka_mpm?severe_comorbidity=false&ph_lt_7=false&insulin_gt_50_12h=false&glucose_gt_16_7_12h=false&depressed_mental_24h=false&fever_24h=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
severe_comorbidity |
boolean | required | Severe coexisting disease at presentation as assigned by the caller (Efstathiou 2002). true scores 6. true or false. magent does not diagnose comorbidity. |
ph_lt_7 |
boolean | required | Arterial pH < 7.0 at presentation as assigned by the caller (Efstathiou 2002). true scores 4. true or false. magent does not assay pH. |
insulin_gt_50_12h |
boolean | required | Regular insulin > 50 IU in the first 12 h as assigned by the caller (Efstathiou 2002). true scores 4. true or false. Not an insulin dose. magent does not order insulin. |
glucose_gt_16_7_12h |
boolean | required | Serum glucose > 16.7 mmol/L after 12 h as assigned by the caller (Efstathiou 2002). true scores 4. true or false. magent does not assay glucose. |
depressed_mental_24h |
boolean | required | Depressed mental state after 24 h as assigned by the caller (Efstathiou 2002). true scores 4. true or false. magent does not examine the patient. |
fever_24h |
boolean | required | Fever after 24 h as assigned by the caller (Efstathiou 2002). true scores 3. true or false. magent does not take temperature. |
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.
- 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 (fixture)
{
"items": [
{
"depressed_mental_24h": "false",
"fever_24h": "false",
"glucose_gt_16_7_12h": "false",
"insulin_gt_50_12h": "false",
"ph_lt_7": "false",
"severe_comorbidity": "false"
},
{
"depressed_mental_24h": "false",
"fever_24h": "false",
"glucose_gt_16_7_12h": "false",
"insulin_gt_50_12h": "false",
"ph_lt_7": "false",
"severe_comorbidity": "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/dka_mpm",
"items": [
{
"components": [
{
"factor": "severe_comorbidity",
"points": 0,
"present": false
},
{
"factor": "ph_lt_7",
"points": 0,
"present": false
},
{
"factor": "insulin_gt_50_12h",
"points": 0,
"present": false
},
{
"factor": "glucose_gt_16_7_12h",
"points": 0,
"present": false
},
{
"factor": "depressed_mental_24h",
"points": 0,
"present": false
},
{
"factor": "fever_24h",
"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.",
"citation": {
"authors": "Efstathiou SP, Tsioulos DI, Tsiakou AG, Gratsias YG, Pefanis AV, Mountokalakis TD",
"doi": "10.1046/j.1365-2265.2002.01636.x",
"id": "efstathiou-2002",
"pmid": "12390332",
"source": "Clin Endocrinol (Oxf). 2002;57(5):595-601",
"title": "A mortality prediction model in diabetic ketoacidosis"
},
"formula": "dka_mpm",
"formula_expression": "DKA-MPM = severe_comorbidity 6 + ph_lt_7 4 + insulin_gt_50_12h 4 + glucose_gt_16_7_12h 4 + depressed_mental_24h 4 + fever_24h 3; Efstathiou 2002; max 25; published in-hospital death 0.86% scores 0-14 and 93.3% scores 19-25",
"max_score": 25,
"score": 0,
"observed_mortality_percent": 0.86
},
{
"components": [
{
"factor": "severe_comorbidity",
"points": 0,
"present": false
},
{
"factor": "ph_lt_7",
"points": 0,
"present": false
},
{
"factor": "insulin_gt_50_12h",
"points": 0,
"present": false
},
{
"factor": "glucose_gt_16_7_12h",
"points": 0,
"present": false
},
{
"factor": "depressed_mental_24h",
"points": 0,
"present": false
},
{
"factor": "fever_24h",
"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.",
"citation": {
"authors": "Efstathiou SP, Tsioulos DI, Tsiakou AG, Gratsias YG, Pefanis AV, Mountokalakis TD",
"doi": "10.1046/j.1365-2265.2002.01636.x",
"id": "efstathiou-2002",
"pmid": "12390332",
"source": "Clin Endocrinol (Oxf). 2002;57(5):595-601",
"title": "A mortality prediction model in diabetic ketoacidosis"
},
"formula": "dka_mpm",
"formula_expression": "DKA-MPM = severe_comorbidity 6 + ph_lt_7 4 + insulin_gt_50_12h 4 + glucose_gt_16_7_12h 4 + depressed_mental_24h 4 + fever_24h 3; Efstathiou 2002; max 25; published in-hospital death 0.86% scores 0-14 and 93.3% scores 19-25",
"max_score": 25,
"score": 0,
"observed_mortality_percent": 0.86
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | dka_mpm |
formula_expression |
string | Exact expression used |
score |
integer | Efstathiou 2002 DKA-MPM points 0-25 |
max_score |
integer | Always 25 |
observed_mortality_percent |
number | Efstathiou 2002 published in-hospital death: 0.86 when score is 0-14, 93.3 when score is 19-25. Omitted for scores 15-18; those scores are not given invented percents. |
components |
array | Per-factor Efstathiou 2002 points |
citation |
object | Efstathiou et al. Clin Endocrinol (Oxf) 2002 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"factor": "severe_comorbidity",
"points": 0,
"present": false
},
{
"factor": "ph_lt_7",
"points": 0,
"present": false
},
{
"factor": "insulin_gt_50_12h",
"points": 0,
"present": false
},
{
"factor": "glucose_gt_16_7_12h",
"points": 0,
"present": false
},
{
"factor": "depressed_mental_24h",
"points": 0,
"present": false
},
{
"factor": "fever_24h",
"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.",
"citation": {
"authors": "Efstathiou SP, Tsioulos DI, Tsiakou AG, Gratsias YG, Pefanis AV, Mountokalakis TD",
"doi": "10.1046/j.1365-2265.2002.01636.x",
"id": "efstathiou-2002",
"pmid": "12390332",
"source": "Clin Endocrinol (Oxf). 2002;57(5):595-601",
"title": "A mortality prediction model in diabetic ketoacidosis"
},
"formula": "dka_mpm",
"formula_expression": "DKA-MPM = severe_comorbidity 6 + ph_lt_7 4 + insulin_gt_50_12h 4 + glucose_gt_16_7_12h 4 + depressed_mental_24h 4 + fever_24h 3; Efstathiou 2002; max 25; published in-hospital death 0.86% scores 0-14 and 93.3% scores 19-25",
"max_score": 25,
"score": 0,
"observed_mortality_percent": 0.86
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_dka_mpm |
DKA-MPM inputs must match Efstathiou 2002 presentation and first-day binary predictors from that paper. 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
- Anion gap — Compute the serum anion gap from sodium, chloride, and bicarbonate, with or without potassium, using the Emmett–Narins 1977 formulas. formula is required.
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. 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
- 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.