Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • Coscine Python SDK Coscine Python SDK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Coscine
  • community features
  • Coscine Python SDKCoscine Python SDK
  • Issues
  • #2
Closed
Open
Created May 25, 2021 by Niklas Siemer@niklassiemer

Feature Request: loading filled meta data form from a file

To work with existing meta data of a specific file, I would like to receive the filled meta data from of a file. I wrote some function to get such a form, however, this feels very fragile and might not cover every scenario:

def form_with_metadata_from_file(pr, res, filename):
    meta_data_of_file = client.get_metadata(res, filename)
    actual_meta_data = [val for val in meta_data_of_file['data']['metadataStorage'][0].values()][0]
    profile_of_res = client.get_application_profile(res, parse=True)
    form = client.MetadataForm(pr, res)
    for key in profile_of_res['graph']:
        try:
            field_val = actual_meta_data[key['path']][0]['value']
            field_type = actual_meta_data[key['path']][0]['type']
        except KeyError:
            field_val = None
        field_name = key['name']['en']
        if field_val is not None and field_type != 'uri':
            form[field_name] = field_val

    return form
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking