webclient.js-i2b2.cells.CRC.CRC_ctrlr_QryStatus.js Maven / Gradle / Ivy
/**
* @projectDescription The Asynchronous Query Status controller (GUI-only controller).
* @inherits i2b2.CRC.ctrlr
* @namespace i2b2.CRC.ctrlr.QueryStatus
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.0
* ----------------------------------------------------------------------------------------
* updated 8-10-09: Initial Creation [Nick Benik]
*/
i2b2.CRC.ctrlr.QueryStatus = function(dispDIV) { this.dispDIV = dispDIV; };
i2b2.CRC.ctrlr.QueryStatus._GetTitle = function(resultType, oRecord, oXML) {
var title = "";
switch (resultType) {
case "PATIENT_ENCOUNTER_SET":
// use given title if it exist otherwise generate a title
try {
var t = i2b2.h.XPath(oXML,'self::query_result_instance/description')[0].firstChild.nodeValue;
} catch(e) {
var t = null;
}
if (!t) { t = "Encounter Set"; }
// create the title using shrine setting
if (oRecord.size >= 10) {
if (i2b2.PM.model.isObfuscated) {
title = t+" - "+oRecord.size+"±"+i2b2.UI.cfg.obfuscatedDisplayNumber.toString()+" encounters";
} else {
title = t; //+" - "+oRecord.size+" encounters";
}
} else {
if (i2b2.PM.model.isObfuscated) {
title = t+" - 10 encounters or less";
} else {
title = t; //+" - "+oRecord.size+" encounters";
}
}
break;
case "PATIENTSET":
// use given title if it exist otherwise generate a title
try {
var t = i2b2.h.XPath(oXML,'self::query_result_instance/description')[0].firstChild.nodeValue;
} catch(e) {
var t = null;
}
if (!t) { t = "Patient Set"; }
// create the title using shrine setting
if (oRecord.size >= 10) {
if (i2b2.PM.model.isObfuscated) {
title = t+" - "+oRecord.size+"±"+i2b2.UI.cfg.obfuscatedDisplayNumber.toString()+" patients";
} else {
title = t; //+" - "+oRecord.size+" patients";
}
} else {
if (i2b2.PM.model.isObfuscated) {
title = t+" - 10 patients or less";
} else {
title = t; //+" - "+oRecord.size+" patients";
}
}
break;
case "PATIENT_COUNT_XML":
// use given title if it exist otherwise generate a title
try {
var t = i2b2.h.XPath(oXML,'self::query_result_instance/description')[0].firstChild.nodeValue;
} catch(e) {
var t = null;
}
if (!t) { t="Patient Count"; }
// create the title using shrine setting
if (oRecord.size >= 10) {
if (i2b2.PM.model.isObfuscated) {
title = t+" - "+oRecord.size+"±"+i2b2.UI.cfg.obfuscatedDisplayNumber.toString()+" patients";
} else {
title = t+" - "+oRecord.size+" patients";
}
} else {
if (i2b2.PM.model.isObfuscated) {
title = t+" - 10 patients or less";
} else {
title = t+" - "+oRecord.size+" patients";
}
}
break;
default :
try {
title = i2b2.h.XPath(oXML,'self::query_result_instance/query_result_type/description')[0].firstChild.nodeValue;
} catch(e) {
}
break;
}
return title;
};
function trim(sString)
{
while (sString.substring(0,1) == '\n')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == '\n')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}
i2b2.CRC.ctrlr.QueryStatus.prototype = function() {
var private_singleton_isRunning = false;
var private_startTime = false;
var private_refreshInterrupt = false;
function private_pollStatus() {
var self = i2b2.CRC.ctrlr.currentQueryStatus;
// this is a private function that is used by all QueryStatus object instances to check their status
// callback processor to check the Query Instance
var scopedCallbackQI = new i2b2_scopedCallback();
scopedCallbackQI.scope = self;
scopedCallbackQI.callback = function(results) {
if (results.error) {
alert(results.errorMsg);
return;
} else {
// find our query instance
var qi_list = results.refXML.getElementsByTagName('query_instance');
var l = qi_list.length;
for (var i=0; i" + description + "