Respiratory · LIVE
RAPID score for pleural infection
RAPID
Sum the Rahman 2014 RAPID points for pleural infection at presentation and return the published low, medium, or high band.
Markdown: /docs/rapid.md · Canonical: https://magentlab.com/docs/rapid
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum the Rahman 2014 RAPID points for pleural infection at presentation and return the published low, medium, or high band.
When to use
When an agent needs the published RAPID total for pleural infection and must not invent a drain, surgery, or fibrinolytic decision.
When not to use
- Not a medical device. magent does not assay urea or albumin or inspect pleural fluid.
- Not a drain, surgery, or fibrinolytic decision. RAPID is a presentation risk score for pleural infection (Rahman 2014), not Light's criteria.
Formula
RAPID = urea_points + age_points + nonpurulent_points + hospital_acquired_points + albumin_points; urea <5 = 0, 5.0-8.0 = 1, >8 = 2; age <50 = 0, 50-70 = 1, >70 = 2; purulent = 0, non-purulent = 1; community = 0, hospital = 1; albumin >=27 g/L = 0, <27 = 1; max 7
Citation
- Authors
- Rahman NM, Kahan BC, Pendleton RC, et al.
- Source
- Chest. 2014;145(4):848-855
Worked example
Urea 4 mmol/L, age 40, purulent community, albumin 35 g/L
Given:
age=40albumin_g_l=35hospital_acquired=falsepleural_purulent=trueurea_mmol_l=4
- urea <5 → 0; age <50 → 0; purulent → 0; community → 0; albumin ≥27 → 0
- score = 0
- risk_band low
Urea 9 mmol/L, age 71, non-purulent hospital, albumin 20 g/L
Given:
age=71albumin_g_l=20hospital_acquired=truepleural_purulent=falseurea_mmol_l=9
- urea >8 → 2; age >70 → 2; non-purulent → 1; hospital → 1; albumin <27 → 1
- score = 7
- risk_band high
Also searched as
- RAPID score
- RAPID pleural infection
- Rahman RAPID
- pleural infection score
- RAPID urea albumin
- pleural RAPID
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
/api/calc/rapid?urea_mmol_l=4&age=40&pleural_purulent=true&hospital_acquired=false&albumin_g_l=35
Full URL: https://api.magentlab.com/api/calc/rapid?urea_mmol_l=4&age=40&pleural_purulent=true&hospital_acquired=false&albumin_g_l=35
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/rapid?urea_mmol_l=4&age=40&pleural_purulent=true&hospital_acquired=false&albumin_g_l=35"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
urea_mmol_l |
number | optional | Serum urea in mmol/L (1-50). Provide this or bun_mg_dl, not both. <5 scores 0; 5.0-8.0 inclusive scores 1; >8 scores 2 (Rahman 2014). |
bun_mg_dl |
number | optional | BUN in mg/dL (3-140). Converted as urea_mmol_l = bun_mg_dl / 2.8. |
age |
integer | required | Age in years (18-120). <50 scores 0; 50-70 inclusive scores 1; >70 scores 2. |
pleural_purulent |
boolean | required | Purulent pleural fluid (Rahman 2014). true scores 0; false (non-purulent) scores 1. magent does not inspect the fluid. |
hospital_acquired |
boolean | required | Hospital-acquired pleural infection (Rahman 2014). true scores 1; false (community) scores 0. |
albumin_g_l |
number | optional | Serum albumin in g/L (10-60). Provide this or albumin_g_dl, not both. ≥27 scores 0; <27 scores 1. |
albumin_g_dl |
number | optional | Serum albumin in g/dL (1-6). Converted as g/L = g/dL × 10. Provide this or albumin_g_l, not both. |
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": [
{
"age": "40",
"albumin_g_l": "35",
"hospital_acquired": "false",
"pleural_purulent": "true",
"urea_mmol_l": "4"
},
{
"age": "40",
"albumin_g_l": "35",
"hospital_acquired": "false",
"pleural_purulent": "true",
"urea_mmol_l": "4"
}
]
}
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/rapid",
"items": [
{
"components": [
{
"value": 4.0,
"factor": "urea",
"points": 0,
"present": false
},
{
"value": 40,
"factor": "age",
"points": 0,
"present": false
},
{
"factor": "nonpurulent",
"points": 0,
"present": false
},
{
"factor": "hospital_acquired",
"points": 0,
"present": false
},
{
"value": 35.0,
"factor": "albumin",
"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": "Rahman NM, Kahan BC, Pendleton RC, et al.",
"doi": "10.1378/chest.13-1558",
"id": "rahman-2014",
"pmid": "24264558",
"source": "Chest. 2014;145(4):848-855",
"title": "A clinical score (RAPID) to identify those at risk for poor outcome at presentation in patients with pleural infection"
},
"formula": "rapid",
"formula_expression": "RAPID = urea_points + age_points + nonpurulent_points + hospital_acquired_points + albumin_points; urea <5 = 0, 5.0-8.0 = 1, >8 = 2; age <50 = 0, 50-70 = 1, >70 = 2; purulent = 0, non-purulent = 1; community = 0, hospital = 1; albumin >=27 g/L = 0, <27 = 1; max 7",
"age_years": 40,
"max_score": 7,
"score": 0,
"risk_band": "low",
"albumin_g_l": 35.0,
"urea_mmol_l": 4.0,
"hospital_acquired": false,
"pleural_purulent": true
},
{
"components": [
{
"value": 4.0,
"factor": "urea",
"points": 0,
"present": false
},
{
"value": 40,
"factor": "age",
"points": 0,
"present": false
},
{
"factor": "nonpurulent",
"points": 0,
"present": false
},
{
"factor": "hospital_acquired",
"points": 0,
"present": false
},
{
"value": 35.0,
"factor": "albumin",
"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": "Rahman NM, Kahan BC, Pendleton RC, et al.",
"doi": "10.1378/chest.13-1558",
"id": "rahman-2014",
"pmid": "24264558",
"source": "Chest. 2014;145(4):848-855",
"title": "A clinical score (RAPID) to identify those at risk for poor outcome at presentation in patients with pleural infection"
},
"formula": "rapid",
"formula_expression": "RAPID = urea_points + age_points + nonpurulent_points + hospital_acquired_points + albumin_points; urea <5 = 0, 5.0-8.0 = 1, >8 = 2; age <50 = 0, 50-70 = 1, >70 = 2; purulent = 0, non-purulent = 1; community = 0, hospital = 1; albumin >=27 g/L = 0, <27 = 1; max 7",
"age_years": 40,
"max_score": 7,
"score": 0,
"risk_band": "low",
"albumin_g_l": 35.0,
"urea_mmol_l": 4.0,
"hospital_acquired": false,
"pleural_purulent": true
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | rapid |
formula_expression |
string | Exact expression used |
score |
integer | RAPID points 0-7 |
max_score |
integer | 7 |
risk_band |
string | Rahman 2014 band: low (0-2), medium (3-4), or high (5-7). A band, not a drain or surgery decision. |
urea_mmol_l |
number | Urea in mmol/L used |
age_years |
integer | Age used |
pleural_purulent |
boolean | Purulent pleural fluid flag used |
hospital_acquired |
boolean | Hospital-acquired infection flag used |
albumin_g_l |
number | Serum albumin used in g/L (after g/dL conversion when supplied) |
components |
array | Per-variable points |
citation |
object | Rahman et al. Chest 2014 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"components": [
{
"value": 4.0,
"factor": "urea",
"points": 0,
"present": false
},
{
"value": 40,
"factor": "age",
"points": 0,
"present": false
},
{
"factor": "nonpurulent",
"points": 0,
"present": false
},
{
"factor": "hospital_acquired",
"points": 0,
"present": false
},
{
"value": 35.0,
"factor": "albumin",
"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": "Rahman NM, Kahan BC, Pendleton RC, et al.",
"doi": "10.1378/chest.13-1558",
"id": "rahman-2014",
"pmid": "24264558",
"source": "Chest. 2014;145(4):848-855",
"title": "A clinical score (RAPID) to identify those at risk for poor outcome at presentation in patients with pleural infection"
},
"formula": "rapid",
"formula_expression": "RAPID = urea_points + age_points + nonpurulent_points + hospital_acquired_points + albumin_points; urea <5 = 0, 5.0-8.0 = 1, >8 = 2; age <50 = 0, 50-70 = 1, >70 = 2; purulent = 0, non-purulent = 1; community = 0, hospital = 1; albumin >=27 g/L = 0, <27 = 1; max 7",
"age_years": 40,
"max_score": 7,
"score": 0,
"risk_band": "low",
"albumin_g_l": 35.0,
"urea_mmol_l": 4.0,
"hospital_acquired": false,
"pleural_purulent": true
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_urea |
urea_mmol_l (1-50) or bun_mg_dl (3-140) is required, not both. Returned before settlement; you are not charged. |
| 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_albumin |
albumin_g_dl (1-6) or albumin_g_l (10-60) is required 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
- Light's criteria — Apply Light 1972 pleural fluid criteria from protein ratio, LDH ratio, and pleural LDH versus two-thirds the laboratory LDH upper limit of normal.
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.