Skip to content

Commit

Permalink
Saving tsv instead of csv
Browse files Browse the repository at this point in the history
  • Loading branch information
valearna committed Dec 15, 2023
1 parent 9a3adcf commit e3f4de6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/frontend/curator_dashboard/src/lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export const downloadCSVSpreadsheet = async (paperID) => {
}
}

export const downloadSentenceClassificationCSV = async (paperID, data, dataType) => {
export const downloadSentenceClassificationTSV = async (paperID, data, dataType) => {
let formContent = "SENTENCE\tCOUNTER\tHAS_ALL_INFO_FOR_CURATION\tIS_CURATABLE\tCONTAINS_LANGUAGE\n";
data.sentences.forEach((sentence, idx) => formContent += "\"" + sentence + "\"\t" + data.counters[idx] + "\t" + Boolean(data.classes[dataType]['all_info'][idx]) + "\t" + Boolean(data.classes[dataType]['curatable'][idx]) + "\t" + Boolean(data.classes[dataType]['language'][idx]) + "\t\n");
downloadFile(formContent, "Sentence_level_classification_" + dataType + "_" + paperID, "text/plain", "csv");
downloadFile(formContent, "Sentence_level_classification_" + dataType + "_" + paperID, "text/plain", "tsv");
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PaperNotLoaded from "./paper_viewer/PaperNotLoaded";
import axios from "axios";
import {useQuery} from "react-query";
import Form from "react-bootstrap/Form";
import {downloadSentenceClassificationCSV} from "../lib/file";
import {downloadSentenceClassificationTSV} from "../lib/file";


const SentenceClassification = () => {
Expand Down Expand Up @@ -59,8 +59,8 @@ const SentenceClassification = () => {
<br/>
<Button size="sm" onClick={() => {
setIsSpreadsheetLoading(true);
downloadSentenceClassificationCSV(paperID, queryRes.data.data, dataType).finally(() => setIsSpreadsheetLoading(false));
}} variant="outline-primary">Download as CSV {isSpreadsheetLoading ? <Spinner animation="border" size="sm"/> : null}</Button>
downloadSentenceClassificationTSV(paperID, queryRes.data.data, dataType).finally(() => setIsSpreadsheetLoading(false));
}} variant="outline-primary">Download as TSV {isSpreadsheetLoading ? <Spinner animation="border" size="sm"/> : null}</Button>
<br/>
<br/>
{queryRes.data.data.fulltext ?
Expand Down

0 comments on commit e3f4de6

Please sign in to comment.