Skip to content

Commit

Permalink
fixed the export data api to update the latest data fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nanli-emory committed Oct 3, 2023
1 parent 33000b6 commit b154c73
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions handlers/dataHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ SeerService.collectionDataExports = async function(req, res, next) {
const {collectionMap, slideMap} = await SeerService.getCollectionsData(Array.from(collectionIds), user);
// create user dir
fs.mkdirSync(`${tmpDir}/${user}`);
//

slideMap.forEach((data, slideId)=>{
const {slide, evaluation, marks} = data;
const locPath = slide.location.split('/'); // TODO
Expand All @@ -740,17 +740,17 @@ SeerService.collectionDataExports = async function(req, res, next) {
// create slide info
data.csvData = {
wsiFileName,
tokenId: slide.name, // TODO change later
tokenId: slide.token_id,
imageId: slide.name,
tumorSiteCodeAndLabel: '',
slideQualitySatisfactory: +evaluation.slide_quality,
tumorPresent: +evaluation.tumor_present,
tumorHistologyAccurate: +evaluation.tumor_histology,
informativenessYN: +evaluation.informativeness,
// TODO Relative Informativeness need to add
tumorPresent: evaluation.tumor_present==undefined?'':+evaluation.tumor_present,
tumorHistologyAccurate: evaluation.tumor_histology==undefined?'':+evaluation.tumor_histology,
informativenessYN: evaluation.informativeness==undefined?'':+evaluation.informativeness,
absoluteInformativeness: evaluation.absolute_informativeness?+evaluation.absolute_informativeness: 0,
tumorHistologyCorrected: evaluation.comments?evaluation.comments.trim(): '',
// Tumor ROI Filename TODO
level: evaluation.level? 1:0,

creator: evaluation.creator,
tumorROIFilename: `${slide.name}.json`,
annotatingPathologist: evaluation.creator,
Expand All @@ -776,6 +776,7 @@ SeerService.collectionDataExports = async function(req, res, next) {
{id: 'relativeInformativeness', title: 'Relative Informativeness'},
{id: 'absoluteInformativeness', title: 'Absolute Informativeness'},
{id: 'tumorHistologyCorrected', title: 'Tumor Histology Corrected'},
{id: 'level', title: 'Level'},
{id: 'tumorROIFilename', title: 'Tumor ROI Filename'},
{id: 'annotatingPathologist', title: 'Annotating Pathologist'},
{id: 'exportDate', title: 'Export Date'},
Expand All @@ -787,16 +788,15 @@ SeerService.collectionDataExports = async function(req, res, next) {

data.slides.forEach((sid)=>{
const slideData = slideMap.get(sid);
// set relative informative

// Relative Informativeness need to add
if (sid == first) {
slideData.csvData.relativeInformativeness = '1';
} else if (sid == second) {
slideData.csvData.relativeInformativeness = '2';
} else if (sid == third) {
slideData.csvData.relativeInformativeness = '3';
} else {
slideData.csvData.relativeInformativeness = 'L';
slideData.csvData.relativeInformativeness = '';
}
csvData.push(slideData.csvData);
});
Expand Down Expand Up @@ -910,9 +910,9 @@ SeerService.getCollectionsData = async function(cids, user) {
const eData = slideMap.get(eval.slide_id);

eval.evaluation.creator = eval.creator;
eval.evaluation.level = eval.level;
if (eData) eData.evaluation = eval.evaluation;
});

// get all human annotaions
const annotQuery = {
"provenance.analysis.source": "human",
Expand Down

0 comments on commit b154c73

Please sign in to comment.