domain.implementation_notes · canonical example

Implementation Notes: CSV-to-Dashboard Generator

Canonical example of a domain.implementation_notes Capsule. Documents the decisions, deviations, tradeoffs, and open questions from implementing a hypothetical CSV-to-interactive-dashboard generator against a written spec.

Spec implemented: CSV-to-interactive-dashboard generator v0.1.0 · Capsule type: domain.implementation_notes · Created: 2026-05-18

Spec reference

Title
CSV-to-interactive-dashboard generator
Version
0.1.0
Path
specs/csv-dashboard-spec.md
Scope
Initial implementation. CSV ingest, type inference, three chart types (bar, line, table), self-contained HTML export.

What got built: A CLI tool that accepts a CSV file, infers column types, and produces a single self-contained HTML dashboard with bar charts, line charts, and a sortable data table. Output conforms to the Capsule Core spec.

Design decisions

Choices made where the spec was ambiguous or silent.

Decision

Use SVG for charts instead of canvas

Context: The spec said "render charts" but didn't specify the rendering technology.

Rationale: Accessibility and printability both matter for capsule-format output. Canvas pixels don't survive PDF export cleanly. SVG is also copy-pasteable into other tools.

Alternatives considered:

  • HTML5 canvas with toDataURL fallback
  • Inline PNG via server-side render

Decision

Type inference uses a fixed pipeline: number, boolean, date, string

Context: Spec did not define type inference rules.

Rationale: Predictable, debuggable, no statistical sampling needed for small CSVs. Larger CSVs may need a different approach later, but the fixed pipeline ships faster.

Alternatives considered:

  • Statistical sampling
  • User-declared schemas only
  • Pandas-style inference

Decision

All data lives inline in the data block as parsed JSON, not as raw CSV

Context: Spec said "package the source data with the dashboard" without specifying format.

Rationale: Already parsed once during type inference. Re-parsing CSV at runtime adds error surface. JSON is queryable from the runtime without a CSV parser.

Alternatives considered:

  • Embed raw CSV as a string
  • Embed both

Deviations

Places the implementation intentionally departs from the spec.

Section 3.2: Date handling

Failed-parse dates are stored as strings, not nulled

Why: Nulling silently loses information that a human reviewer needs to see. The string preserves what was in the source so the reviewer can decide whether to fix the data or relax the parser.

Reversible: yes. Could be brought back into spec compliance later.

Section 4.1: Chart auto-selection

All three chart types shown regardless of column type

Why: The spec said "auto-select the best chart type for each column." Auto-selection is opinionated and frequently wrong. Showing all three lets the user pick. Auto-selection is the obvious follow-up but should not block v0.1.

Reversible: yes.

Tradeoffs

Alternatives considered, and why this one.

Tradeoff

Reactive vs. static dashboard behavior

Question: Should the dashboard be reactive (a filter syncs across all charts) or static (each chart independent)?

Options considered:

  • Reactive: single shared filter state
  • Static: each chart independent
  • Hybrid: table filter affects charts only

Chosen: Static for v0.1

Why: Reactive needs more runtime complexity and increases the chance of bugs that mutate the data block (Core rule 6 forbids modifying capsule-data at runtime). Static ships sooner. Reactive is the obvious v0.2 move.

Tradeoff

Aggregations: precompute or on-demand?

Question: Should aggregations (sum, mean, count) be precomputed at build time or computed in the runtime?

Options considered:

  • Precompute and embed in the data block
  • Compute on demand in the runtime
  • Both

Chosen: Precompute the common ones (count, sum, mean, min, max), compute others on demand

Why: Precomputed values survive in plain-HTML view (no JS needed), satisfying Core rule 12. On-demand computation handles arbitrary queries without bloating the file.

Open questions

Things the implementer wants the spec author to confirm or revise.

Open question medium

What is the size cap for embedded CSV data?

The capsule hard cap is 15 MB. Section 6 did not specify whether the implementation should warn earlier. Currently warns at 5 MB, hard-stops at 15 MB.

Open question low

Source CSV preservation: bit-exact or semantic?

Section 7.3 said "preserve source." Unclear whether that means bit-exact preservation of the original CSV bytes or semantic preservation via the parsed JSON.

Open question high

How should the dashboard handle CSVs with no header row?

Not addressed in the spec. Currently the implementation assumes a header row exists. CSVs without one fail loudly. High urgency because this is a common real-world input.

AI usage guidance

How AI consumers should and shouldn't reason from this capsule.

Allowed

  • Summarize the design decisions
  • Surface open questions for review
  • Identify high-risk deviations
  • Draft a revised spec section based on resolved decisions
  • Flag tradeoffs that may need revisiting in v0.2

Restricted

  • Don't treat deviations as bugs without consulting the why field
  • Don't auto-resolve open questions without human confirmation
  • Don't collapse tradeoff alternatives into a single recommendation

Preferred language

Technical, plainspoken, calibrated about uncertainty.

Exports

Take this capsule's content somewhere else.

About this capsule

This is a canonical example of a domain.implementation_notes Capsule per spec/DOMAIN_CAPSULES.md. It is hand-written rather than LLM- or compiler-produced, which is reflected in generator.kind = "human".

Manifest

Loading manifest...