ropensci-archive / rplos

:warning: ARCHIVED :warning: R client for the PLoS Journals API
Other
314 stars 107 forks source link

Is there any way to automagically detect DOI vs. pmid vs. pmcid vs. mendeley ID? #24

Closed sckott closed 11 years ago

sckott commented 11 years ago

Right now the function alm (just changed name from almplosallviews) has four parameters for each of the four ID types, and you can only use of them. It would be nice to be able to detect them automatically, but Pubmed IDs (pmid) and and PubMed Central IDs (pmcid) as far as I can tell can not be disambiguated.

Any thoughts anyone?

mfenner commented 11 years ago

I think the automatic distinction between DOI and pmid is the most interesting, and should be easy.

Using info=summary the PLOS ALM API can be used to convert between PLoS identifiers, e.g. pmids to DOIs. Other identifiers (e.g. Scopus or Microsoft Academic Search) may be added in the future.

sckott commented 11 years ago

Right, that is an important distinction.

Yes, you can call info=summary to get other identifiers, but the original call has to specify what type of identifier with argument "type" if not DOI, right (as the default is doi)?

What I'm trying to get at is an automatic way of identifying which type of identifier within the R function itself so the user doesn't have to worry about specifying which type of identifier. But unfortunately there is no way to tell apart pmid and pmcid.

mfenner commented 11 years ago

Sometimes the PMCID is written as PMC1852221, but that is unfortunately not common practice. And I wouldn't know if pmid and pmcid use a different number range or that there is another way to tell them apart other than by web query.

In ScienceCard I use Ruby code to automatically detect a pmid and doi. If identifier is a number, treat as pmid, else if starts with 10.1, treat as doi, else handle as missing identifier:

# input is a number, i.e. PubMed ID
if (true if Float(params[:input]) rescue false)
  @article = Article.find_or_initialize_by_pub_med(params[:input])
# input is a DOI
elsif params[:input].match(/^10./)
  @article = Article.find_or_initialize_by_doi(params[:input])
else
  @article = Article.new
end
sckott commented 11 years ago

Yes, that would be great if we could append the 'PMC' to pmcid's, but I don't think that works with the plos search or alm API. For example, this doesn't work:

http://alm.plos.org/api/v3/articles?ids=PMC212692&type=pmcid

Agreed, detecting difference between DOIs, and Mendeley IDs, versus pmcid and pmid is easy because character vs. numeric, and DOI's and Mendeley IDs are quite different so would be easy to disambiguate.

mfenner commented 11 years ago

If you think this is important, I can change the PLOS code to expect pmcids in the format PMC...

sckott commented 11 years ago

I was just trying to make it easier for users so they don't have to specify what type of identifier it is.

First I will see if there is a way to detect difference between Pubmed IDs and PubMed Central IDs.

On Mon, Nov 19, 2012 at 7:34 AM, Martin Fenner notifications@github.comwrote:

If you think this is important, I can change the PLOS code to expect pmcids in the format PMC...

— Reply to this email directly or view it on GitHubhttps://github.com/ropensci/rplos/issues/24#issuecomment-10517808.

karthik commented 11 years ago

Good question. This could be addressed in many ways. Allow the user to choose. They could either do:

pmcid = 212692 or id = PMC212692. So supply everything as a vector with identifier name appended in front, or supply a list with separate vectors for each type. See altmetrics() in rAltmetric for an example.

sckott commented 11 years ago

Just for self reference, for example for a DOI supplied by user:

# If an doi id is not prefixed by "id", add it in.
if(!is.null(doi)) {
    prefix <- as.list((strsplit(doi,'/'))[[1]])[[1]]
    if(prefix != "doi")
         doi <- paste0("doi", "/", doi)
 }
sckott commented 11 years ago

don't think this is an issue anymore