Skip to content

Commit

Permalink
[ALS-5208] Remove Open Access from Authorized BDC (#257)
Browse files Browse the repository at this point in the history
* [ALS-5208] Remove Open Access from Authorized BDC
* [ALS-5208] Remove top panel from Data Access Dashboard
  • Loading branch information
Gcolon021 authored Dec 4, 2023
1 parent 9689d66 commit 2a8308e
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
<a class="header-btn authorized-access-visible header-navigation" data-href="/picsureui/queryBuilder" href="#" id="query-builder-btn" tabindex="-1" title="Authorized Access" aria-label="Authorized Access">Authorized Access</a>
{{/contains}}
{{#contains privileges 'FENCE_PRIV_OPEN_ACCESS'}}
<a class="header-btn header-navigation" data-href="/picsureui/openAccess#" href="#" id="open-access-btn" tabindex="-1" title="Open Access" aria-label="Open Access">Open Access</a>
<a id="api-btn" data-href="/picsureui/api" class="header-navigation header-btn authenticated-visible" href="#" tabindex="-1" title="API" aria-haspopup="true" aria-label="API">API</a>
<button data-intro="#help-header-button" data-sequence="14" class="dropdown-toggle nav-dropdown header-btn authenticated-visible" aria-expanded="false" id="help-dropdown-toggle" tabindex="-1" title="Help" aria-label="Help dropwdown" aria-controls="help-menu-list">
Help <i class="fa fa-caret-down" aria-hidden="true"></i>
Expand Down
53 changes: 0 additions & 53 deletions biodatacatalyst-ui/src/main/webapp/picsureui/overrides/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,6 @@ define(["backbone", "handlebars", "studyAccess/studyAccess", "picSure/settings",
});
};

let displayOpenAccess = function() {
sessionStorage.setItem("isOpenAccess", true);
Backbone.pubSub.trigger('destroySearchView');
$(".header-btn.active").removeClass('active');
$(".header-btn[data-href='/picsureui/openAccess#']").addClass('active');
$('#main-content').empty();
$('#main-content').append(this.layoutTemplate(settings));
const toolSuiteView = new ToolSuiteView({
el: $('#tool-suite-panel'),
isOpenAccess: true
});

const outputPanelView = new outputPanel.View({toolSuiteView: toolSuiteView});
const query = queryBuilder.generateQueryNew({}, {}, null, settings.openAccessResourceId);
outputPanelView.render();
$('#query-results').append(outputPanelView.$el);

const parsedSess = JSON.parse(sessionStorage.getItem("session"));

const searchView = new SearchView({
queryTemplate: JSON.parse(parsedSess.queryTemplate),
queryScopes: parsedSess.queryScopes,
el : $('#filter-list')
});

if($('#search-results-panel').is(":visible")) {
$('#guide-me-button-container').hide();
}

const filterListView = new FilterListView({
outputPanelView : outputPanelView,
el : $('#filter-list-panel')
});
filterListView.render();
toolSuiteView.render();
};

let displayAPI = function() {
$(".header-btn.active").removeClass('active');
$(".header-btn[data-href='/picsureui/api']").addClass('active');
Expand All @@ -91,22 +54,6 @@ define(["backbone", "handlebars", "studyAccess/studyAccess", "picSure/settings",
* "picsureui/queryBuilder2" : function() { renderQueryBuilder2(); }
*/
"picsureui/dataAccess" : displayDataAccess,
"picsureui/openAccess" : function() {
let genomicFilters = getGenomicFilters();
if (genomicFilters.length>0) {
if (confirm(genomicFilterWarningText)) {
filterModel.get('activeFilters').remove(genomicFilters, {silent: true});
displayOpenAccess.call(this);
} else {
// go back to the previous page. Since we do not currently track the previous page with
// backbone js we have to use the browser history to go back two pages. Since a user
// must've visited our page and selected filters this should be safe.
window.history.go(-2);
}
} else {
displayOpenAccess.call(this);
}
},
"picsureui/queryBuilder(/)" : function() {
sessionStorage.setItem("isOpenAccess", false);
let antiScopes = getInvalidActiveFilters();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
define(["jquery", "backbone", "handlebars", "text!studyAccess/studies-data.json"],
function ($, bb, hbs, studyAccessConfiguration) {
function getStudyAccessConfiguration() {
return JSON.parse(studyAccessConfiguration);
}

function groupRecordsByAccess() {
// extract the consent identifiers from the query template
let session = JSON.parse(sessionStorage.getItem("session"));
let validConsents = [];
if (session.queryTemplate) {
let temp = JSON.parse(session.queryTemplate);

if (temp && temp.categoryFilters && temp.categoryFilters["\\_consents\\"]) {
validConsents = temp.categoryFilters["\\_consents\\"];
}
}

// process the study data into permission granted or not groups
let records = {
permitted: [],
denied: [],
na: []
};
let configurationData = JSON.parse(studyAccessConfiguration);
for (let groupid in configurationData) {
for (idx = 0; idx < configurationData[groupid].length; idx++) {
// determine if logged in user is permmited access
let tmpStudy = configurationData[groupid][idx];
const cvc = parseInt(tmpStudy["clinical_variable_count"]).toLocaleString();
tmpStudy["clinical_variable_count"] = cvc == '-1' || cvc == 'NaN' ? 'N/A' : cvc;
const css = parseInt(tmpStudy["clinical_sample_size"]).toLocaleString();
tmpStudy["clinical_sample_size"] = css == '-1' || cvc == 'NaN' ? 'N/A' : css;
const gsc = parseInt(tmpStudy["genetic_sample_size"]).toLocaleString();
tmpStudy["genetic_sample_size"] = gsc == '-1' || gsc == 'NaN' ? 'N/A' : gsc;

let studyConsent = tmpStudy["study_identifier"] + (tmpStudy["consent_group_code"] && tmpStudy["consent_group_code"] != "" ? "." + tmpStudy["consent_group_code"] : "");
tmpStudy['accession'] = tmpStudy["consent_group_code"] ?
tmpStudy["study_identifier"] + "." + tmpStudy["study_version"] + "." + tmpStudy["study_phase"] + "." + tmpStudy["consent_group_code"] :
""; // Show empty string if no consent group code (open dataset)
if (validConsents.includes(studyConsent)) {
tmpStudy['isGranted'] = true;
records.permitted.push(tmpStudy);
} else {
if (!tmpStudy['authZ']) {
tmpStudy['isSuspended'] = true;
}
if (tmpStudy["consent_group_code"] == "c0") {
tmpStudy['isGranted'] = false;
records.na.push(tmpStudy);
} else {
records.denied.push(tmpStudy);
}
}
}
}

// sort by "consent group" then "abbreviated name"
var funcSort = function (a, b) {
if (a["abbreviated_name"] == b["abbreviated_name"]) {
return (a["study_identifier"].localeCompare(b["study_identifier"]));
} else {
return (a["abbreviated_name"].localeCompare(b["abbreviated_name"]));
}
};
records.permitted.sort(funcSort);
records.denied.sort(funcSort);
records.na.sort(funcSort);

return records;
}

return {
getStudyAccessConfiguration: getStudyAccessConfiguration,
groupRecordsByAccess: groupRecordsByAccess
};
});
Original file line number Diff line number Diff line change
@@ -1,97 +1,16 @@
<div class="center-panel">
<div class="panel panel-outline explor-panel">
<div class="panel-heading no-border center-panel">
<div class="side-border heading-space">
<div>
<h4 class="access-title">Authorized Access</h4>
<button type="button" data-href="/picsureui/queryBuilder" aria-label="Explore Authorized Access"
{{#if authorizedAccess}}class="btn btn-primary btn-blue clickable-button"{{/if}}
{{#unless authorizedAccess}}class="btn btn-primary btn-grey"{{/unless}}
{{#unless authorizedAccess}}disabled="disabled"{{/unless}}>
Explore Now
</button>
</div>
<div class="participants-container">
<h4 class="">{{auth_studies_cnt}} Studies</h4>
<h5 class="" id="authorized-participants"></h5>
<div id="authorized-participants-spinner"></div>
</div>
</div>
<div class="heading-space">
<div>
<h4 class="access-title">Open Access</h4>
<button type="button" class="btn btn-primary btn-blue clickable-button" data-href="/picsureui/openAccess" aria-label="Explore Open Access">Explore Now</button>
</div>
<div class="participants-container">
<h4 id="open-studies-count" class=""></h4>
<h5 id="open-participants" class=""></h5>
<div id="open-participants-spinner"></div>
</div>
</div>
</div>
<div class="panel-body" style="display: flex;">
<div class="body-space side-border">
<ul class="plain-list">
<li style="display: flex; flex-direction:row">
<i class="fa-regular fa-address-card" aria-hidden="true"></i>
<i class="fa-solid fa-dna" aria-hidden="true"></i>
<span>Authorized Phenotypic and Genomic Datasets</span>
</li>
<li>
<i class="fa fa-users" aria-hidden="true"></i>
<span>Aggregate Counts</span>
</li>
<li>
<i class="fa-regular fa-user" aria-hidden="true"></i>
<span>Participant-level Data</span>
</li>
<li>
<i class="fa fa-pie-chart" aria-hidden="true"></i>
<span>Visualizations</span>
</li>
<li>
<i class="fa-solid fa-laptop-code" aria-hidden="true"></i>
<span>R and Python API Access</span>
</li>
</ul>
</div>
<div class="body-space">
<ul class="plain-list">
<li>
<i class="fa-regular fa-circle-check" aria-hidden="true"></i>
<span>No Authorization Required</span>
</li>
<li>
<i class="fa-regular fa-address-card" aria-hidden="true"></i>
<span>All Phenotypic Datasets Available in PIC-SURE</span>
</li>
<li>
<i class="fa fa-users" aria-hidden="true"></i>
<span>Aggregate Counts Only</span>
</li>
<li>
<i class="fa-solid fa-laptop-code" aria-hidden="true"></i>
<span>R and Python API Access</span>
</li>
</ul>
</div>
</div>
</div>
</div>



<div id="studies-access">
<div class="space-out">
<div>
<h2 class="studies-title">Data Access Table</h2>
<h4 class="studies-sub-title">View all studies and associated information available in PIC-SURE separated by consent group. Check personalized authorization for available studies in the "Access" column.</h4>
<h4 class="studies-sub-title">View all studies and associated information available in PIC-SURE separated by
consent group. Check personalized authorization for available studies in the "Access" column.</h4>
</div>
<div class="freeze-message">
<div>{{freeze_msg}}</div>
</div>
</div>
<div class="flex-col table-responsive" style="overflow-x: visible !important;">
<table id="data-access-table" style="width:100%" class="table table-striped row-border hover" role="region" aria-label="A table showing infomation about studies included in Pic-sure. Use the first column to request access to studies."></table>
<table id="data-access-table" style="width:100%" class="table table-striped row-border hover" role="region"
aria-label="A table showing infomation about studies included in Pic-sure. Use the first column to request access to studies."></table>
</div>
</div>
Loading

0 comments on commit 2a8308e

Please sign in to comment.