[WEBCLIENT-135] Some metadata terms with special characters will not run in the query tool Created: 02/Sep/15  Updated: 25/Jan/16  Resolved: 07/Dec/15

Status: Closed
Project: i2b2 Web Client
Component/s: Web Client
Affects Version/s: 1.7.06
Fix Version/s: 1.7.07

Type: Bug Priority: Major
Reporter: Reeta Metta Assignee: Janice Donahoe
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocked
blocks WEBCLIENT-153 Previous Queries with special charact... Closed
Affects View/s:
Navigate Terms, Workplace
i2b2 Feature/s:
Queries
i2b2 Sponsored Project/s:
i2b2 Web Client
i2b2 Related Project/s:
BBP
Affects Database/s:
All databases
Affects Web Browser/s:
All Web Browsers
Reproduction Notes: This can be reproduced in both the demo and testing environments.

Upon further investigation I found the error occurs when there are special characters like the ampersand ('&') in the tooltip; the Web Client is not escaping the '&'.

The Web Client is escaping the special characters when they are in the path (item_key) or the name of the item. The problem only occurs when it is in the tooltip.

I have verified that this issue is only a problem in the Web Client. It is working correctly in the i2b2 Workbench.
Participant/s:

 Description   
Ontology terms with special characters return in an error when running a query.
It looks like this is occurs in when there is an ampersand (&) character in C_TOOLTIP.
Steps to reproduce:
log into https://www.i2b2.org/webclient/
Under Navigate Terms panel, click on "Find" tab
Search by : <space>&<space> to return Ontology term with '&' character
"DIRECT ANTIPLATELETB&,AMP,W (LOINC:X3007-6)"
Drag and drop the term in group panel 1 and click on run query.
Getting"cell status message could not be understood error

Attached screen shot of the issue

XML Message History
sentrcvd
GetTermInfo
ONT
called by CRC:QueryTool @ T+00:00.00
sentrcvd
GetTermInfo
ONT
called by CRC:QueryTool @ T+00:00.00
sentrcvd
GetTermInfo
ONT
called by CRC:QueryTool @ T+00:00.09
sentrcvd
runQueryInstance_fromQueryDefinition
CRC
called by CRC:QueryTool @ T+00:11.79
sentrcvd
runQueryInstance_fromQueryDefinition
CRC
called by CRC:QueryTool @ T+00:17.03
sentrcvd
runQueryInstance_fromQueryDefinition
CRC
called by CRC:QueryTool @ T+01:52.19
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns6:request xmlns:ns4="http://www.i2b2.org/xsd/cell/crc/psm/1.1/" xmlns:ns7="http://www.i2b2.org/xsd/cell/ont/1.1/" xmlns:ns3="http://www.i2b2.org/xsd/cell/crc/pdo/1.1/" xmlns:ns5="http://www.i2b2.org/xsd/hive/plugin/" xmlns:ns2="http://www.i2b2.org/xsd/hive/pdo/1.1/" xmlns:ns6="http://www.i2b2.org/xsd/hive/msg/1.1/" xmlns:ns8="http://www.i2b2.org/xsd/cell/crc/psm/querydefinition/1.1/">
<message_header>
<proxy>
            <redirect_url>http://services.i2b2.org:9090/i2b2/services/QueryToolService/request&lt;/redirect_url>
        </proxy>

<sending_application>
<application_name>i2b2_QueryTool</application_name>
<application_version>1.6</application_version>
</sending_application>
<sending_facility>
<facility_name>PHS</facility_name>
</sending_facility>
<receiving_application>
<application_name>i2b2_DataRepositoryCell</application_name>
<application_version>1.6</application_version>
</receiving_application>
<receiving_facility>
<facility_name>PHS</facility_name>
</receiving_facility>
<security>
<domain>i2b2demo</domain>
<username>demo</username>
<password token_ms_timeout="1800000" is_token="true">SessionKey:z413DkIHUROJ8DbeoUCx</password>
</security>
<message_type>
<message_code>Q04</message_code>
<event_type>EQQ</event_type>
</message_type>
<message_control_id>
<message_num>yu2m9gGczlgPy153wxZzb</message_num>
<instance_num>0</instance_num>
</message_control_id>
<processing_id>
<processing_id>P</processing_id>
<processing_mode>I</processing_mode>
</processing_id>
<accept_acknowledgement_type>messageId</accept_acknowledgement_type>
<project_id>Demo</project_id>
</message_header>
<request_header>
<result_waittime_ms>180000</result_waittime_ms>
</request_header>
<message_body>
<ns4:psmheader>
<user group="Demo" login="demo">demo</user>
<patient_set_limit>0</patient_set_limit>
<estimated_time>0</estimated_time>
<query_mode>optimize_without_temp_table</query_mode>
<request_type>CRC_QRY_runQueryInstance_fromQueryDefinition</request_type>
</ns4:psmheader>
<ns4:request xsi:type="ns4:query_definition_requestType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<query_definition>
<query_name>DIRECT ANTIPLAT@11:04:07</query_name>
<query_timing>ANY</query_timing>
<specificity_scale>0</specificity_scale>
<panel>
<panel_number>1</panel_number>
<panel_accuracy_scale>100</panel_accuracy_scale>
<invert>0</invert>
<panel_timing>ANY</panel_timing>
<total_item_occurrences>1</total_item_occurrences>
<item>
<hlevel>5</hlevel>
<item_name>DIRECT ANTIPLATELETB&amp;AMP,AMP,W (LOINC:X3007-6)</item_name>
<item_key>\\i2b2_LABS\i2b2\Labtests\LAB\(LLB6) Coagulation\(LLB12) Platelet Antibodies\PLTABD\LOINC:X3007-6\</item_key>
<tooltip>Labtests \ Coagulation \ Platelet Antibodies \ PLT AB (Direct) (Group:PLTABD) \ Direct antiplateletb&amp,amp,w (LOINC:X3007-6)</tooltip>
<class>ENC</class>
<item_icon>LA</item_icon>
<item_is_synonym>false</item_is_synonym>
<constrain_by_value>
<value_type>TEXT</value_type>
<value_constraint>('POSITIVE')</value_constraint>
<value_operator>IN</value_operator>
</constrain_by_value>
</item>
</panel>
</query_definition>

<result_output_list><result_output priority_index="11" name="patient_count_xml"/>
</result_output_list>

</ns4:request>

</message_body>
</ns6:request>
<faultstring>com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ',' (code 44); expected a semi-colon after the reference for entity 'amp'
 at [row,col {unknown-source}]: [68,117]</faultstring>

 Comments   
Comment by Nich [ 03/Dec/15 ]
The <tooltip> value in the request message was not being escaped. Therefore, any ampersands in the C_TOOLTIP would make the query fail to run.

This is fixed in 1.7.07
Comment by Janice Donahoe [ 25/Jan/16 ]
On 01/22/2016, the 1.7.07 Release was made available at the following locations.

https://www.i2b2.org/software/
 - zip files for release 1.7.07 are available on this site. This includes both the code and documentation.

https://github.com/i2b2
 - source code has been tagged with v1.7.07.
Generated at Fri Apr 03 20:18:30 UTC 2020 using JIRA 7.6.3#76005-sha1:8a4e38d34af948780dbf52044e7aafb13a7cae58.