Skip to content

Commit

Permalink
[DUOS-2142][risk=no] Remove old statistics page (#2376)
Browse files Browse the repository at this point in the history
  • Loading branch information
rushtong authored Nov 1, 2023
1 parent f8b1abf commit 4c93a1e
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 469 deletions.
2 changes: 0 additions & 2 deletions src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import SigningOfficialDataSubmitters from './pages/signing_official_console/Sign
import Translator from './pages/Translator';
import NIHPilotInfo from './pages/NIHPilotInfo';
import {Status} from './pages/Status';
import {SummaryVotes} from './pages/SummaryVotes';
import BackgroundSignIn from './pages/BackgroundSignIn';
import ConsentTextGenerator from './pages/ConsentTextGenerator';
import AdminManageInstitutions from './pages/AdminManageInstitutions';
Expand Down Expand Up @@ -73,7 +72,6 @@ const Routes = (props) => (
<AuthenticatedRoute path="/admin_edit_user/:userId" component={AdminEditUser} props={props} rolesAllowed={[USER_ROLES.admin]} />
<AuthenticatedRoute path="/manage_dac" component={ManageDac} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.chairperson]} />
<AuthenticatedRoute path="/admin_manage_institutions" component={AdminManageInstitutions} props={props} rolesAllowed={[USER_ROLES.admin]} />
<AuthenticatedRoute path="/summary_votes" component={SummaryVotes} props={props} rolesAllowed={[USER_ROLES.all]} />
<AuthenticatedRoute path="/researcher_console" component={ResearcherConsole} props={props} rolesAllowed={[USER_ROLES.researcher]}/>
<AuthenticatedRoute path="/dar_collection/:collectionId" component={DarCollectionReview} props={props} rolesAllowed={[USER_ROLES.researcher, USER_ROLES.chairperson, USER_ROLES.member, USER_ROLES.signingOfficial]}/>
<AuthenticatedRoute path="/chair_console" component={ChairConsole} props={props} rolesAllowed={[USER_ROLES.chairperson]}/>
Expand Down
1 change: 0 additions & 1 deletion src/components/DuosHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const headerTabsConfig = [
{ label: 'DAR Requests', link: '/admin_manage_dar_collections' },
{ label: 'Dataset Catalog', link: '/dataset_catalog' },
{ label: 'DACs', link: '/manage_dac' },
{ label: 'Statistics', link: '/summary_votes' },
{ label: 'Users', link: '/admin_manage_users' },
{ label: 'Institutions', link: '/admin_manage_institutions' },
{ label: 'Library Cards', link: '/admin_manage_lc' }
Expand Down
131 changes: 0 additions & 131 deletions src/components/StatsBox.js

This file was deleted.

Binary file removed src/images/icon_access.png
Binary file not shown.
Binary file removed src/images/icon_access_invalid.png
Binary file not shown.
Binary file removed src/images/icon_dul.png
Binary file not shown.
Binary file removed src/images/icon_dul_invalid.png
Binary file not shown.
Binary file removed src/images/icon_statistics.png
Binary file not shown.
79 changes: 0 additions & 79 deletions src/libs/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,18 +436,6 @@ export const Email = {
}
};

export const Summary = {
getFile: async (fileName) => {
const URI = `/api/consent/cases/summary/file?type=${fileName}`;
const url = `${await getApiUrl()}/${URI}`;
if (fileName === 'TranslateDUL') {
return await getFile(url, 'DUL_summary.tsv');
} else {
return await getFile(url, 'DAR_summary.tsv');
}
}
};

export const Metrics = {

getDatasetStats: async (datasetId) => {
Expand Down Expand Up @@ -505,73 +493,6 @@ export const Match = {
}
};

export const PendingCases = {

findSummary: async () => {
const consentUrl = `${await getApiUrl()}/api/consent/cases/summary`;
const dataAccessUrl = `${await getApiUrl()}/api/dataRequest/cases/summary/DataAccess`;
const rpUrl = `${await getApiUrl()}/api/dataRequest/cases/summary/RP`;
const matchUrl = `${await getApiUrl()}/api/dataRequest/cases/matchsummary`;
const accessResponse = await fetchOk(consentUrl, Config.authOpts());
const access = await accessResponse.json();
let data = dataTemplate;
data.dulTotal[1][1] = access.reviewedPositiveCases + access.reviewedNegativeCases;
// pending cases
data.dulTotal[2][1] = access.pendingCases;
// positive cases
data.dulReviewed[1][1] = access.reviewedPositiveCases;
// negative cases
data.dulReviewed[2][1] = access.reviewedNegativeCases;

const dulResponse = await fetchOk(dataAccessUrl, Config.authOpts());
const dul = await dulResponse.json();
// reviewed cases
data.accessTotal[1][1] = dul.reviewedPositiveCases + dul.reviewedNegativeCases;
// pending cases
data.accessTotal[2][1] = dul.pendingCases;
// positive cases
data.accessReviewed[1][1] = dul.reviewedPositiveCases;
// negative cases
data.accessReviewed[2][1] = dul.reviewedNegativeCases;

const rpResponse = await fetchOk(rpUrl, Config.authOpts());
const rp = await rpResponse.json();

// reviewed cases
data.RPTotal[1][1] = rp.reviewedPositiveCases + rp.reviewedNegativeCases;
// pending cases
data.RPTotal[2][1] = rp.pendingCases;
// positive cases
data.RPReviewed[1][1] = rp.reviewedPositiveCases;
// negative cases
data.RPReviewed[2][1] = rp.reviewedNegativeCases;
const matchResponse = await fetchOk(matchUrl, Config.authOpts());
const match = await matchResponse.json();
if (match[0]) {
// positive cases
data.VaultReviewed[1][1] = match[0].reviewedPositiveCases;
// negative cases
data.VaultReviewed[2][1] = match[0].reviewedNegativeCases;
}
if (match[1]) {
// positive cases
data.Agreement[1][1] = match[1].reviewedPositiveCases;
// negative cases
data.Agreement[2][1] = match[1].reviewedNegativeCases;
}
return data;
}

};

export const StatFiles = {

getDARsReport: async (reportType, fileName) => {
const url = `${await getApiUrl()}/api/dataRequest/${reportType}`;
return getFile(url, fileName);
}
};

export const User = {

getMe: async () => {
Expand Down
6 changes: 2 additions & 4 deletions src/libs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ export const Navigation = {
let page =
queryParams.get('redirectTo') ? queryParams.get('redirectTo')
: firstConsole ? firstConsole.link
: user.isAlumni ? '/summary_votes'
: '/';
: '/';
history.push(page);
},
console: async (user, history) => {
Expand All @@ -207,8 +206,7 @@ export const Navigation = {
let page =
queryParams.get('redirectTo') ? queryParams.get('redirectTo')
: firstConsole ? firstConsole.link
: user.isAlumni ? '/summary_votes'
: '/';
: '/';
history.push(page);
}
};
Expand Down
Loading

0 comments on commit 4c93a1e

Please sign in to comment.