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="fe8fb655e18ba337-9d2ae89c-4b594a28-89b5b444-71b88a5731325371b5158269"><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="820b075011146538-5370db76-4850411b-84269031-4f8a80c4104de2e7738e04d2"><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="542acad7ce09064e-8a7c7d25-4ad44d28-8c1a9fbc-6576cf32704c66536cb48f0c"><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="49f74eb4e0fdf1e4-bde20c39-444a4f6b-a240807e-6f2cc44cbfc52d0c9b92d326"><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="ec3a5f41cbccd58e-113fe80f-420244ae-bb7f9481-5b0bfd50144522f5a0940d6d"><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="7f4490e712fd1bb7-a051505e-412949b4-bd799849-9bbe648d64126bb349c93ae5"><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);

...