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
Built Distribution
File details
Details for the file oc_validator-0.3.1.tar.gz
.
File metadata
- Download URL: oc_validator-0.3.1.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a25aa3d6fb5eef681b11ca8f8280e0f7a3d0da6f6b914de2ec23007a6192cb4 |
|
MD5 | e40ed855ed82b0d952b7c3f853552cde |
|
BLAKE2b-256 | a6e3e2385c4f857f57f8b1920958e74dd9eb808be6844712224ce4b3db9e6332 |
File details
Details for the file oc_validator-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: oc_validator-0.3.1-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a50e56fcf12bcd0305ea12b2f9fca79b79208e3ffd6216da5ab41f0fa4083711 |
|
MD5 | ef4e0e61b7056358567c6c38adbabef2 |
|
BLAKE2b-256 | 6a48865af1f9e80e8d6b634480aad9d45637c6c72c32850c1aee3fea0adfa9a9 |