MAGENT

Emergency · LIVE

TWIST testicular torsion score

TWIST

Sum the five Barbosa 2013 TWIST flags for an already-examined acute scrotum and return the 0–7 score and published risk band (low 0–2, intermediate 3–4, high 5–7).

LIVE $0.005 USDC GET /api/calc/twist

Markdown: /docs/twist.md · Canonical: https://magentlab.com/docs/twist

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

What it computes

Sum the five Barbosa 2013 TWIST flags for an already-examined acute scrotum and return the 0–7 score and published risk band (low 0–2, intermediate 3–4, high 5–7).

When to use

When an agent has already assigned the five Barbosa 2013 TWIST flags and needs the published point total and risk band. magent does not examine the patient and does not diagnose torsion or order ultrasound or surgery.

When not to use

  • Not a medical device.
  • Not a testicular torsion diagnosis.
  • Not an ultrasound order or an operative order.
  • magent does not examine the patient.
  • Barbosa 2013 derived the score in children with acute scrotum. The score has no age points.
  • Risk bands use published cutoffs 2 and 5 (low 0–2, intermediate 3–4, high 5–7).

Formula

TWIST = testicular_swelling (true 2) + hard_testicle (true 2) + absent_cremasteric_reflex (true 1) + nausea_or_vomiting (true 1) + high_riding_testis (true 1); Barbosa 2013; max 7; 0-2 low, 3-4 intermediate, 5-7 high (cutoffs 2 and 5)

Citation

Title
Development and initial validation of a scoring system to diagnose testicular torsion in children
Authors
Barbosa JA, Tiseo BC, Barayan GA, Rosman BM, Torricelli FC, Passerotti CC, Srougi M, Retik AB, Nguyen HT
Source
J Urol. 2013;189(5):1859-1864
DOI
10.1016/j.juro.2012.10.056

Worked example

All five flags false

Given: absent_cremasteric_reflex=falsehard_testicle=falsehigh_riding_testis=falsenausea_or_vomiting=falsetesticular_swelling=false

  1. testicular_swelling false → 0; hard_testicle false → 0; absent_cremasteric_reflex false → 0; nausea_or_vomiting false → 0; high_riding_testis false → 0
  2. Score = 0 (max 7); risk = low

All five flags true

Given: absent_cremasteric_reflex=truehard_testicle=truehigh_riding_testis=truenausea_or_vomiting=truetesticular_swelling=true

  1. testicular_swelling true → 2; hard_testicle true → 2; absent_cremasteric_reflex true → 1; nausea_or_vomiting true → 1; high_riding_testis true → 1
  2. Score = 7 (max 7); risk = high

Also searched as

  • TWIST
  • TWIST score
  • testicular torsion
  • Testicular Workup for Ischemia and Suspected Torsion
  • Barbosa 2013
  • acute scrotum
  • cremasteric reflex
  • high-riding testis

Try

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

/api/calc/twist?testicular_swelling=false&hard_testicle=false&absent_cremasteric_reflex=false&nausea_or_vomiting=false&high_riding_testis=false

Full URL: https://api.magentlab.com/api/calc/twist?testicular_swelling=false&hard_testicle=false&absent_cremasteric_reflex=false&nausea_or_vomiting=false&high_riding_testis=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/twist?testicular_swelling=false&hard_testicle=false&absent_cremasteric_reflex=false&nausea_or_vomiting=false&high_riding_testis=false"

Parameters

Name Type Required Description
testicular_swelling boolean required Testicular swelling as assigned by the caller (Barbosa 2013). true scores 2. magent does not examine the patient.
hard_testicle boolean required Hard testicle as assigned by the caller (Barbosa 2013). true scores 2. magent does not examine the patient.
absent_cremasteric_reflex boolean required Absent cremasteric reflex as assigned by the caller (Barbosa 2013). true scores 1. magent does not examine the patient.
nausea_or_vomiting boolean required Nausea or vomiting as assigned by the caller (Barbosa 2013). true scores 1. magent does not take a symptom history.
high_riding_testis boolean required High-riding testis as assigned by the caller (Barbosa 2013). true scores 1. magent does not examine the patient.

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/twist 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": [
    {
      "absent_cremasteric_reflex": "false",
      "hard_testicle": "false",
      "high_riding_testis": "false",
      "nausea_or_vomiting": "false",
      "testicular_swelling": "false"
    },
    {
      "absent_cremasteric_reflex": "false",
      "hard_testicle": "false",
      "high_riding_testis": "false",
      "nausea_or_vomiting": "false",
      "testicular_swelling": "false"
    }
  ]
}

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/twist",
  "items": [
    {
      "components": [
        {
          "factor": "testicular_swelling",
          "points": 0,
          "present": false
        },
        {
          "factor": "hard_testicle",
          "points": 0,
          "present": false
        },
        {
          "factor": "absent_cremasteric_reflex",
          "points": 0,
          "present": false
        },
        {
          "factor": "nausea_or_vomiting",
          "points": 0,
          "present": false
        },
        {
          "factor": "high_riding_testis",
          "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": "Barbosa JA, Tiseo BC, Barayan GA, Rosman BM, Torricelli FC, Passerotti CC, Srougi M, Retik AB, Nguyen HT",
        "doi": "10.1016/j.juro.2012.10.056",
        "id": "barbosa-2013",
        "pmid": "23103800",
        "source": "J Urol. 2013;189(5):1859-1864",
        "title": "Development and initial validation of a scoring system to diagnose testicular torsion in children"
      },
      "formula": "twist",
      "formula_expression": "TWIST = testicular_swelling (true 2) + hard_testicle (true 2) + absent_cremasteric_reflex (true 1) + nausea_or_vomiting (true 1) + high_riding_testis (true 1); Barbosa 2013; max 7; 0-2 low, 3-4 intermediate, 5-7 high (cutoffs 2 and 5)",
      "max_score": 7,
      "score": 0,
      "risk": "low"
    },
    {
      "components": [
        {
          "factor": "testicular_swelling",
          "points": 0,
          "present": false
        },
        {
          "factor": "hard_testicle",
          "points": 0,
          "present": false
        },
        {
          "factor": "absent_cremasteric_reflex",
          "points": 0,
          "present": false
        },
        {
          "factor": "nausea_or_vomiting",
          "points": 0,
          "present": false
        },
        {
          "factor": "high_riding_testis",
          "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": "Barbosa JA, Tiseo BC, Barayan GA, Rosman BM, Torricelli FC, Passerotti CC, Srougi M, Retik AB, Nguyen HT",
        "doi": "10.1016/j.juro.2012.10.056",
        "id": "barbosa-2013",
        "pmid": "23103800",
        "source": "J Urol. 2013;189(5):1859-1864",
        "title": "Development and initial validation of a scoring system to diagnose testicular torsion in children"
      },
      "formula": "twist",
      "formula_expression": "TWIST = testicular_swelling (true 2) + hard_testicle (true 2) + absent_cremasteric_reflex (true 1) + nausea_or_vomiting (true 1) + high_riding_testis (true 1); Barbosa 2013; max 7; 0-2 low, 3-4 intermediate, 5-7 high (cutoffs 2 and 5)",
      "max_score": 7,
      "score": 0,
      "risk": "low"
    }
  ]
}

Response

Field Type Description
formula string twist
formula_expression string Exact expression used
score integer TWIST points 0-7
max_score integer Always 7
risk string Barbosa 2013 risk band: low (0–2), intermediate (3–4), or high (5–7). Cutoffs 2 and 5. Not a torsion diagnosis.
components array Per-flag points
citation object Barbosa 2013 J Urol citation
disclaimer string Not-a-device notice

Example JSON

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

{
  "components": [
    {
      "factor": "testicular_swelling",
      "points": 0,
      "present": false
    },
    {
      "factor": "hard_testicle",
      "points": 0,
      "present": false
    },
    {
      "factor": "absent_cremasteric_reflex",
      "points": 0,
      "present": false
    },
    {
      "factor": "nausea_or_vomiting",
      "points": 0,
      "present": false
    },
    {
      "factor": "high_riding_testis",
      "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": "Barbosa JA, Tiseo BC, Barayan GA, Rosman BM, Torricelli FC, Passerotti CC, Srougi M, Retik AB, Nguyen HT",
    "doi": "10.1016/j.juro.2012.10.056",
    "id": "barbosa-2013",
    "pmid": "23103800",
    "source": "J Urol. 2013;189(5):1859-1864",
    "title": "Development and initial validation of a scoring system to diagnose testicular torsion in children"
  },
  "formula": "twist",
  "formula_expression": "TWIST = testicular_swelling (true 2) + hard_testicle (true 2) + absent_cremasteric_reflex (true 1) + nausea_or_vomiting (true 1) + high_riding_testis (true 1); Barbosa 2013; max 7; 0-2 low, 3-4 intermediate, 5-7 high (cutoffs 2 and 5)",
  "max_score": 7,
  "score": 0,
  "risk": "low"
}

Client errors (HTTP 400)

Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.

HTTP Code When
400 invalid_flag boolean clinical flags must be true or false 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

  • PECARN pediatric IAI — Apply the Holmes 2013 PECARN seven-variable prediction rule and return whether the child is at very low risk of intra-abdominal injury requiring acute intervention (all seven caller-assigned findings absent). Does not order a CT.
  • SIPA — Compute Acker 2015 SIPA as heart rate in bpm divided by cuff systolic pressure in mm Hg, then compare the ratio with the published age-band cutoff.
  • Kocher criteria — Sum the four Kocher 1999 predictors and return the published predicted probability of septic arthritis versus transient synovitis in children with irritable hip.

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.