Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the HALG file format #68

Open
shawnmjones opened this issue Feb 3, 2022 · 1 comment
Open

Improve the HALG file format #68

shawnmjones opened this issue Feb 3, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@shawnmjones
Copy link
Member

In v0.5, we introduced the HALG file format for executing Hypercane recipes.

To start, Hypercane needs two bash functions to make HALG more compact: cache_hc and move_output.

Consider the following script, simplified to illustrate a point:

#!/bin/bash

input_type=$1
input_argument=$2
working_directory=$3
output_file=$4

cd ${working_directory}

if [ ! -e identified-mementos.tsv ]; then
  hc identify mementos -i $input_type -a $input_argument -o identified-mementos.tsv
fi

if [ ! -e sample-mementos.tsv ]; then
  hc sample true-random -k 2000 -i mementos -a identified-mementos.tsv -o sample-mementos.tsv
fi

if [ ! -e image-report.json ]; then
  hc report imagedata -i mementos -a identified-mementos.tsv -o image-report.json
fi

if [ ! -e terms.tsv ]; then
  hc report terms -i mementos -a identified-mementos.tsv -o terms.tsv
fi

if [ ! -e story.json ]; then
  hc synthesize raintale-story -i mementos -a identified-mementos --imagedata image-report.json --term-report terms.tsv -o story.json
fi

cp ${working_directory}/story.json ${output_file}

which could be simplified to something like this:

#!/bin/bash

input_type=$1
input_argument=$2
working_directory=$3
output_file=$4

function cache_hc() { ... }

function move_output() { ... }

cache_hc "identify mementos" "${input_type}=${input_argument}" "694-mementos.tsv"
cache_hc "sample true-random -k 2000" "694-mementos.tsv" "sample-mementos.tsv"
cache_hc "report imagedata" "sample-mementos.tsv" "image-report.json"
cache_hc "report terms --use-sumgrams" "sample-mementos.tsv" "terms.tsv"
cache_hc "synthesize raintale-story --imagedata image-report.json --term-report terms.tsv" "sample-mementos.tsv" "story.json"
move_output "story.json" "${output_file}

and we can even make the cache_hc and move_output functions available as part of the Hypercane installation itself.

This issue is the start of a conversation/documentation of thinking about this idea with the goal of making HALG more applicable as v0.6 development unfolds.

We also need to document HALG. So far, it differs from a regular shell script by offering comments in the following format:

#!/bin/bash
# algorithm name: DSA1
# algorithm description: An implementation of the algorithm from AlNoamany's dissertation.

These comments are used by Hypercane when displaying the possible algorithms. Getting HALG straight is an important step toward the Recipe Builder.

@shawnmjones shawnmjones added the enhancement New feature or request label Feb 3, 2022
@shawnmjones shawnmjones self-assigned this Feb 3, 2022
@shawnmjones shawnmjones added this to To do in Hypercane v0.6 Feb 3, 2022
@shawnmjones shawnmjones pinned this issue Feb 3, 2022
@shawnmjones
Copy link
Member Author

And after saying all of that, I wonder if there is some way we can make a generic file format that the WUI can consume and create an appropriate Wooey script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant