Skip to content

Instantly share code, notes, and snippets.

@timhodson
Last active March 8, 2016 11:11
Show Gist options
  • Save timhodson/dd26984cf80c94ef986b to your computer and use it in GitHub Desktop.
Save timhodson/dd26984cf80c94ef986b to your computer and use it in GitHub Desktop.
Install Talis Aspire Digitised Content Bulk Import Validator

Installation

This is currently only built for Unix based operating systems such as Mac OSX and Linux

Make sure you already have Python 2.7 and pip installed

pip install tadc-import-validator

Usage

# tadc-import-csv-validator <your_CSV_file> <number_of_header_rows>
tadc-import-csv-validator path/to/your/file.csv 2

You may have header rows in your CSV file which name the columns. The <number_of_header_rows> parameter allows you to tell the tool where to start validating rows from.

Output example

? tadc-import-csv-validator samples/sample.csv 0
[2016-03-08 10:11:06.699965] INFO: validate_csv_file: starting at 10:11AM GMT on Mar 08, 2016
[2016-03-08 10:11:06.700295] INFO: CSVFileValidator: Processing File: samples/sample.csv
[2016-03-08 10:11:06.700383] INFO: CSVFileValidator: Expecting 0 header rows
[2016-03-08 10:11:06.700995] INFO: CSVFileValidator: row 0 is valid
[2016-03-08 10:11:06.701240] ERROR: CSVFileValidator: row 1 is not valid
[2016-03-08 10:11:06.701348] ERROR: CSVFileValidator: column Q: Author of Extract value: '' error: Missing mandatory field
[2016-03-08 10:11:06.701525] INFO: CSVFileValidator: row 2 is valid
[2016-03-08 10:11:06.701721] ERROR: CSVFileValidator: row 3 is not valid
[2016-03-08 10:11:06.701876] ERROR: CSVFileValidator: column Q: Author of Extract value: '' error: Missing mandatory field
[2016-03-08 10:11:06.702178] INFO: CSVFileValidator: row 4 is valid
[2016-03-08 10:11:06.702550] INFO: CSVFileValidator: row 5 is valid
[2016-03-08 10:11:06.702781] INFO: CSVFileValidator: row 6 is valid
[2016-03-08 10:11:06.705255] INFO: CSVFileValidator: Row 9 column C : Student numbers value: '' error: Missing mandatory field
[2016-03-08 10:11:06.702995] INFO: CSVFileValidator: row 7 is valid
[2016-03-08 10:11:06.703199] ERROR: CSVFileValidator: row 8 is not valid
[2016-03-08 10:11:06.703302] ERROR: CSVFileValidator: column C: Student numbers value: '' error: Missing mandatory field
[2016-03-08 10:11:06.704773] INFO: CSVFileValidator: row 9 is valid
[2016-03-08 10:11:06.704905] INFO: CSVFileValidator: Errors were found for the following columns
[2016-03-08 10:11:06.705034] INFO: CSVFileValidator: Row 2 column Q : Author of Extract value: '' error: Missing mandatory field
[2016-03-08 10:11:06.705171] INFO: CSVFileValidator: Row 4 column Q : Author of Extract value: '' error: Missing mandatory field

Logs

A log file is written to /tmp/validate_csv_{{uniq id}}.log for each run of the tool. The log file contains all the messages that were output to the command line when you ran the tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment