Evidence validation at targetvalidation.org
Project description
opentargets-validator
Evidence string validator.
Purpose
This tool is intended to validate JSON files that have a single JSON object per line. This is the format that is required from the data sources that provide us with evidence for our target-disease associations.
The validator will check the expected structure, defined in a JSON schema which must be provided via a --schema
argument.
Be aware that this is not a general-purpose JSON validator, and use of "pretty-printed" JSON will cause errors.
Schema URLs
The Open Targets JSON schema is located at https://github.com/opentargets/json_schema. Note that you should not use master
as this may change any time, instead use the latest available tag, e.g. 1.6.3
. If you are a data provider, you will always receive an email from Open Targets with information about what JSON schema version to use. Also, when specifying the schema to the validator you have to use the "raw" GitHub URL:
https://raw.githubusercontent.com/opentargets/json_schema/1.6.3/opentargets.json
How to install it
The easiest way is with pip:
pip install -U opentargets-validator
It supports both Python 2 and Python 3.
How to use it
You have two options:
- pass a filename or URL as a positional argument
- read from stdin (e.g. a shell pipe)
Read from stdin
cat file.json | opentargets_validator --schema https://raw.githubusercontent.com/opentargets/json_schema/{tag_version}/opentargets.json
Read from positional argument
This can automatically decompress gzip'ed files. Compression will be detected via filename e.g. ending with .json.gz
.
Examples of acceptable paths are:
- https://file/location/name.json
- https://file/location/name.json.gz
- file://relative/local/file.json
- file:///absolute/file.json
- location/file.json
opentargets_validator --schema https://raw.githubusercontent.com/opentargets/json_schema/{tag_version}/opentargets.json https://where/myfile/is/located.json
Note
There used to be a --log-lines
argument that could be used to exit early when a certain number of errors occored. This is no longer supported, and with parallelization improvements it is rarely necessary in practice.
Evidence lines are checked for uniqueness by calculating the hash of the unique_association_fields
field. This can be done in the validator using the --hash
argument.
How to develop
Within a virtualenv you can install with:
pip install -e .[dev]
and you can run the tests with:
pytest --cov=opentargets_validator --cov-report term tests/ --fulltrace
This repository has Travis integration and CodeCov integration .
Releases are put on PyPI automatically via Travis from GitHub tags.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for opentargets-validator-0.6.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 249ac0cac9f2d956ed6d563b46a9a34b855f32bc11d6cff5264d1e1e70056e6f |
|
MD5 | 58bca53ff6e6fc6f50410b18576ca770 |
|
BLAKE2b-256 | 069e798cca84d7930468b7b8e3dcf69ec8545b35df80edc33a8dddf664a5aab0 |
Hashes for opentargets_validator-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca27b826e626e9c4ed0178938af68b47e9d556fb85e8818310dbe09b238d6e3 |
|
MD5 | 3a7c9740fd5dab6a9e231bb6b01f971e |
|
BLAKE2b-256 | 2a2522c657ac9c1c97d0e872a5a2749e558c44a021553f37b0c9c583be199833 |
Hashes for opentargets_validator-0.6.0-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf8fbcd5f3473b78b2205e6155fd069b4de808da2f7d61bff5aa2aa33169d1a |
|
MD5 | f1530b2d54b7390a25c56e37fd91b2b5 |
|
BLAKE2b-256 | 00e69cffbde9d9c647c9630fc6ecaafdc8e8bb6f98022b94b678005c293dc146 |
Hashes for opentargets_validator-0.6.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac16a51346085abe481a8a51e02591695b0ccf07fe8fe314bc341e41703cd3ac |
|
MD5 | 5913edcb17f51e70642049c748fada3c |
|
BLAKE2b-256 | 4738c3ca125d4380d32b891728eddfae275cea2d97157b26074b42f7a51afea1 |