Skip to content

eScienceLab/Cratey-Validator

Repository files navigation

RO-Crate Validation Service

This project presents a Flask-based API for validating RO-Crates.

Project Structure

app/
β”œβ”€β”€ ro_crates/
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ __init__.py         # Registers blueprints
β”‚   β”‚   └── post_routes.py      # POST API routes
β”‚   └── __init__.py             
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ logging_service.py      # Centralised logging
β”‚   └── validation_service.py   # Queue RO-Crates for validation
β”œβ”€β”€ tasks/
β”‚   └── validation_tasks.py     # Validate RO-Crates
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ config.py               # Configuration
β”‚   β”œβ”€β”€ minio_utils.py          # Methods for interacting with MinIO
β”‚   └── webhook_utils.py        # Methods for sending webhooks

Setting up the project

Prerequisites

  • Docker with Docker Compose

Installation

  1. Clone the repository:

    git clone https://github.com/eScienceLab/Cratey-Validator.git
    cd crate-validation-service
  2. Create the .env file for shared environment information. An example environment file is included (example.env), which can be copied for this purpose. But make sure to change any security settings (username and passwords).

  3. Build and start the services using Docker Compose:

    docker compose up --build
  4. Set up the MinIO bucket

    1. Open the MinIO web interface at http://localhost:9000.

    2. Log in with your MinIO credentials.

    3. Create a new bucket named ro-crates.

    4. Enable versioning for the ro-crates bucket β€” this is important for tracking unique object versions.

      Ensure MinIO versioning is enabled

    5. Upload your RO-Crate files to the ro-crates bucket.

    6. To verify that versioning is enabled:

      • Select the uploaded RO-Crate object in the ro-crates bucket.
      • Navigate to the Actions panel on the right.
      • The Display Object Versions option should be clickable.

      Validate MinIO versioning is enabled

Development

For standard usage the Docker Compose script uses prebuilt containers. For testing locally developed containers use the alternate Docker Compose file:

   docker compose --file docker-compose-develop.yml up --build

Example Usage

curl -X 'POST' \
  'http://localhost:5001/ro_crates/validate_by_id_no_webhook' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "crate_id": "1"
}'

About

An API for validating RO Crates in federated trusted research environments πŸ•΅οΈπŸ“¦

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •