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

unpacking metadata fields #52

Open
kurmukovai opened this issue Aug 1, 2023 · 1 comment
Open

unpacking metadata fields #52

kurmukovai opened this issue Aug 1, 2023 · 1 comment
Labels
question Further information is requested

Comments

@kurmukovai
Copy link
Member

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:

  1. Automatically, e.g., AMOS
  2. Manually, e.g., EGD

The first option is cleaner as it does not require writing repetitive code:

def field_name(_meta):
    return _meta[field_name]

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:

image
image
Which of these two options should we prefer?

@kurmukovai kurmukovai added the question Further information is requested label Aug 1, 2023
@maxme1
Copy link
Member

maxme1 commented Aug 1, 2023

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')

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

No branches or pull requests

2 participants