← All ivy-agents
IVYXSTUDIO · IVY AGENT
C

CSV Quality Report

ivy.agent.csv-quality-report · v1.0.0

ivyx

Checks every row of an orders CSV against a schema and writes a report of the rows with problems and the valid rows per country, with no model involved.

Steps

In the order the agent's file lists them, each with where its inputs come from and the values the file fixes. A branch or a loop is a step too.

  1. 01
    Read the CSV
    ivy.node.csv-read

    Reads a CSV file, or CSV text, into rows with the column names and row count.

    takes
    path from the agent's input
    returns
    row_count
    Ivy Node
  2. 02
    Check every row
    ivy.node.rows-validate

    Checks every row against a JSON Schema and splits the rows into valid ones and invalid ones with their problems.

    takes
    rows from step 1
    set
    schema {"type":"object","required":["order_id","customer","quantity","unit_price","status"],"properties":{"order_id":{"type"...
    returns
    error_count, invalid_rows
    Ivy Node
  3. 03
    Count valid rows per country
    ivy.node.table-aggregate

    Groups rows and sums, averages, counts or takes the minimum or maximum of one column, optionally by month, year or day of a date column.

    takes
    rows from step 2, valid_rows
    set
    group_by country
    op count
    returns
    by_country
    Ivy Node
  4. 04
    Lay out the problem rows
    ivy.node.markdown-table

    Formats rows as a Markdown table, with the columns in the order given or as they first appear.

    takes
    rows from step 2, invalid_rows
    set
    columns ["order_id","customer","problems"]
    Ivy Node
  5. 05
    Lay out the country counts
    ivy.node.markdown-table

    Formats rows as a Markdown table, with the columns in the order given or as they first appear.

    takes
    rows from step 3
    Ivy Node
  6. 06
    Assemble the report
    ivy.node.template-render

    Fills {{ name }} placeholders in a text template from a mapping, and reports which names were missing.

    takes
    values.file from the agent's input, path
    values.error_count from step 2, error_count
    values.row_count from step 1, row_count
    values.problems from step 4, markdown
    values.by_country from step 5, markdown
    set
    template # CSV quality report File: {{ file }} {{ error_count }} of {{ row_count }} rows have a problem. ## Rows with problems...
    on_missing empty
    returns
    report
    Ivy Node
  7. 07
    Write the report
    ivy.node.file-write

    Writes text to a file, creating its folder, and returns the absolute path and the number of bytes written.

    takes
    text from step 6
    set
    path reports/csv-quality.md
    overwrite true
    returns
    path
    Ivy Node

What it touches

Collected from what each of its nodes declares, plus the model call when a step is a model turn. A declaration is the author's statement, and it is what policy rules select on.

Writes files

Inputs

FieldTypeDescription
pathrequiredstringPath to the orders CSV, with the columns order_id, customer, country, quantity, unit_price and status.

Outputs

FieldTypeDescription
row_countintegerHow many rows the file has.
error_countintegerHow many rows had a problem.
invalid_rowsarrayThe rows with problems, each with its problems as one sentence.
by_countryarrayThe valid rows counted per country.
reportstringThe report that was written.
pathstringThe file the report was written to.

Tests

2 of 2 test cases passed on Oct 4, 2026, in the publisher's own environment, before this version was published. The registry keeps that record; it does not run the cases again.

Requires: python:3.9

  • four-bad-rows

    Six orders, four with a problem: a missing quantity, a negative one, an unknown status and a missing customer.

    given
    path data/showcase/orders.csv
    expects
    row_count equals 6
    error_count equals 4
    report matches O-1002[\s\S]*O-1003[\s\S]*O-1004[\s\S]*O-1006
    path matches reports/csv-quality\.md$
  • clean-file

    A clean file has no problem row and still counts its countries.

    given
    path data/showcase/orders-clean.csv
    expects
    row_count equals 3
    error_count equals 0
    report matches 0 of 3 rows