Git Product home page Git Product logo

pfa-validator's Introduction

CHUV License DockerHub ImageVersion ImageLayers Codacy Badge CircleCI

pfa-validator

A small python program that validates that a PFA document is:

  • Syntaxically correct JSON
  • Syntaxically correct PFA
  • Semantically correct PFA

This project does not perform cross-validation on the PFA document.

Usage

The program can be run as a Python program or as a Docker container.

It may fetch the PFA document to validate from the file system or from a PostgreSQL database.

  • When fetching the PFA document from the file system, the program expects a PFA_PATH environment variable that contains the path to the PFA document to validate.

  • When fetching the PFA document from a PostgreSQL database, the program expects the following environment variables:

    • INPUT_METHOD that must be set to POSTGRESQL
    • the database's credentials: DB_HOST, DB_PORT, DB_NAME, DB_USER and DB_PASSWORD
    • the parameters of the query to perform: DB_TABLE DB_COLUMN
    • the job ID (used to check the job_id column and get the right PFA document): JOB_ID

In addition, the program will also need the following environment variables to be set up in order to get some validation data: FEATURES_DB_HOST, FEATURES_DB_PORT, FEATURES_DB_NAME, FEATURES_DB_USER, FEATURES_DB_PASSWORD and FEATURES_DB_TABLE

Examples

Validate a PFA file

  1. Build the image: docker build -t pfa-validator .
  2. Run a container based on that image:
    docker run --volume $(pwd)/data:/data \
    --env PFA_PATH="/data/example_01_valid/model.pfa" \
    --env FEATURES_DB_HOST=db \
    --env FEATURES_DB_PORT=5432 \
    --env FEATURES_DB_NAME=sample \
    --env FEATURES_DB_USER=sample \
    --env FEATURES_DB_PASSWORD=... \
    --env FEATURES_DB_TABLE=features \
    hbpmip/pfa-validator:0.10.1-2

Validate a PFA PostgreSQL column

  1. Build the image: docker build -t pfa-validator .
  2. Run a container based on that image:
  docker run \
    --env INPUT_METHOD=POSTGRESQL \
    --env JOB_ID=1
    --env DB_HOST=172.20.0.2 \
    --env DB_PORT=5432 \
    --env DB_NAME=woken \
    --env DB_USER=woken \
    --env DB_PASSWORD=... \
    --env DB_TABLE=job_result \
    --env DB_COLUMN=data \
    --env FEATURES_DB_HOST=db \
    --env FEATURES_DB_PORT=5432 \
    --env FEATURES_DB_NAME=sample \
    --env FEATURES_DB_USER=sample \
    --env FEATURES_DB_PASSWORD=... \
    --env FEATURES_DB_TABLE=features \
    hbpmip/pfa-validator:0.10.1-2

NOTE: If you don't want to use Docker, you can install the dependencies with: pip install -r requirements.txt and run this program using Python2. The environment variables still have to be set up.

TODO

  • Allow validation of YAML formatted PFA document

Acknowledgements

This work has been funded by the European Union Seventh Framework Program (FP7/2007­2013) under grant agreement no. 604102 (HBP)

This work is part of SP8 of the Human Brain Project (SGA1).

pfa-validator's People

Contributors

ludovicc avatar mbreskvar avatar mirco-nasuti avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pfa-validator's Issues

Updating titus for Python 3

Hi,

I came across this project which uses titus package which is not supported in Python 3.
With the sunset of Python 2 by the end of this year, I am glad to inform that Titus 2 is fully supported in Python 3.4-3.8.
pip install titus2
All syntax and functionality remain the same and the code requires no modification.
For more details please head to this repo - https://github.com/animator/titus2
The migrated code is passing all unit tests and conformance tests.
Please don't forget to star the project in case you find it useful.

Cheers,
Ankit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.