feat: add new fields to dataset_entry and update related components for processing and display

This commit is contained in:
averel10
2026-03-13 14:01:25 +01:00
parent 2b6d23c406
commit 4c9b4734e7
9 changed files with 667 additions and 35 deletions

34
src/lib/csv-parser.ts Normal file
View File

@@ -0,0 +1,34 @@
/**
* CSV parser that handles quoted fields
*/
export function parseCSVLine(line: string): string[] {
const values: string[] = [];
let current = '';
let inQuotes = false;
for (let i = 0; i < line.length; i++) {
const char = line[i];
const nextChar = line[i + 1];
if (char === '"') {
if (inQuotes && nextChar === '"') {
// Escaped quote
current += '"';
i++;
} else {
// Toggle quote state
inQuotes = !inQuotes;
}
} else if (char === ',' && !inQuotes) {
// Field separator
values.push(current.trim());
current = '';
} else {
current += char;
}
}
// Add the last field
values.push(current.trim());
return values;
}

View File

@@ -16,6 +16,10 @@ export const dataset_entry = sqliteTable('dataset_entry', {
dialect: text('dialect').notNull(),
iteration: integer('iteration').notNull(),
durationMs: integer('duration_ms'),
rmsValue: real('rms_value'),
longestPause: real('longest_pause'),
utmosScore: real('utmos_score'),
werScore: real('wer_score'),
createdAt: integer('created_at', { mode: 'timestamp' })
.notNull()
.default(sql`(unixepoch())`),