GithubHelp home page GithubHelp logo

ankitsharma26 / csv-validator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from digital-preservation/csv-validator

0.0 0.0 0.0 20.46 MB

CSV Validation Tool and API (CSV Schema RI)

Home Page: http://digital-preservation.github.io/csv-validator

License: Mozilla Public License 2.0

Java 2.61% Scala 97.39%

csv-validator's Introduction

CSV Validator

A Validation Tool and APIs for validating CSV (Comma Separated Value) files by using CSV Schema.

CI

Released under the Mozilla Public Licence version 2.0.

A comprehensive user guide is available in GitHub pages, along with a more complete specification of the CSV Schema language.

Technology

The Validation tool and APIs are written in Scala 2.11 and may be used as:

  • A stand-alone command line tool.

  • A desktop tool, we provide a simple Swing GUI.

  • A library in your Scala project.

  • A library in your Java project (We provide a Java 7 interface, to make things simple for Java programmers too).

The Validation Tool and APIs can be used on any Java Virtual Machine which supports Java 7 or better (NB Java 6 support was removed in version 1.1). The source code is built using the Apache Maven build tool, by executing mvn clean install.

Maven Artifacts

Released Maven Artifacts can be found in Maven Central under the groupId uk.gov.nationalarchives.

Java API

If you wish to use the CSV Validator from your own Java project, we provide a native Java API, the dependency details are:

<dependency>
	<groupId>uk.gov.nationalarchives</groupId>
    <artifactId>csv-validator-java-api</artifactId>
    <version>1.1</version>
</dependency>

The Javadoc, can be found in either Maven Central or you can build it locally by executing mvn javadoc:javadoc.

Example Java code of using the CSV Validator through the Java API:

Boolean failFast = false;
List<Substitution> pathSubstitutions = new ArrayList<Substitution>();

List<FailMessage> messages = CsvValidator.validate(
"/data/csv/data.csv",
"/data/csv/data-schema.csvs",
failFast,
pathSubstitutions,
true);

 if(messages.isEmpty()) {
	System.out.println("Completed validation OK");
 } else {
 	for(FailMessage message : messages) {
 		if(message instanceof WarningMessage) {
 			System.out.println("[WARN] " + message.getMessage());
 		} else {
 			System.out.println("[ERROR] " + message.getMessage());
 		}
 	}
}

Scala API

Likewise, if you wish to use the CSV Validator from your own Scala project, the Scala API is part of the core, the dependency details are:

<dependency>
	<groupId>uk.gov.nationalarchives</groupId>
    <artifactId>csv-validator-core</artifactId>
    <version>1.1.5</version>
</dependency>

The Scaladoc, can be found in either Maven Central or you can build it locally by executing mvn scala:doc.

An example of using the Scala API can be found in the class uk.gov.nationalarchives.csv.validator.api.java.CsvValidatorJavaBridge from the csv-validator-java-api module. The Scala API at present gives much more control over the individual Schema Parsing and Validation Processor than the Java API.

Schema Examples

Examples of CSV Schema can be found in the test cases of the csv-validator-core module. See the *.csvs files in acceptance/. Schemas used by the Digital Preservation department at The National Archives are also available in the example-schemas folder of the csv-schema repository.

Current Limitations of the CSV Validator Tool

The CSV Validator implements almost all of CSV Schema 1.1 language, current limitations and missing functionality are:

  • DateExpr is not yet fully implemented (may raise Schema check error).

  • PartialDateExpr is not yet implemented (raises Schema check error).

  • At least MD5, SHA-1, SHA-2, SHA-3, and SHA-256 checksum algorithms are supported. Probably many more as well as we defer to Java's java.security.MessageDigest class.

csv-validator's People

Contributors

adamretter avatar davidainslie avatar benjaminparker avatar jim-collins avatar andy1138 avatar valydia avatar dependabot-preview[bot] avatar dependabot[bot] avatar nickiwelch avatar lauradamiantna avatar rwalpole avatar luketebbs avatar rhubner avatar jessflan avatar etorreborre avatar nyango avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.