-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add function for getting full data name, combined data source and dataset name (used in readii_2_roqc) #127
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ae789bf
feat: add function for getting full data name, combined data source a…
strixy16 d47dfe0
feat: update lock file
strixy16 2d0f1fa
fix: correct number of arguments for loadImageDatasetConfig
strixy16 e3b9f0c
fix: add missing key handling
strixy16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,5 +1,7 @@ | ||
from .logging_config import logger | ||
from .dataset_config import get_full_data_name | ||
|
||
__all__ = [ | ||
'logger', | ||
'get_full_data_name' | ||
] |
This file contains hidden or 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 @@ | ||
from pathlib import Path | ||
from typing import Dict, Union | ||
|
||
from readii.io.loaders import loadImageDatasetConfig | ||
from readii.utils import logger | ||
|
||
def get_full_data_name(config: Union[Dict | Path]): | ||
"""Combine DATA_SOURCE and DATASET_NAME config variables into a single string.""" | ||
|
||
match type(config): | ||
case Path(): | ||
dataset_config = loadImageDatasetConfig(config.stem, config.parent) | ||
case Dict(): | ||
dataset_config = config | ||
case _: | ||
message = "Error getting full data name: config must be of type Path or Dict." | ||
logger.debug(message) | ||
raise TypeError(message) | ||
|
||
try: | ||
data_source = dataset_config['DATA_SOURCE'] | ||
dataset_name = dataset_config['DATASET_NAME'] | ||
return f"{data_source}_{dataset_name}" | ||
except KeyError as e: | ||
message = f"Missing required key in dataset configuration: {e}" | ||
logger.error(message) | ||
raise ValueError(message) from e | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the assumption about Path naming convention.
The implementation assumes that
config.stem
(filename without extension) corresponds to the dataset name expected byloadImageDatasetConfig
. This assumption should be documented or validated.Consider adding validation or documentation about the expected file naming convention:
🏁 Script executed:
Length of output: 552
Add validation and documentation for dataset config file naming
Please ensure that when passing a
Path
toget_dataset_config
(insrc/readii/utils/dataset_config.py
), the filename stem matches both the expected dataset name and its parent directory. Although tests use matching names (e.g.tests/4D-Lung/4D-Lung.yaml
→ stem “4D-Lung”), this assumption should be explicit and enforced.• File: src/readii/utils/dataset_config.py
Lines: 10–18
Suggested changes:
Additionally, update the function’s docstring (or README) to state:
📝 Committable suggestion
🤖 Prompt for AI Agents