Emergency · LIVE
Gupta postoperative respiratory failure
Gupta PRF
Compute the Gupta 2011 Chest logistic probability of postoperative respiratory failure (mechanical ventilation >48 h after surgery or unplanned intubation within 30 days) from ASA class, functional status, preoperative sepsis, emergency case, and surgery type.
Markdown: /docs/gupta-prf.md · Canonical: https://magentlab.com/docs/gupta-prf
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Compute the Gupta 2011 Chest logistic probability of postoperative respiratory failure (mechanical ventilation >48 h after surgery or unplanned intubation within 30 days) from ASA class, functional status, preoperative sepsis, emergency case, and surgery type.
When to use
When an agent needs the published Gupta 2011 Chest PRF probability and must not invent a ventilator order, a diagnosis, ARISCAT points, or a low/high cutoff.
When not to use
- Not a medical device. Not a diagnosis and not a ventilator order.
- Gupta 2011 Chest logistic PRF model only. This is not ARISCAT and not a surgical clearance.
- Gupta 2011 does not publish a low or high PRF cutoff; magent does not invent one.
- Age and laboratory values are not in the published table.
- functional_status, sepsis, emergency, and surgery are caller-assigned published categories. magent does not examine the patient or classify the procedure from a CPT code.
Formula
L = -1.7397 + functional_status + asa_class + sepsis + emergency + surgery (Gupta 2011 Chest logistic table); independent 0, partially_dependent 0.7678, totally_dependent 1.4046; ASA1 -3.5265, ASA2 -2.0008, ASA3 -0.6201, ASA4 0.2441, ASA5 0; sepsis none -0.7840, sirs 0, sepsis 0.2752, septic_shock 0.9035; elective -0.5739, emergency 0; hernia 0, anorectal -1.3530, aortic 1.0781, bariatric -1.0112, brain 0.7336, breast -2.6462, cardiac 0.2744, ent 0.1060, foregut_hpb 0.9694, gbaas -0.5668, intestinal 0.5737, neck -0.5271, obstetric_gynecologic -1.2431, orthopedic -0.8577, other_abdomen 0.2416, peripheral_vascular -0.2389, skin -0.3206, spine -0.5220, thoracic 0.6715, vein -2.0080, urology 0.3093; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))
Citation
- Authors
- Gupta H, Gupta PK, Fang X, Miller WJ, Cemaj S, Forse RA, Morrow LE
- Source
- Chest. 2011;140(5):1207-1215
Worked example
Independent, ASA 2, no sepsis, elective hernia
Given:
asa_class=2emergency=falsefunctional_status=independentsepsis=nonesurgery=hernia
- L = -1.7397 + 0 (independent) + -2.0008 (ASA 2) + -0.7840 (none) + -0.5739 (elective) + 0 (hernia) = -5.0984
- estimated_probability_percent = 100 × e^(-5.0984) / (1 + e^(-5.0984))
Independent, ASA 4, no sepsis, elective hernia
Given:
asa_class=4emergency=falsefunctional_status=independentsepsis=nonesurgery=hernia
- L = -1.7397 + 0 + 0.2441 (ASA 4) + -0.7840 (none) + -0.5739 (elective) + 0 = -2.8535
- estimated_probability_percent from the Chest logistic table, two decimals from the unrounded logit
Independent, ASA 2, no sepsis, emergency hernia
Given:
asa_class=2emergency=truefunctional_status=independentsepsis=nonesurgery=hernia
- L = -1.7397 + 0 + -2.0008 (ASA 2) + -0.7840 (none) + 0 (emergency) + 0 = -4.5245
- estimated_probability_percent from the Chest logistic table, two decimals from the unrounded logit
Independent, ASA 2, preoperative sepsis, elective hernia
Given:
asa_class=2emergency=falsefunctional_status=independentsepsis=sepsissurgery=hernia
- L = -1.7397 + 0 + -2.0008 (ASA 2) + 0.2752 (sepsis) + -0.5739 (elective) + 0 = -4.0392
- estimated_probability_percent from the Chest logistic table, two decimals from the unrounded logit
Totally dependent, ASA 2, no sepsis, elective hernia
Given:
asa_class=2emergency=falsefunctional_status=totally_dependentsepsis=nonesurgery=hernia
- L = -1.7397 + 1.4046 (totally_dependent) + -2.0008 (ASA 2) + -0.7840 (none) + -0.5739 (elective) + 0 = -3.6938
- estimated_probability_percent from the Chest logistic table, two decimals from the unrounded logit
Independent, ASA 2, no sepsis, elective aortic
Given:
asa_class=2emergency=falsefunctional_status=independentsepsis=nonesurgery=aortic
- L = -1.7397 + 0 + -2.0008 (ASA 2) + -0.7840 (none) + -0.5739 (elective) + 1.0781 (aortic) = -4.0203
- estimated_probability_percent from the Chest logistic table, two decimals from the unrounded logit
Also searched as
- Gupta PRF
- postoperative respiratory failure
- Gupta 2011 Chest respiratory failure
- unplanned intubation after surgery
- mechanical ventilation after surgery
- NSQIP respiratory failure probability
- Gupta perioperative pulmonary risk
- postoperative reintubation probability
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/gupta_prf?functional_status=independent&asa_class=2&sepsis=none&emergency=false&surgery=hernia
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/gupta_prf?functional_status=independent&asa_class=2&sepsis=none&emergency=false&surgery=hernia"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
functional_status |
string | required · independent, partially_dependent, totally_dependent | Gupta 2011 Chest functional status as assigned by the caller: independent (reference, 0), partially_dependent (+0.7678), or totally_dependent (+1.4046). magent does not examine the patient. |
asa_class |
integer | required | ASA physical status 1-5 (Gupta 2011 Chest logistic table; class 5 is the reference). class 1 -3.5265, class 2 -2.0008, class 3 -0.6201, class 4 +0.2441, class 5 adds 0. Caller-assigned integer. |
sepsis |
string | required · none, sirs, sepsis, septic_shock | Gupta 2011 Chest preoperative sepsis category as assigned by the caller: none (-0.7840), sirs (reference, 0), sepsis (+0.2752), or septic_shock (+0.9035). magent does not diagnose sepsis. |
emergency |
boolean | required | Gupta 2011 Chest emergency case as assigned by the caller: true (reference, 0) or false (elective, -0.5739). |
surgery |
string | required · hernia, anorectal, aortic, bariatric, brain, breast, cardiac, ent, foregut_hpb, gbaas, intestinal, neck, obstetric_gynecologic, orthopedic, other_abdomen, peripheral_vascular, skin, spine, thoracic, vein, urology | Gupta 2011 Chest procedure category as assigned by the caller. hernia (ventral, inguinal, or femoral) is the reference (0). gbaas is gallbladder, appendix, adrenal, or spleen. thoracic is non-esophageal thoracic. orthopedic is orthopedic or non-vascular extremity. ent excludes thyroid/parathyroid (neck). magent does not classify a CPT code. |
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": [
{
"asa_class": "2",
"emergency": "false",
"functional_status": "independent",
"sepsis": "none",
"surgery": "hernia"
},
{
"asa_class": "2",
"emergency": "false",
"functional_status": "independent",
"sepsis": "none",
"surgery": "hernia"
}
]
}
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/gupta_prf",
"items": [
{
"emergency": 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": "Gupta H, Gupta PK, Fang X, Miller WJ, Cemaj S, Forse RA, Morrow LE",
"doi": "10.1378/chest.11-0466",
"id": "gupta-2011-prf",
"pmid": "21757571",
"source": "Chest. 2011;140(5):1207-1215",
"title": "Development and validation of a risk calculator predicting postoperative respiratory failure"
},
"formula": "gupta_prf",
"formula_expression": "L = -1.7397 + functional_status + asa_class + sepsis + emergency + surgery (Gupta 2011 Chest logistic table); independent 0, partially_dependent 0.7678, totally_dependent 1.4046; ASA1 -3.5265, ASA2 -2.0008, ASA3 -0.6201, ASA4 0.2441, ASA5 0; sepsis none -0.7840, sirs 0, sepsis 0.2752, septic_shock 0.9035; elective -0.5739, emergency 0; hernia 0, anorectal -1.3530, aortic 1.0781, bariatric -1.0112, brain 0.7336, breast -2.6462, cardiac 0.2744, ent 0.1060, foregut_hpb 0.9694, gbaas -0.5668, intestinal 0.5737, neck -0.5271, obstetric_gynecologic -1.2431, orthopedic -0.8577, other_abdomen 0.2416, peripheral_vascular -0.2389, skin -0.3206, spine -0.5220, thoracic 0.6715, vein -2.0080, urology 0.3093; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
"estimated_probability_percent": 0.61,
"logit": -5.0984,
"asa_class": 2,
"surgery": "hernia",
"functional_status": "independent",
"sepsis": "none"
},
{
"emergency": 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": "Gupta H, Gupta PK, Fang X, Miller WJ, Cemaj S, Forse RA, Morrow LE",
"doi": "10.1378/chest.11-0466",
"id": "gupta-2011-prf",
"pmid": "21757571",
"source": "Chest. 2011;140(5):1207-1215",
"title": "Development and validation of a risk calculator predicting postoperative respiratory failure"
},
"formula": "gupta_prf",
"formula_expression": "L = -1.7397 + functional_status + asa_class + sepsis + emergency + surgery (Gupta 2011 Chest logistic table); independent 0, partially_dependent 0.7678, totally_dependent 1.4046; ASA1 -3.5265, ASA2 -2.0008, ASA3 -0.6201, ASA4 0.2441, ASA5 0; sepsis none -0.7840, sirs 0, sepsis 0.2752, septic_shock 0.9035; elective -0.5739, emergency 0; hernia 0, anorectal -1.3530, aortic 1.0781, bariatric -1.0112, brain 0.7336, breast -2.6462, cardiac 0.2744, ent 0.1060, foregut_hpb 0.9694, gbaas -0.5668, intestinal 0.5737, neck -0.5271, obstetric_gynecologic -1.2431, orthopedic -0.8577, other_abdomen 0.2416, peripheral_vascular -0.2389, skin -0.3206, spine -0.5220, thoracic 0.6715, vein -2.0080, urology 0.3093; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
"estimated_probability_percent": 0.61,
"logit": -5.0984,
"asa_class": 2,
"surgery": "hernia",
"functional_status": "independent",
"sepsis": "none"
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | gupta_prf |
formula_expression |
string | Gupta 2011 Chest logistic expression |
functional_status |
string | independent, partially_dependent, or totally_dependent |
asa_class |
integer | ASA physical status 1-5 |
sepsis |
string | none, sirs, sepsis, or septic_shock |
emergency |
boolean | true if the case is an emergency |
surgery |
string | Gupta 2011 Chest procedure category |
logit |
number | Gupta 2011 Chest linear predictor L, 4 decimal places |
estimated_probability_percent |
number | 100 * exp(L) / (1 + exp(L)) from the unrounded logit, 2 decimal places. A probability, not a ventilator order. |
citation |
object | Gupta et al. Chest 2011 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"emergency": 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": "Gupta H, Gupta PK, Fang X, Miller WJ, Cemaj S, Forse RA, Morrow LE",
"doi": "10.1378/chest.11-0466",
"id": "gupta-2011-prf",
"pmid": "21757571",
"source": "Chest. 2011;140(5):1207-1215",
"title": "Development and validation of a risk calculator predicting postoperative respiratory failure"
},
"formula": "gupta_prf",
"formula_expression": "L = -1.7397 + functional_status + asa_class + sepsis + emergency + surgery (Gupta 2011 Chest logistic table); independent 0, partially_dependent 0.7678, totally_dependent 1.4046; ASA1 -3.5265, ASA2 -2.0008, ASA3 -0.6201, ASA4 0.2441, ASA5 0; sepsis none -0.7840, sirs 0, sepsis 0.2752, septic_shock 0.9035; elective -0.5739, emergency 0; hernia 0, anorectal -1.3530, aortic 1.0781, bariatric -1.0112, brain 0.7336, breast -2.6462, cardiac 0.2744, ent 0.1060, foregut_hpb 0.9694, gbaas -0.5668, intestinal 0.5737, neck -0.5271, obstetric_gynecologic -1.2431, orthopedic -0.8577, other_abdomen 0.2416, peripheral_vascular -0.2389, skin -0.3206, spine -0.5220, thoracic 0.6715, vein -2.0080, urology 0.3093; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
"estimated_probability_percent": 0.61,
"logit": -5.0984,
"asa_class": 2,
"surgery": "hernia",
"functional_status": "independent",
"sepsis": "none"
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_gupta_prf |
Gupta postoperative respiratory failure needs the published NSQIP predictors in range. 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
- Gupta MICA — Compute the Gupta 2011 Table 2 logistic probability of 30-day myocardial infarction or cardiac arrest after surgery from age, ASA class, functional status, creatinine category, and surgery type.
- ARISCAT — Sum Canet 2010 Table 6 simplified ARISCAT points (β×10 rounded) from age, preoperative SpO2, respiratory infection, anemia flag, incision, duration of surgery, and emergency, and return the published low / intermediate / high band.
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.