All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webclient.js-i2b2.cells.WORK.i2b2_msgs.js Maven / Gradle / Ivy

/**
 * @projectDescription	Messages to configure and build a WORK cell communicator object.
 * @namespace	i2b2.WORK.ajax
 * @author		Nick Benik, Griffin Weber MD PhD
 * @version 	1.3
 * updated 2-20-09: Refactor Communicator layer [Nick Benik] 
 */

// create the communicator Object
i2b2.WORK.ajax = i2b2.hive.communicatorFactory("WORK");

// create namespaces to hold all the communicator messages and parsing routines
i2b2.WORK.cfg.msgs = {};
i2b2.WORK.cfg.parsers = {};
		
// ================================================================================================== //
//i2b2.WORK.cfg.msgs.getFoldersByProject = '\n'+ "NO EXAMPLE OF THIS FUNCTION BEING CALLED WAS FOUND."


// ================================================================================================== //
i2b2.WORK.cfg.msgs.moveChild = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'			\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+'	\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'			{{{target_node_id}}}\n'+
'			{{{new_parent_node_id}}}\n'+
'		\n'+
'	\n'+
'';
i2b2.WORK.ajax._addFunctionCall("moveChild","{{{URL}}}moveChild", i2b2.WORK.cfg.msgs.moveChild);

// ================================================================================================== //
// URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/getFoldersByUser
i2b2.WORK.cfg.msgs.getFoldersByUserId = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'	\n'+
'';
i2b2.WORK.cfg.parsers.getFoldersByUser = function(){
	if (!this.error) {
		this.model = [];		
		var nlst = i2b2.h.XPath(this.refXML, "//folder[name and share_id and index and visual_attributes]");
		for (var i = 0; i < nlst.length; i++) {
			var s = nlst[i];
			var nodeData = {};
			nodeData.xmlOrig = s;
			nodeData.index = i2b2.h.getXNodeVal(s, "index");
			nodeData.key = nodeData.index;
			nodeData.name = i2b2.h.getXNodeVal(s, "name");
			nodeData.annotation = i2b2.h.getXNodeVal(s, "tooltip");
			nodeData.share_id = i2b2.h.getXNodeVal(s, "share_id");
			nodeData.visual = String(i2b2.h.getXNodeVal(s, "visual_attributes")).strip();
			nodeData.isRoot = true;
			// encapsulate into SDX object
			var sdxDataPack = i2b2.sdx.Master.EncapsulateData('WRK', nodeData);
			this.model.push(sdxDataPack);
		}
	} else {
		this.model = false;
		console.error("[getFoldersByUserId] Could not parse() data!");
	}
	return this;
}
i2b2.WORK.ajax._addFunctionCall(	"getFoldersByUserId",
									"{{{URL}}}getFoldersByUserId",
									i2b2.WORK.cfg.msgs.getFoldersByUserId,
									null,
									i2b2.WORK.cfg.parsers.getFoldersByUserId);



// ================================================================================================== //
// URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/getFoldersByProject
i2b2.WORK.cfg.msgs.getFoldersByProject = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'	\n'+
'';
i2b2.WORK.cfg.parsers.getFoldersByProject = function(){
	if (!this.error) {
		this.model = [];		
		var nlst = i2b2.h.XPath(this.refXML, "//folder[name and share_id and index and visual_attributes]");
		for (var i = 0; i < nlst.length; i++) {
			var s = nlst[i];
			var nodeData = {};
			nodeData.xmlOrig = s;
			nodeData.index = i2b2.h.getXNodeVal(s, "index");
			nodeData.key = nodeData.index;
			nodeData.name = i2b2.h.getXNodeVal(s, "name");
			nodeData.annotation = i2b2.h.getXNodeVal(s, "tooltip");
			nodeData.share_id = i2b2.h.getXNodeVal(s, "share_id");
			nodeData.visual = String(i2b2.h.getXNodeVal(s, "visual_attributes")).strip();
			nodeData.isRoot = true;
			// encapsulate into SDX object
			var sdxDataPack = i2b2.sdx.Master.EncapsulateData('WRK', nodeData);
			this.model.push(sdxDataPack);
		}
	} else {
		this.model = false;
		console.error("[getQueryMasterList_fromUserId] Could not parse() data!");
	}
	return this;
}
i2b2.WORK.ajax._addFunctionCall(	"getFoldersByProject",
									"{{{URL}}}getFoldersByProject",
									i2b2.WORK.cfg.msgs.getFoldersByProject,
									null,
									i2b2.WORK.cfg.parsers.getFoldersByProject);



// ================================================================================================== //
// URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/getChildren
i2b2.WORK.cfg.msgs.getChildren = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'			{{{parent_key_value}}}\n'+
'		\n'+
'	\n'+
'';
i2b2.WORK.cfg.parsers.getChildren = function(){
	if (!this.error) {
		this.model = [];
		var nlst = i2b2.h.XPath(this.refXML, "//folder[name and share_id and index and visual_attributes]");
		for (var i = 0; i < nlst.length; i++) {
			var s = nlst[i];
			var nodeData = {};
			nodeData.xmlOrig = s;
			nodeData.index = i2b2.h.getXNodeVal(s, "index");
			nodeData.key = nodeData.index;
			nodeData.name = i2b2.h.getXNodeVal(s, "name");
			nodeData.annotation = i2b2.h.getXNodeVal(s, "tooltip");
			nodeData.share_id = i2b2.h.getXNodeVal(s, "share_id");
			nodeData.visual = String(i2b2.h.getXNodeVal(s, "visual_attributes")).strip();
			nodeData.encapType = i2b2.h.getXNodeVal(s, "work_xml_i2b2_type");
			nodeData.isRoot = false;
			// encapsulate into SDX object
			var sdxDataPack = i2b2.sdx.Master.EncapsulateData('WRK', nodeData);
			this.model.push(sdxDataPack);
			if (nodeData.encapType == "FOLDER") {
				var sdxDataPack = i2b2.sdx.Master.EncapsulateData('WRKF', nodeData);
				this.model.push(sdxDataPack);
			}
		}
	} else {
		this.model = false;
		console.error("[getQueryMasterList_fromUserId] Could not parse() data!");
	}
	return this;
}
i2b2.WORK.ajax._addFunctionCall("getChildren",
								"{{{URL}}}getChildren",
								i2b2.WORK.cfg.msgs.getChildren, 
								null,
								i2b2.WORK.cfg.parsers.getChildren);



// ================================================================================================== //
// URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/addChild
i2b2.WORK.cfg.msgs.addChild = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'			{{{child_name}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_project}}}\n'+
'			{{{share_id}}}\n'+
'			{{{child_index}}}\n'+
'			{{{parent_key_value}}}\n'+
'			{{{child_visual_attributes}}}\n'+
'			{{{child_annotation}}}\n'+
'			{{{child_work_type}}}\n'+
'			{{{child_work_xml}}}\n'+
'		\n'+
'	\n'+
'';
// ================================================================================================== //
i2b2.WORK.ajax._addFunctionCall("addChild","{{{URL}}}addChild", i2b2.WORK.cfg.msgs.addChild, ['child_work_xml']);



// URL:  (used by addChild to encapsulate non-WRK SDX type of CONCPT)
i2b2.WORK.cfg.msgs.encapsulateCONCPT = ''+
'			\n'+
'				\n'+
'					\n'+
'						\n'+
'							{{{concept_level}}}\n'+
'							{{{concept_id}}}\n'+
'							{{{concept_name}}}\n'+
'							{{{concept_synonym}}}\n'+
'							{{{concept_visual_attributes}}}\n'+
'							{{{concept_total}}}\n'+
'							{{{concept_basecode}}}\n'+
'							{{{concept_fact_table_column}}}\n'+
'							{{{concept_table_name}}}\n'+
'							{{{concept_column_name}}}\n'+
'							{{{concept_column_data_type}}}\n'+
'							{{{concept_operator}}}\n'+
'							{{{concept_dimcode}}}\n'+
'							{{{concept_comment}}}\n'+
'							{{{concept_tooltip}}}\n'+
'						\n'+
'					\n'+
'				\n'+
'			\n';
// ================================================================================================== //


// URL:  (used by addChild to encapsulate non-WRK SDX type of PRS)
i2b2.WORK.cfg.msgs.encapsulatePRS = ''+
'			\n'+
'				\n'+
'					\n'+
'						{{{prs_id}}}\n'+
'						{{{qi_id}}}\n'+
'						{{{prs_description}}}\n' +
'						\n'+
'							1\n'+
'							PATIENTSET\n'+
'							LIST\n' +
'							LA\n' +
'							Patient list\n'+
'						\n'+
'						{{{prs_set_size}}}\n'+
'						{{{prs_start_date}}}\n'+
'						{{{prs_end_date}}}\n'+
//'						\n'+
//'							3\n'+
//'							FINISHED\n'+
//'							FINISHED\n'+
//'						\n'+
'					\n'+
'				\n'+
'			\n';
// ================================================================================================== //

// URL:  (used by addChild to encapsulate non-WRK SDX type of PRS)
i2b2.WORK.cfg.msgs.encapsulateENS = ''+
'			\n'+
'				\n'+
'					\n'+
'						{{{prs_id}}}\n'+
'						{{{qi_id}}}\n'+
'						{{{prs_description}}}\n' +
'						\n'+
'							1\n'+
'							ENCOUNTERSET\n'+
'							LIST\n' +
'							LA\n' +
'							Encounter list\n'+
'						\n'+
'						{{{prs_set_size}}}\n'+
'						{{{prs_start_date}}}\n'+
'						{{{prs_end_date}}}\n'+
'					\n'+
'				\n'+
'			\n';
// ================================================================================================== //


// URL:  (used by addChild to encapsulate non-WRK SDX type of PRC)
i2b2.WORK.cfg.msgs.encapsulatePRC = ''+
'			\n'+
'				\n'+
'					\n'+
'						{{{prc_id}}}\n'+
'						{{{qi_id}}}\n'+
'						\n'+
'							4\n'+
'							PATIENT_COUNT_XML\n'+
'							Number of patients\n'+
'						\n'+
'						{{{prc_set_size}}}\n'+
'						{{{prc_start_date}}}\n'+
'						{{{prc_end_date}}}\n'+
//'						\n'+
//'							3\n'+
//'							FINISHED\n'+
//'							FINISHED\n'+
//'						\n'+
'					\n'+
'				\n'+
'			\n';
// ================================================================================================== //


// URL:  (used by addChild to encapsulate non-WRK SDX type of PRC)
i2b2.WORK.cfg.msgs.encapsulateQM = ''+
'			\n'+
'				\n'+
'					\n'+
'						{{{qm_id}}}\n'+
'						{{{qm_name}}}\n'+
'						{{{qm_user_id}}}\n'+
'						{{{qm_user_group_id}}}\n'+
'					\n'+
'				\n'+
'			\n';
// ================================================================================================== //

// URL:  (used by addChild to encapsulate non-WRK SDX type of PR)
i2b2.WORK.cfg.msgs.encapsulatePR = ''+
'			\n'+
'				 \n'+
'					 \n'+
'						{{{pr_id}}} \n'+
'			    	 \n'+
'				 \n'+
'			\n';
// ================================================================================================== //

// URL:  (used by addChild to encapsulate non-WRK SDX type of QDEF)
i2b2.WORK.cfg.msgs.encapsulateQDEF = ''+
'			\n'+
'				\n'+
'{{{query_def}}}\n'+
'				\n'+
'			\n';
// ================================================================================================== //


// URL:  (used by addChild to encapsulate non-WRK SDX type of QGDEF)
i2b2.WORK.cfg.msgs.encapsulateQGDEF = ''+
'			\n'+
'				\n'+
'{{{query_def}}}\n'+
'				 \n'+
'			\n';
// ================================================================================================== //


//URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/renameChild
i2b2.WORK.cfg.msgs.renameChild = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'			{{{rename_target_id}}}\n'+
'			{{{rename_text}}}\n'+
'		\n'+
'	\n'+
'\n';
// ================================================================================================== //
i2b2.WORK.ajax._addFunctionCall("renameChild","{{{URL}}}renameChild", i2b2.WORK.cfg.msgs.renameChild);




// URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/annotateChild
i2b2.WORK.cfg.msgs.annotateChild = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'			{{{annotation_target_id}}}\n'+
'			{{{annotation_text}}}\n'+
'		\n'+
'	\n'+
'';
// ================================================================================================== //
i2b2.WORK.ajax._addFunctionCall("annotateChild","{{{URL}}}annotateChild", i2b2.WORK.cfg.msgs.annotateChild);



// URL: Address: http://127.0.0.1:7070/i2b2/rest/WorkplaceService/deleteChild
i2b2.WORK.cfg.msgs.deleteChild = '\n'+
'\n'+
'	\n'+
'		{{{proxy_info}}}\n'+
'		1.1\n'+
'		\n'+
'			i2b2 Ontology\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		\n'+
'			1.1\n'+
'			' + i2b2.ClientVersion + '\n'+
'		\n'+
'		\n'+
'			i2b2 Hive\n'+
'		\n'+
'		{{{header_msg_datetime}}}\n'+
'		\n'+
'			{{{sec_domain}}}\n'+
'			{{{sec_user}}}\n'+
'			{{{sec_pass_node}}}\n'+
'		\n'+
'		\n'+
'			{{{header_msg_id}}}\n'+
'			0\n'+
'		\n'+
'		\n'+
'			P\n'+
'			I\n'+
'		\n'+
'		AL\n'+
'		AL\n'+
'		US\n'+
'		{{{sec_project}}}\n'+
'	\n'+
'	\n'+
'		{{{result_wait_time}}}000\n'+
'	\n'+
'	\n'+
'		\n'+
'			{{{delete_target_id}}}\n'+
'		\n'+
'	\n'+
'\n';
// ================================================================================================== //
i2b2.WORK.ajax._addFunctionCall("deleteChild","{{{URL}}}deleteChild", i2b2.WORK.cfg.msgs.deleteChild);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy