Skip to content

iobis/qc-service

Repository files navigation

qc-service

travis coverage

QC service for checking data for and from OBIS

Source on GitHub at iobis/qc-service

Parameters

There are two endpoints: outlierstaxon and outliersdatasets.

The following parameters are GET request:

  • x: longitude of the points
  • y: latitude of the points
  • mad_coef (optional): Coefficient to multiply the median absolute deviation (MAD) by in order to determine the range of valid values (default is 6)
  • iqr_coef (optional): Coefficient to multiply the interquartile range (IQR) by in order to determine the range of valid values (default is 3)
  • aphiaid (optional): Taxonomic identifier as provided by the world register of marine species (WoRMS), this is parameter is only used by the outlierstaxon endpoint
  • returnvalues (optional): Return the values based on which the outlier analysis is done (default is false).

For a POST request a json or msgpack object with the following attributes is expected:

  • points: nested list of longitude/latitude pairs
  • mad_coef (optional): Coefficient to multiply the median absolute deviation (MAD) by in order to determine the range of valid values (default is 6)
  • iqr_coef (optional): Coefficient to multiply the interquartile range (IQR) by in order to determine the range of valid values (default is 3)
  • aphiaid (optional): taxonomic identifier as provided by the world register of marine species (WoRMS), this is parameter is only used by the outlierstaxon endpoint
  • returnvalues (optional): Return the values based on which the outlier analysis is done (default is false).

Example usage

GET outlierstaxon: http://api.iobis.org/outlierstaxon?x=50.1936,-170.9961,-80.9894,-99.6441,85.1296,63.6118,141.1846,-148.7020,-28.1081,-169.2730,-101.2903,1.9279,-170.4471,-108.4184,53.9584,16.1789,-100.6414,32.1356,111.3950,-177.6604&y=55.0475,35.6651,-28.7549,-62.0137,82.2984,-29.4130,-73.3057,-72.5911,62.5490,18.6707,55.2831,41.3517,6.5211,85.1608,-21.8638,9.3673,59.2928,21.3336,65.1072,13.9234

GET outliersdataset: http://api.iobis.org/outliersdataset?x=50.1936,-170.9961,-80.9894,-99.6441,85.1296,63.6118,141.1846,-148.7020,-28.1081,-169.2730,-101.2903,1.9279,-170.4471,-108.4184,53.9584,16.1789,-100.6414,32.1356,111.3950,-177.6604&y=55.0475,35.6651,-28.7549,-62.0137,82.2984,-29.4130,-73.3057,-72.5911,62.5490,18.6707,55.2831,41.3517,6.5211,85.1608,-21.8638,9.3673,59.2928,21.3336,65.1072,13.9234

Development environment installation

pipenv --three
pipenv install tox
pipenv install nose
pipenv install requests
pipenv install pandas
pipenv install json-logging-py
pipenv install gunicorn
pipenv install sphinx sphinx-autobuild sphinx_rtd_theme
pipenv install git+https://github.com/iobis/pyxylookup.git#egg=pyxylookup
# enter virtual environment
pipenv shell

Tests

Run tests

pipenv run nosetests --with-coverage --cover-package=service

Run locally

pipenv run gunicorn service.app:api

Call locally

echo '{"points":[[2.9,51.2]]}' | curl -d @- http://localhost:8000/outlierstaxon

Deploying

  1. (Optional) generate requirements.txt
pipenv lock -r > requirements.txt

And remove git+https://github.com/iobis/pyxylookup.git#egg=pyxylookup from it.

  1. Use docker-compose or build and start
docker-compose up

Alternative is to build and start the Docker image

docker build -t qc-service .
docker run -e GUNICORN_WORKERS=4 -e GUNICORN_ACCESSLOG=- -p 8000:8000 qc-service
  1. Configure the two endpoints (outlierstaxon and outliersdataset) in NGINX

Meta

About

Web service for additional quality control of data for OBIS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published