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="9ccd85bd82ee3f2d-ac56b954-4beb4e57-b44fbfbe-f3c06ac35211796738375c7c"><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="26f4a2297f3103a1-7efbf6c9-467c42e1-8fcbb2d4-c6f703da4dfc4ae131d1d5a5"><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="ea8ce9ef75ac6bc2-e0d44b55-4f7646d3-8e578234-a80a0e0604b0cb1fa510fb49"><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="e1a0ddf47ee6f52d-e96b705d-4d564ffc-b387ad5d-48317a6b9ccf9dc60af00119"><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="18721b37ee33c3a1-a9baa765-43be48fb-83a2a53e-2b7145f4fc7e01ded5e8e5fe"><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="803a33f6af801489-2aeffa8c-407c46ca-84a98e04-4480923b6e313dcfbe4de93e"><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);

...