This repository contains the code for the eLTER prototype outlier analysis service created during the EOSC-HUB project (https://www.eosc-hub.eu/)
This work is co-funded by the EOSC-hub project (Horizon 2020) under Grant number 777536.
Reference: Goldfarb, D., Kobler, J. and Peterseil, J. (2020) Providing a user-friendly outlier analysis service implemented as open REST API. EGU2020-14903. https://meetingorganizer.copernicus.org/EGU2020/EGU2020-14903.html
This service prototype is based on a python-flask server stub automatically generated from an OpenAPI Specification yaml file via the online Swagger Editor. See the section below for further information about the generation and how to start the server.
Requests to the flask server trigger the respective procedures in the default controller, which call R-code performing the actual work. The latter can be found in the outlier_script folder and is divided into several functional modules represented as separate R-Scripts. The entry point is the script quality_check.R which retrieves the data to be analyzed from file repositories or from SOS, which uses 52°North's sos4R library for that purpose. The actual outlier analysis is performed in the file outlierAnalysis.R.
This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub. This is an example of building a swagger-enabled Flask server.
This example uses the Connexion library on top of Flask.
Python 3.5.2+
To run the server, please execute the following from the root directory:
pip3 install -r requirements.txt
python3 -m swagger_server
and open your browser to here:
http://localhost:8080/v1/ui/
Your Swagger definition lives here:
http://localhost:8080/v1/swagger.json
To launch the integration tests, use tox:
sudo pip install tox
tox
To run the server on a Docker container, please execute the following from the root directory:
# building the image
docker build -t swagger_server .
# starting up a container
docker run -p 8080:8080 swagger_server