Skip to content
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

Generate participants.tsv if it doesn't exist or update it if subject is missing in the file #244

Merged
merged 22 commits into from
Jun 17, 2020
Merged

Generate participants.tsv if it doesn't exist or update it if subject is missing in the file #244

merged 22 commits into from
Jun 17, 2020

Conversation

eurunuela
Copy link
Collaborator

Partly closes #242 and #185

Proposed Changes

  • Generate participants.tsv if it doesn't exist already.

@eurunuela eurunuela added BrainHack This issue is suggested for BrainHack participants! Enhancement New feature or request Minormod This PR generally closes an `Enhancement` issue. It increments the minor version (0.+1.0) labels Jun 16, 2020
@codecov
Copy link

codecov bot commented Jun 16, 2020

Codecov Report

Merging #244 into master will decrease coverage by 0.85%.
The diff coverage is 82.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #244      +/-   ##
==========================================
- Coverage   94.41%   93.56%   -0.86%     
==========================================
  Files           8        8              
  Lines         681      730      +49     
==========================================
+ Hits          643      683      +40     
- Misses         38       47       +9     
Impacted Files Coverage Δ
phys2bids/bids.py 87.91% <78.57%> (-8.01%) ⬇️
phys2bids/cli/run.py 96.55% <100.00%> (+0.12%) ⬆️
phys2bids/phys2bids.py 89.65% <100.00%> (+0.08%) ⬆️
phys2bids/utils.py 92.10% <100.00%> (+0.55%) ⬆️

@eurunuela
Copy link
Collaborator Author

eurunuela commented Jun 16, 2020

@smoia @vinferrer @tsalo what should we do when participants.tsv already exists?

  1. Warn the user and not update the file.
  2. Warn the user and update the file with the yaml content.
  3. Have an overwrite option in the parser and update the file.

Of course, this is also valid for dataset_description.json.

@tsalo
Copy link
Member

tsalo commented Jun 16, 2020

For the participants.tsv, I think that updating an existing file will be the norm after converting the first participant, so I vote 2, except when the participant already exists in the file.

@smoia
Copy link
Member

smoia commented Jun 16, 2020

Totally agree with @tsalo on this.
Check if the file exists,
if so check if the subject id is present,
if so update with missing information (but without overwriting values),
otherwise add subject id (and values) to the list
Then update the file in the folder or write it.

I think we can follow this steps for all the files.

@eurunuela eurunuela changed the title Generate participants.tsv if it is doesn't already exist Generate participants.tsv if it doesn't already exist Jun 16, 2020
@eurunuela eurunuela changed the title Generate participants.tsv if it doesn't already exist Generate participants.tsv if it is doesn't exist or update if subject is missing in the file Jun 17, 2020
phys2bids/utils.py Outdated Show resolved Hide resolved
@eurunuela
Copy link
Collaborator Author

Tests pass but we're losing coverage. I'll add an extra call to phys2bids in the integration test to cover part of the new function. Given that this PR is critical for OHBM, I think we can add the unit tests later.

What do you think @smoia @vinferrer ?

@eurunuela
Copy link
Collaborator Author

Adding the extra call to phys2bids makes the test much slower... How about we add the dataset_description.json functionality first and then we work on the unit tests to avoid tests taking this long.

@vinferrer
Copy link
Collaborator

vinferrer commented Jun 17, 2020

Adding the extra call to phys2bids makes the test much slower... How about we add the dataset_description.json functionality first and then we work on the unit tests to avoid tests taking this long.

Sure, Do you wanna open an issue so we don't forget about it?

phys2bids/bids.py Outdated Show resolved Hide resolved
@eurunuela
Copy link
Collaborator Author

@vinferrer I think I've covered all your comments, let me know!

@eurunuela eurunuela requested a review from vinferrer June 17, 2020 12:46
@smoia smoia changed the title Generate participants.tsv if it is doesn't exist or update if subject is missing in the file Generate participants.tsv if it doesn't exist or update if subject is missing in the file Jun 17, 2020
phys2bids/phys2bids.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@vinferrer vinferrer left a comment

Choose a reason for hiding this comment

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

Good to go then

Copy link
Member

@smoia smoia left a comment

Choose a reason for hiding this comment

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

Looks good!
A couple of changes here and there, plus a bit of discussion.

I agree on putting aside the unit test for now - please open an issue about them though!

One thing: this could actually call for the use of pandas. Do we want to add it as a dependency?

phys2bids/bids.py Outdated Show resolved Hide resolved
phys2bids/bids.py Show resolved Hide resolved
phys2bids/bids.py Outdated Show resolved Hide resolved
phys2bids/bids.py Show resolved Hide resolved
phys2bids/bids.py Outdated Show resolved Hide resolved
phys2bids/cli/run.py Show resolved Hide resolved
phys2bids/phys2bids.py Outdated Show resolved Hide resolved
@eurunuela
Copy link
Collaborator Author

@smoia I think I've covered the most important comments. Please let me know.

@eurunuela
Copy link
Collaborator Author

There's still a bug on that previous commit. Fix coming.

@eurunuela eurunuela requested a review from smoia June 17, 2020 14:51
@smoia smoia self-assigned this Jun 17, 2020
Copy link
Member

@smoia smoia left a comment

Choose a reason for hiding this comment

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

LGTM!

@smoia smoia removed BrainHack This issue is suggested for BrainHack participants! Enhancement New feature or request labels Jun 17, 2020
@smoia smoia changed the title Generate participants.tsv if it doesn't exist or update if subject is missing in the file Generate participants.tsv if it doesn't exist or update it if subject is missing in the file Jun 17, 2020
@eurunuela eurunuela merged commit 5a9972c into physiopy:master Jun 17, 2020
@eurunuela eurunuela deleted the enh/dataset_description branch June 17, 2020 15:51
@smoia smoia added the released This issue/pull request has been released. label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minormod This PR generally closes an `Enhancement` issue. It increments the minor version (0.+1.0) released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically generate BIDS compulsory agnostic files and update them if they already exist
4 participants