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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: oc_validator-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 09c5ce3a3c85e92a17d1636a1af8a63f25129817cad4f01aeefa15838e05b5fe
MD5 42e5b8118d58b2c340f062c568c4db9a
BLAKE2b-256 95954f8edfabe0c1cf6c082ae0c040877d6a595ad6aa2ba6454e122c4def8a47

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oc_validator-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e744f53e9dcd69fc486326216ff4d6616425eab745e89a7b5db2b21f709b7aff
MD5 93749be99ce4d30929467453c027e07a
BLAKE2b-256 3ac65b58c67a3438c6d5edf5ddf9be5d0a22e5acb7105e2a211dff4f6a75f847

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