MAGENT

Infection / VTE · LIVE

YEARS algorithm

Apply the van der Hulle 2017 YEARS algorithm: count three caller-assigned items and return whether PE is excluded at the published D-dimer threshold.

LIVE $0.005 USDC GET /api/calc/years

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

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

What it computes

Apply the van der Hulle 2017 YEARS algorithm: count three caller-assigned items and return whether PE is excluded at the published D-dimer threshold.

When to use

When an agent has caller-assigned YEARS items and a D-dimer in ng/mL FEU and needs the published PE-excluded or CTPA-indicated result.

When not to use

  • Not a diagnosis of pulmonary embolism. YEARS is a diagnostic-management algorithm, not a PE confirmation.
  • Not the Wells PE score and not PERC. Do not substitute those tools.
  • The 2017 YEARS cohort excluded pregnancy. This tool does not apply a pregnancy-adapted YEARS rule and has no pregnancy parameter.
  • The caller assigns clinical_signs_dvt, hemoptysis, and pe_most_likely. magent does not decide whether PE is the most likely diagnosis and does not examine the patient.
  • D-dimer is ng/mL fibrinogen-equivalent units (FEU) as in the paper. Other D-dimer units are not this tool.
  • Thresholds are strict less-than: 1000 ng/mL when years_items is 0; 500 ng/mL when years_items is 1-3. Equality is not PE-excluded.

Formula

PE excluded iff (years_items == 0 and d_dimer_ng_ml < 1000) or (years_items >= 1 and d_dimer_ng_ml < 500); years_items counts clinical_signs_dvt, hemoptysis, and pe_most_likely

Citation

Title
Simplified diagnostic management of suspected pulmonary embolism (the YEARS study): a prospective, multicentre, cohort study
Authors
van der Hulle T, Cheung WY, Kooij S, et al.
Source
Lancet. 2017;390(10091):289-297
DOI
10.1016/S0140-6736(17)30885-1

Worked example

Zero YEARS items, D-dimer 499 ng/mL FEU

Given: clinical_signs_dvt=falsed_dimer_ng_ml=499hemoptysis=falsepe_most_likely=false

  1. clinical_signs_dvt, hemoptysis, and pe_most_likely are false → years_items = 0
  2. Threshold is 1000 ng/mL FEU
  3. 499 < 1000 → PE excluded; CTPA not indicated

Zero YEARS items, D-dimer equal to 1000 is not excluded

Given: clinical_signs_dvt=falsed_dimer_ng_ml=1000hemoptysis=falsepe_most_likely=false

  1. years_items = 0 so the threshold is 1000
  2. 1000 is not < 1000 → PE not excluded; CTPA indicated

Also searched as

  • YEARS algorithm
  • YEARS PE
  • van der Hulle YEARS
  • YEARS D-dimer
  • simplified PE YEARS
  • YEARS pulmonary embolism

Try

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

/api/calc/years?clinical_signs_dvt=false&hemoptysis=false&pe_most_likely=false&d_dimer_ng_ml=499

Full URL: https://api.magentlab.com/api/calc/years?clinical_signs_dvt=false&hemoptysis=false&pe_most_likely=false&d_dimer_ng_ml=499

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/years?clinical_signs_dvt=false&hemoptysis=false&pe_most_likely=false&d_dimer_ng_ml=499"

Parameters

Name Type Required Description
clinical_signs_dvt boolean required Clinical signs of deep-vein thrombosis. true or false as assigned by the caller. Counts as one unweighted YEARS item when true.
hemoptysis boolean required Hemoptysis. true or false as assigned by the caller. Counts as one unweighted YEARS item when true.
pe_most_likely boolean required PE is the most likely diagnosis, as assigned by the caller. magent does not decide PE most likely. Counts as one unweighted YEARS item when true.
d_dimer_ng_ml number required D-dimer in ng/mL fibrinogen-equivalent units (FEU) as in van der Hulle 2017 (0-20000). PE excluded only when strictly below 1000 (0 YEARS items) or 500 (1-3 items). Equality is not excluded.

Bulk (POST)

POST the same path with a JSON items array. Price is n times the GET unit. Invalid items return HTTP 400 before settlement.

POST /api/calc/years Max 25 unit_amount * n PREVIEW

  • 1 to 25 items. Each item uses the same keys as the GET query parameters.
  • 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": [
    {
      "clinical_signs_dvt": "false",
      "d_dimer_ng_ml": "499",
      "hemoptysis": "false",
      "pe_most_likely": "false"
    },
    {
      "clinical_signs_dvt": "false",
      "d_dimer_ng_ml": "499",
      "hemoptysis": "false",
      "pe_most_likely": "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/years",
  "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": "van der Hulle T, Cheung WY, Kooij S, et al.",
        "doi": "10.1016/S0140-6736(17)30885-1",
        "id": "van-der-hulle-2017",
        "source": "Lancet. 2017;390(10091):289-297",
        "title": "Simplified diagnostic management of suspected pulmonary embolism (the YEARS study): a prospective, multicentre, cohort study"
      },
      "formula": "years",
      "formula_expression": "PE excluded iff (years_items == 0 and d_dimer_ng_ml < 1000) or (years_items >= 1 and d_dimer_ng_ml < 500); years_items counts clinical_signs_dvt, hemoptysis, and pe_most_likely",
      "criteria": [
        {
          "factor": "clinical_signs_dvt",
          "met": false
        },
        {
          "factor": "hemoptysis",
          "met": false
        },
        {
          "factor": "pe_most_likely",
          "met": false
        }
      ],
      "ctpa_indicated": false,
      "d_dimer_ng_ml": 499.0,
      "d_dimer_threshold_ng_ml": 1.0e3,
      "pe_excluded": true,
      "years_items": 0
    },
    {
      "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": "van der Hulle T, Cheung WY, Kooij S, et al.",
        "doi": "10.1016/S0140-6736(17)30885-1",
        "id": "van-der-hulle-2017",
        "source": "Lancet. 2017;390(10091):289-297",
        "title": "Simplified diagnostic management of suspected pulmonary embolism (the YEARS study): a prospective, multicentre, cohort study"
      },
      "formula": "years",
      "formula_expression": "PE excluded iff (years_items == 0 and d_dimer_ng_ml < 1000) or (years_items >= 1 and d_dimer_ng_ml < 500); years_items counts clinical_signs_dvt, hemoptysis, and pe_most_likely",
      "criteria": [
        {
          "factor": "clinical_signs_dvt",
          "met": false
        },
        {
          "factor": "hemoptysis",
          "met": false
        },
        {
          "factor": "pe_most_likely",
          "met": false
        }
      ],
      "ctpa_indicated": false,
      "d_dimer_ng_ml": 499.0,
      "d_dimer_threshold_ng_ml": 1.0e3,
      "pe_excluded": true,
      "years_items": 0
    }
  ]
}

Response

Field Type Description
formula string years
formula_expression string YEARS item count plus strict D-dimer thresholds
years_items integer Count of true YEARS items (0-3). Each item is one, not weighted.
d_dimer_ng_ml number Caller D-dimer in ng/mL FEU
d_dimer_threshold_ng_ml number 1000.0 when years_items is 0; 500.0 when years_items is 1-3
pe_excluded boolean true only when D-dimer is strictly below the item-count threshold. Not a diagnosis.
ctpa_indicated boolean true when PE is not excluded (not pe_excluded)
criteria array Per-item YEARS rows with factor and met (true when that item is present)
citation object van der Hulle 2017 Lancet 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": "van der Hulle T, Cheung WY, Kooij S, et al.",
    "doi": "10.1016/S0140-6736(17)30885-1",
    "id": "van-der-hulle-2017",
    "source": "Lancet. 2017;390(10091):289-297",
    "title": "Simplified diagnostic management of suspected pulmonary embolism (the YEARS study): a prospective, multicentre, cohort study"
  },
  "formula": "years",
  "formula_expression": "PE excluded iff (years_items == 0 and d_dimer_ng_ml < 1000) or (years_items >= 1 and d_dimer_ng_ml < 500); years_items counts clinical_signs_dvt, hemoptysis, and pe_most_likely",
  "criteria": [
    {
      "factor": "clinical_signs_dvt",
      "met": false
    },
    {
      "factor": "hemoptysis",
      "met": false
    },
    {
      "factor": "pe_most_likely",
      "met": false
    }
  ],
  "ctpa_indicated": false,
  "d_dimer_ng_ml": 499.0,
  "d_dimer_threshold_ng_ml": 1.0e3,
  "pe_excluded": true,
  "years_items": 0
}

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_d_dimer d_dimer_ng_ml must be a number from 0 to 20000. 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

  • Wells PE — Compute the Wells pulmonary-embolism probability score and return three-tier and two-tier bands.
  • PERC rule — Apply the Kline 2004 eight-factor pulmonary embolism rule-out criteria and return whether all eight are met (PERC-negative).

Payment

Required query parameters must be present and valid. 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

  • Invalid query parameters return HTTP 400 before settlement. You are not charged.
  • Settlement finishes before the tool executes (paymentFlow upfront). 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.