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.ONT.ONT_view_Info.js Maven / Gradle / Ivy
/**
* @projectDescription View controller for ONT's "Info" tab.
* @inherits i2b2.ONT.view
* @namespace i2b2.ONT.view.info
* @author Nich Wattanasin
* @version 1.0
* ----------------------------------------------------------------------------------------
* updated 12-12-18: Launch [Nich Wattanasin]
*/
console.group('Load & Execute component file: ONT > view > Find');
console.time('execute time');
// create and save the view object
i2b2.ONT.view.info = new i2b2Base_cellViewController(i2b2.ONT, 'info');
i2b2.ONT.view.info.visible = false;
i2b2.ONT.view.info.modifier = false;
i2b2.ONT.view.info.currentSdxData = '';
this.currentTab = 'names';
// redefine the option functions
// ================================================================================================== //
i2b2.ONT.view.info.showOptions = function(subScreen) {
if (!this.modalOptions) {
var handleSubmit = function() {
this.cancel();
}
var handleCancel = function() {
this.cancel();
}
this.modalOptions = new YAHOO.widget.SimpleDialog("optionsOntInfo",
{ width : "400px",
fixedcenter : true,
constraintoviewport : true,
modal: true,
zindex: 700,
buttons : [ { text:"OK", handler:handleSubmit, isDefault:true },
{ text:"Cancel", handler:handleCancel } ]
} );
$('optionsOntInfo').show();
this.modalOptions.render(document.body);
}
this.modalOptions.show();
// load settings from html
//i2b2.ONT.view['info'].params.max = parseInt($('ONTFINDMaxQryDisp').value,10);
//i2b2.ONT.view['info'].params.synonyms = $('ONTFINDshowSynonyms').checked;
//i2b2.ONT.view['info'].params.hiddens = $('ONTFINDshowHiddens').checked;
//$('ONTFINDMaxQryDisp').value = this.params.max;
//$('ONTFINDshowSynonyms').checked = parseBoolean(this.params.synonyms);
//$('ONTFINDshowHiddens').checked = parseBoolean(this.params.hiddens);
}
// ================================================================================================== //
i2b2.ONT.view.info.showView = function() {
$('tabInfo').addClassName('active');
$('ontInfoDisp').style.display = 'block';
}
// ================================================================================================== //
i2b2.ONT.view.info.hideView = function() {
$('tabInfo').removeClassName('active');
$('ontInfoDisp').style.display = 'none';
}
// ================================================================================================== //
i2b2.ONT.view.info.selectSubTab = function(tabCode) {
// toggle between the Navigate and Find Terms tabs
switch (tabCode) {
case "names":
this.currentTab = 'names';
$('ontFindTabName').blur();
$('ontFindTabName').className = 'findSubTabSelected';
$('ontFindTabCode').className = 'findSubTab';
$('ontFindFrameName').show();
$('ontFindFrameCode').hide();
$('ontSearchNamesResults').show();
$('ontSearchCodesResults').hide();
break;
case "codes":
this.currentTab = 'codes';
$('ontFindTabCode').blur();
$('ontFindTabName').className = 'findSubTab';
$('ontFindTabCode').className = 'findSubTabSelected';
$('ontFindFrameModifier').hide();
//$('ontSearchModifiersResults').hide();
$('ontFindFrameName').hide();
$('ontFindFrameCode').show();
$('ontSearchNamesResults').hide();
$('ontSearchCodesResults').show();
break;
}
}
// ================================================================================================== //
i2b2.ONT.view.info.PopulateCategories = function() {
// insert the categories option list
var tns = $('ontFindCategory');
// clear the list first
while( tns.hasChildNodes() ) { tns.removeChild( tns.lastChild ); }
// add the default option
//Load from HTML
i2b2.ONT.view['info'].params.max = parseInt($('ONTFINDMaxQryDisp').value,10);
i2b2.ONT.view['info'].params.synonyms = $('ONTFINDshowSynonyms').checked;
i2b2.ONT.view['info'].params.hiddens = $('ONTFINDshowHiddens').checked;
var tno = document.createElement('OPTION');
tno.setAttribute('value', '[[[ALL]]]');
var tnt = document.createTextNode('Any Category');
tno.appendChild(tnt);
tns.appendChild(tno);
// populate the Categories from the data model
for (var i=0; i 5){
for(i=0;i 0) {
var dataType = i2b2.h.getXNodeVal(mdnodes[0], 'DataType');
if(dataType)
var valueType = i2b2.CRC.view.modLabvaluesCtlr.getValueType(dataType);
else
var valueType = "NODATATYPE";
} else {
// no LabValue configuration
return false;
}
// notify the value type's controller class to activate
try {
if(valueType){
var GeneralValueType = valueType;
i2b2.CRC.view[GeneralValueType].showDialog(0, null, key, extData, false, null);
}
else
alert('An error has occurred while trying to determine the value type.');
} catch(e) {
alert('An error has occurred while trying to initialize the Valuebox.');
}
//i2b2.CRC.view['NUMBER'].showDialog(0, null, '\\\\i2b2_LABS\\i2b2\\Labtests\\LAB\\(LLB16) Chemistry\\(LLB31) Anemia Related Studies\\', i2b2.ONT.view.info.currentSdxData, false,null);
}
//================================================================================================== //
i2b2.ONT.view.info.showInfoByKey = function(key) {
i2b2.ONT.view.info.currentSdxData = '';
var t = i2b2.ONT.view.nav.params;
if($('ontMainBox').style.display == "none"){
i2b2.ONT.view.main.ZoomView();
}
$('tabInfo').click();
var term = i2b2.ONT.ajax.GetTermInfo("ONT", {ont_max_records:'max="1"', ont_synonym_records:'false', ont_hidden_records: 'false', concept_key_value: key}).parse();
if(term.model.length > 0){
var sdxData = term.model[0];
sdxData.renderData = {
htmlID : 'temp'
};
i2b2.ONT.view.info.currentSdxData = sdxData;
// get all the variables of the concept
//var table_name = results.model[0].origData.table_name;
var term_name = sdxData.origData.name;
var term_tooltip = sdxData.origData.tooltip;
var term_key = sdxData.origData.key;
var term_dimcode = sdxData.origData.dim_code;
var term_icon = i2b2.ONT.view.info.getIcon(sdxData.origData.hasChildren);
var term_parent_key = i2b2.ONT.view.info.getParentKey(sdxData.origData.key);
var term_metadataxml = i2b2.h.XPath(sdxData.origData.xmlOrig, 'metadataxml/ValueMetadata[string-length(Version)>0]');
var term_table = sdxData.origData.table_name;
//var term_description = 'This term is a {non-draggable} {folder} which {can} be used in a query. The term {represents the code of 125.125 and} {could have} children below it.';
var term_description = 'This term is a ';
if(sdxData.origData.hasChildren.substring(1,0) === "C"){
term_description += 'non-draggable ';
} else {
term_description += 'draggable ';
}
if (sdxData.origData.hasChildren.substring(1,0) === "C" || sdxData.origData.hasChildren.substring(1,0) === "F" || sdxData.origData.hasChildren.substring(1,0) === "O" || sdxData.origData.hasChildren.substring(1,0) === "D"){
term_description += 'folder ';
} else {
term_description += 'leaf node ';
}
term_description += 'which ';
if(sdxData.origData.hasChildren.substring(1,0) === "C"){
term_description += 'cannot ';
} else {
term_description += 'can ';
}
term_description += 'be used in a query. The term ';
if(typeof sdxData.origData.basecode !== "undefined"){
term_description += 'represents the code of ' + sdxData.origData.basecode + ' and ';
}
if (sdxData.origData.hasChildren.substring(1,0) === "C" || sdxData.origData.hasChildren.substring(1,0) === "F" || sdxData.origData.hasChildren.substring(1,0) === "O" || sdxData.origData.hasChildren.substring(1,0) === "D"){
term_description += 'may ';
} else {
term_description += 'does not ';
}
term_description += 'have children below it.';
// display
$('ontInfoName').innerHTML = ' ' + term_name;
$('ontInfoTooltip').innerHTML = term_tooltip;
if(term_parent_key !== ''){
var parent_key = term_parent_key.replace(/\\/g,'\\\\');
$('ontInfoTooltip').innerHTML += ' - Go Up ';
}
$('ontInfoKey').innerHTML = term_key;
if (term_metadataxml.length > 0) {
$('ontMetadataXml').innerHTML = 'This term accepts values to be set when using the term in a query. Preview Value Box ';
} else {
$('ontMetadataXml').innerHTML = 'This term does not allow values to be set.';
}
//$('ontInfoSQL').innerHTML = "SELECT * FROM i2b2metadata WHERE c_fullname LIKE '" + term_key + "%';";
// var sql_term_dimcode = term_dimcode.replace(/\\/g,'\\\\');
// if(term_table.toLowerCase() == 'concept_dimension'){
// $('ontInfoSQL').innerHTML = "SELECT CONCEPT_PATH, CONCEPT_CD, NAME_CHAR FROM concept_dimension WHERE CONCEPT_PATH LIKE '" + sql_term_dimcode + "%';";
//} else {
// $('ontInfoSQL').innerHTML = "No example is available";
//}
$('ontInfoDescription').innerHTML = term_description;
// get children
var options = {};
options.ont_hidden_records = t.hiddens;
options.ont_max_records = "max='"+t.max+"' ";
options.ont_synonym_records = t.synonyms;
options.ont_patient_count = t.patientCount;
options.ont_short_tooltip = t.shortTooltip;
options.ont_show_concept_code = t.showConceptCode;
options.concept_key_value = key;
if (t.modifiers == undefined || t.modifiers == false){
options.version = i2b2.ClientVersion;
} else {
options.version = "1.5";
}
var response = i2b2.ONT.ajax.GetChildConcepts("ONT:SDX:Concept", options);
response.parse();
var basecodes = [];
var childrenHTML = 'Name Code ';
for(i=0; i < response.model.length; i++){
var child = response.model[i];
var child_icon = i2b2.ONT.view.info.getIcon(child.origData.hasChildren);
var child_key = child.origData.key.replace(/\\/g,'\\\\');
childrenHTML += ' ' + child.origData.name + ' ';
if(typeof child.origData.basecode !== "undefined"){
childrenHTML += child.origData.basecode;
}
childrenHTML += ' ';
}
childrenHTML += '
';
$('ontInfoChildren').innerHTML = childrenHTML;
} else {
$('ontInfoChildren').innerHTML = 'This term has no children ';
}
}
//================================================================================================== //
i2b2.ONT.view.info.doShowInfo = function(p_sType, p_aArgs, p_oValue) {
i2b2.ONT.view.info.showInfoByKey(p_oValue.origData.key);
//window.open(p_oValue,'infoPrintWindow','width=800,height=750,menubar=yes,resizable=yes,scrollbars=yes');
}
//================================================================================================== //
i2b2.ONT.view.info.doRefreshAll = function() {
i2b2.ONT.view.info.PopulateCategories();
}
//================================================================================================== //
i2b2.ONT.view.info.doShowModifiers = function(e) {
var op = i2b2.ONT.view.info.contextRecord;
$('ontFindFrameModifierTitle').innerHTML = 'Find Modifiers for ' + op.sdxInfo.sdxDisplayName;
i2b2.ONT.view.info.modifier = true;
i2b2.ONT.view.info.Resize();
i2b2.hive.MasterView.addZoomWindow("ONT");
// i2b2.ONT.view.nav.PopulateCategories();
}
// ================================================================================================== //
i2b2.ONT.view.info.ContextMenuValidate = function(p_oEvent) {
var clickId = null;
var currentNode = this.contextEventTarget;
while (!currentNode.id) {
if (currentNode.parentNode) {
currentNode = currentNode.parentNode;
} else {
// we have recursed up the tree to the window/document DOM... it's a bad click
this.cancel();
return;
}
}
clickId = currentNode.id;
var items = this.getItems();
var addItem = { text: "Find Modifiers", onclick: { fn: i2b2.ONT.view.info.doShowModifiers } };
if ($('ONTFINDdisableModifiers').checked) {
if (items.length == 2 )
{
this.removeItem(1);
}
} else if (items.length == 1) {
this.insertItem(addItem,1);
}
// see if the ID maps back to a treenode with SDX data
var tvNode = i2b2.ONT.view.info.yuiTreeName.getNodeByProperty('nodeid', clickId);
if (tvNode == null) {
tvNode = i2b2.ONT.view.info.yuiTreeCode.getNodeByProperty('nodeid', clickId);
}
if (tvNode) {
if (tvNode.data.i2b2_SDX) {
if (tvNode.data.i2b2_SDX.sdxInfo.sdxType == "CONCPT") {
i2b2.ONT.view.info.contextRecord = tvNode.data.i2b2_SDX;
} else {
this.cancel();
return;
}
}
}
};
//================================================================================================== //
i2b2.ONT.view.info.ContextMenu = new YAHOO.widget.ContextMenu(
"divContextMenu-Find",
{ lazyload: true,
trigger: $('ontFindDisp'),
itemdata: [
{ text: "Refresh All", onclick: { fn: i2b2.ONT.view.info.doRefreshAll } },
{ text: "Find Modifiers", onclick: { fn: i2b2.ONT.view.info.doShowModifiers } }
] }
);
//================================================================================================== //
i2b2.ONT.view.info.ContextMenu.subscribe("triggerContextMenu",i2b2.ONT.view.info.ContextMenuValidate);
// This is done once the entire cell has been loaded
// ================================================================================================== //
console.info("SUBSCRIBED TO i2b2.events.afterCellInit");
i2b2.events.afterCellInit.subscribe(
(function(en,co) {
if (co[0].cellCode=='ONT') {
// ===================================================================
var thisview = i2b2.ONT.view.info;
// perform visual actions
thisview.Resize();
// ===================================================================
}
})
);
//================================================================================================== //
i2b2.events.initView.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
newMode = newMode[0];
this.viewMode = newMode;
this.visible = true;
this.Resize();
// -------------------------------------------------------
}),'',i2b2.ONT.view.info);
i2b2.events.changedViewMode.subscribe((function(eventTypeName, newMode) {
// -------------------------------------------------------
newMode = newMode[0];
this.viewMode = newMode;
switch(newMode) {
case "Patients":
case "Analysis":
var wlst = i2b2.hive.MasterView.getZoomWindows();
if (wlst.indexOf("HISTORY")!=-1 || wlst.indexOf("WORK")!=-1) { return; }
this.visible = true;
this.Resize();
break;
default:
this.visible = false;
break;
}
// -------------------------------------------------------
}),'',i2b2.ONT.view.info);
// ================================================================================================== //
i2b2.events.changedZoomWindows.subscribe((function(eventTypeName, zoomMsg) {
// -------------------------------------------------------
newMode = zoomMsg[0];
switch (newMode.window) {
case "ONT":
case "HISTORY":
case "WORK":
this.ResizeHeight();
//this.Resize(); //tdw9
}
// -------------------------------------------------------
}),'',i2b2.ONT.view.info);
console.timeEnd('execute time');
console.groupEnd();