i2b2 Web Client
Space shortcuts
Space Tools

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Communicator Subsystem (v1.4 and up)

Overview

Starting with version 1.4 of the web client, AJAX communication routines have been abstracted into a standardized subsystem. The communication subsystem consists of 2 primary object classes:

...

i2b2.ONT.cfg.parsers.GetSchemes = function(){
     if (!this.error){
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="cb792a9b4dfe35b0-0ca52348-490e41a0-b791ba50-dd673ec632fd0938527115c7"><ac:plain-text-body><![CDATA[           this.model = [];
           // extract records from XML msg
]]></ac:plain-text-body></ac:structured-macro>
           // extract records from XML msg
           var c = this.refXML.getElementsByTagName('concept');
           for (var i=0; i < 1 * c.length; i++) {
                var o = new Object;
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7e6a2009365e1fae-9c9493a0-4fe14858-bfc384be-14249a24570c6a887409c1af"><ac:plain-text-body><![CDATA[                o.xmlOrig = c[i];
]]></ac:plain-text-body></ac:structured-macro>
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="449a188b08270f66-ea32ef61-4a244da1-a5988e3b-3c9edd1862ef4c90f52ba708"><ac:plain-text-body><![CDATA[                o.level = i2b2.h.getXNodeVal(c[i],'level');
]]></ac:plain-text-body></ac:structured-macro>
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="302075e2a9668457-96f50fa5-41ec4288-9555b893-0d70c9f7c87ae87386a8f550"><ac:plain-text-body><![CDATA[                o.key = i2b2.h.getXNodeVal(c[i],'key');
]]></ac:plain-text-body></ac:structured-macro>
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="dbc47cc7cbe545c4-1bf83f9c-48c046a8-a5989c87-5a2113ff913d82904d574647"><ac:plain-text-body><![CDATA[                o.name = i2b2.h.getXNodeVal(c[i],'name');
]]></ac:plain-text-body></ac:structured-macro>
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4caea5522c2a6743-6753abc3-43cb4834-bb27ad40-ee1cbe723061e4be742735d3"><ac:plain-text-body><![CDATA[                o.total_num = i2b2.h.getXNodeVal(c[i],    &'totalnum');
]]></ac:plain-text-body></ac:structured-macro>
                 // save extracted info
                  this.model.push(o);
           }
      } else {
            this.model = false;
            console.error(

Wiki Markup
"\[GetSchemes\] Could not parse() data\!"
);
      }
     return this;
}; |

...

// create the object containing tag/value pairs to be used by the XML msg template
var tagValues = { ont ont_synonym_records" "N",
ont                            ont_hidden_records" "N",
ont                            ont_search_strategory" "contains",
ont                            ont_search_string" "asthma",
                        };
// use synchronous call to request results from the i2b2 Hive back-end
var results_cdo = i2b2.ONT.ajax.GetNameInfo ("originated by test", tagValues);

// dump the Communication Data Object variable (Firefox w/Firebug only)
console.dir (results_cdo);

// dump the sent xml (Firefox w/Firebug only)
console.debug (results_cdo.msgRequest);

// dump the returned xml (Firefox w/Firebug only)
console.debug (results_cdo.msgResponse);

...

// create the object containing tag/value pairs to be used by the XML msg template
var tagValues = { ont_synonym_records" "N",
                          ont_hidden_records" "N",
                          ont_search_strategory" "contains",
                          ont_search_string" "asthma",
                        };

// define a simple function to allow asynchronous call to the i2b2 Hive back-end
var simpAsyncCallback = function (results_cdo) {
// dump the Communication Data Object variable (Firefox w/Firebug only)
console.dir (results_cdo);
// dump the sent xml (Firefox w/Firebug only)
console.debug (results_cdo.msgRequest);
// dump the returned xml (Firefox w/Firebug only)
console.debug (results_cdo.msgResponse);
{color:#333333}};

// use asynchronous call to request results from the i2b2 Hive back-end
i2b2.ONT.ajax.GetNameInfo ("originated by test", tagValues, simpAsyncCallback);

...

// create the object containing tag/value pairs to be used by the XML msg template
var tagValues = { ont_synonym_records" "N",
                          ont_hidden_records" "N",
                          ont_search_strategory" "contains",
                          ont_search_string" "asthma",
                        };

// define a simple function to allow asynchronous call to the i2b2 Hive back-end
var complexAsyncCallback = function (results_cdo) {
// dump the Communication Data Object variable (Firefox w/Firebug only)
this.dir (results_cdo);
// dump the sent xml (Firefox w/Firebug only)
this.debug (results_cdo.msgRequest);
// dump the returned xml (Firefox w/Firebug only)
this.debug (results_cdo.msgResponse);
};

// create scoped-callback object (attaches execution scope to complexAsynchCallback)
var scopedCB = new i2b2_scopedCallback (complexAsyncCallback, window.console) ;

// use asynchronous call to request results from the i2b2 Hive back-end
i2b2.ONT.ajax.GetNameInfo ("originated by test", tagValues, simpAsyncCallback);

...