/** * Program: models_bleedingRisk.js * @date 10/20/2022 * @author Stephan K Eisenbarth * Organization: VA CART * Bleeding Risk: Colin O'Donnell * Description: JavaScript file containing the function calls for Bleeding Risk */ // /** * Modifier Function... * @author Stephan K Eisenbarth * @date 11/21/2019 * Description: Processes the bleeding risk form * @param parFormID String containing the Bleeding Risk form's ID * @return outArr String array containing the values of successfully processing the bleeding risk model */ function processForm_BleedingRisk (parFormID) { var outArr = true; var errMess = null; var errTitle = "Bleeding Risk - "; var x = getElemInput (parFormID, "heightFld"); if (isEmpty (x.value) == true || x.value == "null") { errMess = errTitle + "Height (in inches) text field cannot be empty"; } else { if (checkVal_Height () == true) { var heightVal = parseInt (x.value); x = getElemInput (parFormID, "weightLbsFld"); if (isEmpty(x.value) == true) { errMess = errTitle + "Weight (in pounds) text field cannot be empty"; } else { if (checkVal_Weight () == true) { var weightVal = parseFloat (x.value); x = getElemInput (parFormID, "statusMenu"); if (isEmpty(x.value) == true || x.value == "NULL") { errMess = errTitle + "PCI Status menu cannot be empty"; } else { x = getElemInput (parFormID, "indicaMenu"); if (isEmpty(x.value) == true || x.value == "NULL") { errMess = errTitle + "Indication menu cannot be empty"; } else { x = getElemInput (parFormID, "HgBFld"); if (isEmpty(x.value) == true) { errMess = errTitle + "Hemoglobin value cannot be empty"; } else { if (checkVal_Hemoglobin () == true) { x = getElemInput (parFormID, "inrFld"); if (isEmpty(x.value) == true) { errMess = errTitle + "INR value cannot be empty, use 0 if no value exists"; } else { if (checkVal_INR () == true) { x = getElemInput (parFormID, "troponinFld"); if (isEmpty(x.value) == true) { errMess = errTitle + "Troponin value cannot be empty, use 0 if no value exists"; } else { if (checkVal_Troponin () == true) { x = getBSA (heightVal, weightVal) // Fields filled out so run Bleeding Risk calculation if (x < 1.2 || x > 3.1) { errMess = errTitle + "Patient with specified characteristics as not in the model's data set and thus could not be calculated"; x = null; } else { outArr = calcBleedRisk (parFormID); } } } } } } } } } } } } } if (errMess != null) { alert (errMess); if (currModel != "bleeding_Area") { changeModel ("bleedingBtn"); } if (x != null) { getElementFromCurrModel(x.id).focus (); } } return outArr; } /** * Modifier Function... * @author Stephan K Eisenbarth * @date 3/14/2018 * Description: Show the final results tables for the bleeding risk * @param parFormID String containing the Bleeding Risk form's ID * @param tmpArr String array containing the RISK Percentage, Lower Limit Confidence Interval Percentage, then the Upper Limit Confidence Interval Percentage */ function showResults_bleeding (parFormID, tmpArr) { if (tmpArr != null && tmpArr.length > 0) { var str = "

VA Bleeding Model

" + "
" + "
" + "This bleeding risk estimate may be used to inform discussions of the risk/benefit of a PCI. Any clinical decisions related to the need for or against any medical procedure, or selection of access site, are at the discretion of the treating provider." + "" + "" + "" + "" + "" + "" + "" + "" + ""; if (tmpArr.length > 5) { str += ""; } str += "" + "" + "" + "" + "" + "" + "
" + " " + "" + "Radial" + "" + "Femoral" + "
" + "Bleeding Risk" + "" + "" + tmpArr[0].toFixed(1) + "%"; if (tmpArr.length > 2) { str += " (95% CI: " + tmpArr [1].toFixed(1) + ", " + tmpArr [2].toFixed(1) + ")"; } str += "" + "" + tmpArr[3].toFixed(1) + "% (95% CI: " + tmpArr [4].toFixed(1) + ", " + tmpArr [5].toFixed(1) + ")" + "
" + "Based on a single model of all patients undergoing PCI, patients with similar characteristics would have a " + tmpArr[0].toFixed(1) + "% risk of bleeding event from a radial approach"; if (tmpArr.length > 3) { str += ", and a " + tmpArr[3].toFixed(1) + "% risk from a femoral approach."; } str += "" + "
" + "

VA National Bleeding Event Rate:

" + "
" + "

4.86%

" + "
" + "
"; if (tmpArr.length > 5) { str += "
" + "" + "" + "" + "" + "" + "" + "" + "" + ""; // PCI status if (getElemInput (parFormID, "statusMenu").value == "elective") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "statusMenu").value == "emergent") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "statusMenu").value == "salvage") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "statusMenu").value == "urgent") { str += "" + "" + "" + ""; } // Indication if (getElemInput (parFormID, "indicaMenu").value == "Stable Angina") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "indicaMenu").value == "Unstable Angina") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "indicaMenu").value == "STEMI") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "indicaMenu").value == "NSTEMI") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "indicaMenu").value == "Chest Pain") { str += "" + "" + "" + ""; } else if (getElemInput (parFormID, "indicaMenu").value == "Other") { str += "" + "" + "" + ""; } if (getElemInput (parFormID, "CGS").checked == true) { str += "" + "" + "" + ""; } if (getElemInput (parFormID, "PAD").checked == true) { str += "" + "" + "" + ""; } if (getElemInput (parFormID, "AFIB").checked == true) { str += "" + "" + "" + ""; } if (getElemInput (parFormID, "CKD").checked == true) { str += "" + "" + "" + ""; } str += "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
" + "Metric" + "" + "Value" + "
" + "Estimated BSA" + "
    " + "
  • " + "Height: " + getElemInput (parFormID, "heightFld").value + " (inches)" + "
  • " + "
  • " + "Weight: " + getElemInput (parFormID, "weightLbsFld").value + " (pounds)" + "
  • " + "
" + "
" + (parseFloat (getElemInput (parFormID, "bsaFld").value)).toFixed (2) + "
" + "Elective PCI" + "" + "Yes" + "
" + "Emergent PCI" + "" + "Yes" + "
" + "Salvage" + "" + "Yes" + "
" + "Urgent" + "" + "Yes" + "
" + "Stable Angina" + "" + "Yes" + "
" + "Unstable Angina" + "" + "Yes" + "
" + "STEMI" + "" + "Yes" + "
" + "NSTEMI" + "" + "Yes" + "
" + "Chest Pain" + "" + "Yes" + "
" + "Other Indication" + "" + "Yes" + "
" + "Cardiogenic Shock" + "" + "Yes" + "
" + "PAD" + "" + "Yes" + "
" + "AFIB" + "" + "Yes" + "
" + "CKD" + "" + "Yes" + "
" + "Hemoglobin" + "" + getElemInput (parFormID, "HgBFld").value + " (g/dl)" + "
" + "INR (Standardized Prothrombin Time)" + "" + getElemInput (parFormID, "inrFld").value + "
" + "Troponin" + "" + getElemInput (parFormID, "troponinFld").value + " (ng/ml)" + "
" + "
"; } document.getElementById ("resultsArea_bleedingRisk").innerHTML = str + "
"; } } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ CALCULATION INFORMATION +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /** * Accessor Function... * @author Stephan K Eisenbarth * @date 3/14/2018 * Description: Returns an array containing the covariate human readable names * @return varNameArr String array containing the covariate human readable names */ function getVariableNamesArr () { var varNameArr = ["Intercept", "bsa", "SALVGE", "LarINR", "STABLE_ANGINA", "LarHgB", "EMRGNT", "NSTEMI", "URGENT", "LarTROPONIN", "CKD", "AFIB", "RADIAL", "PAD", "HEIGHT", "UNSTABLE_ANGINA", "CGS"]; return varNameArr; } /** * Modifier function... * @author Stephan K Eisenbarth * @date 4/7/2020 * Description: Puts values from specified String array into the bleeding risk input fields in a specific order * @param parFormID String containing the Bleeding Risk form's ID * @param tmpBArr String array object containing the values to set the bleeding risk input fields to */ function setBleedingInputs (parFormID, tmpBArr) { if (tmpBArr != null && tmpBArr.length > 0) { if (tmpBArr.length > 0 && tmpBArr [0] != null) { getElemInput (parFormID, "heightFld").value = tmpBArr [0]; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [1]) == false) { getElemInput (parFormID, "weightLbsFld").value = tmpBArr [1]; } else { getElemInput (parFormID, "weightLbsFld").value = "0"; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [2]) == false) { if (isInteger (tmpBArr [2]) == true) { getElemInput (parFormID, "statusMenu").selectedIndex =tmpBArr [2]; } else { if ((tmpBArr [2].toLowerCase ()).indexOf ("ele") > -1) { getElemInput (parFormID, "statusMenu").value = "Elective"; } else if ((tmpBArr [2].toLowerCase ()).indexOf ("urg") > -1) { getElemInput (parFormID, "statusMenu").value = "Urgent"; } else if ((tmpBArr [2].toLowerCase ()).indexOf ("eme") > -1) { getElemInput (parFormID, "statusMenu").value = "Emergent"; } else if ((tmpBArr [2].toLowerCase ()).indexOf ("sal") > -1) { getElemInput (parFormID, "statusMenu").value = "Salvage"; } else { getElemInput (parFormID, "statusMenu").value = tmpBArr [2]; } } } else { getElemInput (parFormID, "statusMenu").value = "NULL"; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [3]) == false) { if (isInteger (tmpBArr [3]) == true) { getElemInput (parFormID, "indicaMenu").selectedIndex = tmpBArr [3]; } else { if ((tmpBArr [3].toLowerCase ()).indexOf ("sta") > -1) { getElemInput (parFormID, "indicaMenu").value = "Stable Angina"; } else if ((tmpBArr [3].toLowerCase ()).indexOf ("uns") > -1) { getElemInput (parFormID, "indicaMenu").value = "Unstable Angina"; } else if ((tmpBArr [3].toLowerCase ()).indexOf ("nst") > -1) { getElemInput (parFormID, "indicaMenu").value = "NSTEMI"; } else if ((tmpBArr [3].toLowerCase ()).indexOf ("ste") > -1) { getElemInput (parFormID, "indicaMenu").value = "STEMI"; } else if ((tmpBArr [3].toLowerCase ()).indexOf ("oth") > -1) { getElemInput (parFormID, "indicaMenu").value = "Other"; } else { getElemInput (parFormID, "indicaMenu").value = tmpBArr [3]; } } } else { getElemInput (parFormID, "indicaMenu").value = "NULL"; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [4]) == false) { if (tmpBArr [4] == "1" || tmpBArr [4].toLowerCase ().indexOf ("t") > -1) { getElemInput (parFormID, "CGS").checked = true; } else { getElemInput (parFormID, "CGS").checked= false; } } else { getElemInput (parFormID, "CGS").checked= false; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [5]) == false) { if (tmpBArr [5] == "1" || tmpBArr [5].toLowerCase ().indexOf ("t") > -1) { getElemInput (parFormID, "PAD").checked = true; } else { getElemInput (parFormID, "PAD").checked = false; } } else { getElemInput (parFormID, "PAD").checked = false; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [6]) == false) { if (tmpBArr [6] == "1" || tmpBArr [6].toLowerCase ().indexOf ("t") > -1) { getElemInput (parFormID, "AFIB").checked = true; } else { getElemInput (parFormID, "AFIB").checked = false; } } else { getElemInput (parFormID, "AFIB").checked = false; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [7]) == false) { if (tmpBArr [7] == "1" || tmpBArr [7].toLowerCase ().indexOf ("t") > -1) { getElemInput (parFormID, "CKD").checked = true; } else { getElemInput (parFormID, "CKD").checked = false; } } else { getElemInput (parFormID, "CKD").checked = false; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [8]) == false) { getElemInput (parFormID, "HgBFld").value = tmpBArr [8]; } else { getElemInput (parFormID, "HgBFld").value = "0"; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [9]) == false) { getElemInput (parFormID, "inrFld").value = tmpBArr [9]; } else { getElemInput (parFormID, "inrFld").value = "0"; } if (tmpBArr.length > 0 && isEmpty (tmpBArr [10]) == false) { getElemInput (parFormID, "troponinFld").value = tmpBArr [10]; } else { getElemInput (parFormID, "troponinFld").value = "0"; } } } /** * Modifier Function... * @author Stephan K Eisenbarth * @date 11/21/2019 * Description: Calculates the associated Bleeding Risk percentrage value based on the form's values * ORDER OF COVARIATES MATTERS, MUST BE SAME ORDER FOR MATRIX MULTIPLICATION * @param parFormID String containing the Bleeding Risk form's ID */ function calcBleedRisk (parFormID) { var resultsArr = null; var covarArr = [17]; // Array of the initial covariate values var index = 0; // int index used to track the current place within the covariate value array var ok = true; // Whether form was properly filled out covarArr [index ++] = 1 // Intercept value is always 1 var HEIGHT = 0; HEIGHT = parseInt (getElemInput (parFormID, "heightFld").value); var WEIGHT = 0.0; WEIGHT = parseFloat (getElemInput (parFormID, "weightLbsFld").value); var BSA = getBSA (HEIGHT, WEIGHT); // BSA value from input if (BSA < 1) { ok = false; } covarArr [index ++] = BSA; getElemInput (parFormID, "bsaFld").value = BSA; // Salvage value from input var SALV = 0; if (getElemInput (parFormID, "statusMenu").value == "salvage") { SALV = 1; } covarArr [index ++] = SALV; // INR value from input var INR = 0.0; var x = getElemInput (parFormID, "inrFld"); if (x.value == null || x.value == "" || x.value == " ") { ok = false; alert ("INR (Standardized Prothrombin Time) value cannot be empty"); x.focus (); } else { INR = parseFloat (getElemInput (parFormID, "inrFld").value); if (INR == 0) { INR = 1; } if (INR > 0) { INR = Math.log (INR); } } covarArr [index ++] = INR; // Stable Angina value from input var STBLANGIN = 0; if (getElemInput (parFormID, "indicaMenu").value == "Stable Angina") { STBLANGIN = 1; } covarArr [index ++] = STBLANGIN; // Hemoglobin (HgB) value from input var HEMO = 0.0; var x = getElemInput (parFormID, "HgBFld"); if (x.value == null || x.value == "" || x.value == " ") { ok = false; alert ("Hemoglobin value cannot be empty"); x.focus (); } else { HEMO = parseFloat (getElemInput (parFormID, "HgBFld").value); } covarArr [index ++] = HEMO; // Emergent value from input var EMERG = 0; if (getElemInput (parFormID, "statusMenu").value == "emergent") { EMERG = 1; } covarArr [index ++] = EMERG; // NSTEMI value from input var NSTEMI = 0; if (getElemInput (parFormID, "indicaMenu").value == "NSTEMI") { NSTEMI = 1; } covarArr [index ++] = NSTEMI; // Urgent value from input var URGENT = 0; if (getElemInput (parFormID, "statusMenu").value == "urgent") { URGENT = 1; } covarArr [index ++] = URGENT; // Troponin value from input var TROPONIN = 0.0; var x = getElemInput (parFormID, "troponinFld"); if (x.value == null || x.value == "" || x.value == " ") { ok = false; alert ("Troponin value cannot be empty"); x.focus (); } else { TROPONIN = parseFloat (getElemInput (parFormID, "troponinFld").value); if (TROPONIN == 0) { TROPONIN = 0.015; } if (TROPONIN > 0) { TROPONIN = Math.log (TROPONIN); } } covarArr [index ++] = TROPONIN; // CKD value from input var CKD = 0; if (getElemInput (parFormID, "CKD").checked) { CKD = 1; } covarArr [index ++] = CKD; // AFIB value from input var AFIB = 0; if (getElemInput (parFormID, "AFIB").checked) { AFIB = 1; } covarArr [index ++] = AFIB; // Radial value is 1 to get Radial access results var RADIAL = 1; covarArr [index ++] = RADIAL; // PAD value from input var PAD = 0; if (getElemInput (parFormID, "PAD").checked) { PAD = 1; } covarArr [index ++] = PAD; // Height value from input covarArr [index ++] = HEIGHT; // Unstable Angina value from input var UNSTBLANGIN = 0; if (getElemInput (parFormID, "indicaMenu").value == "Unstable Angina") { UNSTBLANGIN = 1; } covarArr [index ++] = UNSTBLANGIN; // CGS value from input var CGS = 0; if (getElemInput (parFormID, "CGS").checked) { CGS = 1; } covarArr [index ++] = CGS; if (ok == true) { resultsArr = getBleedingRisk (parFormID, covarArr); showResults_bleeding (parFormID, resultsArr); } return resultsArr; } /** * Accessor Function... * @author Stephan K Eisenbarth * @date 11/21/2019 * Description: Returns an array containing the In-Hospital percentrage calculations * @param parFormID String containing the Bleeding Risk form's ID * @param tmpCovarArr Array containing the int covariate modified values * @return riskArr Array containing the Risk percentage, the Lower Limit and Upper Limit confidence intervals */ function getBleedingRisk (parFormID, tmpCovarArr) { var riskArr = null; var varNameArr = getVariableNamesArr (); var finalRisk = 0.0; var RISK = 0.0; var nonRadRISK = 0.0; if (tmpCovarArr != null && tmpCovarArr.length > 0) { // Values do exist within the tmpCovarArr object tmpNonRadCovarArr = new Array (tmpCovarArr.length); for (var i = 0; i < tmpCovarArr.length; i++) { tmpNonRadCovarArr [i] = tmpCovarArr [i]; } // For the femoral access input value array, find the index of the radial covariat and make the value 0 in the array var radialCovIndex = -1; for (var i = 0; i < varNameArr.length; i++) { if (varNameArr[i].toLowerCase () == "radial") { radialCovIndex = i; i = varNameArr.length; } } if (radialCovIndex > -1) { tmpNonRadCovarArr [radialCovIndex] = 0; } // Array of the covariate modifiers // Modifier Value Assocaited Covariate // ------------------ ------------------------- var modCovarArr = [-0.0424101044, // Intercept -1.5417235849, // bsa 1.3015560689, // SALVGE 0.7719733469, // INR -0.6221792508, // STABLE_ANGINA -0.2821464788, // Hemoglobin (HgB) 1.0426407870, // EMRGNT 0.1858782401, // NSTEMI 0.3398986371, // URGENT 0.1025969919, // TROPONIN 0.2157190451, // CKD 0.2723984583, // AFIB -0.2542632329, // RADIAL 0.2029641179, // PAD 0.0521844126, // HEIGHT -0.3181954656, // Unstable Angine 0.4837044011]; // CGS // Generate CALC value by modify each covariate then adding everything together var CALC = 0.0; CALC = parseFloat(modCovarArr [0]) * parseFloat(tmpCovarArr [0]); for (var i = 1; i < tmpCovarArr.length; i++) { CALC += (parseFloat(modCovarArr [i]) * parseFloat(tmpCovarArr [i])); } var nonRadCALC = 0.0; nonRadCALC = parseFloat(modCovarArr [0]) * parseFloat(tmpNonRadCovarArr [0]); for (var i = 1; i < tmpNonRadCovarArr.length; i++) { nonRadCALC += (parseFloat(modCovarArr [i]) * parseFloat(tmpNonRadCovarArr [i])); } // Get the probability var PROB = 0.0; PROB = (Math.pow (e, CALC))/(1+(Math.pow (e, CALC))); nonRadPROB = (Math.pow (e, nonRadCALC))/(1+(Math.pow (e, nonRadCALC))); // Generate the risk percentage RISK = 100 * PROB; nonRadRISK = 100 * nonRadPROB; // 2D Array of matrix (17x17) var matrix = [ [0.1870523117900, 0.0120717605860, 0.0004028965086,-0.0002251450722,-0.0016029185469,-0.0008282581521,-0.0010440737200,-0.0014595924741,-0.0006876990806, 0.0000576410460,-0.0017226309485, 0.0003845959652,-0.0000499785005,-0.0004535413785,-0.0028704198731,-0.0012211555523, 0.0000715872680], [0.0120717605860, 0.0100362906480,-0.0001630357035,-0.0000836727592,-0.0002346693396,-0.0000727764613, 0.0002591517550,-0.0000449141070, 0.0000546295694, 0.0000188257860,-0.0002087297296,-0.0001307610033,-0.0000301943783, 0.0003466095351,-0.0004574087727,-0.0001809899034, 0.0002061572890], [0.0004028965090,-0.0001630357030, 0.1170372110166,-0.0007875644789, 0.0008830881610,-0.0000082384251, 0.0017176122920, 0.0004340742958, 0.0008824265883,-0.0001703990859,-0.0000169372727, 0.0000404961239,-0.0001290371493,-0.0001164224847,-0.0000153906326, 0.0004557951930,-0.0060187473020], [-0.0002251450720,-0.0000836727590,-0.0007875644789, 0.0055049055579, 0.0001456898278, 0.0000663225560,-0.0001693572050, 0.0000316026312,-0.0001124930159,-0.0000143041202,-0.0000522086660,-0.0007741917721,-0.0000299021995,-0.0000089644411,-0.0000131598033, 0.0000435888729,-0.0007628736860], [-0.0016029185470,-0.0002346693400, 0.0008830881610, 0.0001456898278, 0.0032538363593,-0.0000153676423, 0.0010571727180, 0.0010197913408, 0.0003892141446, 0.0000275164675, 0.0000352115739, 0.0000586866735,-0.0000022667041,-0.0000050336004, 0.0000119679232, 0.0012303477999, 0.0000342259840], [-0.0008282581520,-0.0000727764610,-0.0000082384251, 0.0000663225560,-0.0000153676423, 0.0000719062724,-0.0000208022650, 0.0000190666196, 0.0000031507910,-0.0000012841054, 0.0000965134502, 0.0000255489965,-0.0000011138896, 0.0000420689040, 0.0000003966187,-0.0000061142553, 0.0000726033070], [-0.0010440737200, 0.0002591517550, 0.0017176122916,-0.0001693572051, 0.0010571727179,-0.0000208022655, 0.0036387518920, 0.0006033276395, 0.0008089332051,-0.0001759929676, 0.0001149954663, 0.0001530231061, 0.0000706950117, 0.0000840826355,-0.0000103440570, 0.0005979187277,-0.0009581321120], [-0.0014595924740,-0.0000449141070, 0.0004340742958, 0.0000316026312, 0.0010197913408, 0.0000190666196, 0.0006033276400, 0.0021965375114,-0.0006127753037,-0.0000555093850,-0.0000467496477, 0.0000066471493,-0.0000575074725,-0.0000340375603, 0.0000043158495, 0.0012427156381,-0.0000147589250], [-0.0006876990810, 0.0000546295690, 0.0008824265883,-0.0001124930159, 0.0003892141446, 0.0000031507910, 0.0008089332050,-0.0006127753037, 0.0016768781692,-0.0000287889439, 0.0000202871042, 0.0000020500194, 0.0000224075015, 0.0000101602324,-0.0000008916155,-0.0002989907500,-0.0000358027230], [0.0000576410460, 0.0000188257860,-0.0001703990859,-0.0000143041202, 0.0000275164675,-0.0000012841054,-0.0001759929680,-0.0000555093850,-0.0000287889439, 0.0000617055996,-0.0000043801711, 0.0000130989444,-0.0000107489108, 0.0000028375251,-0.0000002159978, 0.0000560059225,-0.0000381917990], [-0.0017226309480,-0.0002087297300,-0.0000169372727,-0.0000522086660, 0.0000352115739, 0.0000965134502, 0.0001149954660,-0.0000467496477, 0.0000202871042,-0.0000043801711, 0.0014064255216,-0.0001099928856, 0.0000148333353,-0.0001733994966, 0.0000076001584, 0.0000050833369, 0.0000231063940], [0.0003845959650,-0.0001307610030, 0.0000404961239,-0.0007741917721, 0.0000586866735, 0.0000255489965, 0.0001530231060, 0.0000066471493, 0.0000020500194, 0.0000130989444,-0.0001099928856, 0.0019052949563,-0.0000143363974,-0.0000753144146,-0.0000098997418, 0.0000711841031,-0.0000347782030], [-0.0000499785010,-0.0000301943780,-0.0001290371493,-0.0000299021995,-0.0000022667041,-0.0000011138896, 0.0000706950120,-0.0000575074725, 0.0000224075016,-0.0000107489108, 0.0000148333353,-0.0000143363974, 0.0015274251236,-0.0000048806982,-0.0000031611194,-0.0000647698480, 0.0000759294180], [-0.0004535413790, 0.0003466095350,-0.0001164224847,-0.0000089644411,-0.0000050336004, 0.0000420689040, 0.0000840826360,-0.0000340375603, 0.0000101602324, 0.0000028375251,-0.0001733994966,-0.0000753144146,-0.0000048806982, 0.0013636554403,-0.0000162104644,-0.0000273865386,-0.0000801534050], [-0.0028704198730,-0.0004574087730,-0.0000153906326,-0.0000131598033, 0.0000119679232, 0.0000003966187,-0.0000103440570, 0.0000043158495,-0.0000008916155,-0.0000002159978, 0.0000076001584,-0.0000098997418,-0.0000031611194,-0.0000162104644, 0.0000548868610, 0.0000079749217,-0.0000206561580], [-0.0012211555520,-0.0001809899030, 0.0004557951930, 0.0000435888729, 0.0012303477999,-0.0000061142553, 0.0005979187280, 0.0012427156381,-0.0002989907500, 0.0000560059225, 0.0000050833369, 0.0000711841031,-0.0000647698480,-0.0000273865386, 0.0000079749218, 0.0027659831259, 0.0000692498280], [0.0000715872680, 0.0002061572890,-0.0060187473015,-0.0007628736856, 0.0000342259837, 0.0000726033067,-0.0009581321120,-0.0000147589251,-0.0000358027227,-0.0000381917989, 0.0000231063944,-0.0000347782029, 0.0000759294180,-0.0000801534052,-0.0000206561580, 0.0000692498278, 0.0309608423280] ]; var outArr = new Array (tmpCovarArr.length); var nonRadOutArr = new Array (tmpNonRadCovarArr.length); // Perform martix multiplication outArr = runMatrixMultiplication (tmpCovarArr, matrix); nonRadOutArr = runMatrixMultiplication (tmpNonRadCovarArr, matrix); var finalRisk = 0; // Transpose the covariate array (tmpCovarArr) and perform matirx multiplication with the above matrix (outArr) to get final result for (var i = 0; i < outArr.length; i++) { finalRisk += (parseFloat(outArr [i]) * parseFloat(tmpCovarArr [i])); } var nonRadFinalRisk = 0; // Transpose the covariate array (tmpCovarArr) and perform matirx multiplication with the above matrix (outArr) to get final result for (var i = 0; i < nonRadOutArr.length; i++) { nonRadFinalRisk += (parseFloat(nonRadOutArr [i]) * parseFloat(tmpNonRadCovarArr [i])); } } var standardError = Math.sqrt (finalRisk); var nonRadStandardError = Math.sqrt (nonRadFinalRisk); var lcl = getLowerConfidenceLevel (CALC, standardError); if (lcl < 0) { lcl = 0; } var nonRadLcl = getLowerConfidenceLevel (nonRadCALC, nonRadStandardError); if (nonRadLcl < 0) { nonRadLcl = 0; } var ucl = getUpperConfidenceLevel (CALC, standardError); if (ucl > 1) { ucl = 1; } var nonRadUcl = getUpperConfidenceLevel (nonRadCALC, nonRadStandardError); if (nonRadUcl > 1) { nonRadUcl = 1; } riskArr = [RISK, lcl*100, ucl*100, nonRadRISK, nonRadLcl*100, nonRadUcl*100]; return riskArr; } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ FOR TESTING +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /** * Modifier Function... * @author Stephan K Eisenbarth * @date 4/30/2018 * Description: Runs series of test data (NO GUI) */ function runTestData_bleeding () { var varNameArr = getVariableNamesArr (); var testArr = [[1,2.46,0,0,0,0,0,15,1.3,0,1,0,0,1,0,74], [1,1.75,0,1,0,0,0,10.7,1.0807116,0,0,0,0,1,0,67], [1,2.24,0,1,0,0,0,10,14,1,0,0,0,0,261,69], [1,2.46,0,0,0,0,1,15.00000,1.300000,0,1,0,0,1,0.000,74.0], [1,1.92,0,0,0,0,1,13.50048,1.080712,0,1,1,1,0,0.460,64.0], [1,1.75,0,0,1,0,1,16.30000,1.000000,0,0,0,1,0,0.000,66.0], [1,1.75,0,1,0,0,1,10.70000,1.080712,0,0,0,0,1,0.000,67.0], [1,2.02,0,0,1,0,1,16.40000,1.000000,0,0,0,1,0,0.000,68.0], [1,2.01,0,1,0,0,1,13.20000,1.000000,0,0,0,0,0,3.830,68.0], [1,2.22,0,0,0,0,1,14.00000,1.000000,0,1,1,1,0,0.021,72.0], [1,2.06,0,1,0,0,1,16.00000,1.000000,0,0,0,0,0,0.018,67.0], [1,2.24,0,1,0,0,1,10.00000,14.000000,1,0,0,0,0,261.000,69.0], [1,1.92,0,0,1,0,1,17.00000,0.900000,0,1,0,1,0,0.000,67.0], [1,2.42,0,0,1,0,1,12.50000,1.060000,0,1,0,1,1,0.000,73.0], [1,2.04,0,0,0,1,1,9.20000,1.050000,0,0,1,0,1,60.200,68.5] ]; var tmpStr = ""; var tmpResArr = null; for (var i = 3; i < testArr.length; i++) { tmpStr += "

Test #" + i + "

" + "\n"; for (var x = 0; x < testArr[i].length; x++) { tmpStr += "\n" + "\n" + "\n" + "\n"; } tmpResArr = getBleedingRisk (testArr [i]); tmpStr += "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "
\n" + "" + varNameArr [x] + "\n" + "\n" + testArr [i][x] + "
\n" + "PROB\n" + "\n" + (tmpResArr [0]/100) + "\n" + "
\n" + "LL\n" + "\n" + (tmpResArr [1]/100) + "\n" + "
\n" + "UL\n" + "\n" + (tmpResArr [2]/100) + "\n" + "
\n" + "PROB (no radial)\n" + "\n" + (tmpResArr [3]/100) + "\n" + "
\n" + "LL (no radial)\n" + "\n" + (tmpResArr [4]/100) + "\n" + "
\n" + "UL (no radial)\n" + "\n" + (tmpResArr [5]/100) + "\n" + "
\n" + "
\n"; } document.getElementById ("resultsArea_bleedingRisk").innerHTML = tmpStr; }