-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into piotr/harvard
- Loading branch information
Showing
12 changed files
with
333 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,11 +17,13 @@ These notebooks perform optimally within a HEAL Gen3 Workspace and the notebooks | |
|
||
### VLMD extraction and validation | ||
|
||
The [VLMD docs](heal/vlmd/README.md) describe how to use the SDK for extracting and validating VLMD dictionaries. | ||
|
||
The [VLMD documentation](heal/vlmd/README.md) describes how to use the SDK for extracting and validating VLMD dictionaries. | ||
|
||
|
||
### Run tests | ||
|
||
``` | ||
```bash | ||
poetry run pytest -vv tests | ||
``` | ||
|
||
|
@@ -33,19 +35,38 @@ reference the git repo. | |
As an example, `pip install` can be called from the command line for getting | ||
the master branch of the `heal-platform-sdk`, | ||
|
||
``` | ||
```bash | ||
pip install -e git+https://github.com/uc-cdis/heal-platform-sdk.git#egg=heal | ||
``` | ||
|
||
or a particular branch, eg, | ||
|
||
``` | ||
```bash | ||
pip install -e git+https://github.com/uc-cdis/heal-platform-sdk.git@my-branch#egg=heal | ||
``` | ||
|
||
The specification can also be listed in requirements.txt file | ||
(with, say, a tag specification of 0.1.0) | ||
|
||
``` | ||
```bash | ||
pip install -e git+https://github.com/uc-cdis/[email protected]#egg=heal | ||
``` | ||
|
||
### CLI | ||
|
||
The SDK exposes a Command Line Interface (CLI) for some functions. | ||
|
||
The CLI can be invoked as follows | ||
|
||
`heal [OPTIONS] COMMAND [ARGS]` | ||
|
||
For a list of commands and options run | ||
|
||
`heal --help` | ||
|
||
For example, the following can validate a VLMD file in csv format: | ||
|
||
`heal vlmd validate --input_file "vlmd_for_validation.csv"` | ||
|
||
The [VLMD documentation](heal/vlmd/README.md) provides information on | ||
using the VLMD functions, such as `extract` and `validate`. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import click | ||
from cdislogging import get_logger | ||
|
||
from heal.vlmd.extract.extract import vlmd_extract | ||
|
||
logging = get_logger("__name__") | ||
|
||
|
||
@click.command() | ||
@click.option( | ||
"--input_file", | ||
"input_file", | ||
required=True, | ||
help="name of file to extract HEAL-compliant VLMD file", | ||
type=click.Path(writable=True), | ||
) | ||
@click.option( | ||
"--output_dir", | ||
"output_dir", | ||
help="directory to write converted dictionary'", | ||
default=".", | ||
type=click.Path(writable=True), | ||
show_default=True, | ||
) | ||
def extract(input_file, output_dir): | ||
"""Extract HEAL-compliant VLMD file from input file""" | ||
|
||
logging.info(f"Extracting VLMD from {input_file}") | ||
|
||
try: | ||
vlmd_extract(input_file, output_dir=output_dir) | ||
except Exception as e: | ||
logging.error(f"Extraction error {str(e)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
|
||
import cdislogging | ||
import click | ||
|
||
import heal.cli.vlmd as vlmd | ||
|
||
|
||
@click.group() | ||
@click.option( | ||
"--silent", | ||
"silent", | ||
is_flag=True, | ||
default=False, | ||
help="don't show ANY logs", | ||
) | ||
@click.pass_context | ||
def main(ctx, silent): | ||
"""HEAL-Platform SDK Command Line Interface""" | ||
ctx.ensure_object(dict) | ||
|
||
if silent: | ||
# we still need to define the logger, the log_level here doesn't | ||
# really matter b/c we immediately disable all logging | ||
logger = cdislogging.get_logger("heal_cli", log_level="debug") | ||
# disables all logging | ||
logging.disable(logging.CRITICAL) | ||
|
||
|
||
main.add_command(vlmd.vlmd) | ||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import click | ||
from cdislogging import get_logger | ||
|
||
from heal.vlmd.validate.validate import vlmd_validate | ||
|
||
logging = get_logger("__name__") | ||
|
||
|
||
@click.command() | ||
@click.option( | ||
"--input_file", | ||
"input_file", | ||
required=True, | ||
help="name of file to validate", | ||
type=click.Path(writable=True), | ||
) | ||
def validate(input_file): | ||
"""Validate VLMD input file""" | ||
|
||
logging.info(f"Validating VLMD file{input_file}") | ||
|
||
try: | ||
vlmd_validate(input_file) | ||
logging.info("Valid") | ||
except Exception as e: | ||
logging.error(f"Validation error {str(e)}") | ||
logging.error("Invalid file") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import click | ||
|
||
from heal.cli import extract, validate | ||
|
||
|
||
@click.group() | ||
def main(): | ||
"""HEAL Command Line Interface""" | ||
pass | ||
|
||
|
||
@click.group() | ||
def vlmd(): | ||
"""Commands for VLMD""" | ||
pass | ||
|
||
|
||
vlmd.add_command(extract.extract) | ||
vlmd.add_command(validate.validate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import json | ||
|
||
import pytest | ||
|
||
from heal.vlmd.config import ( | ||
|
Oops, something went wrong.