Reproduction Notes:
This can be reproduced in the i2b2 test environment.
In the metadata tables, concepts can be setup as a multiple in which a single concept will automatically include other concepts when a query is run. The concepts to be included are defined in the C_DIMCODE column.
The problem is when there is a space between the values entered in the C_DIMCODE the single quotes are not being escaped properly when the SQL is generated. This is resulting in the incorrect number of patients being returned.
If you remove the spaces between values the single quotes are being escaped correctly.
The following two examples were done using the i2b2 demo data.
EXAMPLE 1: Spaces in the C_DIMCODE
C_FULLNAME = \i2b2\Demographics\Race\Black\
C_DIMCODE = 'b', 'black', 'hib', 'his/black'
Excerpt of SQL Generated =
RACE_CD IN ('b'', ''black'', ''hib'', ''his/black')
EXAMPLE 2: No spaces in the C_DIMCODE
C_FULLNAME = \i2b2\Demographics\Race\Black\
C_DIMCODE = 'b','black','hib','his/black'
Excerpt of SQL Generated =
RACE_CD IN ('b','black','hib','his/black')
WHAT SHOULD HAPPEN:
Regardless of whether or not there are spaces between the values, the generated SQL should escape the single quotes correctly.
{"report":{"fcp":1035.9000005722046,"ttfb":242.70000076293945,"pageVisibility":"visible","entityId":10461,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"5899fe49-0f7c-4943-a74c-2ab027561227","navigationType":0,"readyForUser":1106.4000005722046,"redirectCount":0,"resourceLoadedEnd":1091.5,"resourceLoadedStart":254.80000019073486,"resourceTiming":[{"duration":213.10000038146973,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/7fd763ecdf5ed1f47fc4d22fa8382e97-CDN/4x9nqn/820011/16zrvj4/49fa3aa3d35a2cc689cbf274e66cc41a/_/download/contextbatch/css/_super/batch.css","startTime":254.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":254.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":467.9000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":220.10000038146973,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/898b8076c5e82f53cd816ca393e45a56-CDN/4x9nqn/820011/16zrvj4/f614b50eeb842ebd1ea7ab2903699907/_/download/contextbatch/css/project.issue.navigator,jira.view.issue,jira.global,atl.general,-_super/batch.css?jira.create.linked.issue=true&richediton=true","startTime":255.10000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":255.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":475.20000076293945,"responseStart":0,"secureConnectionStart":0},{"duration":539.1999998092651,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/4c9c503fe98f210445831b0d7b0cdc33-CDN/4x9nqn/820011/16zrvj4/49fa3aa3d35a2cc689cbf274e66cc41a/_/download/contextbatch/js/_super/batch.js?locale=en-US","startTime":255.30000019073486,"connectEnd":704.7000007629395,"connectStart":677.9000005722046,"domainLookupEnd":677.9000005722046,"domainLookupStart":677.9000005722046,"fetchStart":255.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":704.7000007629395,"responseEnd":794.5,"responseStart":728.1000003814697,"secureConnectionStart":690.8000001907349},{"duration":531.5999994277954,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/694e598c1ae48b0f96655173631cd247-CDN/4x9nqn/820011/16zrvj4/f614b50eeb842ebd1ea7ab2903699907/_/download/contextbatch/js/project.issue.navigator,jira.view.issue,jira.global,atl.general,-_super/batch.js?jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":255.70000076293945,"connectEnd":711.9000005722046,"connectStart":688.4000005722046,"domainLookupEnd":688.4000005722046,"domainLookupStart":688.4000005722046,"fetchStart":255.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":712,"responseEnd":787.3000001907349,"responseStart":729.5,"secureConnectionStart":699.9000005722046},{"duration":490.30000019073486,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/53f54e0ac3f00bb56b136b4d2fff2853-CDN/4x9nqn/820011/16zrvj4/aae1242f5fc81cc6a5bb8bc963ccda29/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en-US","startTime":256,"connectEnd":729,"connectStart":704,"domainLookupEnd":704,"domainLookupStart":704,"fetchStart":256,"redirectEnd":0,"redirectStart":0,"requestStart":731.7000007629395,"responseEnd":746.3000001907349,"responseStart":744.6000003814697,"secureConnectionStart":715.3000001907349},{"duration":506.5,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":256.20000076293945,"connectEnd":747.2000007629395,"connectStart":721.4000005722046,"domainLookupEnd":721.4000005722046,"domainLookupStart":721.4000005722046,"fetchStart":256.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":747.2000007629395,"responseEnd":762.7000007629395,"responseStart":761.2000007629395,"secureConnectionStart":734.1000003814697},{"duration":511.8999996185303,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":256.4000005722046,"connectEnd":754.2000007629395,"connectStart":731,"domainLookupEnd":731,"domainLookupStart":731,"fetchStart":256.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":754.7000007629395,"responseEnd":768.3000001907349,"responseStart":767.3000001907349,"secureConnectionStart":742.1000003814697},{"duration":226,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/30748292e4ca68be6947d7969829384b-CDN/4x9nqn/820011/16zrvj4/4f66da484ef7d95a2a604d3ab014374c/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":256.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":256.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":482.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":527.1999998092651,"initiatorType":"script","name":"https://community.i2b2.org/jira/rest/api/1.0/shortcuts/820011/a9e270f026ecabffc9a59343e5439391/shortcuts.js?context=issuenavigation&context=issueaction","startTime":256.70000076293945,"connectEnd":769.4000005722046,"connectStart":746.2000007629395,"domainLookupEnd":746.2000007629395,"domainLookupStart":746.2000007629395,"fetchStart":256.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":769.4000005722046,"responseEnd":783.9000005722046,"responseStart":782.4000005722046,"secureConnectionStart":757.6000003814697},{"duration":177.30000019073486,"initiatorType":"link","name":"https://community.i2b2.org/jira/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/4x9nqn/820011/16zrvj4/efa42a25652b26dfd802540c024826b3/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.css?jira.create.linked.issue=true&richediton=true","startTime":346.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":346.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":524.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":475.70000076293945,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/8087506fefd02b4096991c90836b49f6-CDN/4x9nqn/820011/16zrvj4/efa42a25652b26dfd802540c024826b3/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-jira.view.issue,-project.issue.navigator/batch.js?jira.create.linked.issue=true&locale=en-US&richediton=true","startTime":347,"connectEnd":807.6000003814697,"connectStart":783.9000005722046,"domainLookupEnd":783.9000005722046,"domainLookupStart":783.8000001907349,"fetchStart":347,"redirectEnd":0,"redirectStart":0,"requestStart":807.7000007629395,"responseEnd":822.7000007629395,"responseStart":821.6000003814697,"secureConnectionStart":795.4000005722046},{"duration":449.3999996185303,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":394.1000003814697,"connectEnd":829.8000001907349,"connectStart":806.5,"domainLookupEnd":806.5,"domainLookupStart":806.5,"fetchStart":394.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":829.9000005722046,"responseEnd":843.5,"responseStart":842.7000007629395,"secureConnectionStart":817.9000005722046},{"duration":654.3999996185303,"initiatorType":"script","name":"https://community.i2b2.org/jira/s/d41d8cd98f00b204e9800998ecf8427e-CDN/4x9nqn/820011/16zrvj4/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":437.1000003814697,"connectEnd":1076.2000007629395,"connectStart":1052.9000005722046,"domainLookupEnd":1052.9000005722046,"domainLookupStart":1052.9000005722046,"fetchStart":437.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1076.3000001907349,"responseEnd":1091.5,"responseStart":1090.1000003814697,"secureConnectionStart":1064.3000001907349}],"fetchStart":0,"domainLookupStart":160,"domainLookupEnd":160,"connectStart":160,"connectEnd":197,"secureConnectionStart":172,"requestStart":197,"responseStart":242,"responseEnd":437,"domLoading":249,"domInteractive":1154,"domContentLoadedEventStart":1154,"domContentLoadedEventEnd":1191,"domComplete":2346,"loadEventStart":2346,"loadEventEnd":2347,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1142.2000007629395},{"name":"bigPipe.sidebar-id.end","time":1142.9000005722046},{"name":"bigPipe.activity-panel-pipe-id.start","time":1143.1000003814697},{"name":"bigPipe.activity-panel-pipe-id.end","time":1145.6000003814697},{"name":"activityTabFullyLoaded","time":1200.9000005722046}],"measures":[],"correlationId":"d1ae0d83d2c10b","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":226,"dbReadsTimeInMs":42,"dbConnsTimeInMs":50,"applicationHash":"0629dd8d260e3954ece49053e565d01dabe11609","experiments":[]}}