Read the Markdown source ↗

Lossless CSV Intake Profile

Inspect CSV structure and formula-like cells while keeping identifiers and values as text.

Version: 1.0.0. License: MIT. Status: tested reference baseline; no comparative ranking is claimed.

Contract

Require a single-character delimiter other than CR, LF, or quote. Parse CSV with a header and strict csv.reader. Reject empty or duplicate headers and ragged rows. Return rows as strings, per-column empty and distinct counts, and cells whose left-trimmed text begins with =, +, -, or @. Formula locations use one-based data row numbers and exact column names.

The exact required input fields and types are in input.schema.json. Extra fields are rejected at declared object boundaries. JSON duplicate keys and non-finite numbers are rejected by the CLI. Input strings are case-sensitive unless stated otherwise. Array order is preserved unless the contract specifies sorting.

Use

Unpack the ZIP, enter its directory, and run:

python3 baseline.py < example.input.json
python3 -m unittest -v

Python 3.10 or newer, standard library only. The reference implementation exposes run(input_dict) and accepts one JSON object on standard input. Success returns {"ok": true, "result": ...} with exit code 0. Invalid input returns {"ok": false, "error": "..."} with exit code 1. example.output.json contains the result without the CLI envelope. Import callers receive exceptions for invalid input.

Example input

{
  "csv_text": "id,note\n001,hello\n002,=1+1\n",
  "delimiter": ","
}

Example result

{
  "rows": [
    {
      "id": "001",
      "note": "hello"
    },
    {
      "id": "002",
      "note": "=1+1"
    }
  ],
  "columns": [
    {
      "name": "id",
      "empty": 0,
      "distinct": 2
    },
    {
      "name": "note",
      "empty": 0,
      "distinct": 2
    }
  ],
  "formula_like_cells": [
    {
      "row": 2,
      "column": "note"
    }
  ]
}

Boundaries

Formula-like is a review flag, not proof of a spreadsheet formula; negative numbers are also flagged. The profile neither executes formulas nor guarantees safe spreadsheet export. Empty means exactly an empty string. Leading zeros, whitespace and Unicode are preserved. The host owns input and parser field-size limits.

This package performs no network calls, executes no submitted commands, and writes no user files. Host applications own authorization, resource budgets, and persistence. Example values are fixtures, not recommended policies or limits.

Acceptance and provenance

cases.json records named expected results and rejection cases. test_baseline.py runs those cases and checks the command-line contract. manifest.json records file digests. The specification, implementation, and evidence are separate files so a replacement implementation can target the same contract.

Original code and examples generated for this Arcomm collection. No third-party code is bundled. Read LICENSE for reuse terms.

Download

Download the file

SHA-256: 4eb13391357f522225d404507e30210450d1cd0d38a4bd17579a56e847faca2d

Size: 7040 bytes.

Revisions

Revision history