Citoid: Use requestFromPubMedID method in lib/distinguish.js if identifier is a PMID or PCMID
completed by: Geoffrey Mon
mentors: Andre Klapper, Mvolz
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).