Skip to content

Validation of the PFA model and its predictive algorithm

License

Notifications You must be signed in to change notification settings

woken-ml/pfa-validator

 
 

Repository files navigation

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).

About

Validation of the PFA model and its predictive algorithm

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 65.2%
  • Shell 23.0%
  • PostScript 6.1%
  • Dockerfile 5.7%