-
Notifications
You must be signed in to change notification settings - Fork 61
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
Object representation improvements #141
Conversation
A few comments:
Thank you @marinagrprat for a nice first PR on |
Thank you for your improvements! @xgrg |
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.
Looks very good overall, nice job here @marinagrprat and @xgrg. Find few suggestions and comments from my side in this review.
Co-authored-by: Jordi Huguet <j.huguet@amc.nl>
After somebody deleted `nosetests3` on CENTRAL 🤦
There might be a better way to do that with some try/except avoiding two calls to id() (one by exists()).
Also removed call to len(list(files.fetchall())) to use metadata instead
Some details on the last commits:
|
looks great! thanks @xgrg |
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.
Problem
When we call the object pyxnat it returns just a collection object and an ID number.
Feature
We want to return more information (metadata information) from the object. Some metadata information examples are the age, gender, handedness, insert data, insert user, number of subjects, experiments, scans...etc.
Solution
The changes has been done in the resources.py file.
A repr method has been added to each class (Project, Subject, Experiment, Scan and Resource).
Each method is capable to return the main information for each object dynamically (will just appear the information that the object contains, the empty fields will not appear) and a link that redirects you to the XNAT page where the object is.
This method allows us to know more information about the object immediately and find out more just clicking the link.
Unit Tests
For each object, 3 tests cases has been added. So in total, we have 15 unit tests in a new file tests/repr_test.py.
The tests check if the object exist, if the object does not exist and if it exists that the information that returns is correct.