MAGENT

Liver · LIVE

NAFLD fibrosis score

Compute the Angulo 2007 NAFLD fibrosis score from age, BMI, IFG/diabetes, AST, ALT, platelets, and albumin.

LIVE $0.005 USDC GET /api/calc/nafld_fibrosis

Markdown: /docs/nafld-fibrosis.md · Canonical: https://magentlab.com/docs/nafld-fibrosis

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

What it computes

Compute the Angulo 2007 NAFLD fibrosis score from age, BMI, IFG/diabetes, AST, ALT, platelets, and albumin.

When to use

When an agent needs published NAFLD fibrosis-score arithmetic and must not invent FIB-4 cutoffs or a biopsy result.

When not to use

  • Not a diagnosis and not a biopsy. Angulo bands are published cut-points, not histology.
  • BMI is caller-supplied. magent does not compute BMI from height and weight in this tool.
  • Angulo 2007 only. Not FIB-4, not APRI, and not the BARD score.

Formula

NFS = -1.675 + 0.037*age + 0.094*BMI + 1.13*IFG/diabetes + 0.99*(AST/ALT) - 0.013*platelets - 0.66*albumin

Citation

Title
The NAFLD fibrosis score: a noninvasive system that identifies liver fibrosis in patients with NAFLD
Authors
Angulo P, Hui JM, Marchesini G, et al.
Source
Hepatology. 2007;45(4):846-854
DOI
10.1002/hep.21496

Worked example

Age 50, BMI 30, IFG, AST/ALT 1, platelets 200, albumin 4

Given: age=50albumin_g_dl=4alt_u_l=40ast_u_l=40bmi_kg_m2=30ifg_or_diabetes=trueplatelets_10e9_l=200

  1. IFG/diabetes = 1; AST/ALT = 40/40 = 1
  2. NFS = -1.675 + 0.037*50 + 0.094*30 + 1.13*1 + 0.99*1 - 0.013*200 - 0.66*4 = -0.125
  3. Band indeterminate (-1.455 to 0.676)

Also searched as

  • NAFLD fibrosis score
  • NFS Angulo
  • nonalcoholic fatty liver fibrosis
  • Angulo 2007
  • NAFLD score
  • liver fibrosis NAFLD

Try

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

/api/calc/nafld_fibrosis?age=50&bmi_kg_m2=30&ifg_or_diabetes=true&ast_u_l=40&alt_u_l=40&platelets_10e9_l=200&albumin_g_dl=4

Full URL: https://api.magentlab.com/api/calc/nafld_fibrosis?age=50&bmi_kg_m2=30&ifg_or_diabetes=true&ast_u_l=40&alt_u_l=40&platelets_10e9_l=200&albumin_g_dl=4

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/nafld_fibrosis?age=50&bmi_kg_m2=30&ifg_or_diabetes=true&ast_u_l=40&alt_u_l=40&platelets_10e9_l=200&albumin_g_dl=4"

Parameters

Name Type Required Description
age integer required Age in years (18-120).
bmi_kg_m2 number required Body-mass index in kg/m^2 (10-80). Caller-supplied; magent does not compute BMI.
ifg_or_diabetes boolean required Impaired fasting glucose or diabetes as assigned by the caller (Angulo 2007 IFG/diabetes term). true or false.
ast_u_l number required Aspartate aminotransferase in U/L (1-10000).
alt_u_l number required Alanine aminotransferase in U/L (1-10000).
platelets_10e9_l number required Platelet count in 10^9/L (1-2000).
albumin_g_dl number optional Albumin in g/dL (1-6). Provide albumin_g_dl or albumin_g_l, not both.
albumin_g_l number optional Albumin in g/L (10-60). Converted as g/dL = g/L / 10.

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/nafld_fibrosis 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": "50",
      "albumin_g_dl": "4",
      "alt_u_l": "40",
      "ast_u_l": "40",
      "bmi_kg_m2": "30",
      "ifg_or_diabetes": "true",
      "platelets_10e9_l": "200"
    },
    {
      "age": "50",
      "albumin_g_dl": "4",
      "alt_u_l": "40",
      "ast_u_l": "40",
      "bmi_kg_m2": "30",
      "ifg_or_diabetes": "true",
      "platelets_10e9_l": "200"
    }
  ]
}

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/nafld_fibrosis",
  "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": "Angulo P, Hui JM, Marchesini G, et al.",
        "doi": "10.1002/hep.21496",
        "id": "angulo-2007",
        "source": "Hepatology. 2007;45(4):846-854",
        "title": "The NAFLD fibrosis score: a noninvasive system that identifies liver fibrosis in patients with NAFLD"
      },
      "formula": "nafld_fibrosis",
      "formula_expression": "NFS = -1.675 + 0.037*age + 0.094*BMI + 1.13*IFG/diabetes + 0.99*(AST/ALT) - 0.013*platelets - 0.66*albumin",
      "albumin_g_dl": 4.0,
      "age_years": 50,
      "ast_u_l": 40.0,
      "platelets_10e9_l": 200.0,
      "alt_u_l": 40.0,
      "angulo_band": "indeterminate",
      "ast_alt_ratio": 1.0,
      "bmi_kg_m2": 30.0,
      "ifg_or_diabetes": true,
      "nfs": -0.125
    },
    {
      "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": "Angulo P, Hui JM, Marchesini G, et al.",
        "doi": "10.1002/hep.21496",
        "id": "angulo-2007",
        "source": "Hepatology. 2007;45(4):846-854",
        "title": "The NAFLD fibrosis score: a noninvasive system that identifies liver fibrosis in patients with NAFLD"
      },
      "formula": "nafld_fibrosis",
      "formula_expression": "NFS = -1.675 + 0.037*age + 0.094*BMI + 1.13*IFG/diabetes + 0.99*(AST/ALT) - 0.013*platelets - 0.66*albumin",
      "albumin_g_dl": 4.0,
      "age_years": 50,
      "ast_u_l": 40.0,
      "platelets_10e9_l": 200.0,
      "alt_u_l": 40.0,
      "angulo_band": "indeterminate",
      "ast_alt_ratio": 1.0,
      "bmi_kg_m2": 30.0,
      "ifg_or_diabetes": true,
      "nfs": -0.125
    }
  ]
}

Response

Field Type Description
formula string nafld_fibrosis
formula_expression string Exact Angulo 2007 expression
age_years integer Age in years used
bmi_kg_m2 number Caller-supplied BMI in kg/m^2
ifg_or_diabetes boolean IFG or diabetes flag used
ast_u_l number AST in U/L
alt_u_l number ALT in U/L
ast_alt_ratio number AST/ALT ratio, 4 decimals
platelets_10e9_l number Platelets in 10^9/L
albumin_g_dl number Albumin in g/dL
nfs number NAFLD fibrosis score, 3 decimals
angulo_band string Published Angulo 2007 cut-points: low (<-1.455), indeterminate (-1.455 to 0.676), high (>0.676). Not a diagnosis.
citation object Angulo Hepatology 2007 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": "Angulo P, Hui JM, Marchesini G, et al.",
    "doi": "10.1002/hep.21496",
    "id": "angulo-2007",
    "source": "Hepatology. 2007;45(4):846-854",
    "title": "The NAFLD fibrosis score: a noninvasive system that identifies liver fibrosis in patients with NAFLD"
  },
  "formula": "nafld_fibrosis",
  "formula_expression": "NFS = -1.675 + 0.037*age + 0.094*BMI + 1.13*IFG/diabetes + 0.99*(AST/ALT) - 0.013*platelets - 0.66*albumin",
  "albumin_g_dl": 4.0,
  "age_years": 50,
  "ast_u_l": 40.0,
  "platelets_10e9_l": 200.0,
  "alt_u_l": 40.0,
  "angulo_band": "indeterminate",
  "ast_alt_ratio": 1.0,
  "bmi_kg_m2": 30.0,
  "ifg_or_diabetes": true,
  "nfs": -0.125
}

Client errors (HTTP 400)

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

HTTP Code When
400 invalid_age age must be an integer from 18 to 120 Returned before settlement; you are not charged.
400 invalid_bmi_kg_m2 bmi_kg_m2 must be a number from 10 to 80. 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_ast ast_u_l must be a number from 1 to 10000 Returned before settlement; you are not charged.
400 invalid_alt alt_u_l must be a number from 1 to 10000 Returned before settlement; you are not charged.
400 invalid_platelets platelets_10e9_l must be a number from 1 to 2000 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

  • FIB-4 — Compute the FIB-4 fibrosis index from age, AST, ALT, and platelets.
  • APRI — Compute the AST to platelet ratio index (APRI) from AST, laboratory AST ULN, and platelet count.

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.
  • 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.