app.csv
Parses CSV and TSV text into ClojureScript data structures.
Provides parse-csv for simple row-of-maps output and parse-metadata for richer output that includes column header configuration (labels, widths, detected types) suitable for UI rendering.
Type detection classifies columns as :date, :numeric, or :string based on sampling all non-empty values.
detect-column-type
(detect-column-type values)Classifies a sequence of string values as :date, :numeric, or :string.
Examines all non-empty values. If >=80% parse as dates, returns :date. Otherwise if >=80% parse as numbers, returns :numeric. Falls back to :string.
Returns :string for empty input.
metadata->csv
(metadata->csv active-cols rows)Serializes metadata rows into a CSV string.
Uses the order of active-cols to emit a header row (via :label) and row values (via :key).
parse-csv
(parse-csv content)Parses a CSV/TSV string into a sequence of maps.
Automatically detects the delimiter (tab or comma) by inspecting the first line. Handles RFC4180-style quoted values. Header strings are converted to keywords for map keys.
Returns a sequence of maps, one per data row, keyed by the keyword-ified header names. Blank lines are skipped.
parse-metadata
(parse-metadata content)(parse-metadata content default-col-width)Parses a CSV/TSV string into a map with column metadata and data rows.
Like parse-csv, but returns a richer structure suitable for rendering metadata columns alongside a phylogenetic tree. The delimiter is auto-detected from the first line.
default-col-width is the pixel width assigned to each column (defaults to 120 if not provided).
Each column header is classified by type (:date, :numeric, or :string) via detect-column-type, based on sampling all values in that column.
Returns a map with keys: - :headers - vector of column config maps, each with: - :key - keyword derived from the header string - :label - original header string for display - :width - column width in pixels - :type - detected data type (:date, :numeric, or :string) - :data - sequence of row maps keyed by header keywords