Validate Tool

The validate tool is used to validate a spreadsheet (either an Excel workbook or a list of csv files), and generate a validation report that can be used to either fix errors or accompany the data as “proof of validity”.

Console output is separated into stdout and stderr, to support piping the validation result to another program.

Usage

python tools/validate.py [OPTIONS] DATA_FILE...

Arguments

  • DATA_FILE...

    The path of the Excel file or CSV files to be validated.

Options

  • --version=<version>

    The ODM version to validate against. Defaults to the latest ODM version.

  • --out=<path>

    The path to write the validation report to. Defaults to stdout/console when not specified.

  • --format=(txt, json, yaml)

    The output format. When the --out parameter is passed, the format can be auto-detected from the filename extension, otherwise it defaults to TXT.

    The TXT format is a human readable format, which looks more like the output from a compiler than an actual report. This is useful for fixing errors in the input data.

  • --verbosity=(0, 1, 2)

    The error message verbosity. Defaults to 2.

Examples

  • Validate two CSV files with the latest ODM version, and print human readable errors to the console:

    python tools/validate.py measures.csv samples.csv

  • Validate an Excel file with version 1.1.0 of the ODM, and write the result to a YAML file:

    python tools/validate.py lab-data.xlsx --version=1.1.0 --out=./report.yaml