Skip to main content

Evidence validation at targetvalidation.org

Project description

PyPI version

Build Status

codecov

Docker Repository on Quay.io

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.

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/1.6.0/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:

opentargets_validator --schema https://raw.githubusercontent.com/opentargets/json_schema/1.6.0/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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentargets-validator-0.5.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distributions

opentargets_validator-0.5.0-py3.7.egg (12.2 kB view hashes)

Uploaded Source

opentargets_validator-0.5.0-py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 3

opentargets_validator-0.5.0-py2-none-any.whl (11.4 kB view hashes)

Uploaded Python 2

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