inveniosoftware / invenio-app-rdm

Turn-key research data management platform.
https://inveniordm.docs.cern.ch
MIT License
99 stars 143 forks source link

affiliations: handling of different affiliation names via API #1851

Open tmorrell opened 1 year ago

tmorrell commented 1 year ago

Package version (if known): v9.1

Describe the bug

Users often want to customize their affiliation, by adding things like department. We still want to tie these affiliations to the correct ROR identifier for the institution. My expectation is that when utilizing the API a submitted affiliation name will take precedence over the ROR vocabulary. However, the submitted affiliation name is lost.

Steps to Reproduce

  1. Utilize this metadata:
    {
    "metadata": {
    "creators": [
        {
        "affiliations": [
            {
                "id": "05dxps055",
                "name": "Caltech Library"
            }
        ],
        "person_or_org": {
            "given_name": "Morrell",
            "family_name":"Thomas",
            "type": "personal"
        }
        }
    ],
    "publisher": "CaltechDATA",
    "resource_type": {
        "id": "image"
    },
    "title": "Title",
    "publication_date": "2019-02-14"
    }
    }
  2. Run this script to create a record on the test instance
    
    import requests
    import json
    import os

token=os.environ['TOKEN']

with open('aff-metadata.json','r') as infile: metadata = json.load(infile)

url = "https://inveniordm.web.cern.ch/"

headers = {
        "Authorization": "Bearer %s" % token,
        "Content-type": "application/json",
    }

metadata["files"] = {"enabled": False}

# Make draft and publish
result = requests.post(
        url + "/api/records", headers=headers, json=metadata)
idv = result.json()["id"]
publish_link = result.json()["links"]["publish"]

result = requests.post(publish_link, headers=headers)
print(idv)


4. See that the affiliation is "California Institute of Technology" instead of "Caltech Library"

## Expected behavior
A submitted affiliation name would take precedence for this specific record.
github-actions[bot] commented 1 year ago

This issue was automatically marked as stale.