ECG interval · LIVE
Shanghai Score System (Antzelevitch 2016)
Shanghai Score System
Sum Antzelevitch 2016 Table 2 Shanghai Score System points from a caller-assigned ECG finding plus optional clinical, family, and pathogenic-mutation items, and return probable_definite, possible, or nondiagnostic.
Markdown: /docs/shanghai.md · Canonical: https://magentlab.com/docs/shanghai
Not a medical device. Not a diagnosis, dose, or listing recommendation.
What it computes
Sum Antzelevitch 2016 Table 2 Shanghai Score System points from a caller-assigned ECG finding plus optional clinical, family, and pathogenic-mutation items, and return probable_definite, possible, or nondiagnostic.
When to use
When an agent already has the Table 2 ECG pattern (and optional clinical, family, and genetic tokens) as assigned by the caller and needs the published Shanghai BrS point total. magent does not read tracings. Not a diagnosis or ICD indication. Not the ERS Table 5 score.
When not to use
- Not a medical device and not a diagnosis or ICD indication.
- magent does not read tracings. The caller assigns the ECG pattern, clinical item, family item, and pathogenic-mutation flag.
- Table 2 awards points once per category (highest item only) and requires at least one ECG finding. The ECG floor is 2, so nondiagnostic (<2) is published but not reachable from a valid ECG token.
- This is the Antzelevitch 2016 Shanghai Score System for Brugada syndrome (Table 2) only. Not the ERS Table 5 Shanghai score, not Morita 2018, and not the Brugada 1991 wide-QRS algorithm.
Formula
Shanghai Table 2 (Antzelevitch 2016): ECG required, highest only (spontaneous_type1 3.5, fever_type1 3, drug_converted_type2_3 2) + clinical highest only (vf_arrest 3, nocturnal_agonal 2, arrhythmic_syncope 2, unclear_syncope 1, af_under_30 0.5, none 0) + family highest only (relative_definite_brs 2, suspicious_scd 1, unexplained_scd_under_45 0.5, none 0) + pathogenic_mutation 0.5; max 9; probable_definite ≥3.5, possible 2–3, nondiagnostic <2. Not ERS Table 5
Citation
- Authors
- Antzelevitch C, Yan GX, Ackerman MJ, Borggrefe M, Corrado D, Guo J, et al.
- Source
- Heart Rhythm. 2016;13(10):e295-e324
Worked example
Spontaneous type 1 ECG only
Given:
clinical=noneecg_pattern=spontaneous_type1family=nonepathogenic_mutation=false
- ECG spontaneous_type1 = 3.5 (highest ECG item)
- clinical none 0, family none 0, pathogenic_mutation false 0
- score = 3.5; shanghai_band probable_definite
Drug-converted type 2 or 3 ECG only
Given:
clinical=noneecg_pattern=drug_converted_type2_3family=nonepathogenic_mutation=false
- ECG drug_converted_type2_3 = 2
- clinical none 0, family none 0, pathogenic_mutation false 0
- score = 2; shanghai_band possible
Also searched as
- Shanghai Score System
- Antzelevitch 2016 Shanghai
- Brugada Shanghai score
- Shanghai BrS diagnostic score
- Proposed Shanghai Score System
- J-wave Shanghai Brugada
- type 1 Brugada ECG Shanghai
- HRS EHRA APHRS Shanghai BrS
- not ERS Shanghai score
- fever type 1 Brugada score
Try
Opens the live endpoint. Unpaid browser requests show the paywall; agents should send Accept: application/json.
/api/calc/shanghai?ecg_pattern=spontaneous_type1&clinical=none&family=none&pathogenic_mutation=false
Full URL: https://api.magentlab.com/api/calc/shanghai?ecg_pattern=spontaneous_type1&clinical=none&family=none&pathogenic_mutation=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/shanghai?ecg_pattern=spontaneous_type1&clinical=none&family=none&pathogenic_mutation=false"
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ecg_pattern |
string | required · spontaneous_type1, fever_type1, drug_converted_type2_3 | Highest Table 2 ECG finding as assigned by the caller (Antzelevitch 2016). spontaneous_type1 scores 3.5; fever_type1 scores 3; drug_converted_type2_3 scores 2. At least one ECG finding is required. Award once (highest item only). magent does not read tracings. |
clinical |
string | optional · vf_arrest, nocturnal_agonal, arrhythmic_syncope, unclear_syncope, af_under_30, none | Highest Table 2 clinical-history item as assigned by the caller (Antzelevitch 2016). vf_arrest 3; nocturnal_agonal 2; arrhythmic_syncope 2; unclear_syncope 1; af_under_30 0.5; none 0. Optional; omitted defaults to none. Award once (highest item only). magent does not take a history. |
family |
string | optional · relative_definite_brs, suspicious_scd, unexplained_scd_under_45, none | Highest Table 2 family-history item as assigned by the caller (Antzelevitch 2016). relative_definite_brs 2; suspicious_scd 1; unexplained_scd_under_45 0.5; none 0. Optional; omitted defaults to none. Award once (highest item only). magent does not take a pedigree. |
pathogenic_mutation |
boolean | required | Probable pathogenic mutation in a BrS susceptibility gene (Antzelevitch 2016 Table 2 IV). true scores 0.5; false scores 0. magent does not interpret sequencing. |
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": [
{
"clinical": "none",
"ecg_pattern": "spontaneous_type1",
"family": "none",
"pathogenic_mutation": "false"
},
{
"clinical": "none",
"ecg_pattern": "spontaneous_type1",
"family": "none",
"pathogenic_mutation": "false"
}
]
}
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/shanghai",
"items": [
{
"family": "none",
"components": [
{
"value": "spontaneous_type1",
"factor": "ecg_pattern",
"points": 3.5,
"present": true
},
{
"value": "none",
"factor": "clinical",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "family",
"points": 0,
"present": false
},
{
"value": false,
"factor": "pathogenic_mutation",
"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": "Antzelevitch C, Yan GX, Ackerman MJ, Borggrefe M, Corrado D, Guo J, et al.",
"doi": "10.1016/j.hrthm.2016.05.024",
"id": "antzelevitch-2016",
"pmid": "27423412",
"source": "Heart Rhythm. 2016;13(10):e295-e324",
"title": "J-Wave syndromes expert consensus conference report: Emerging concepts and gaps in knowledge"
},
"formula": "shanghai",
"formula_expression": "Shanghai Table 2 (Antzelevitch 2016): ECG required, highest only (spontaneous_type1 3.5, fever_type1 3, drug_converted_type2_3 2) + clinical highest only (vf_arrest 3, nocturnal_agonal 2, arrhythmic_syncope 2, unclear_syncope 1, af_under_30 0.5, none 0) + family highest only (relative_definite_brs 2, suspicious_scd 1, unexplained_scd_under_45 0.5, none 0) + pathogenic_mutation 0.5; max 9; probable_definite ≥3.5, possible 2–3, nondiagnostic <2. Not ERS Table 5",
"max_score": 9,
"score": 3.5,
"clinical": "none",
"ecg_pattern": "spontaneous_type1",
"pathogenic_mutation": false,
"shanghai_band": "probable_definite"
},
{
"family": "none",
"components": [
{
"value": "spontaneous_type1",
"factor": "ecg_pattern",
"points": 3.5,
"present": true
},
{
"value": "none",
"factor": "clinical",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "family",
"points": 0,
"present": false
},
{
"value": false,
"factor": "pathogenic_mutation",
"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": "Antzelevitch C, Yan GX, Ackerman MJ, Borggrefe M, Corrado D, Guo J, et al.",
"doi": "10.1016/j.hrthm.2016.05.024",
"id": "antzelevitch-2016",
"pmid": "27423412",
"source": "Heart Rhythm. 2016;13(10):e295-e324",
"title": "J-Wave syndromes expert consensus conference report: Emerging concepts and gaps in knowledge"
},
"formula": "shanghai",
"formula_expression": "Shanghai Table 2 (Antzelevitch 2016): ECG required, highest only (spontaneous_type1 3.5, fever_type1 3, drug_converted_type2_3 2) + clinical highest only (vf_arrest 3, nocturnal_agonal 2, arrhythmic_syncope 2, unclear_syncope 1, af_under_30 0.5, none 0) + family highest only (relative_definite_brs 2, suspicious_scd 1, unexplained_scd_under_45 0.5, none 0) + pathogenic_mutation 0.5; max 9; probable_definite ≥3.5, possible 2–3, nondiagnostic <2. Not ERS Table 5",
"max_score": 9,
"score": 3.5,
"clinical": "none",
"ecg_pattern": "spontaneous_type1",
"pathogenic_mutation": false,
"shanghai_band": "probable_definite"
}
]
}
Response
| Field | Type | Description |
|---|---|---|
formula |
string | shanghai |
formula_expression |
string | Antzelevitch 2016 Table 2 Shanghai Score System expression |
score |
number | Shanghai Table 2 point total (ECG floor 2; max 9) |
max_score |
integer | 9 |
shanghai_band |
string | probable_definite when score ≥3.5; possible when 2–3; nondiagnostic when <2 (unreachable while an ECG finding is required). Not a diagnosis or ICD indication. |
ecg_pattern |
string | Echo of the caller-assigned ECG token |
clinical |
string | Echo of the caller-assigned clinical token (none when omitted) |
family |
string | Echo of the caller-assigned family token (none when omitted) |
pathogenic_mutation |
boolean | Echo of the caller-assigned pathogenic-mutation flag |
components |
array | Per-category Table 2 points |
citation |
object | Antzelevitch et al. Heart Rhythm 2016 citation |
disclaimer |
string | Not-a-device notice |
Example JSON
Machine form of the same example. Frozen fixture. Not a live lookup.
{
"family": "none",
"components": [
{
"value": "spontaneous_type1",
"factor": "ecg_pattern",
"points": 3.5,
"present": true
},
{
"value": "none",
"factor": "clinical",
"points": 0,
"present": false
},
{
"value": "none",
"factor": "family",
"points": 0,
"present": false
},
{
"value": false,
"factor": "pathogenic_mutation",
"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": "Antzelevitch C, Yan GX, Ackerman MJ, Borggrefe M, Corrado D, Guo J, et al.",
"doi": "10.1016/j.hrthm.2016.05.024",
"id": "antzelevitch-2016",
"pmid": "27423412",
"source": "Heart Rhythm. 2016;13(10):e295-e324",
"title": "J-Wave syndromes expert consensus conference report: Emerging concepts and gaps in knowledge"
},
"formula": "shanghai",
"formula_expression": "Shanghai Table 2 (Antzelevitch 2016): ECG required, highest only (spontaneous_type1 3.5, fever_type1 3, drug_converted_type2_3 2) + clinical highest only (vf_arrest 3, nocturnal_agonal 2, arrhythmic_syncope 2, unclear_syncope 1, af_under_30 0.5, none 0) + family highest only (relative_definite_brs 2, suspicious_scd 1, unexplained_scd_under_45 0.5, none 0) + pathogenic_mutation 0.5; max 9; probable_definite ≥3.5, possible 2–3, nondiagnostic <2. Not ERS Table 5",
"max_score": 9,
"score": 3.5,
"clinical": "none",
"ecg_pattern": "spontaneous_type1",
"pathogenic_mutation": false,
"shanghai_band": "probable_definite"
}
Client errors (HTTP 400)
Invalid params return 400 without charge. Shared HTTP 402 and 503 meanings: Payments.
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_shanghai_ecg |
ecg_pattern must be spontaneous_type1, fever_type1, or drug_converted_type2_3 (Antzelevitch 2016 Shanghai BrS Table 2; at least one ECG finding is required). 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_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
- Brugada — Apply the Brugada 1991 four-step algorithm for regular wide-QRS tachycardia and return diagnosis vt or svt plus the step that stopped the tree.
- QTc — Compute heart-rate-corrected QT using Bazett or Fridericia. The formula argument is required.
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.