Merge branch 'main' into prototyp-2-fabio

This commit is contained in:
smaubio
2026-03-13 14:58:02 +01:00
18 changed files with 819 additions and 177 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())`),