GSoC/GCI Archive
Google Code-in 2014 Wikimedia Foundation

Citoid: Use requestFromPubMedID method in lib/distinguish.js if identifier is a PMID or PCMID

completed by: Geoffrey Mon

mentors: Andre Klapper, Mvolz

citoid is a Node.js application (written in Javascript) that retrieves information about a webpage, book, journal article, etc. given a URL to the webpage or some other identifier, like DOI (digital object identifier).

It uses another open source project, Zotero's translation-server, also written in Javascript, to do a lot of the work. Doing this work may involve reading both citoid and translation-server code. In order to get citoid working on your computer, you'll need to download both Node version 10.0 (for citoid) and xpcshell version 29.0 (for Zotero) to get both of them working. Citoid is a very new project so the code is rough around the edges and may change a lot- but that means there's lots of code to write! There are installation instructions and more information available athttps://www.mediawiki.org/wiki/Citoid

See https://phabricator.wikimedia.org/T78769 for the corresponding bug report. In method lib/distinguish.js, currently only DOIs are detected in the search field (coming from the api endpoint only: see https://www.mediawiki.org/wiki/Citoid/API#Making_a_request_to_api.2F_endpoint_.28GET.29). If the value of the field isn't a DOI, distinguish assumes the value is a URL and uses the method requestFromURL accordingly. However, a requestFromPubMedID method was recently added (as a GCI task!!). Use RegEx (regular expressions) to determine if the value of the search field is a PMID or PCMID, and if it is, use the requestFromPubMedID method (which takes either value- PMCIDs must be prefixed with PMC to be recognized by the method).

Keep in mind these are user-entered values, so they may contain extra spaces, or be missing the PMC prefix (which you'll need to add to the value if it is missing).