Skip to content

[ENH] use datalad copy files #207

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

[ENH] use datalad copy files #207

wants to merge 5 commits into from

Conversation

Remi-Gau
Copy link
Contributor

@Remi-Gau Remi-Gau commented Apr 6, 2024

No description provided.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Remi-Gau - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Implementation of copy_files is pending; ensure it's completed. (link)
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 1 other issue
  • 🟢 Security: all looks good
  • 🟡 Testing: 4 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Docstrings: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines 19 to 27
def copy_files(
output_dir: Path,
datasets: pd.DataFrame,
participants: pd.DataFrame | None,
dataset_types: list[str],
datatypes: list[str],
task: str,
space: str,
bids_filter: None | dict[str, dict[str, dict[str, str]]] = None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_clarification): Consider documenting the copy_files function.

space: str,
bids_filter: None | dict[str, dict[str, dict[str, str]]] = None,
):
pass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code_refinement): Implementation of copy_files is pending; ensure it's completed.


assert (
output_dir / "study-ds000001" / "bids" / "sub-01" / "anat" / "sub-03_T1w.nii.gzz"
).exists()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Test test_copy_files lacks validation for non-existent files.

It would be beneficial to include a test case that validates the behavior when the expected output files do not exist after the copy_files operation. This could help in ensuring the function's robustness in handling errors or unexpected conditions.

Suggested change
).exists()
assert not (
output_dir / "study-ds000001" / "bids" / "sub-01" / "anat" / "sub-03_T1w.nii.gzz"
).exists()


import pandas as pd

from cohort_creator.copy_files import copy_files
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Consider adding a test for copy_top_files function.

The test_copy_top_files function currently does not assert any outcomes or behaviors. Adding assertions to verify that the expected top files are copied correctly would enhance the test's effectiveness and coverage.


assert (
output_dir / "study-ds000001" / "bids" / "sub-01" / "anat" / "sub-03_T1w.nii.gzz"
).exists()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): The assertion in test_copy_files may reference an incorrect file path.

The file path in the assertion (sub-03_T1w.nii.gzz) does not match the participant ID (sub-01) used in the test setup. This discrepancy could lead to false positives or negatives in test outcomes. Please verify the intended file path and participant ID.

@neurodatascience neurodatascience deleted a comment from sourcery-ai bot Apr 6, 2024
@Remi-Gau
Copy link
Contributor Author

Remi-Gau commented Apr 8, 2024

copy_file only works with URL, so this won't work

need to implement shrinky: https://github.com/datalad/shrinky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant