Page MenuHomePhabricator

Investigate PDF URLs with DOIs returning a warning in logstash
Closed, DuplicatePublic

Description

Turns out, that PDF URLs that contain a DOI already return metadata in most cases. Zotero can look for DOIs that are part of another string.

Examples, that work:

Example, that does not work:

The last one is possibly not working, because Zotero does not know, when the DOI is ending. In theory the "/pdf" could be part of it, but it is not.

But in all cases the logstash registers a warning. Find out, why that ist.

Event Timeline

One idea for the last example: It sounds like the code currently extracts the substring "10.3389/fpsyg.2010.00001/pdf" as the possible DOI, but that fails. What about this: Split the string at word boundaries with a regex like '10.3389/fpsyg.2010.00001/pdf'.split( /(?=\b\W)/ ) and implement a loop that tries again with the next possible versions of the substring. The second attempt uses "10.3389/fpsyg.2010.00001", then possibly "10.3389/fpsyg.2010", and so on. That loop should obviously enforce some sensible limits, e.g. it can only run a maximum of 3 times, and the remaining candidate string must have at least 9 characters or more (assuming the absolute smallest DOI looks something like "10.1000/1").

https://support.datacite.org/docs/doi-basics#suffix mentions a list of characters that "should not be included in a DOI suffix". I'm not sure if this is only a recommendation or a strict rule. In any case, this list can be used to improve the suggested regex:

'10.3389/fpsyg.2010.00001/pdf'.split( /(?=\b[;\/?:@&=+$,!])/ )
[ '10.3389', '/fpsyg.2010.00001', '/pdf' ]

Here the second split creates exactly the candidate we are looking for. The first split needs to be ignored because the first slash is required in a DOI.