Skip to content

Commit

Permalink
Updated data button working + fixed viewing stats
Browse files Browse the repository at this point in the history
  • Loading branch information
bkop-ds committed Jun 18, 2024
1 parent 0f80cfb commit d727f88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
17 changes: 10 additions & 7 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
reSizePlots,
showComments,
summaryStatsFolder,
summaryStatsFolderId
} from "./shared.js";
import { renderDataSummary } from "./pages/about.js";
import { variables } from "./variables.js";
Expand Down Expand Up @@ -1284,7 +1285,7 @@ export const addEventUpdateSummaryStatsData = () => {
template += '</br><div id="summaryDataFolderList"></div>';

template +=
'<div class="modal-footer"><button type="submit" class="btn btn-outline-primary" disabled>Update data</button></div>';
'<div class="modal-footer"><button type="submit" class="btn btn-outline-primary">Update data</button></div>';
template += "</form>";
body.innerHTML = template;
addEventDataTypeRadio();
Expand Down Expand Up @@ -1323,26 +1324,28 @@ const addEventDataTypeRadio = () => {
document.getElementsByName("summarydataType")
).filter((ele) => ele.checked === true)[0].value;
let template = "";
const response = await getFolderItems(162298847509);
const response = await getFolderItems(summaryStatsFolderId);
console.log(response);
let summaryFolder = [];
if (dataType === "summary") {
if (dataType === "missingness") {
summaryFolder = response.entries.filter(
(dt) =>
dt.type === "folder" &&
/summary results/i.test(dt.name) === true
/Subset Stats generate by NCI/i.test(dt.name) === true
);
} else {
summaryFolder = response.entries.filter(
(dt) =>
dt.type === "folder" &&
/_missingness_statistics/i.test(dt.name) === true
/Results/i.test(dt.name) === true
);
}
template += `Select data folder(s)`;
template += `<ul>`;
summaryFolder.forEach((folder) => {

template += `<li class="filter-list-item">
<button type="button" class="filter-btn collapsible-items update-summary-stats-btn filter-midset-data-btn" data-folder-id="${folder.id}">
<button type="button" class="filter-btn collapsible-items update-summary-stats-btn filter-midset-data-btn active-filter" data-folder-id="${folder.id}">
<div class="variable-name">${folder.name}</div>
</button>
</li>`;
Expand All @@ -1356,7 +1359,7 @@ const addEventDataTypeRadio = () => {
};

const addEventAccessStatsRadio = async () => {
const response = await getFolderItems(171750396639);
const response = await getFolderItems(summaryStatsFolderId); //171750396639
let summaryFolder = response.entries;
console.log(summaryFolder);
let template = "";
Expand Down
4 changes: 4 additions & 0 deletions src/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ export const summaryStatsFileId = 956943662666; //861342561526;//908600664259; /

export const summaryStatsCasesFileId = 862065772362; //862065772362; //958869203942; //927803436743; //862065772362; //cases => Pilot - BCRP_Summary_Results_Cases.csv

export const summaryStatsFolderId = 162298847509;

export const missingnessStatsFileId = 1277209005113;//1276945367872;//1043323929905; //653087731560; //Unknown, TUA Commented out July 21, file needs to be updated to missingness stats using BCRPP data, not confluence data
// export const missingnessStatsFileId = 653087731560;
export const missingnessStatsCasesFileId = 1276917853820;

export const missingnessStatsFolderId = 230196820645;

export const cps2StatsFileId = 908522264695;

export const summaryStatsFolder = 145995372820;
Expand Down
8 changes: 3 additions & 5 deletions src/visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ const chartLabels = {

export const getFileContent = async () => {
showAnimation();
document.getElementById(
"dataLastModified"
).innerHTML = `Data current as of - ${new Date(
lastModified
).toLocaleString()}`;
const { jsonData, headers } = csvJSON(await getFile(summaryStatsFileId));
const lastModified = (await getFileInfo(summaryStatsFileId)).modified_at;
document.getElementById("dataLastModified").innerHTML = `Data current as of - ${new Date(lastModified).toLocaleString()}`;
if (jsonData.length === 0) {
document.getElementById(
"confluenceDiv"
Expand Down

0 comments on commit d727f88

Please sign in to comment.