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

Dennis b #2

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 16 additions & 10 deletions api/dataProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ const _ = require('lodash');
// // COHORT
// //
// ////////////////////////////////////////////////////////////////////////////////////////
// Location, Laterality, [Quadrant, Clockface], Histologic Type, Behavior, Stage, Grade, Extent, T, N, M, Tumor Type, [ER, PR, HER2]

const factDisplayOrder = ["Location", "Laterality", "Quadrant", "Clockface", "Histologic Type", "Behavior",
"Stage", "Grade", "Extent", "T", "N", "M", "Tumor Type", "ER", "PR", "HER2"]



const getCohortData = (neo4jRawArr) => {
neo4jRawArr = JSON.parse(neo4jRawArr)
Expand Down Expand Up @@ -411,10 +417,12 @@ const getCancerAndTumorSummary = (neo4jRawArr) => {
}
}
allCollatedCancerFacts = allCollatedCancerFacts.sort(function (a, b) {
const nameA = a.category;
const nameB = b.category;
if (nameA > nameB) return 1;
if (nameA < nameB) return -1;
// const nameA = a.category;
// const nameB = b.category;
const indexA = factDisplayOrder.indexOf(a.categoryName);
const indexB = factDisplayOrder.indexOf(b.categoryName);
if (indexA > indexB) return 1;
if (indexA < indexB) return -1;
return 0;
});

Expand Down Expand Up @@ -577,14 +585,12 @@ const getTumorSummary = (tumorsArr) => {
targetTumor.data.sort((a, b) => {
let sa = a.category;
let sb = b.category;
const indexA = factDisplayOrder.indexOf(sa);
const indexB = factDisplayOrder.indexOf(sb);

if (sa < sb) {
return -1;
}
if (indexA < indexB) return -1;
if (indexA > indexB) return 1;

if (sa > sb) {
return 1;
}
return 0;
});
});
Expand Down
Loading