Open kurmukovai opened 1 year ago
We could write a kind of factory for such methods:
def _field(*keys):
def wrapper(_metadata):
for field in fields:
_metadata = _metadata[field]
return _metadata
return wrapper
and use it like so
class ...:
age = _field('Clinical_data', 'Age')
Many medium datasets, especially those published in nii.gz, provide meta information (such as sex, age, manufacturer, etc.) in the form of a CSV spreadsheet or JSON. Currently, in AMID, we have two ways of unpacking these CSVs and creating dataset fields:
The first option is cleaner as it does not require writing repetitive code:
However, the second option results in explicitly defined methods, allowing the addition of docstrings, and visibility in documentation. For instance, right now, AMOS has many fields not visible in the documentation:
Which of these two options should we prefer?