Extension:PubmedParser

What can this extension do?
This extension provides a parser keyword (#PMID) to fetch article information by unique ID from the Pubmed database. It outputs the article information formatted as Wiki markup for a template. The template can be defined inside the Wiki and adjusted as needed.

Compared with the other, very useful extension Pubmed, this extension can be fully configured using Wiki messages (see the special page "Sytem Messages" in your wiki). It does not require editing configuration files on the server.

PubmedParser fetches information on a single article at a time only. If you would like to generate lists of article, please have a look at the Pubmed extension.

If the Cite extension is installed, you can add an additional parameter to the #PMID keyword, and PubmedParser will generate a   structure for you. This makes it extremely easy to insert reusably references into your Wiki page.

Usage
To retrieve the article with PMID 19782018, insert the following into your page:

This will produce the following output:

However, you will never get to see this output, since   represents a template, which is immediately processed by the MediaWiki software.

Notes:
 * The template "pubmed" must exist in your wiki; otherwise, "Template:pubmed" will be inserted in red into your displayed page (click on the red link to create the template).
 * You can fully customize the names of the template itself as well as the names of the parameters of the template (see below)).
 * Your template does not need to use all parameters; unused parameters will be discarded.
 * authors is an abbreviated list of the author names; use allauthors if you need all of the names.
 * journal is the full journal name as stored in Pubmed; use journala to get the ISO abbreviation.

Thus, if your template looks like this:



You will get this:

Template parameters
You can use the following parameters in your "pubmed" template. Note that you can edit all parameter names (as well as the name of the template itself) according to your needs (see Customization below).

Example template "pubmed"


Formatted example:

Note: This template requires the [Help:Extension:ParserFunctions ParserFunctions] extension (which provides  ) to linkt the DOI only if it is contained in the Pubmed data.

Adding tags automatically
You may add an additional parameter to the #PMID call to make the PubmedParser automatically insert   tags. The Cite extension will use these tags to build your bibliography. To reuse the reference, simply insert  .

Example:

This will produce the following output:

Since this output is immediately parsed again by MediaWiki, you will never get to see it this way; instead, you will see the footnote generated by the Cite extension, which contains whatever output your template "pubmed" produces from this.

To cite this same paper again, simply type  

Customization
You can customize the name of the template as well as the names of the parameters by editing the system messages of your wiki: Go to Special:AllMessages and filter for "pubmedparser".

Download instructions
Download the archive (zip file or tar ball) and extract it in.

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

Configuration parameters
There is one configuration variable that you may want to adjust to your needs:

If this path exists and is writable for the web server, PubmedParser will locally store the XML data of the articles in this path. This accelerates retrieval of article information when a page is edited. Note that viewing of a page (rather than editing it) does not trigger information retrieval from Pubmed, as the information for unchanged Wiki pages is cached by the MediaWiki software regardless of this setting.

Forcing reload from Pubmed
Occasionally, Pubmed article information is updated, e.g. when an article that was initially published online-only appears in print. When using the cache feature, you can force retrieval of information from Pubmed by adding a 'reload' parameter to your #PMID call:

or

It goes without saying that the updated information is stored in the cache folder.

Note that reloading only occurs when a page is edited but not when it is viewed. Therefore, you can leave the 'reload' parameter in your #PMID call without causing superfluous download requests from Pubmed. The next time you edit a page, you can remove the 'reload' option, and the article information will be retrieved from cache again.

Code
Source code is available as a Git repository and can be browsed at sf.net/p/pubmedparser/code.