Skip to content

--format csv emits unquoted comma-joined analog_values — variable field count breaks the 3-column CSV #38

Description

@tylerkron

Summary

Live-stream CSV output (--format csv) writes a fixed 3-column header but emits a variable number of unquoted comma-separated fields, because the analog values are comma-joined directly into the row. Any standard CSV reader mis-parses every multi-channel row.

ToCsvLine (Program.cs ~1641):

var analog = string.Join(",", analogValues);
...
return $"{timestamp},{analog},{digital}";

Actual output with --channels 3 (2 channels):

timestamp,analog_values,digital_hex
3148625540,2,00-04          <- 3 fields (first message had 1 analog value)
3149045542,5,8,00-04        <- 4 fields, "5,8" silently splits across columns

csv.DictReader/Excel/pandas all shift the digital column for multi-channel rows, and the column count varies row to row.

Suggested fix

Either quote the joined list ("5,8"), or better, emit one column per channel (timestamp,ch0,ch1,digital_hex) with the count fixed by the enabled-channel mask rather than inferred from the first message (related: #34, which is the same inference problem in the offline SD export path — note the first live message also carries only 1 analog value, so first-sample inference under-counts here too).

Found while stress-testing against a live Nq1 with Daqifi.Core @ 262061f.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions