npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chripon

v1.2.0

Published

Convert a human-friendly JSON description of a ChRIS pipeline to a collection+json template suitable for POSTing to a ChRIS instance.

Downloads

4

Readme

chripon

Abstract

chripon (or CHRIsPipelineJSON) is a simple nodejs JSON converter, transforming a typically human generated JSON file describing a ChRIS pipeline into a collection JSON format suitable for POSTing to a ChRIS API endpoint.

This utility is useful as a CLI tool for other scripts/programs that want to POST a human generated JSON of a ChRIS pipeline to a ChRIS API endpoint.

For reference, a ChRIS pipeline typically contains some descriptive/meta information and a structure defining a tree of plugins, organized in a directed acyclic graph (DAG).

Background

The ChRIS backend, aka CUBE, can accept a JSON object describing a ChRIS pipeline. The submitted JSON object follows a collection+JSON schema which in its simplest sense comprises a template object of a data list elements containing str:name, str:value dictionary tuples,

    {
        "template": {
          "data": [
                {
                  "name": "authors",
                  "value": "[email protected]"
                },
                {
                  "name": "name",
                  "value": "covidnet-test"
                },
                {
                  "name": "description",
                  "value": "covidnet pipeline"
                },
                {
                  "name": "category",
                  "value": "mri"
                },
                {
                  "name": "locked",
                  "value": "true"
                },
                {
                  "name": "plugin_tree",
                  "value": "[{\"plugin_name\":\"pl-med2img\", ..."
                }
            ]
        }
    }   

The collection+JSON schema can only accept string values. Thus, the plugin_tree can be particularly complex to create as a JSON string de novo. Arguably a more natural description of a ChRIS pipeline object is

    {
        "authors": "[email protected]",
        "name": "covidnet-test",
        "description": "covidnet pipeline",
        "category": "mri",
        "locked": "true",
        "plugin_tree": [
          {
            "plugin_name": "pl-med2img",
            "plugin_version": "1.1.2",
            "previous_index": null,
            "plugin_parameter_default": [
              {
                "name": "inputFileSubStr",
                "default": "dcm"
              },
              {
                "name": "sliceToConvert",
                "default": "0"
              }
            ]
          },
          {
            "plugin_name": "pl-covidnet",
            "plugin_version": "0.2.4",
            "previous_index": 0,
            "plugin_parameter_default": [
              {
                "name": "imagefile",
                "default": "sample.png"
              }
            ]
          },
          {
            "plugin_name": "pl-covidnet-pdfgeneration",
            "plugin_version": "0.2.1",
            "previous_index": 1,
            "plugin_parameter_default": [
              {
                "name": "imagefile",
                "default": "sample.png"
              }
            ]
          }
        ]
    }

where the plugin_tree is more clearly and straightforwardly specified. Quite simply, chripon converts the second JSON into the first.

Installation

npm

Using npm, simply do

npm install -g chripon

github repo

Alternatively, directly from a checked out repo:

npm install -g .

Running

The script requires essentially two components: an input source and an output sink. The source should generate a JSON structure, and the output sink in turn receives a JSON structure.

Input

Input sources can be either explicitly named files, or strings that are piped into the script. For example, a piped input source

cat file.json | chripon --stdin ...

or a named input file

chripon --inputFile file.json ...

Output

Similarly, output destinations are either the standard out stream (--stdout) or an explicitly named output file (--outputFile file.json).

Examples

I/O with streams

cat file.json | chripon --stdin --stdout --stringify plugin_tree

I/0 with files

chripon --inputFile input.json --outputFile output.json --stringify plugin_tree

Or a mix

cat file.json | chripon --stdin --outputFile output.json --stringify plugin_tree

Arguments

    --man
    Show this man page. All other options, even if specified, are ignored.

    --verbose
    Be chatty!

    [--stdin] | [-i <inputFile>]
    Input specification. 
    If [--stdin] then input is read from a standard input stream.
    If [-i <inputFile>] then input is read from <inputFile>.
    If both specified, then [--stdin] only is used.

    [--stdout] | [-o <outputFile>] 
    Output specification.
    If [--stdout] then dump resultant JSON to standard output.
    If [-o <outputFile>] then save results to <outputFile>.
    If both specified, then [--stdin] only is used.
    
    [--stringify <JSONkey>]
    If passed, then additionally stringify the JSON key in the input
    specification.