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.3.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

oc_validator-0.3.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oc_validator-0.3.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10

File hashes

Hashes for oc_validator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6612061def038eb3abba4d497fbe261b769994944ec816bc9eb2de2a4e98687a
MD5 ae667372e730e555b25a78b82a48517b
BLAKE2b-256 36db892d5fd27ff98169ece4c71487bc712fca1114db3a112c3d44ccb421c4dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oc_validator-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10

File hashes

Hashes for oc_validator-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 435e8007152ed7c68293f81557e7fab0cc906a3e72404912f323177abd8ea873
MD5 e590b213e970ee004eb392a73252167f
BLAKE2b-256 cd4701cf9d35144a0017909aed2588be2962f738972a9e3743462c0f8bcaa10c

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