Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
webclient.js-i2b2.cells.plugins.standard.Timeline.Timeline_modLabRange.js Maven / Gradle / Ivy
/**
* @projectDescription (GUI-only) Controller for CRC Query Tool's Lab Values constraint dialog box.
* @inherits i2b2.Timeline.view
* @namespace i2b2.Timeline.view.modalLabValues
* @author Nick Benik, Griffin Weber MD PhD
* @version 1.3
* ----------------------------------------------------------------------------------------
* updated 9-15-08: RC4 launch [Nick Benik]
*/
i2b2.Timeline.view.modalLabValues = {
formdata: {},
cfgTestInfo: {
name: 'RND-TEST',
flagType: 'NA',
flags: [{name:'Abnormal', value:'A'},{name:'Normal', value:'@'}],
valueValidate: {
onlyPos: true,
onlyInt: true,
maxString: 0
},
valueType: 'PosFloat',
valueUnitsCurrent: 0, // index into Units[]
valueUnits: {},
rangeInfo: {},
enumInfo: {}
},
updateValue: function(e) {
posx = 0; posy = 0;
var point = YAHOO.util.Event.getXY(e);
var point2 = YAHOO.util.Dom.getXY('mlvfrmGrp');
var newvalue = point[0] - point2[0];
var newvalue = (520/($('mlvfrmGrpHighOfHigh').innerHTML - $('mlvfrmGrpLowOfLow').innerHTML)) * newvalue;
var newvalue2 = "as";
},
// ================================================================================================== //
show: function( queryPanelController, key, extData, isModifier) {
//if (Object.isUndefined(i2b2.Timeline.model.queryCurrent.panels[panelIndex])) { return; }
var fd = i2b2.Timeline.view.modalLabValues.formdata;
//var dm = i2b2.Timeline.model.queryCurrent.panels[panelIndex];
// save info for callback
//this.qpi = panelIndex;
this.cpc = queryPanelController;
i2b2.Timeline.view.modalLabValues.isModifier = isModifier;
//i2b2.Timeline.view.modalLabValues.itemNumber = extData.itemNumber;
//this.isModifier = isMod;
this.key = key;
this.i2b2Data = extData;
// Create SimpleDialog control
if (!this.sd) {
this.sd = new YAHOO.widget.SimpleDialog("itemLabRange", {
zindex: 700,
width: "600px",
fixedcenter: true,
constraintoviewport: true,
modal: true,
buttons: [{
text: "OK",
isDefault: true,
handler:
(function() {
var closure_qpi = i2b2.Timeline.view.modalLabValues.qpi;
var closure_cpc = i2b2.Timeline.view.modalLabValues.cpc;
var closure_key = i2b2.Timeline.view.modalLabValues.key;
var closure_number = i2b2.Timeline.view.modalLabValues.itemNumber;
// submit value(s)
if (this.submit()) {
if (i2b2.Timeline.view.modalLabValues.isModifier) {
i2b2.Timeline.model.concepts.ModValues = i2b2.Timeline.view.modalLabValues.i2b2Data.ModValues;
} else {
i2b2.Timeline.model.concepts.LabValues = i2b2.Timeline.view.modalLabValues.i2b2Data.LabValues;
}
// update the panel/query tool GUI
//i2b2.Timeline.ctrlr.QT.doSetQueryName.call(this, '');
i2b2.Timeline.conceptsRender();
//queryPanelController._renameConcept(closure_key, i2b2.Timeline.view.modalLabValues.isModifier, pd);
//queryPanelController._renameConcept(i2b2.Timeline.view.modalLabValues.i2b2Data.itemNumber, i2b2.Timeline.view.modalLabValues.isModifier, pd);
delete i2b2.Timeline.view.modalLabValues.isModifier;
}
})
}, {
text: "Cancel",
handler: (function(){ this.cancel(); })
}]
});
$('itemLabRange').show();
this.sd.validate = this.ValidateSave; // attach the validation function from this class
this.sd.render(document.body);
// register for actions upon the modal DOM elements
YAHOO.util.Event.addListener("mlvfrmTypeNONE", "click", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmTypeFLAG", "click", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmTypeVALUE", "click", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmFlagValue", "change", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmEnumValue", "change", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmOperator", "change", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmDbOperator", "change", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmStringOperator", "change", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmUnits", "change", this.changeHandler);
YAHOO.util.Event.addListener("mlvfrmStrValue", "keypress", (function(e) {
// anonymous function
if (e.keyCode==8 || e.keyCode==46) { return true; }
var msl = i2b2.Timeline.view.modalLabValues.cfgTestInfo.valueValidate.maxString;
if (!msl || this.value.length < msl) {
delete i2b2.Timeline.view.modalLabValues.formdata.lastValidStr;
return true;
} else {
if (!i2b2.Timeline.view.modalLabValues.formdata.lastValidStr) {
i2b2.Timeline.view.modalLabValues.formdata.lastValidStr = this.value;
}
return true;
}
}));
YAHOO.util.Event.addListener("mlvfrmStrValue", "keyup", (function(e) {
// anonymous function
if (i2b2.Timeline.view.modalLabValues.formdata.lastValidStr) {
this.value = i2b2.Timeline.view.modalLabValues.formdata.lastValidStr;
}
}));
}
// configure the form
var mdnodes = i2b2.h.XPath(extData.origData.xmlOrig, 'descendant::metadataxml/ValueMetadata[Version]');
if (mdnodes.length > 0) {
this.cfgByMetadata(mdnodes[0]);
} else {
// no LabValue configuration
return false;
}
if (i2b2.Timeline.view.modalLabValues.isModifier) {
if (!this.i2b2Data.ModValues && this.i2b2Data.origData.ModValues) {
// copy server delivered Lab Values to our scope
this.i2b2Data.ModValues = this.i2b2Data.origData.ModValues;
}
var tmpLab = this.i2b2Data.ModValues;
} else {
if (!this.i2b2Data.LabValues && this.i2b2Data.origData.LabValues) {
// copy server delivered Lab Values to our scope
this.i2b2Data.LabValues = this.i2b2Data.origData.LabValues;
}
var tmpLab = this.i2b2Data.LabValues;
}
// load any data already attached to the node
if (tmpLab) {
switch(tmpLab.MatchBy) {
case "FLAG":
fd.selectedType = "FLAG";
$("mlvfrmTypeFLAG").checked = true;
var tn = $("mlvfrmFlagValue");
for (var i=0; i -1) {
tn.options[i].selected = true;
} else {
tn.options[i].selected = false;
}
}
}
break;
}
} else {
fd.selectedType = "NONE";
$("mlvfrmTypeNONE").checked = true;
}
// show the form
this.sd.show();
this.Redraw();
},
// ================================================================================================== //
changeHandler: function(e) {
var dm = i2b2.Timeline.view.modalLabValues.cfgTestInfo;
var fd = i2b2.Timeline.view.modalLabValues.formdata;
if (fd.ignoreChanges) { return true; }
// get the DOM node that fired the event
var tn;
if (e.target) {
tn = e.target;
} else {
if (e.srcElement) tn = e.srcElement;
if (tn.nodeType == 3) tn = tn.parentNode;
}
// process
switch(tn.id) {
case "mlvfrmTypeNONE":
fd.selectedType = 'NONE';
break;
case "mlvfrmTypeFLAG":
fd.selectedType = 'FLAG';
break;
case "mlvfrmTypeVALUE":
fd.selectedType = 'VALUE';
break;
case "mlvfrmFlagValue":
fd.flagValue = tn.options[tn.selectedIndex].value;
break;
case "mlvfrmOperator":
var i1 = $('mlvfrmUnits');
fd.numericOperator = tn.options[tn.selectedIndex].value;
fd.valueUnitsCurrent = i1.selectedIndex;
break;
case "mlvfrmStringOperator":
fd.stringOperator = tn.options[tn.selectedIndex].value;
break;
case "mlvfrmDbOperator":
fd.dbOperator = tn.checked;
break;
case "mlvfrmEnumValue":
fd.enumIndex = tn.selectedIndex;
fd.enumValue = tn.options[fd.enumIndex].innerHTML;
break;
case "mlvfrmUnits":
var u1 = $('mlvfrmUnits');
// convert entered values
var cvD = dm.valueUnits[fd.unitIndex].multFactor;
var cvM = dm.valueUnits[u1.selectedIndex].multFactor;
var lst = [$('mlvfrmNumericValue'), $('mlvfrmNumericValueLow'), $('mlvfrmNumericValueHigh')];
/*
for (var i=0;i 0) {
dm.valueValidate.maxString = t;
} else {
dm.valueValidate.maxString = false;
}
break;
case "largestring":
dm.valueType = "LRGSTR";
dm.valueValidate.onlyPos = false;
dm.valueValidate.onlyInt = false;
// extract max string setting
try {
var t = refXML.getElementsByTagName('MaxStringLength')[0].firstChild.nodeValue;
t = parseInt(t);
} catch(e) {
var t = -1;
}
if (t > 0) {
dm.valueValidate.maxString = t;
} else {
dm.valueValidate.maxString = false;
}
break;
case "Enum":
dm.valueType = "ENUM";
dm.valueValidate.onlyPos = false;
dm.valueValidate.onlyInt = false;
dm.valueValidate.maxString = false;
// extract the enum data
var t1 = i2b2.h.XPath(refXML,"descendant::EnumValues/Val");
//var t = i2b2.h.XPath(refXML,"descendant::EnumValues/Val/text()");
//var t2 = [];
var sn = $('mlvfrmEnumValue');
// clear the drop down
while( sn.hasChildNodes() ) { sn.removeChild( sn.lastChild ); }
var t2 = new Array();
for (var i=0; i section
var t = i2b2.h.XPath(refXML,"descendant::CommentsDeterminingExclusion/Com/text()");
var t2 = [];
for (var i=0; i 0) {
for (var i=0;i -1 ) {
dm.enumInfo[i2] = null;
}
}
// clean up the array
dm.enumInfo = dm.enumInfo.compact();
}
}
// clear & populate the Enum dropdown
// populate values
var count = 0;
//for (var i in dm.enumInfo) {
/*for (var i in dm.enumInfo) {
//for (var i=0; i0) {
// d.excluded = true;
//}
// Equal Units
//if (i2b2.h.XPath(refXML,"descendant::UnitValues/descendant::ExcludingUnits[text()='"+t[i]+"']").length>0) {
// d.excluded = true;
//}
// does unit require conversion?
try {
d.multFactor = i2b2.h.XPath(refXML,"descendant::UnitValues/descendant::ConvertingUnits[Units/text()='"+t[i]+"']/MultiplyingFactor/text()")[0].nodeValue;
} catch(e) {
d.multFactor = 1;
}
tProcessing.set(t[i], d);
}
// get our master unit (the first NormalUnits encountered that is not disabled)
var t = i2b2.h.XPath(refXML,"descendant::UnitValues/descendant::NormalUnits/text()");
var t2 = [];
for (var i=0; i parseFloat(iv2))) {
errorMsg.push(" - The low value is larger than the high value\n");
}
// CONVERT VALUES TO MASTER UNITS
if (dm.valueUnits[fd.unitIndex].excluded) {
alert('You cannot set a numerical value using the current Unit Of Measure.');
return false;
}
if (dm.valueUnits.find(function(o){ return ((o.masterUnit === true) && (o.excluded===true)); })) {
alert('You cannot set a numerical value because the master Unit Of Measure is declared as invalid.');
return false;
}
try {
var convtMult = dm.valueUnits[fd.unitIndex].multFactor;
if (tmpLabValue.ValueHigh) tmpLabValue.ValueHigh = (tmpLabValue.ValueHigh * convtMult);
if (tmpLabValue.ValueLow) tmpLabValue.ValueLow = (tmpLabValue.ValueLow * convtMult);
if (tmpLabValue.Value) tmpLabValue.Value = (tmpLabValue.Value * convtMult);
for (var i=0; i dm.valueValidate.maxString)) {
errorMsg.push(" - Input is over the "+dm.valueValidate.maxString+" character limit.\n");
} else {
tmpLabValue.ValueString = $('mlvfrmStrValue').value;
}
break;
case "STR":
tmpLabValue.GeneralValueType = "STRING";
tmpLabValue.SpecificValueType = "STRING";
tmpLabValue.StringOp = fd.stringOperator;
var sv = $('mlvfrmStrValue').value;
if (dm.valueValidate.maxString && (sv.length > dm.valueValidate.maxString)) {
errorMsg.push(" - Input is over the "+dm.valueValidate.maxString+" character limit.\n");
} else {
tmpLabValue.ValueString = $('mlvfrmStrValue').value;
}
break;
case "ENUM":
tmpLabValue.GeneralValueType = "ENUM";
tmpLabValue.SpecificValueType = "ENUM";
tmpLabValue.ValueEnum = [];
tmpLabValue.NameEnum = [];
var t = $('mlvfrmEnumValue').options;
for (var i=0; i