Schema validation for evidence submitted to Open Targets
Project description
Open Targets JSON validator
The opentargets-validator
tool in this repository validates JSON files which are submitted to Open Targets by various data sources against the Open Targets JSON schemas.
Installation
pip install --upgrade opentargets-validator
Usage examples
Validating a local gzipped file against the latest schema version from GitHub:
opentargets_validator \
--schema https://raw.githubusercontent.com/opentargets/json_schema/master/schemas/disease_target_evidence.json \
evidence.json.gz
Validating a portion of the local file against a local copy of the schema:
zcat evidence.json.gz | head -n 100 | opentargets_validator --schema evidence_schema.json
Input files
The validator has to be provided with two inputs:
- Data to validate. It has to contain exactly one complete JSON object per line.
- Schema to validate against. It can be any valid JSON Draft 7 schema.
Either of the input files (data and schema) can be read from:
- STDIN (
-
) - Uncompressed remote file (https://example.com/example.json)
- Uncompressed local file (
example.json
) - GZIP-compressed local file (
example.json.gz
)
Development instructions
An editable copy can be installed within a virtual environment:
python -m venv env
source env/bin/activate
pip install -e .[dev]
The tests can be run with:
python -m pytest --cov=opentargets_validator --cov-report term tests/ --fulltrace
Note that you should always use python -m pytest
and not pytest
, because the latter might invoke a system-wide installation (if you have any) and cause incorrect test results.
This repository has Travis integration and CodeCov integration.
Releases are put on PyPI automatically via Travis from GitHub tags.