Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALS-6171] Show Stigmatizing variables in open access but disable filtering on them #298

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ define(['backbone', 'handlebars', 'underscore', 'text!search-interface/datatable
let dataRow = _.find(this.data(), (entry)=>{ return entry[1] === variableId;});
dataRow[0] = true;
let checkbox = $('input[data-varid="' + variableId +'"]')[0];
if(checkbox!==undefined){
if(checkbox!==undefined && checkbox.disabled === false){
checkbox.checked = true;
}
});
Expand Down Expand Up @@ -182,17 +182,7 @@ define(['backbone', 'handlebars', 'underscore', 'text!search-interface/datatable
let data = this.dtData;
const isOpenAccess = JSON.parse(sessionStorage.getItem('isOpenAccess'));
if(!data){

if (isOpenAccess) {
// filter out stigmatized variables
data = this.model.dtVariables.filter(function (variable) {
return variable.result.metadata?.is_stigmatized === "false" || variable.result.metadata?.columnmeta_is_stigmatized === "false";
});
} else {
data = this.model.dtVariables;
}

data = data.map(function(variable) {
data = this.model.dtVariables.map(function(variable) {
let values = variable.result.values.join(", ");
return [
existingFilter ?
Expand All @@ -206,7 +196,8 @@ define(['backbone', 'handlebars', 'underscore', 'text!search-interface/datatable
variable.result.metadata.columnmeta_data_type,
(variable.result.metadata.columnmeta_data_type.toLowerCase() == 'continuous') ? 'Min: '+ variable.result.metadata.columnmeta_min + ', Max: ' + variable.result.metadata.columnmeta_max : 'See Values',
(variable.result.metadata.columnmeta_data_type.toLowerCase() == 'continuous') ? "" : '[ ' + values + ' ]',
variable.result.metadata.columnmeta_HPDS_PATH
variable.result.metadata.columnmeta_HPDS_PATH,
variable.result.metadata.columnmeta_is_stigmatized,
];
});
this.dtData = data;
Expand Down Expand Up @@ -237,7 +228,11 @@ define(['backbone', 'handlebars', 'underscore', 'text!search-interface/datatable
},
{
render: function(data,type,row,meta){
return '<input data-sort-token=' + (data?0:1) + ' checked='+data+' type="checkbox" tabindex="-1" data-varid="'+row[1]+'"></input>';
if (isOpenAccess && (row[8] === false || row[8] === "false")) {
return '<input data-sort-token=' + (data?0:1) + ' checked='+data+' type="checkbox" tabindex="-1" data-varid="'+row[1]+'"></input>';
} else {
return '<input title="This variable is stigmatizing" data-sort-token=' + (data?0:1) + ' type="checkbox" tabindex="-1" disabled></input>';
}
},
type:'string',
targets: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<div id="tool-suite-help" class="search-help-modal">
<p>There are a few reasons a user might see no or unexpected results when searching for variables.</p>
<ul>
<li>The PIC-SURE Open Access dataset excludes stigmatizing variables from the following categories: Mental health diagnoses/history/treatment; Illicit drug use history; Sexually transmitted disease diagnoses/history/treatment; Sexual history; Intellectual Achievement/Ability/Educational Attainment; Direct or surrogate identifiers of legal status.</li>
<li>There may be several rows that seem to display duplicated variables from the same study. However, these are actually distinct variables within the study from different datasets. Click on each row to learn more about the dataset the variable is associated with.</li>
<li>PIC-SURE does not support semantic search at this time. Try searching for synonyms of your search term (e.g.
searching "myocardial infarction" instead of "heart attack"). Also ensure that your search term is spelled
correctly.</li>
<li>Please note that Open PIC-SURE does not enable filtering on stigmatizing variables from the following categories: Mental health diagnoses/history/treatment;
Illicit drug use history; Sexually transmitted disease diagnoses/history/treatment; Sexual history; Intellectual Achievement/Ability/Educational Attainment;
Direct or surrogate identifiers of legal status.</li>
</ul>
<p>Note that you will not be able to use DCC Harmonized data set variables with variables from studies that are not
included in the harmonized data set in the same query. </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,6 @@ define(["backbone", "handlebars", "underscore", "text!search-interface/search-re

if (tagFilterModel.get("searchResults")) {
let filteredResults = filterUnwantedResultsOut(tagFilterModel.get("searchResults").results.searchResults);
if (JSON.parse(sessionStorage.getItem('isOpenAccess'))) {
filteredResults = _.filter(filteredResults, function (result) {
return result.result.metadata.columnmeta_is_stigmatized === "false";
});
}
if (filteredResults.length === 0) {
if ($('#no-results').length === 0) {
$('#guide-me-button-container').show();
Expand Down Expand Up @@ -409,6 +404,7 @@ define(["backbone", "handlebars", "underscore", "text!search-interface/search-re
dataTableDescription: metadata.columnmeta_var_group_description,
description: metadata.columnmeta_description,
hashed_var_id: metadata.hashed_var_id,
is_stigmatized: metadata.columnmeta_is_stigmatized === 'true',
is_harmonized: searchUtil.isStudyHarmonized(metadata.columnmeta_study_id.toLowerCase()),
result_index: i,
metadata: metadata
Expand Down Expand Up @@ -467,9 +463,10 @@ define(["backbone", "handlebars", "underscore", "text!search-interface/search-re
},
{
render: function (data, type, row, meta) {
let filterTitleText = "Click to configure a filter using this variable.";
let exportTitleText = "Click to add this variable to your data retrieval.";
let isOpenAccess = JSON.parse(sessionStorage.getItem('isOpenAccess'));
let filterTitleText = (isOpenAccess && row.is_stigmatized) ? "This variable is stigmatizing." : "Click to configure a filter using this variable.";
let filterClasses = 'fa fa-filter search-result-action-btn' + (isOpenAccess && row.is_stigmatized ? " disabled-icon" : '');
let exportTitleText = "Click to add this variable to your data retrieval.";
let tourAttr;
if (row.result_index == 0) {
tourAttr = isOpenAccess ? ' data-intro="#open-actions-row"' : ' data-intro="#authorized-actions-row"' + ' data-sequence="6" id="first-actions-row"';
Expand All @@ -480,7 +477,7 @@ define(["backbone", "handlebars", "underscore", "text!search-interface/search-re
// add data_hierarchy
iconHtml += '<i class="fa-solid fa-sitemap search-result-action-btn ' + (row.metadata.data_hierarchy ? '" title="View Data Tree"' : 'disabled-icon hidden-icon" title="This variable does not have a data hierarchy."') + ' data-variable-id="' + row.variable_id + '" data-study-id="' + row.study_id + '"></i>';
// add filter
iconHtml += '<i data-table-id="' + row.table_id + '" data-variable-id="' + row.variable_id + '" data-study-id="' + row.study_id + '" data-result-index="' + row.result_index + '" title="' + filterTitleText + '" class="fa fa-filter search-result-action-btn"></i>'
iconHtml += '<i data-table-id="' + row.table_id + '" data-variable-id="' + row.variable_id + '" data-study-id="' + row.study_id + '" data-result-index="' + row.result_index + '" title="' + filterTitleText + '" class="'+filterClasses+'"></i>'
// add export
if (!isOpenAccess) {
iconHtml += '<i data-table-id="' + row.table_id + '" data-variable-id="' + row.variable_id + '" data-study-id="' + row.study_id + '" data-result-index="' + row.result_index + '" title="' + exportTitleText + '" class="export-icon search-result-action-btn '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{#if hasDataHierarchy}}
<i data-target="variable" data-id="{{variableId}}" data-study="{{variableMetadata.columnmeta_study_id}}" aria-label="View Data Hierarchy Button - {{dataTreeTitleText}}" title="{{dataTreeTitleText}}" class="fa-solid fa-sitemap search-result-action-btn" tabindex=1000000></i>
{{/if}}
<i data-target="variable" data-id="{{variableId}}" data-study="{{variableMetadata.columnmeta_study_id}}" aria-label="Filter By Variable Button - {{filterTitleText}}" title="{{filterTitleText}}" tabindex=1000001 class="fa fa-filter search-result-action-btn"></i>
<i data-target="variable" data-id="{{variableId}}" data-study="{{variableMetadata.columnmeta_study_id}}" aria-label="Filter By Variable Button - {{filterTitleText}}" title="{{filterTitleText}}" tabindex=1000001 class="fa fa-filter search-result-action-btn {{disabledClass}}"></i>
{{#if isAuthorized}}
{{#if isExportField}}
<i data-target="variable" data-id="{{variableId}}" data-study="{{variableMetadata.columnmeta_study_id}}" aria-label="Add Variable to Export Button - {{exportTitleText}}" title="{{exportTitleText}}" tabindex=1000002 class="fa-regular fa-square-check export-icon search-result-action-btn"></i>
Expand All @@ -33,6 +33,9 @@
{{#if variableMetadata.columnmeta_var_report_comment}}
<div>Variable Report Comment: {{variableMetadata.columnmeta_var_report_comment}}</div>
{{/if}}
{{#if variableMetadata.columnmeta_is_stigmatized}}
<div>This variable is stigmatizing.</div>
{{/if}}
</div>
{{#if variableMetadata.derived_group_id}}
<hr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ define(["jquery", "backbone", "handlebars", "underscore", "text!search-interface
this.isOpenAccess = JSON.parse(sessionStorage.getItem('isOpenAccess'));
this.modalTemplate = HBS.compile(modalTemplate);
this.varId = opts.varId;
const filterTitleText = "Click to configure a filter using this variable.";
const variableInfo = variableInfoCache[opts.varId];
const filterTitleText = this.isOpenAccess && variableInfo?.variableMetadata.columnmeta_is_stigmatized ? 'This variable is stigmatizing.' : "Click to configure a filter using this variable.";
const disabledClass = (this.isOpenAccess && variableInfo.variableMetadata.columnmeta_is_stigmatized) ? 'disabled-icon' : '';
const exportTitleText = "Click to add this variable to your data retrieval.";
const dataTreeTitleText = "Click to view the data tree for this variable.";
const variableInfo = variableInfoCache[opts.varId];
variableInfo.isAuthorized = !JSON.parse(sessionStorage.getItem('isOpenAccess'));
variableInfo.filterTitleText = filterTitleText;
variableInfo.exportTitleText = exportTitleText;
Expand All @@ -32,6 +33,7 @@ define(["jquery", "backbone", "handlebars", "underscore", "text!search-interface
&& variableInfo?.variableMetadata?.data_hierarchy !== ""
&& variableInfo?.variableMetadata?.data_hierarchy !== "{}";
variableInfo.dataTreeTitleText = dataTreeTitleText;
variableInfo.disabledClass = disabledClass;
this.dataTableData = opts.dataTableData;
tagFilterModel.get('requiredTags').bind('add', this.tagRequired.bind(this));
tagFilterModel.get('excludedTags').bind('add', this.tagExcluded.bind(this));
Expand Down Expand Up @@ -179,9 +181,7 @@ define(["jquery", "backbone", "handlebars", "underscore", "text!search-interface
let filterViewData = {
dtId: event.target.dataset.id,
filter: filter ? filter.toJSON() : undefined,
dtVariables: JSON.parse(sessionStorage.getItem('isOpenAccess')) ?
this.filterStigmatizedVariables(response.results.searchResults) :
response.results.searchResults,
dtVariables: response.results.searchResults,
dataTableInfo: dataTableInfo
};
this.filterModalView = new datatableFilterModalView({
Expand All @@ -199,9 +199,6 @@ define(["jquery", "backbone", "handlebars", "underscore", "text!search-interface
});
}
},
filterStigmatizedVariables: function (results) {
return results.filter(searchResult => searchResult.result.metadata.columnmeta_is_stigmatized !== true);
},
filterKeypressHandler: function (event) {
if (event.key.toLowerCase() === 'enter' || event.key.toLowerCase() === ' ') {
this.filterClickHandler(event);
Expand Down