Skip to content

Commit

Permalink
Revert "[ALS-6171] Show stigvars in open access but disable filtering (
Browse files Browse the repository at this point in the history
…#298)"

This reverts commit e8a6492.
  • Loading branch information
ramari16 committed May 3, 2024
1 parent 7ee3aad commit de49f5e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 26 deletions.
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 && checkbox.disabled === false){
if(checkbox!==undefined){
checkbox.checked = true;
}
});
Expand Down Expand Up @@ -182,7 +182,17 @@ define(['backbone', 'handlebars', 'underscore', 'text!search-interface/datatable
let data = this.dtData;
const isOpenAccess = JSON.parse(sessionStorage.getItem('isOpenAccess'));
if(!data){
data = this.model.dtVariables.map(function(variable) {

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) {
let values = variable.result.values.join(", ");
return [
existingFilter ?
Expand All @@ -196,8 +206,7 @@ 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_is_stigmatized,
variable.result.metadata.columnmeta_HPDS_PATH
];
});
this.dtData = data;
Expand Down Expand Up @@ -228,11 +237,7 @@ define(['backbone', 'handlebars', 'underscore', 'text!search-interface/datatable
},
{
render: function(data,type,row,meta){
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>';
}
return '<input data-sort-token=' + (data?0:1) + ' checked='+data+' type="checkbox" tabindex="-1" data-varid="'+row[1]+'"></input>';
},
type:'string',
targets: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<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,6 +371,11 @@ 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 @@ -404,7 +409,6 @@ 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 @@ -463,10 +467,9 @@ define(["backbone", "handlebars", "underscore", "text!search-interface/search-re
},
{
render: function (data, type, row, meta) {
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 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 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 @@ -477,7 +480,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="'+filterClasses+'"></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="fa fa-filter search-result-action-btn"></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 {{disabledClass}}"></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"></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,9 +33,6 @@
{{#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,11 +20,10 @@ 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 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 filterTitleText = "Click to configure a filter using this variable.";
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 @@ -33,7 +32,6 @@ 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 @@ -181,7 +179,9 @@ define(["jquery", "backbone", "handlebars", "underscore", "text!search-interface
let filterViewData = {
dtId: event.target.dataset.id,
filter: filter ? filter.toJSON() : undefined,
dtVariables: response.results.searchResults,
dtVariables: JSON.parse(sessionStorage.getItem('isOpenAccess')) ?
this.filterStigmatizedVariables(response.results.searchResults) :
response.results.searchResults,
dataTableInfo: dataTableInfo
};
this.filterModalView = new datatableFilterModalView({
Expand All @@ -199,6 +199,9 @@ 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

0 comments on commit de49f5e

Please sign in to comment.