eprints / orcid_support_advance

ORCID Support Advance plugin
1 stars 6 forks source link

Improvements to ExportToOrcid.pm #6

Closed GFournie closed 5 years ago

GFournie commented 6 years ago

Hi,

In action_export, the write_orcid_record() result is tested for success with "$result->is_success()" and then behaves as if all the records have been successfully written.

But that not always the case. For example, if I export two eprints (with one of them already in orcid), $result->is_success() returns "true" even if only one export has been successful.

The result->content() must be analysed to know exactly what was happened...

<bulk:bulk ...>

    <error:error>
        <error:response-code>409</error:response-code>
        <error:developer-message>409 Conflict: You have already added this activity (matched by external identifiers.) If you are trying to edit the item, please use PUT instead of POST.</error:developer-message>
        <error:user-message>There was an error when updating the record. ...</error:user-message>
        <error:error-code>9021</error:error-code>
        <error:more-info>https://members.orcid.org/api/resources/troubleshooting</error:more-info>
    </error:error>

    <work:work put-code="932853" visibility="public">
        <common:created-date>2018-06-12T13:24:28.322Z</common:created-date>
        ...
    </work:work>

</bulk:bulk>

So, there were a successful export (work:work) and an unsuccessful one (error:error). To replace an item a PUT request must be issued instead of POST. And the put-code given with a successful import has to be given in the PUT request (so it should possibly need a new "orcid_put_code" field in the eprint dataset to store this value).

As is, the plugin is not able toi update records. Do you intend to improve ExportToOrcid.pm to make the update possible ?

(Anyway, the plugin is really very useful and, when updates are needed, users can delete records in Orcid before exporting them again from eprints. Not really optimal, but it is a working solution... Many thanks for your work!)

dennmuel commented 6 years ago

We're facing the same problem with our instance. If we find a solution, we'll get back to this issue with a PR. (Probably not before the midth of September though...) Also - if desired - we could provide some code to export more information to orcid (like language, ISBN)

Edit: Discussion about how to save the putcode in #12 .

dennmuel commented 5 years ago

I think this issue can be closed now (fixed with v.1.5).