Skip to content

Commit

Permalink
[MNT] Update help text and fix formatting issues in user messages (#217)
Browse files Browse the repository at this point in the history
* fix missing whitespaces in user messages

* add more info to help text

* provide example value for --name
  • Loading branch information
alyssadai authored Sep 26, 2023
1 parent 3ae6fcc commit 6801eb1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions bagel/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def check_unique_bids_subjects(pheno_subjects: list, bids_subjects: list):
unique_bids_subjects = set(bids_subjects).difference(pheno_subjects)
if len(unique_bids_subjects) > 0:
raise LookupError(
"The specified BIDS directory contains subject IDs not found in"
f"the provided phenotypic json-ld file: {unique_bids_subjects}"
"The specified BIDS directory contains subject IDs not found in "
f"the provided phenotypic json-ld file: {unique_bids_subjects}. "
"Please check that the specified BIDS and phenotypic datasets match."
)

Expand Down
20 changes: 13 additions & 7 deletions bagel/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
from bagel import mappings, models
from bagel.utility import check_overwrite, load_json

bagel = typer.Typer()
bagel = typer.Typer(
help="""
A command-line tool for creating valid, subject-level instances of the Neurobagel graph data model.
To view the arguments for a specific command, run: bagel [COMMAND] --help
"""
)


@bagel.command()
Expand All @@ -34,8 +40,8 @@ def pheno(
name: str = typer.Option(
...,
help="A descriptive name for the dataset the input belongs to. "
"This name is expected to match the name field in the BIDS "
"dataset_description.json file.",
"This name is expected to match the name field in the BIDS dataset_description.json file. "
'Should be enclosed in quotes, e.g.: --name "my dataset name"',
),
portal: str = typer.Option(
default=None,
Expand All @@ -60,8 +66,8 @@ def pheno(
with the Neurobagel annotation tool. The annotations are expected to be stored
in a data dictionary (.json).
This tool will create a valid, subject-level instance of the Neurobagel
graph datamodel for the provided phenotypic file in the .jsonld format.
This command will create a valid, subject-level instance of the Neurobagel
graph data model for the provided phenotypic file in the .jsonld format.
You can upload this .jsonld file to the Neurobagel graph.
"""
# Check if output file already exists
Expand Down Expand Up @@ -188,8 +194,8 @@ def bids(
with phenotypic metadata (.jsonld) created in a previous step using the
bagel pheno command.
This tool will create a valid, subject-level instance of the Neurobagel
graph datamodel for the combined metadata in the .jsonld format.
This command will create a valid, subject-level instance of the Neurobagel
graph data model for the combined metadata in the .jsonld format.
You can upload this .jsonld file to the Neurobagel graph.
"""
# Check if output file already exists
Expand Down
4 changes: 2 additions & 2 deletions bagel/pheno_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def validate_data_dict(data_dict: dict) -> None:
> 1
):
raise ValueError(
"The provided data dictionary has more than one column about participant ID or session ID."
"The provided data dictionary has more than one column about participant ID or session ID. "
"Please make sure that only one column is annotated for participant and session IDs."
)

Expand Down Expand Up @@ -446,6 +446,6 @@ def validate_inputs(data_dict: dict, pheno_df: pd.DataFrame) -> None:
if row_indices := get_rows_with_empty_strings(pheno_df, columns_about_ids):
raise LookupError(
"We have detected missing values in participant or session id columns. "
"Please make sure that every row has a non-empty participant id (and session id where applicable)."
"Please make sure that every row has a non-empty participant id (and session id where applicable). "
f"We found missing values in the following rows (first row is zero): {row_indices}."
)

0 comments on commit 6801eb1

Please sign in to comment.