{"id":466,"date":"2025-09-08T17:44:50","date_gmt":"2025-09-08T17:44:50","guid":{"rendered":"https:\/\/tomchan.hk\/?page_id=466"},"modified":"2025-09-09T16:13:14","modified_gmt":"2025-09-09T16:13:14","slug":"echo-z-score-2","status":"publish","type":"page","link":"https:\/\/tomchan.hk\/?page_id=466","title":{"rendered":"Paediatrics Echo z-score"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Paediatrics Echo z-score<\/h2>\n\n\n\n<!-- Z-Score Calculator (PHN + Kobayashi) -->\n<div id=\"phn-zcalc-root-1\" class=\"phn-scope\">\n  <style>\n    .phn-scope, .phn-scope * { box-sizing: border-box; }\n    .phn-scope{ font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif; color:#111; font-size:14px; }\n    .phn-scope input[type=number]::-webkit-outer-spin-button,\n    .phn-scope input[type=number]::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }\n    .phn-scope input[type=number]{ -moz-appearance:textfield; appearance:textfield; }\n    .phn-card{ background:#fff; border-radius:16px; padding:12px 14px; box-shadow:0 6px 24px rgba(0,0,0,.06) }\n    .phn-topbar{ display:grid; grid-template-columns:repeat(6,minmax(140px,1fr)); gap:10px; align-items:end }\n    .phn-label{ font-size:.85rem; color:#374151; margin:0 0 4px }\n    .phn-input,.phn-select{ width:100%; padding:8px 10px; border:1px solid #e5e7eb; border-radius:10px; background:#fff }\n    .phn-select{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis }\n    .phn-badge{ display:inline-block; background:#f3f4f6; border-radius:999px; padding:6px 10px }\n    .phn-badge small{ color:#6b7280 }\n    .phn-grid{\n      display:grid;\n      grid-template-columns: minmax(170px,1.8fr) 0.35fr 0.45fr 0.45fr 0.9fr; \/* Param | Value | Unit | z | +\/-2 SD *\/\n      gap:8px; align-items:center;\n    }\n    .phn-head{ font-size:.9rem; font-weight:600; color:#374151; padding:6px 2px; border-bottom:1px solid #d1d5db; }\n    .phn-cell{ padding:6px 4px }\n    .phn-name{ font-weight:600; cursor:pointer }\n    .phn-name:hover{ text-decoration:underline }\n    .phn-grid .phn-input.phn-val{ max-width:72px; text-align:right; padding:6px 8px }\n    .phn-unit{ font-size:.9rem; color:#374151; padding:0; min-width:auto; border-radius:0; background:transparent; display:inline; text-align:left; }\n    .phn-z{ font-weight:700; text-align:center }\n    .phn-range{ color:#374151; font-size:.9rem }\n    .phn-divider{ grid-column:1 \/ -1; height:0; margin:6px 0 10px 0; border-bottom:1px dashed #e5e7eb; }\n    .phn-tiprow{ grid-column:1 \/ -1; display:none; padding:8px 10px; background:#111; color:#fff; border-radius:10px; font-size:.85rem }\n    .phn-tiprow.show{ display:block }\n    @media (max-width: 1100px){\n      .phn-topbar{ grid-template-columns:repeat(3,minmax(140px,1fr)) }\n    }\n    @media (max-width: 640px){\n      .phn-topbar{ grid-template-columns:repeat(2,minmax(140px,1fr)) }\n      .phn-grid{ grid-template-columns: minmax(150px,1.8fr) 0.3fr 0.42fr 0.42fr 0.85fr; }\n      .phn-grid .phn-input.phn-val{ max-width:60px; }\n    }\n  <\/style>\n\n  <div class=\"phn-card\">\n    <div class=\"phn-topbar\">\n      <div><label class=\"phn-label\">Height (cm)<\/label><input id=\"phn-h\" type=\"number\" step=\"any\" class=\"phn-input\" placeholder=\"e.g., 120\"><\/div>\n      <div><label class=\"phn-label\">Weight (kg)<\/label><input id=\"phn-w\" type=\"number\" step=\"any\" class=\"phn-input\" placeholder=\"e.g., 30\"><\/div>\n      <div><label class=\"phn-label\">BSA override (m^2)<\/label><input id=\"phn-bsa\" type=\"number\" step=\"any\" class=\"phn-input\" placeholder=\"auto if blank\"><\/div>\n      <div>\n        <label class=\"phn-label\">BSA formula<\/label>\n        <select id=\"phn-bsaF\" class=\"phn-select\">\n          <option value=\"haycock\" selected>Haycock (default)<\/option>\n          <option value=\"mosteller\">Mosteller<\/option>\n          <option value=\"dubois\">Du Bois<\/option>\n          <option value=\"gehan\">Gehan-George<\/option>\n        <\/select>\n      <\/div>\n      <div>\n        <label class=\"phn-label\">Sex<\/label>\n        <select id=\"phn-sex\" class=\"phn-select\">\n          <option value=\"male\" selected>Male<\/option>\n          <option value=\"female\">Female<\/option>\n        <\/select>\n      <\/div>\n      <div>\n        <label class=\"phn-label\">Z-score model<\/label>\n        <select id=\"phn-model\" class=\"phn-select\">\n          <option value=\"phn\" selected>PHN \/ Lopez 2017 (multi-param)<\/option>\n          <option value=\"kobayashi\">Kobayashi (coronaries)<\/option>\n        <\/select>\n      <\/div>\n    <\/div>\n  <\/div>\n\n  <div class=\"phn-card\" style=\"margin-top:12px;\">\n    <div style=\"display:grid;grid-template-columns:2fr 1fr;gap:10px;align-items:center\">\n      <div>\n        <label class=\"phn-label\">Reference<\/label>\n        <div class=\"phn-input\" id=\"phn-ref\" style=\"background:#f9fafb\">\n          PHN Echocardiographic Z-Scores (Lopez et al., 2017): z from indexed mu &#038; SD; +\/-2 SD in raw units.\n        <\/div>\n      <\/div>\n      <div>\n        <label class=\"phn-label\">Computed BSA<\/label>\n        <div class=\"phn-badge\" id=\"phn-badge\">BSA \u2014 <small id=\"phn-badgeSub\"><\/small><\/div>\n      <\/div>\n    <\/div>\n  <\/div>\n\n  <input id=\"phn-q\" class=\"phn-input\" placeholder=\"Find a specific area of interest\" style=\"margin:12px 0\">\n\n  <div class=\"phn-grid\" id=\"phn-grid\">\n    <div class=\"phn-head\">Parameter<\/div>\n    <div class=\"phn-head\">Value<\/div>\n    <div class=\"phn-head\">Unit<\/div>\n    <div class=\"phn-head\">z<\/div>\n    <div class=\"phn-head\">+\/-2 SD<\/div>\n  <\/div>\n<\/div>\n\n<script type=\"text\/javascript\">\n(function(){\n  \"use strict\";\n\n  var grid = document.getElementById(\"phn-grid\");\n  var refBox = document.getElementById(\"phn-ref\");\n\n  var PARAM_META = {\n    MVAP:{a:0.50,label:\"Mitral Valve, Antero-Posterior\",unit:\"mm\",scale:0.1, tip:\"MV annulus AP diameter; end-diastole; inner-edge.\"},\n    MVLAT:{a:0.50,label:\"Mitral Valve, Lateral\",unit:\"mm\",scale:0.1, tip:\"MV annulus lateral diameter; end-diastole.\"},\n    MVA:{a:1.00,label:\"Mitral Valve Area\",unit:\"cm^2\",scale:1, tip:\"Planimetered annulus area; end-diastole.\"},\n    TVAP:{a:0.50,label:\"Tricuspid Valve, Antero-Posterior\",unit:\"mm\",scale:0.1, tip:\"TV annulus AP; end-diastole.\"},\n    TVLAT:{a:0.50,label:\"Tricuspid Valve, Lateral\",unit:\"mm\",scale:0.1, tip:\"TV annulus lateral; end-diastole.\"},\n    TVA:{a:1.00,label:\"Tricuspid Valve Area\",unit:\"cm^2\",scale:1, tip:\"Planimetered annulus area; end-diastole.\"},\n    ANN:{a:0.50,label:\"Aortic Valve Annulus\",unit:\"mm\",scale:0.1, tip:\"LVOT annulus; systole; inner-edge.\"},\n    ROOT:{a:0.50,label:\"Sinus of Valsalva\",unit:\"mm\",scale:0.1, tip:\"Aortic root at sinus level; mid-systole.\"},\n    STJ:{a:0.50,label:\"Sino-Tubular Junction\",unit:\"mm\",scale:0.1, tip:\"STJ diameter; mid-systole.\"},\n    AAO:{a:0.50,label:\"Ascending Aorta\",unit:\"mm\",scale:0.1, tip:\"Proximal AAo above STJ; mid-systole.\"},\n    ARCHPROX:{a:0.50,label:\"Proximal Transverse Arch\",unit:\"mm\",scale:0.1, tip:\"Proximal arch; inner-edge.\"},\n    ARCHDIST:{a:0.50,label:\"Distal Transverse Arch\",unit:\"mm\",scale:0.1, tip:\"Distal arch; inner-edge.\"},\n    ISTH:{a:0.50,label:\"Aortic Isthmus\",unit:\"mm\",scale:0.1, tip:\"Isthmus diameter; inner-edge.\"},\n    LMCA:{a:0.45,label:\"Left Main Coronary\",unit:\"mm\",scale:1, tip:\"Proximal LMCA inner diameter.\"},\n    LAD:{a:0.45,label:\"Proximal LAD\",unit:\"mm\",scale:1, tip:\"Proximal LAD inner diameter.\"},\n    RCA:{a:0.45,label:\"Proximal RCA\",unit:\"mm\",scale:1, tip:\"Proximal RCA inner diameter.\"},\n    LCX:{a:0.45,label:\"Proximal LCx\",unit:\"mm\",scale:1, tip:\"Proximal circumflex inner diameter.\"},\n    PVSAX:{a:0.50,label:\"Pulmonary Valve (SAX)\",unit:\"mm\",scale:0.1, tip:\"PV annulus short-axis; mid-systole.\"},\n    PVLAX:{a:0.50,label:\"Pulmonary Valve (LAX)\",unit:\"mm\",scale:0.1, tip:\"PV annulus long-axis; mid-systole.\"},\n    MPA:{a:0.50,label:\"Main Pulmonary Artery\",unit:\"mm\",scale:0.1, tip:\"MPA proximal to bifurcation.\"},\n    RPA:{a:0.50,label:\"Right Pulmonary Artery\",unit:\"mm\",scale:0.1, tip:\"RPA proximal diameter.\"},\n    LPA:{a:0.50,label:\"Left Pulmonary Artery\",unit:\"mm\",scale:0.1, tip:\"LPA proximal diameter.\"},\n    LVEDD:{a:0.45,label:\"LV End-Diastolic Diameter\",unit:\"mm\",scale:0.1, tip:\"PLAX; end-diastole.\"},\n    LVPWT:{a:0.40,label:\"LV Posterior Wall (ED)\",unit:\"mm\",scale:0.1, tip:\"Posterior wall thickness at ED.\"},\n    LVST:{a:0.40,label:\"LV Septal Thickness (ED)\",unit:\"mm\",scale:0.1, tip:\"Septal thickness at ED.\"},\n    LVEDL:{a:0.45,label:\"LV End-Diastolic Length\",unit:\"mm\",scale:0.1, tip:\"A4C base-to-apex at ED.\"},\n    LVEDLEPI:{a:0.45,label:\"LV End-Diastolic Length (Epicardial)\",unit:\"mm\",scale:0.1, tip:\"Epicardial contour length at ED.\"},\n    LVEDA:{a:0.90,label:\"LV End-Diastolic Area\",unit:\"cm^2\",scale:1, tip:\"Apical planimetered area at ED.\"},\n    LVEDAEPI:{a:0.90,label:\"LV End-Diastolic Area (Epicardial)\",unit:\"cm^2\",scale:1, tip:\"Epicardial area at ED.\"},\n    LVEDV:{a:1.30,label:\"LV End-Diastolic Volume\",unit:\"mL\",scale:1, tip:\"Biplane Simpson's or PHN; ED.\"},\n    LVEDVEPI:{a:1.30,label:\"LV End-Diastolic Volume (Epicardial)\",unit:\"mL\",scale:1, tip:\"Epicardial volume; ED.\"},\n    LVM:{a:1.25,label:\"LV Mass\",unit:\"g\",scale:1, tip:\"From wall thickness\/geometry in PHN.\"},\n    LVMTV:{a:0.00,label:\"LV Mass:Volume Ratio\",unit:\"\",scale:1, tip:\"Derived index (unitless).\"},\n    LVTTD:{a:0.00,label:\"LV Thickness:Dimension Ratio\",unit:\"\",scale:1, tip:\"Derived index (unitless).\"},\n    LVSI:{a:0.00,label:\"LV Sphericity Index\",unit:\"\",scale:1, tip:\"Derived index (unitless).\"}\n  };\n\n  var PHN_STATS = {\n    MVAP:[2.31,0.24], MVLAT:[2.23,0.22], MVA:[4.06,0.68],\n    TVAP:[2.36,0.28], TVLAT:[2.36,0.29], TVA:[4.39,0.83],\n    ANN:[1.48,0.14], ROOT:[2.06,0.18], STJ:[1.69,0.16], AAO:[1.79,0.18],\n    ARCHPROX:[1.53,0.23], ARCHDIST:[1.36,0.19], ISTH:[1.25,0.18],\n    LMCA:[2.95,0.57], LAD:[1.90,0.34], RCA:[2.32,0.55],\n    PVSAX:[1.91,0.24], PVLAX:[2.01,0.28],\n    MPA:[1.82,0.24], RPA:[1.07,0.18], LPA:[1.10,0.18],\n    LVEDD:[3.89,0.33], LVPWT:[0.57,0.09], LVST:[0.58,0.09],\n    LVEDL:[6.31,0.46], LVEDLEPI:[6.87,0.45],\n    LVEDA:[11.91,1.89], LVEDAEPI:[20.00,2.59],\n    LVEDV:[62.02,11.94], LVEDVEPI:[113.14,17.85],\n    LVM:[53.02,9.06], LVMTV:[0.88,0.16], LVTTD:[0.15,0.03], LVSI:[1.63,0.17]\n  };\n\n  var MODEL_KEYS = {\n    phn: Object.keys(PARAM_META),\n    kobayashi: [\"LMCA\",\"LAD\",\"LCX\",\"RCA\"]\n  };\n\n  var LABEL={haycock:\"Haycock\", mosteller:\"Mosteller\", dubois:\"Du Bois\", gehan:\"Gehan-George\"};\n  function bsaHaycock(h,w){ return (h&&w)? 0.024265*Math.pow(h,0.3964)*Math.pow(w,0.5378):null; }\n  function bsaMosteller(h,w){ return (h&&w)? Math.sqrt((h*w)\/3600):null; }\n  function bsaDuBois(h,w){ return (h&&w)? 0.007184*Math.pow(h,0.725)*Math.pow(w,0.425):null; }\n  function bsaGehan(h,w){ return (h&&w)? 0.0235*Math.pow(h,0.42246)*Math.pow(w,0.51456):null; }\n  function calcBSA(h,w,f){ if(f===\"mosteller\")return bsaMosteller(h,w); if(f===\"dubois\")return bsaDuBois(h,w); if(f===\"gehan\")return bsaGehan(h,w); return bsaHaycock(h,w); }\n\n  var $h=document.getElementById(\"phn-h\");\n  var $w=document.getElementById(\"phn-w\");\n  var $bsa=document.getElementById(\"phn-bsa\");\n  var $bF=document.getElementById(\"phn-bsaF\");\n  var $badge=document.getElementById(\"phn-badge\");\n  var $badgeSub=document.getElementById(\"phn-badgeSub\");\n  var $q=document.getElementById(\"phn-q\");\n  var $sex=document.getElementById(\"phn-sex\");\n  var $model=document.getElementById(\"phn-model\");\n\n  function currentBSA(){\n    var ov=parseFloat($bsa.value);\n    if(!isNaN(ov)&&ov>0) return {bsa:ov,label:\"Override\"};\n    var h=parseFloat($h.value), w=parseFloat($w.value);\n    if($model.value===\"kobayashi\"){ return {bsa:bsaHaycock(h,w), label:\"Haycock (fixed for Kobayashi)\"}; }\n    var f=$bF.value;\n    return {bsa:calcBSA(h,w,f), label:LABEL[f]};\n  }\n\n  function clearRows(){\n    while(grid.children.length>5){ grid.removeChild(grid.lastElementChild); }\n  }\n  function addRow(key, meta){\n    var nameCell = document.createElement(\"div\"); nameCell.className=\"phn-cell phn-name\"; nameCell.textContent=meta.label; nameCell.setAttribute(\"data-key\",key);\n    var valCell = document.createElement(\"div\"); valCell.className=\"phn-cell\"; valCell.innerHTML='<input type=\"number\" step=\"any\" class=\"phn-input phn-val\" id=\"in_'+key+'\" placeholder=\"0\">';\n    var unitCell= document.createElement(\"div\"); unitCell.className=\"phn-cell\"; unitCell.innerHTML='<span class=\"phn-unit\">'+(meta.unit||\"\")+'<\/span>';\n    var zCell   = document.createElement(\"div\"); zCell.className=\"phn-cell phn-z\"; zCell.id=\"z_\"+key; zCell.textContent=\"\u2014\";\n    var rCell   = document.createElement(\"div\"); rCell.className=\"phn-cell phn-range\"; rCell.id=\"r_\"+key; rCell.textContent=\"\u2014\";\n    var divider = document.createElement(\"div\"); divider.className=\"phn-divider\";\n    var tipRow  = document.createElement(\"div\"); tipRow.className=\"phn-tiprow\"; tipRow.id=\"tip_\"+key; tipRow.textContent=meta.tip||\"See study methods for acquisition details.\";\n    grid.appendChild(nameCell); grid.appendChild(valCell); grid.appendChild(unitCell); grid.appendChild(zCell); grid.appendChild(rCell); grid.appendChild(divider); grid.appendChild(tipRow);\n  }\n  \n  \n  (function(){\n  \"use strict\";\n\n  \/\/ --- Debounce recompute for smoother typing ---\n  var _t=null;\n  function debouncedRecompute(){\n    if(_t) clearTimeout(_t);\n    _t = setTimeout(recompute, 80); \/\/ ~12 fps\n  }\n\n  \/\/ Rewire existing listeners to use debouncedRecompute instead of recompute\n  [\"input\",\"change\"].forEach(function(ev){\n    document.getElementById(\"phn-h\").addEventListener(ev,debouncedRecompute);\n    document.getElementById(\"phn-w\").addEventListener(ev,debouncedRecompute);\n    document.getElementById(\"phn-bsa\").addEventListener(ev,debouncedRecompute);\n    document.getElementById(\"phn-bsaF\").addEventListener(ev,debouncedRecompute);\n    document.getElementById(\"phn-sex\").addEventListener(ev,debouncedRecompute);\n  });\n\n  \/\/ --- Disable BSA formula chooser for Kobayashi (Haycock forced) ---\n  function toggleBSAFormulaLock(){\n    var isK = document.getElementById(\"phn-model\").value === \"kobayashi\";\n    var sel = document.getElementById(\"phn-bsaF\");\n    sel.disabled = isK;\n    sel.title = isK ? \"Kobayashi uses Haycock BSA\" : \"\";\n  }\n\n  \/\/ Hook into model change\n  document.getElementById(\"phn-model\").addEventListener(\"change\", function(){\n    toggleBSAFormulaLock();\n  });\n\n  \/\/ Run once on load too\n  toggleBSAFormulaLock();\n\n})();\n  \n  \n  \n  function buildRowsForModel(){\n    clearRows();\n    var model=$model.value;\n    MODEL_KEYS[model].forEach(function(k){ addRow(k, PARAM_META[k]); });\n    Array.prototype.forEach.call(document.querySelectorAll(\".phn-val\"), function(el){\n      [\"input\",\"change\"].forEach(function(ev){ el.addEventListener(ev,recompute); });\n    });\n    if(model===\"phn\"){ refBox.textContent = \"PHN Echocardiographic Z-Scores (Lopez et al., 2017): z from indexed mu & SD; +\/-2 SD in raw units.\"; }\n    else { refBox.textContent = \"Coronary Z-Scores (Kobayashi; LMS). BSA = Haycock; sex-specific L, M(BSA), S(BSA); +\/-2 SD in raw units.\"; }\n  }\n\n  function computePHNRow(k, meta, bsa, raw){\n    var pair = PHN_STATS[k]; if(!pair) return {z:null, low:null, high:null};\n    var mu=pair[0], sd=pair[1];\n    var x = Math.pow(bsa, meta.a);\n    var indexed = (raw*meta.scale)\/x;\n    var z = (indexed - mu)\/sd;\n    var lowRaw = ((mu - 2*sd)*x)\/meta.scale;\n    var highRaw= ((mu + 2*sd)*x)\/meta.scale;\n    return {z:z, low:lowRaw, high:highRaw};\n  }\n\n  function lms_raw_from_z(L, M, S, z){\n    if (Math.abs(L) < 1e-9) return M * Math.exp(S * z);\n    return M * Math.pow(1 + L*S*z, 1\/L);\n  }\n\n  function computeKobayashiRow(k, sex, bsa, raw){\n    if(!isFinite(raw) || !isFinite(bsa)) return {z:null, low:null, high:null};\n    var B=bsa;\n    function pow6(c6,c5,c4,c3,c2,c1,c0){\n      return (c6*Math.pow(B,6) + c5*Math.pow(B,5) + c4*Math.pow(B,4) + c3*Math.pow(B,3) + c2*Math.pow(B,2) + c1*B + c0);\n    }\n    var L, M, S;\n\n    if(k===\"RCA\"){\n      if(sex===\"male\"){ M = pow6(0.0183,-0.1867,0.7132,-1.1982,0.6038,1.6558,0.7517); L=0.292; S=0.174; }\n      else{ M = pow6(0.0363,-0.3503,1.2615,-2.0255,1.1301,1.4256,0.7727); L=0.607; S=0.17; }\n    } else if(k===\"LMCA\"){\n      if(sex===\"male\"){ M = pow6(0.076,-0.6549,2.1792,-3.3446,1.916,1.5869,0.933); L=0.336; S=0.151; }\n      else{ M = pow6(0.1738,-1.4226,4.5095,-6.7646,4.3972,0.662,1.0021); L=0.363; S=pow6(-0.0002,0.0014,-0.0032,0.0032,0.0021,-0.0367,0.1819); }\n    } else if(k===\"LAD\"){\n      if(sex===\"male\"){ M = pow6(0.0755,-0.5537,1.4885,-1.6204,0.155,2.0239,0.633); L=0.6481*B - 0.3205; S=pow6(0.0298,-0.2189,0.5974,-0.7135,0.2947,0.0411,0.1459); }\n      else{ M = pow6(0.1611,-1.2491,3.683,-4.9471,2.5568,1.1944,0.7109); L=0.204; S=0.168; }\n    } else if(k===\"LCX\"){\n      if(sex===\"male\"){ M = pow6(0.078,-0.5761,1.5481,-1.6499,0.0767,1.9436,0.5294); L=0.4536*B - 0.2542; S=pow6(0.0011,-0.0081,0.0239,-0.0351,0.0267,-0.0037,0.2009); }\n      else{ M = pow6(0.0495,-0.4345,1.4492,-2.188,1.1905,1.1956,0.6348); L=0.6683*B - 0.2618; S=0.2; }\n    } else {\n      return {z:null, low:null, high:null};\n    }\n\n    if(!isFinite(M) || !isFinite(L) || !isFinite(S) || M<=0) return {z:null, low:null, high:null};\n\n    var z = (Math.pow(raw\/M, L) - 1) \/ (L*S);\n    var okLow = (1 + L*S*(-2)) > 0;\n    var okHi  = (1 + L*S*( 2)) > 0;\n    if(!okLow || !okHi) return {z:z, low:null, high:null};\n\n    var low = lms_raw_from_z(L, M, S, -2);\n    var high= lms_raw_from_z(L, M, S,  2);\n    return { z:z, low:low, high:high };\n  }\n\n  function recompute(){\n    var bsaInfo=currentBSA(), bsa=bsaInfo.bsa, label=bsaInfo.label;\n    if(!bsa){ $badge.textContent=\"BSA \u2014\"; $badgeSub.textContent=\"\"; }\n    else { $badge.textContent=\"BSA \"+bsa.toFixed(3)+\" m^2\"; $badge.appendChild($badgeSub); $badgeSub.textContent=\" \"+label; }\n\n    var model=$model.value, sex=$sex.value;\n    MODEL_KEYS[model].forEach(function(k){\n      var meta=PARAM_META[k];\n      var raw=parseFloat((document.getElementById(\"in_\"+k)||{}).value);\n      var zEl=document.getElementById(\"z_\"+k), rEl=document.getElementById(\"r_\"+k);\n      if (!bsa || !isFinite(raw)){ zEl.textContent=\"\u2014\"; rEl.textContent=\"\u2014\"; return; }\n      var res = (model===\"phn\") ? computePHNRow(k, meta, bsa, raw) : computeKobayashiRow(k, sex, bsa, raw);\n      if(res && isFinite(res.z)){\n        zEl.textContent = res.z.toFixed(2);\n        rEl.textContent = (isFinite(res.low) && isFinite(res.high)) ? (res.low.toFixed(2)+\" \u2013 \"+res.high.toFixed(2)) : \"\u2014\";\n      }else{ zEl.textContent=\"\u2014\"; rEl.textContent=\"\u2014\"; }\n    });\n  }\n\n  $q.addEventListener(\"input\", function(){\n    var q=$q.value.trim().toLowerCase();\n    var cells=[].slice.call(grid.children);\n    Object.keys(PARAM_META).forEach(function(k){\n      var nameCell=cells.find(function(n){ return n.classList && n.classList.contains(\"phn-name\") && n.getAttribute(\"data-key\")===k; });\n      if(!nameCell) return;\n      var show = !q || (PARAM_META[k].label||\"\").toLowerCase().includes(q);\n      var valCell=nameCell.nextElementSibling, unitCell=valCell.nextElementSibling,\n          zCell=unitCell.nextElementSibling, rCell=zCell.nextElementSibling,\n          divider=rCell.nextElementSibling, tipRow=divider.nextElementSibling;\n      [nameCell,valCell,unitCell,zCell,rCell,divider,tipRow].forEach(function(el){ el.style.display = show ? \"\" : \"none\"; });\n    });\n  });\n\n  grid.addEventListener(\"click\", function(e){\n    var nameCell=e.target.closest(\".phn-name\"); if(!nameCell) return;\n    var tipRow=nameCell.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling;\n    [].forEach.call(grid.querySelectorAll(\".phn-tiprow.show\"), function(el){ el.classList.remove(\"show\"); });\n    if(tipRow) tipRow.classList.toggle(\"show\");\n  });\n\n  [\"input\",\"change\"].forEach(function(ev){\n    document.getElementById(\"phn-h\").addEventListener(ev,recompute);\n    document.getElementById(\"phn-w\").addEventListener(ev,recompute);\n    document.getElementById(\"phn-bsa\").addEventListener(ev,recompute);\n    document.getElementById(\"phn-bsaF\").addEventListener(ev,recompute);\n    document.getElementById(\"phn-sex\").addEventListener(ev,recompute);\n    document.getElementById(\"phn-model\").addEventListener(ev,function(){ buildRowsForModel(); recompute(); });\n  });\n\n  buildRowsForModel();\n  recompute();\n})();\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Paediatrics Echo z-score Height (cm) Weight (kg) BSA override (m^2) BSA formula Haycock (default)MostellerDu BoisGehan-George Sex MaleFemale Z-score model PHN \/ Lopez 2017 (multi-param)Kobayashi (coronaries) Reference PHN Echocardiographic Z-Scores (Lopez et al., 2017): z from indexed mu &#038; SD; +\/-2 SD in raw units. Computed BSA BSA \u2014 Parameter Value Unit z +\/-2 SD<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-full.php","meta":{"footnotes":""},"tags":[],"class_list":["post-466","page","type-page","status-publish","article"],"_links":{"self":[{"href":"https:\/\/tomchan.hk\/index.php?rest_route=\/wp\/v2\/pages\/466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tomchan.hk\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tomchan.hk\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tomchan.hk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tomchan.hk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466"}],"version-history":[{"count":39,"href":"https:\/\/tomchan.hk\/index.php?rest_route=\/wp\/v2\/pages\/466\/revisions"}],"predecessor-version":[{"id":511,"href":"https:\/\/tomchan.hk\/index.php?rest_route=\/wp\/v2\/pages\/466\/revisions\/511"}],"wp:attachment":[{"href":"https:\/\/tomchan.hk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tomchan.hk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}