Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | export default function createAndDownloadTMTVReport(segReport, additionalReportRows, options = {}) { const firstReport = segReport[Object.keys(segReport)[0]]; const columns = Object.keys(firstReport); const csv = [columns.join(',')]; Object.values(segReport).forEach(segmentation => { const row = []; columns.forEach(column => { // if it is array then we need to replace , with space to avoid csv parsing error row.push( Array.isArray(segmentation[column]) ? segmentation[column].join(' ') : segmentation[column] ); }); csv.push(row.join(',')); }); csv.push(''); csv.push(''); csv.push(''); csv.push(`Patient ID,${firstReport.PatientID}`); csv.push(`Study Date,${firstReport.StudyDate}`); csv.push(''); additionalReportRows.forEach(({ key, value: values }) => { const temp = []; temp.push(`${key}`); Object.keys(values).forEach(k => { temp.push(`${k}`); temp.push(`${values[k]}`); }); csv.push(temp.join(',')); }); const blob = new Blob([csv.join('\n')], { type: 'text/csv;charset=utf-8', }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = options.filename ?? `${firstReport.PatientID}_tmtv.csv`; a.click(); } |