Skip to main content

A software to validate CSV documents storing citation data and bibliographic metadata according to the OpenCitations Data Model.

Project description

oc_validator

oc_validator is a Python (≥3.9) library to validate CSV documents storing citation data and bibliographic metadata. To be processed by the validator, the tables must be built as either CITS-CSV or META-CSV tables, defined in two specification documents[^1][^2].

[^1]: Massari, Arcangelo, and Ivan Heibi. 2022. ‘How to Structure Citations Data and Bibliographic Metadata in the OpenCitations Accepted Format’. https://doi.org/10.48550/arXiv.2206.03971.

[^2]: Massari, Arcangelo. 2022. ‘How to Produce Well-Formed CSV Files for OpenCitations’. https://doi.org/10.5281/zenodo.6597141.

Installation

The library can be installed from pip:

pip install oc_validator

Usage

The validation process can be executed from the CLI, by running the following command:

python -m oc_validator.main -i <input csv file path> -o <output dir path>

An object of the Validator class is instantiated, passing as parameters the path to the input document to validate and the path to the directory where to store the output. By calling the validate() method on the instance of Validator, the validation process gets executed.

The process automatically detects which of the two tables has been passed as input (on condition that the input CSV document's header is formatted correctly for at least one of them). During the process, the whole document is always processed: if the document is invalid or contains anomalies, the errors/warnings are reported in detail in a JSON file and summarized in a .txt file, which will be automatically created in the output directory. validate also returns a list of dictionaries corresponding to the JSON validation report (empty if the document is valid).

v = Validator('path/to/table.csv', 'output/directory')
v.validate()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oc_validator-0.1.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

oc_validator-0.1.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file oc_validator-0.1.1.tar.gz.

File metadata

  • Download URL: oc_validator-0.1.1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.0 Windows/10

File hashes

Hashes for oc_validator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 adb32c702b539764d182d55b23781c8cdef7c05b70123c15b39c2bd6698f765b
MD5 6bdecd627f30f9db06bb8740a171ead4
BLAKE2b-256 68eb015b476428fcb364c0eb323214ccafda9c497c19b6000ebb874072f87a32

See more details on using hashes here.

File details

Details for the file oc_validator-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: oc_validator-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.0 Windows/10

File hashes

Hashes for oc_validator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d935b443c3965b3b02095518647022baabc49736d96e154f2a0cb6e07b355e8e
MD5 a653589f373774e3ca27f4c239b0b19f
BLAKE2b-256 7bf291f47408619069c2f36584efd83b25b85d735c0d21d74c38b1f761911254

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page