feat: support generic CSV/JSON tabular data with auto-detection#123
Merged
Conversation
Add generic CSV and JSON parsers plus content-based parser auto-detection (pkg/parser/detect.go), so vizb charts any tabular data, not just benchmark output. CSV/JSON parsers pick numeric columns as series; the new -g/--group flag merges non-numeric columns into the group name (parsed by -p/-r). Rename the core data types to match their now-generic role: Benchmark -> Dataset, BenchmarkData -> DataPoint, and the data-carrying helpers (convertToDataset, prepareData, prepareDatasetFromResults, MergeDatasets, deepCloneDataset). JSON wire format is unchanged (struct tags kept), so existing vizb JSON files and the UI keep working.
Add generic cmd, file, and group inputs to the composite action so it visualizes any command output or input file, not just benchmarks. Keep bench-cmd/bench-file as deprecated aliases (used only when the new inputs are empty), so the change is non-breaking.
Reframe README, docs, and CLI help so vizb reads as a visualizer for benchmark output or any tabular CSV/JSON data. Soften benchmark-only vocabulary on shared surfaces (data/series/labels/rows) while keeping benchmark wording where it is genuinely benchmark-specific. Add new Tabular Data and Auto-Detection guide pages and register them in the Starlight sidebar.
Add example sales.csv and sales.json fixtures plus CI workflows that build and publish their visualizations.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repositions vizb from a benchmark-only tool to a benchmark + tabular-data visualizer. It now charts any tabular CSV/JSON table in addition to Go/Rust/JS benchmark output.
What changed
pkg/parser/detect.go). Numeric columns become series; the new-g/--groupflag merges non-numeric columns into the group name (parsed by-p/-r).Benchmark → Dataset,BenchmarkData → DataPointand their data-carrying helpers, to match the now-generic role. JSON wire format is unchanged (struct tags kept) — existing vizb JSON files and the UI keep working.cmd/file/groupinputs;bench-cmd/bench-filekept as deprecated aliases (used only when the new inputs are empty). Non-breaking.examples/csv/sales.csv,examples/json/sales.json, and deploy workflows for both.Verification
go build ./...,go vet ./...,gofmtclean;go test -count=1 ./...green.vizb examples/json/sales.jsonauto-detects the json parser and produces a chart.