Skip to content

Commit dc7933f

Browse files
committed
Minor check in run_parser for collection_type
Fixes on documentation
1 parent 2c64250 commit dc7933f

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

bam_masterdata/cli/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def push_to_openbis(file_path, datamodel_path):
622622
"collection_type", # alias
623623
type=click.Choice(["COLLECTION", "DEFAULT_EXPERIMENT"], case_sensitive=False),
624624
default="COLLECTION",
625-
help='Type of collection to create in openBIS. Options are "COLLECTION" or "DEFAULT_EXPERIMENT". Defaults to "COLLECTION".',
625+
help="Type of collection to create in openBIS. Options are 'COLLECTION' or 'DEFAULT_EXPERIMENT'. Defaults to 'COLLECTION'.",
626626
)
627627
def parser(files_parser, project_name, collection_name, space_name, collection_type):
628628
parser_map = {} # TODO load from configuration from yaml file

bam_masterdata/cli/run_parser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ def run_parser(
4343
"No files or parsers to parse. Please provide valid file paths or contact an Admin to add missing parser."
4444
)
4545
return
46+
# Ensure collection_type is valid
47+
if collection_type not in ["COLLECTION", "DEFAULT_EXPERIMENT"]:
48+
logger.error(
49+
f"Invalid collection_type '{collection_type}'. Must be either 'COLLECTION' or 'DEFAULT_EXPERIMENT'."
50+
)
51+
return
4652

4753
# Specify the space
4854
try:

docs/tutorials/parsing.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ run_parser(
203203
You can choose between two collection types:
204204
- `"COLLECTION"` (default): A general-purpose collection type
205205
- `"DEFAULT_EXPERIMENT"`: A collection type designed for experiments with additional metadata fields like start/end dates, experimental goals, etc.
206-
207-
If you don't specify `collection_type`, it defaults to `"COLLECTION"`.
206+
207+
If you don't specify `collection_type`, it defaults to `"COLLECTION"`. We recommend keeping the default `collection_type`, as future openBIS releases will get rid of the collection concept and we will, as a result, deprecate this feature.
208208

209209
### What Happens Next?
210210

@@ -245,7 +245,6 @@ run_parser(
245245
project_name="MY_PROJECT",
246246
collection_name="MULTI_DATA_COLLECTION",
247247
files_parser=files_parser,
248-
collection_type="DEFAULT_EXPERIMENT" # Use DEFAULT_EXPERIMENT for experiment data
249248
)
250249
```
251250

@@ -467,7 +466,6 @@ def main():
467466
project_name="AUTOMATION_TEST",
468467
collection_name="BATCH_EXPERIMENTS",
469468
files_parser=files_parser,
470-
collection_type="DEFAULT_EXPERIMENT"
471469
)
472470

473471
print("Metadata injection complete!")

0 commit comments

Comments
 (0)