MAGENT

Emergency · LIVE

Gupta postoperative pneumonia

Gupta pneumonia

Compute the Gupta 2013 Mayo Clin Proc logistic probability of postoperative pneumonia from age, COPD, ASA class, functional status, preoperative sepsis, smoking in the last year, and surgery type.

LIVE $0.005 USDC GET /api/calc/gupta_pneumonia

Markdown: /docs/gupta-pneumonia.md · Canonical: https://magentlab.com/docs/gupta-pneumonia

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

What it computes

Compute the Gupta 2013 Mayo Clin Proc logistic probability of postoperative pneumonia from age, COPD, ASA class, functional status, preoperative sepsis, smoking in the last year, and surgery type.

When to use

When an agent needs the published Gupta 2013 Mayo Clin Proc pneumonia probability and must not invent an antibiotic order, a ventilator order, a diagnosis, ARISCAT points, or a low/high cutoff.

When not to use

  • Not a medical device. Not a diagnosis, not an antibiotic order, and not a ventilator order.
  • Gupta 2013 Mayo Clin Proc logistic pneumonia model only. This is not ARISCAT and not a surgical clearance.
  • Gupta 2013 does not publish a low or high pneumonia cutoff; magent does not invent one.
  • Gupta 2013 does not use race. magent does not accept a race input.
  • functional_status, sepsis, smoking, COPD, and surgery are caller-assigned published categories. magent does not examine the patient or classify the procedure from a CPT code.

Formula

L = -2.8977 + 0.0144*age + copd + functional_status + asa_class + sepsis + smoking + surgery (Gupta 2013 Mayo Clin Proc logistic table); COPD no -0.4553, yes 0; independent 0, partially_dependent 0.7653, totally_dependent 0.9400; ASA1 -3.0225, ASA2 -1.6057, ASA3 -0.4915, ASA4 0.0123, ASA5 0; sepsis none -0.7641, sirs 0, sepsis -0.0842, septic_shock 0.1048; smoking no -0.4306, yes 0; hernia 0, anorectal -0.8470, aortic 0.7178, bariatric -0.6282, brain 0.6841, breast -2.3318, cardiac 0.1382, ent -0.3665, foregut_hpb 1.0660, gbaas -0.3951, intestinal 0.6169, neck -0.0872, obstetric_gynecologic -0.4101, orthopedic -0.5415, other_abdomen 0.4021, peripheral_vascular -0.4519, skin -0.5075, spine -0.5672, thoracic 0.8901, vein -1.4760, urology 0.1076; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))

Citation

Title
Development and validation of a risk calculator for predicting postoperative pneumonia
Authors
Gupta H, Gupta PK, Schuller D, Fang X, Miller WJ, Modrykamien A, Wichman TO, Morrow LE
Source
Mayo Clin Proc. 2013;88(11):1241-1249
DOI
10.1016/j.mayocp.2013.06.027

Worked example

Age 40, independent, ASA 2, no COPD, no sepsis, non-smoker, hernia

Given: age=40asa_class=2copd=falsefunctional_status=independentsepsis=nonesmoking=falsesurgery=hernia

  1. L = -2.8977 + 0.0144×40 + -0.4553 (no COPD) + 0 (independent) + -1.6057 (ASA 2) + -0.7641 (none) + -0.4306 (non-smoker) + 0 (hernia) = -5.5774
  2. estimated_probability_percent = 100 × e^(-5.5774) / (1 + e^(-5.5774))

Age 70, COPD, independent, ASA 2, no sepsis, non-smoker, hernia

Given: age=70asa_class=2copd=truefunctional_status=independentsepsis=nonesmoking=falsesurgery=hernia

  1. L = -2.8977 + 0.0144×70 + 0 (COPD) + 0 + -1.6057 (ASA 2) + -0.7641 (none) + -0.4306 (non-smoker) + 0 = -4.6901
  2. estimated_probability_percent from the Mayo Clin Proc logistic table, two decimals from the unrounded logit

Age 40, independent, ASA 4, no COPD, no sepsis, non-smoker, hernia

Given: age=40asa_class=4copd=falsefunctional_status=independentsepsis=nonesmoking=falsesurgery=hernia

  1. L = -2.8977 + 0.0144×40 + -0.4553 (no COPD) + 0 + 0.0123 (ASA 4) + -0.7641 (none) + -0.4306 (non-smoker) + 0 = -3.9594
  2. estimated_probability_percent from the Mayo Clin Proc logistic table, two decimals from the unrounded logit

Age 40, totally dependent, ASA 2, no COPD, no sepsis, non-smoker, hernia

Given: age=40asa_class=2copd=falsefunctional_status=totally_dependentsepsis=nonesmoking=falsesurgery=hernia

  1. L = -2.8977 + 0.0144×40 + -0.4553 (no COPD) + 0.9400 (totally_dependent) + -1.6057 (ASA 2) + -0.7641 (none) + -0.4306 (non-smoker) + 0 = -4.6374
  2. estimated_probability_percent from the Mayo Clin Proc logistic table, two decimals from the unrounded logit

Age 40, independent, ASA 2, no COPD, no sepsis, non-smoker, aortic

Given: age=40asa_class=2copd=falsefunctional_status=independentsepsis=nonesmoking=falsesurgery=aortic

  1. L = -2.8977 + 0.0144×40 + -0.4553 (no COPD) + 0 + -1.6057 (ASA 2) + -0.7641 (none) + -0.4306 (non-smoker) + 0.7178 (aortic) = -4.8596
  2. estimated_probability_percent from the Mayo Clin Proc logistic table, two decimals from the unrounded logit

Also searched as

  • Gupta postoperative pneumonia
  • NSQIP pneumonia probability
  • Gupta 2013 pneumonia
  • postoperative pneumonia risk
  • preoperative pneumonia probability
  • surgical pneumonia probability
  • Gupta perioperative pneumonia

Try

Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.

/api/calc/gupta_pneumonia?age=40&copd=false&functional_status=independent&asa_class=2&sepsis=none&smoking=false&surgery=hernia

Full URL: https://api.magentlab.com/api/calc/gupta_pneumonia?age=40&copd=false&functional_status=independent&asa_class=2&sepsis=none&smoking=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_pneumonia?age=40&copd=false&functional_status=independent&asa_class=2&sepsis=none&smoking=false&surgery=hernia"

Parameters

Name Type Required Description
age integer required Age in years (18-120). Gupta 2013 Mayo Clin Proc: +0.0144 per year.
copd boolean required Gupta 2013 COPD causing functional disability or hospitalization, or FEV1 <75%, as assigned by the caller: true (reference, 0) or false (-0.4553). magent does not diagnose COPD.
functional_status string required · independent, partially_dependent, totally_dependent Gupta 2013 Mayo Clin Proc functional status as assigned by the caller: independent (reference, 0), partially_dependent (+0.7653), or totally_dependent (+0.9400). magent does not examine the patient.
asa_class integer required ASA physical status 1-5 (Gupta 2013 Mayo Clin Proc logistic table; class 5 is the reference). class 1 -3.0225, class 2 -1.6057, class 3 -0.4915, class 4 +0.0123, class 5 adds 0. Caller-assigned integer.
sepsis string required · none, sirs, sepsis, septic_shock Gupta 2013 Mayo Clin Proc preoperative sepsis category as assigned by the caller: none (-0.7641), sirs (reference, 0), sepsis (-0.0842), or septic_shock (+0.1048). magent does not diagnose sepsis.
smoking boolean required Gupta 2013 smoking within the last year as assigned by the caller: true (reference, 0) or false (-0.4306).
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 2013 Mayo Clin Proc 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.

POST /api/calc/gupta_pneumonia Max 25 unit_amount + extra_item_amount * (n - 1) extra $0.002 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 (fixture)

{
  "items": [
    {
      "age": "40",
      "asa_class": "2",
      "copd": "false",
      "functional_status": "independent",
      "sepsis": "none",
      "smoking": "false",
      "surgery": "hernia"
    },
    {
      "age": "40",
      "asa_class": "2",
      "copd": "false",
      "functional_status": "independent",
      "sepsis": "none",
      "smoking": "false",
      "surgery": "hernia"
    }
  ]
}

Open bulk paywall →

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_pneumonia",
  "items": [
    {
      "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, Schuller D, Fang X, Miller WJ, Modrykamien A, Wichman TO, Morrow LE",
        "doi": "10.1016/j.mayocp.2013.06.027",
        "id": "gupta-2013-pneumonia",
        "pmid": "24182703",
        "source": "Mayo Clin Proc. 2013;88(11):1241-1249",
        "title": "Development and validation of a risk calculator for predicting postoperative pneumonia"
      },
      "formula": "gupta_pneumonia",
      "formula_expression": "L = -2.8977 + 0.0144*age + copd + functional_status + asa_class + sepsis + smoking + surgery (Gupta 2013 Mayo Clin Proc logistic table); COPD no -0.4553, yes 0; independent 0, partially_dependent 0.7653, totally_dependent 0.9400; ASA1 -3.0225, ASA2 -1.6057, ASA3 -0.4915, ASA4 0.0123, ASA5 0; sepsis none -0.7641, sirs 0, sepsis -0.0842, septic_shock 0.1048; smoking no -0.4306, yes 0; hernia 0, anorectal -0.8470, aortic 0.7178, bariatric -0.6282, brain 0.6841, breast -2.3318, cardiac 0.1382, ent -0.3665, foregut_hpb 1.0660, gbaas -0.3951, intestinal 0.6169, neck -0.0872, obstetric_gynecologic -0.4101, orthopedic -0.5415, other_abdomen 0.4021, peripheral_vascular -0.4519, skin -0.5075, spine -0.5672, thoracic 0.8901, vein -1.4760, urology 0.1076; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
      "age_years": 40,
      "estimated_probability_percent": 0.38,
      "logit": -5.5774,
      "asa_class": 2,
      "surgery": "hernia",
      "smoking": false,
      "copd": false,
      "functional_status": "independent",
      "sepsis": "none"
    },
    {
      "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, Schuller D, Fang X, Miller WJ, Modrykamien A, Wichman TO, Morrow LE",
        "doi": "10.1016/j.mayocp.2013.06.027",
        "id": "gupta-2013-pneumonia",
        "pmid": "24182703",
        "source": "Mayo Clin Proc. 2013;88(11):1241-1249",
        "title": "Development and validation of a risk calculator for predicting postoperative pneumonia"
      },
      "formula": "gupta_pneumonia",
      "formula_expression": "L = -2.8977 + 0.0144*age + copd + functional_status + asa_class + sepsis + smoking + surgery (Gupta 2013 Mayo Clin Proc logistic table); COPD no -0.4553, yes 0; independent 0, partially_dependent 0.7653, totally_dependent 0.9400; ASA1 -3.0225, ASA2 -1.6057, ASA3 -0.4915, ASA4 0.0123, ASA5 0; sepsis none -0.7641, sirs 0, sepsis -0.0842, septic_shock 0.1048; smoking no -0.4306, yes 0; hernia 0, anorectal -0.8470, aortic 0.7178, bariatric -0.6282, brain 0.6841, breast -2.3318, cardiac 0.1382, ent -0.3665, foregut_hpb 1.0660, gbaas -0.3951, intestinal 0.6169, neck -0.0872, obstetric_gynecologic -0.4101, orthopedic -0.5415, other_abdomen 0.4021, peripheral_vascular -0.4519, skin -0.5075, spine -0.5672, thoracic 0.8901, vein -1.4760, urology 0.1076; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
      "age_years": 40,
      "estimated_probability_percent": 0.38,
      "logit": -5.5774,
      "asa_class": 2,
      "surgery": "hernia",
      "smoking": false,
      "copd": false,
      "functional_status": "independent",
      "sepsis": "none"
    }
  ]
}

Response

Field Type Description
formula string gupta_pneumonia
formula_expression string Gupta 2013 Mayo Clin Proc logistic expression
age_years integer Input age in years
copd boolean true if Gupta 2013 COPD criterion is present
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
smoking boolean true if the caller assigns smoking within the last year
surgery string Gupta 2013 Mayo Clin Proc procedure category
logit number Gupta 2013 Mayo Clin Proc 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 an antibiotic order.
citation object Gupta et al. Mayo Clin Proc 2013 citation
disclaimer string Not-a-device notice

Example JSON

Machine form of the same example. Frozen fixture. Not a live lookup.

{
  "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, Schuller D, Fang X, Miller WJ, Modrykamien A, Wichman TO, Morrow LE",
    "doi": "10.1016/j.mayocp.2013.06.027",
    "id": "gupta-2013-pneumonia",
    "pmid": "24182703",
    "source": "Mayo Clin Proc. 2013;88(11):1241-1249",
    "title": "Development and validation of a risk calculator for predicting postoperative pneumonia"
  },
  "formula": "gupta_pneumonia",
  "formula_expression": "L = -2.8977 + 0.0144*age + copd + functional_status + asa_class + sepsis + smoking + surgery (Gupta 2013 Mayo Clin Proc logistic table); COPD no -0.4553, yes 0; independent 0, partially_dependent 0.7653, totally_dependent 0.9400; ASA1 -3.0225, ASA2 -1.6057, ASA3 -0.4915, ASA4 0.0123, ASA5 0; sepsis none -0.7641, sirs 0, sepsis -0.0842, septic_shock 0.1048; smoking no -0.4306, yes 0; hernia 0, anorectal -0.8470, aortic 0.7178, bariatric -0.6282, brain 0.6841, breast -2.3318, cardiac 0.1382, ent -0.3665, foregut_hpb 1.0660, gbaas -0.3951, intestinal 0.6169, neck -0.0872, obstetric_gynecologic -0.4101, orthopedic -0.5415, other_abdomen 0.4021, peripheral_vascular -0.4519, skin -0.5075, spine -0.5672, thoracic 0.8901, vein -1.4760, urology 0.1076; estimated_probability_percent = 100 * exp(L) / (1 + exp(L))",
  "age_years": 40,
  "estimated_probability_percent": 0.38,
  "logit": -5.5774,
  "asa_class": 2,
  "surgery": "hernia",
  "smoking": false,
  "copd": false,
  "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_pneumonia Gupta pneumonia needs Gupta 2013 age, COPD, functional status, ASA, sepsis, smoking, and surgery type in published ranges. 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 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.
  • 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.

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.