feat(sdcard): add SdCardLogEntry.HasDeviceTimestamp - #321
Conversation
Each SD card parser (protobuf, JSON, CSV) now reports per-entry whether its Timestamp came from a real device tick or was substituted with the session base time, so consumers no longer need to reverse-engineer the distinction statistically (e.g. daqifi-desktop's ImportTimestampQuality heuristic). Closes #303 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR Summary by QodoAdd per-entry HasDeviceTimestamp flag to SD card parsers
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Code Review by Qodo
Context used 1.
|
Declare HasDeviceTimestamp as an init property in the record body instead of a primary-constructor parameter, so the generated constructor and Deconstruct signatures stay unchanged for consumers compiled against the previous 4-parameter shape. Also drops the inaccurate "missing CSV timestamp column" example from the XML docs — the CSV parser skips such rows outright rather than emitting them with a substituted timestamp. Addresses Qodo review feedback on PR #321. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
SdCardLogEntry.HasDeviceTimestamp(defaulttrue), reporting per-entry whetherTimestampwas reconstructed from a real device tick or substituted with the session base timeSdCardFileParser(protobuf):falsewhenMsgTimeStamp == 0or the tick rate is unknownSdCardJsonFileParser:falsewhen the tick rate is unknownSdCardCsvFileParser:falsewhen the tick rate is unknownWhy
Core already knows, exactly and per-entry, whether a timestamp was real or substituted, but previously threw that away — only the resulting (possibly-substituted) tick was exposed. daqifi-desktop needs this distinction to warn users about a flat time axis on import, so it reverse-engineers it statistically in
ImportTimestampQuality.csby counting how many ticks equal the first tick past a 20% threshold. That heuristic misclassifies any legitimately high-rate file whose first ≥20% of samples happen to share a tick. Exposing the real per-entry flag lets desktop drop the heuristic (and the ~60 lines ofObserve/CollapsedFraction/HasFlatTimeAxisstate it requires) in favor of an exact answer.Closes #303
Test plan
SdCardFileParserTests,SdCardJsonFileParserTests,SdCardCsvFileParserTestscoveringHasDeviceTimestamptrue/false cases (zero message timestamp, unknown tick rate) for all three parsersdotnet testsuite: 1475/1475 passing (net9.0 and net10.0)daqifi-core-example-appCLI against this branch (DaqifiCoreProjectPath), downloaded a real SD card log from a Nyquist device on COM3, and confirmed parsed entries reportHasDeviceTimestamp=truewith correctly reconstructed, monotonically increasing timestamps🤖 Generated with Claude Code