datacite / bracco

Frontend for the DataCite DOI Fabrica service
https://doi.datacite.org
MIT License
13 stars 8 forks source link

I click "Update DOI" button, nothing happens (as in NOTHING happens). #188

Closed kjgarza closed 5 years ago

kjgarza commented 5 years ago

Expected Behaviour

When I update doi metadata in Fabrica using Upload file with a URL (to a landing page with schema.org). The metadata should get updated without errors.

Current Behaviour

The new pages like this one

https://datasets.aida.medtech4health.se/10.23698/aida/drsk

use json-ld, and I would like to be able to just point Fabrica to each of these pages and press "Update DOI", but when I put that URL (or indeed the entire json-ld blob) into the main text field on the "Update DOI (File Upload)" page nothing happens. No error message, and I'm not redirected anywhere, just nothing.

details: https://usersnap.com/a/#/datacite/p/datacite-41ebcc0f/579

Steps to Reproduce

  1. Create DOI with Upload file and https://datasets.aida.medtech4health.se/10.23698/aida/drsk
  2. Update same doi with Upload file and different url
  3. click update

Context (Environment)

Production Envrioment.

Hypothesis

The API return a 422 error on updating, it could be that the description fields are not "cleaned" before sending the information.

Detailed Description

Possible Implementation

Front logo Front conversations

richardhallett commented 5 years ago

This bug actually appears to be related to attempting to update an older schema version to a newer version i.e. 3 to 4 via gathering the data from a JSON-LD endpoint.

The steps to reproduce:

  1. Create a Findable DOI

  2. Use this metadata as an example:

    <?xml version="1.0" encoding="UTF-8"?>
    <resource xmlns="http://datacite.org/schema/kernel-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
    <identifier identifierType="DOI">10.23698/AIDA/DRSK</identifier>
    <creators>
    <creator>
      <creatorName>Karin Lindman</creatorName>
      <affiliation>Department of Clinical Pathology, Region Östergötland, Linköping, Sweden</affiliation>
    </creator>
    <creator>
      <creatorName>Jerónimo F. Rose</creatorName>
      <affiliation>Center for Medical Image Science and Visualization (CMIV), Linköping University, Linköping, Sweden</affiliation>
    </creator>
    <creator>
      <creatorName>Martin Lindvall</creatorName>
      <affiliation>Sectra AB, Sweden</affiliation>
    </creator>
    <creator>
      <creatorName>Caroline Bivik Stadler</creatorName>
      <affiliation>Center for Medical Image Science and Visualization (CMIV), Linköping University, Linköping, Sweden</affiliation>
    </creator>
    <creator>
      <creatorName>Claes Lundström</creatorName>
      <affiliation>Center for Medical Image Science and Visualization (CMIV), Linköping University, Linköping and Sectra AB, Sweden</affiliation>
    </creator>
    <creator>
      <creatorName>Darren Treanor</creatorName>
      <affiliation>Department of Clinical Pathology, Region Östergötland, Sweden; Section of Pathology and Tumour Biology, Leeds Institute of Cancer and Pathology, University of Leeds and Department of Cellular Pathology, St. James University Hospital, Leeds, UK</affiliation>
    </creator>
    </creators>
    <titles>
    <title>Skin data from the Visual Sweden project DROID</title>
    </titles>
    <publisher>Analytic Imaging Diagnostics Arena (AIDA)</publisher>
    <publicationYear>2019</publicationYear>
    <descriptions>
    <description descriptionType="Other">_Data used in research study (to be published).</description>
    </descriptions>
    <rightsList>
    <rights rightsURI="">Restricted access</rights>
    </rightsList>
    </resource>
  3. Then attempt to update with the newer schema via a landing page URL: https://datasets.aida.medtech4health.se/10.23698/aida/drsk

This then generates the 422 mentioned above.

yohell commented 5 years ago

Thank you Richard! I can confirm that the workaround you emailed me separately works:

However to solve that specific DOI, I updated the schema manually, I created another temporary draft DOI, used the URL to generate the schema and then copied that with the correct DOI in the xml to this DOI, then deleted the temporary DOI. This isn't an ideal work-around but it allowed me to update the metadata for this DOI.

I've used it to update the other DOIs that were causing me problems.

kjgarza commented 5 years ago

This is Lupo API Error, rather than Fabrica

{
  "errors": [
    {
      "source": "xml",
      "title": "No matching global declaration available for the validation root. at line 2, column 0"
    }
  ]
}
kjgarza commented 5 years ago

When updating a DOI using schema.org url upload there is not schema version. the API merges the update with the old doi information.

https://github.com/datacite/lupo/blob/0e351994289c145aaeeae968fa2c48a3ab91f7b8/app/controllers/dois_controller.rb#L288

If the old DOI is in previous version, then it will cause conflict.

Probably the solution is to default to lastest version when the metadata is valid and there is no schema information.

The parser of the schema.org url is calling bolognese which seems to return nil if the schemaVersion is not supplied.

https://github.com/datacite/lupo/blob/0e351994289c145aaeeae968fa2c48a3ab91f7b8/app/models/concerns/crosscitable.rb#L40

https://github.com/datacite/bolognese/blob/df6504f13ef063cc552389836e144a1c9cbb3eb2/lib/bolognese/readers/schema_org_reader.rb#L165

kjgarza commented 5 years ago

Actually,

https://github.com/datacite/lupo/blob/0e351994289c145aaeeae968fa2c48a3ab91f7b8/app/controllers/dois_controller.rb#L288

Refers to the version of schema.org, not the version of the datacite schema.

https://schema.org/schemaVersion

So when using the Reader in crosscite we will never get the datacite schema version.

I think the solution should be to default the latest schema version in LUPO controller when we have a schema.org upload.

kjgarza commented 5 years ago

confirmed with https://doi.test.datacite.org/clients/ethz.ubasojs/dois/10.12685%2Fh984-0f68/