Commit 33ff8aad authored by Andrey Kiselev's avatar Andrey Kiselev
Browse files

Add source code

parent dbb6b566
/**
* This piece of code is licensed under MIT license.
*/
let xlsx = require('node-xlsx'); // read excel files
let fs = require('fs'); // search for all tracks files in dir
let accents = require('remove-accents'); // remove accents
// read all track files
let tracks = fs.readdirSync(__dirname + '/data/accepted/');
// read all authors
let authors = xlsx.parse(__dirname + '/data/registered authors.xlsx');
let abandoned = [];
// for all tracks
tracks.map( track => {
// push the name of the track file
abandoned.push([]);
abandoned.push([track]);
// get all lines in paper file
let papers = xlsx.parse(__dirname + '/data/accepted/' + track);
let filtered = papers[0].data.filter( paper => {
// check if has a valid (numeric) id and author list is not empty
if (!isNaN(paper[0]) && paper[3]) {
for(let i = 0, length = authors[0].data.length; i < length; i++) {
let author = authors[0].data[i];
// if there is any author, exclude from filter
if (accents.remove(paper[3]).includes(accents.remove(author[0] + ' ' + author[1]))) return false;
if (accents.remove(paper[3]).includes(accents.remove(author[1] + ' ' + author[0]))) return false;
}
return true;
}
});
abandoned = abandoned.concat(filtered);
});
// write xlsx file to disk
fs.writeFileSync(__dirname + '/data/abandoned_papers.xlsx', xlsx.build([{name: "AbandonedPapers", data: abandoned}]))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment