RESQUE-Framework / website

The Research Quality Evaluation Scheme
https://resque-framework.github.io/website/
MIT License
2 stars 3 forks source link

Add basic doi validation / correction #52

Closed nicebread closed 10 months ago

nicebread commented 11 months ago

While working on the R scripts for the profile analysis, I had to normalize the dois, using this R script:

dois <- dois %>% 
  str_replace_all("doi: ", "") %>% 
  str_replace_all(" ", "") %>% 
  str_trim()

dois_normalized <- str_extract(dois, pattern="10.\\d{4,9}/[-._;()/:a-z0-9A-Z]+")
all_pubs$doi_links <- paste0("https://doi.org/", dois_normalized)

Because some dois were not valid, such as:

Can we do this normalization already in the web form? And add a quick check whether the constructed URL points to a valid web site? (And add a ✅ if it does, and a ❌ "doi is not valid" if it doesn't)

(related to #12)

alpkaanaksu commented 11 months ago

We actually replace the DOI with the DOI returned from the server, if user chooses to fetch the information automatically.

Maybe we can ask for the DOI first, then fill in the following fields for title and year using the information we get from the server. We can show a warning, if the DOI does not exist. So instead of Title -> Year -> DOI as we currently have it, we could have DOI -> Title -> Year, where we update title and year after the DOI changes.

Are publications without a DOI allowed? If not, we can also change Title and Year to uneditable info fields.

nicebread commented 11 months ago

Yes, great idea! We only want works that have a doi.

alpkaanaksu commented 11 months ago

This is how I implemented it:

https://github.com/nicebread/RESQUE/assets/68744864/602b8100-fceb-4854-a038-e3277b6b9c79

nicebread commented 11 months ago

Very nice! The only question is, how robust the doi retrieval is. Does it, for example, work with the following (valid) dois?

https://doi.org/10.15626/MP.2021.2911 https://doi.org/10.5964/ps.6029

Which service is used to resolve the dois?

Do we need a solution that user still can enter the title and date if the doi simply is not recognized by the system?

alpkaanaksu commented 11 months ago

I would assume that it works for any valid DOI, we get the information from doi.org.

fetch('https://doi.org/' + doi, {
      headers: {
          Accept: 'application/vnd.citationstyles.csl+json'
      }
})

The DOIs you are concerned about:

Screenshot 2023-10-26 at 18 08 17 Screenshot 2023-10-26 at 18 08 45
nicebread commented 10 months ago

Yes, implement it like that!

alpkaanaksu commented 10 months ago

I pushed my changes: 515b04038b9e0adebdcb97f467f964cd03bb1719

@nicebread you can try it.

nicebread commented 10 months ago

Works great! I tried it on a slow internet connection in the train, which caused a ~4 second delay until the title and year got retrieved. Could you add a status indicator (in the "Paper title" and "Year of publication" field), such as: "[circular loading indicator] Retrieving meta-data from doi.org ..."