Skip to content

Nitpick: csv files are not valid csv #1

@flowstatedev

Description

@flowstatedev

First off, thank you very much for doing this! This is a great resource for CIQ devs (all 5 of us).

My nitpicky issue is that the device info csv files are not csv files:

  • most applications (e.g. Excel, Numbers) will assume comma as a default delimiter (CSV literally stands for "comma-separated values", although I realize other separators are used. It is unusual, but not unheard of, to see multiple separators in the same file though.
  • With the previous point in mind, some reader implementations (such as github) will not like the fact that each record/row does not have the same number of fields/columns
  • some applications (such as Numbers) will assume the first line is a header row

e.g. https://github.com/flocsy/garmin-dev-tools/blob/main/csv/device2all-versions.csv

image

approachs60:2.4.1
approachs62:3.0.12
approachs7042mm:4.2.1,4.2.3,4.2.4,5.0.0
approachs7047mm:4.2.1,4.2.3,4.2.4,5.0.0
...

If this file is opened in Numbers, a table which looks like the following is created (where the first row is incorrectly rendered as a header):

approach60:2.4.1
approachs62:3.0.12
approachs7042mm:4.2.1 4.2.3 4.2.4 5.0.0
approachs7047mm:4.2.1 4.2.3 4.2.4 5.0.0
...

I realize this scheme is partly a consequence of the fact that each record has a variable number of fields. With this in mind, I would invert the current scheme: use a comma to separate the record key (in this case, device id) from the other fields, and use a non-standard separator (such as | or :) to separate the variable-arity fields (in this case, the version numbers.) Or you could stick with a commas, but escape them using quotes.

e.g.

Device ID,Versions
approachs60,"2.4.1"
approachs62,"3.0.12"
approachs7042mm,"4.2.1, 4.2.3, 4.2.4, 5.0.0"
approachs7047mm,"4.2.1, 4.2.3, 4.2.4, 5.0.0"
...

This should result in a nice table which looks like:

Device ID Versions
approach60 2.4.1
approachs62 3.0.12
approachs7042mm 4.2.1, 4.2.3, 4.2.4, 5.0.0
approachs7047mm 4.2.1, 4.2.3, 4.2.4, 5.0.0
...

If you're on board with this, I'd be happy to a push a PR to implement whichever approach you think is best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions