Skip to main content

Generation of challenge packs

Project description

🛠️ grand-challenge-forge

A utility that generates distributable items that help challenge organizers set up their challenge more easily on Grand-Challenge.org.


CI PyPI PyPI - Python Version Code style: black

Install

Install via PyPi:

pip install grand-challenge-forge
grand-challenge-forge --help

📦 Challenge packs

A challenge pack consists of challenge-tailored examples for the following:

  • A script to automate uploading data to an archive
  • A submission algorithm that can be submitted to a challenge phase
  • An evaluation method that evaluates algorithm submissions and generates performance metrics for ranking

Usage

PACK generation

grand-challenge-forge pack pack-context.json

Will use the context found in pack-context.json and generate a pack at the current working directory in a directory dist/ (default).

Example of the content of pack-context.json
{
    "challenge": {
        "slug": "challenge-slug",
        "phases": [
            {
                "slug": "phase-slug",
                "archive": {
                    "url": "https://grand-challenge.org/archives/archive-slug/"
                },
                "algorithm_inputs": [
                    {
                        "slug": "input-ci-slug",
                        "kind": "Segmentation",
                        "super_kind": "Image",
                        "relative_path": "images/input-value"
                    },
                    {
                        "slug": "another-input-ci-slug",
                        "kind": "Anything",
                        "super_kind": "File",
                        "relative_path": "another-input-value.json"
                    }
                ],
                "algorithm_outputs": [
                    {
                        "slug": "output-ci-slug",
                        "kind": "Image",
                        "super_kind": "Image",
                        "relative_path": "images/output-value"
                    },
                    {
                        "slug": "another-output-ci-slug",
                        "kind": "Anything",
                        "super_kind": "File",
                        "relative_path": "output-value.json"
                    }
                ]
            },
            {
                "slug": "another-phase-slug",
                "archive": {
                    "url": "https://grand-challenge.org/archives/another-archive-slug/"
                },
                "algorithm_inputs": [
                    {
                        "slug": "input-ci-slug",
                        "kind": "Image",
                        "super_kind": "Image",
                        "relative_path": "images/input-value"
                    }
                ],
                "algorithm_outputs": [
                    {
                        "slug": "another-output-ci-slug",
                        "kind": "Anything",
                        "super_kind": "File",
                        "relative_path": "output-value.json"
                    }
                ]
            }
        ]
    }
}

Alternatively, you generate a pack by providing a JSON string directly:

grand-challenge-forge pack --output-dir /tmp '{ "challenge": { "slug": "a-slug"...'

This will output a pack directory in the /tmp directory.

[!NOTE] By default, the forge does quality checks on the pack that may require docker. You can disable these via -n

Via API pack generation can be done via:

from grand_challenge_forge.forge import generate_challenge_pack
from Pathlib import Path

qc = []
generate_challenge_pack(
    context={"challenge": {...}}
    output_path=Path("dist/"),
    quality_control_registry=qc,
    delete_existing=False,
)
for check in qc:
    check()

ALGORITHM-TEMPLATE generation

grand-challenge-forge algorithm algorithm-context.json

Will use the context found in algorithm-context.json and generate a algorith-template directory at the current working directory in a directory dist/ (default).

Example of the content of algorithm-context.json
{
    "algorithm": {
        "title": "An Algorithm Title",
        "slug": "an-algorithm-title",
        "url": "https://grand-challenge.org/algorithms/an-algorithm/",
        "inputs": [
                {
                    "slug": "input-ci-slug",
                    "kind": "Segmentation",
                    "super_kind": "Image",
                    "relative_path": "images/input-value"
                },
                {
                    "slug": "another-input-ci-slug",
                    "kind": "Anything",
                    "super_kind": "File",
                    "relative_path": "another-input-value.json"
                }
            ],
        "outputs": [
                {
                    "slug": "output-ci-slug",
                    "kind": "Image",
                    "super_kind": "Image",
                    "relative_path": "images/output-value"
                },
                {
                    "slug": "another-output-ci-slug",
                    "kind": "Anything",
                    "super_kind": "File",
                    "relative_path": "output-value.json"
                }
            ]
        },
}

Alternatively, you generate an algorithm template by providing a JSON string directly:

grand-challenge-forge algorithm --output-dir /tmp '{ "algorithm": { ... } }'

This will output an algorithm-template directory in the /tmp directory.

[!NOTE] By default, the forge does quality checks on the template that may require docker. You can disable these via -n

Via API the algorithm-template generation can be done via:

from grand_challenge_forge.forge import generate_algorithm_template
from Pathlib import Path

qc = []
generate_algorithm_template(
    context={"algorithm": { ... }}
    output_path=Path("dist/"),
    quality_control_registry=qc,
    delete_existing=False,
)
for check in qc:
    check()

🏗️ Development

Install locally

Install grand-challenge-forge locally (requires poetry):

git clone https://github.com/DIAGNijmegen/rse-grand-challenge-forge.git
cd rse-grand-challenge-forge
poetry install
poetry run grand-challenge-forge --help

Pre-commit hooks

Several linters and stylers run to check the formatting during continuous integration. Ensure they are run before committing by installing pre-commit.

Running Tests

use tox to run all tests across all supported python versions:

pip install tox
tox

Dependencies

Under the hood grand-challenge-forge uses:

  • Click
    • a composable command line interface toolkit
  • Jinja2
    • a utility that renders templates

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grand_challenge_forge-0.6.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

grand_challenge_forge-0.6.0-py3-none-any.whl (46.1 kB view details)

Uploaded Python 3

File details

Details for the file grand_challenge_forge-0.6.0.tar.gz.

File metadata

  • Download URL: grand_challenge_forge-0.6.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

File hashes

Hashes for grand_challenge_forge-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d592189d55c6324db6177a4074470553b1468f0477155925c6374173f3a80bf1
MD5 114f387251cf0a77bf3405e6694dd467
BLAKE2b-256 0b2650cf34c295de31c8094683fba799a9df59a1af3fa83d0a65d8995c1c5af8

See more details on using hashes here.

File details

Details for the file grand_challenge_forge-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for grand_challenge_forge-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa01ab5d3f5b3a86efbf8b99d4ac0a8c426b41f3f7380d4c760f614a196ac9f
MD5 99ec75ab0e3ae3e9d7f545240a2a76b1
BLAKE2b-256 ed4eabb5821209e05ec75d4a8cfcbcc6cf493ed89be8e66816c77591aba9ce3d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page