Employment field always empty when using connection

Hi all,
I’m using the datacite commons GraphQL API https://api.datacite.org/graphql to retrieve data, and I noticed when querying an organization and its affiliated people, the employment field for a person is always empty, even though it is filled in their ORCID profile. I don’t have that problem if I query the person directly, then the employment field is always filled exactly like their ORCID profile.

So to make it more specific, if I use this query:

{
  organization(id: "https://ror.org/04qmmjx98") {
   id
people {
  edges {
    node {
      id
      employment {
        organizationId
        organizationName
        startDate
        endDate
      }
    }
  }
}
  }
}

then all the employment fields I get are empty, but if I take one of the person.id that was returned and use it in the following query I get the employment data:

{
  person(id: "https://orcid.org/0000-0003-4106-461X") {
    employment {
      organizationId
      organizationName
      startDate
      endDate
    }
  }
}

That behavior is strange, since I expected to have at least the organization in the employment in the first query, because I assume the employment field makes the connection between an organization and a person.

This is a limitation of the ORCID REST API, which returns much more detailed information for a single record than for a query. We can make this clearer in the GraphQL API, but ideally ORCID would support returning this information also in queries.

If we would be interested in supporting this requirement: Do you know who should we talk to?

I’m a bit confused about what is happening here.

The first query is looking for a ROR id. We don’t yet return ROR ids in our API responses (but will do by the end of the year), but we do return GRID ids. So I am assuming that the commons are doing something behind the scenes to find ORCID iDs with the corresponding GRID ids.

You can see this in the second query, which shows grid.10854.38 not Research Organization Registry (ROR) Search

@mhfenner You have the correct ORCIDs in the first query response. How do you work them out?

@TomDemeranville In GraphQL we can combine multiple REST calls into one GraphQL call. What is happening here is that in the first part we get the GRID ID for ROR ID “Research Organization Registry (ROR) Search”, and in the second part query the ORCID API for the affiliation defined by the GRID ID.

For those who don’t know Tom, he is the ORCID Product Director.

Ah, so you use the search API for a specific GRID, right?

Yes. Which is easy at this point, as GRID and ROR map perfectly.

So this might be somewhat helpful, as it at least includes the other affiliation names: https://pub.orcid.org/v3.0/expanded-search/?q=grid-org-id:grid.10854.38 . I can see a case for including their ORG ids as well.

Thanks to both of you for giving a peak behind the curtains :slight_smile:

Now I see, when I start querying at the organization level, I only get the attributes in the link Tom Demeranville provided,
these are ORCID, givenName, familyName and a list of names of institutions. So not only employment is empty but also for example the attributes links or country.
(Btw is there a documentation which API calls are made under the hood of datacite commons?)

But now there is another question:
How come I get a different number of connected ORCIDs to an organization in the ORCID API and in datacite commons?
When I follow Tom Demeranville’s link I get a result of 151 people connected to the gridid and when I use the organization query from my previous post the totalCount is 435?

Sandra, you can always look at the source code if you are comfortable with Ruby, e.g. here: lupo/app/graphql/types at master · datacite/lupo · GitHub. GraphQL in the backend is a bit complex, even more so for these examples where we combine API calls to ROR, ORCID and even a bit of Wikidata.

For the discrepancy in numbers I suggest you compare the results by ORCID ID and other metadata, I have no easy explanation.

And to be clear, DataCite Commons is using the same public ORCID REST API that you can use, there are no “secret” API calls between DataCite and ORCID, also not any ORCID member API calls.