Pages

Sunday, August 18, 2019

References, citations, and bibliographies. Oh, and tools and formats and APIs.

Give an explorer some tools, and they will study things, they will find new (or better) answers. Every scientist, boy/girl scout, teacher knows this. Give a kid a ball, and they will invent a game. Give them a magnifier, and they will explore a new world.

In the first two, hundreds of years of science, the instruments where physical things, and often the instrument is merely the human brain. In the past 30 years, electronic brains (aka software) has become an increasingly important instrument in software. It's not judgmental, biased, but, of course, only as good as the source code. So, in 1994 I got a new instrument: the Internet (yes, with a capital at the time). One of the things I did at the time was play with new instruments. For example, I played with DocBook. But DocBook did not have BibTeX. So, I wrote BibTex for DocBook. I called it JReferences. It worked for me.

Give an explorer some tools, and they will study things. I got educated and become a scholar.

Now, one thing I love is to show people new instruments (which I do with this blog, for example) and to educate people in the tricks of doing research and being a scholar (~0.5 FTE of my day job). When Lars found an interesting topic, I only had to give him the tools and he would use them. And with time, he started developing new tools, new instruments. Now fairly, he's more dedicated than me, and the tool I want to blog about is so much more well-done than my JReferences :)

Top half of the first PDF page of the article.
So, at some point I realized that it was worth writing it up, and I advised that. And he did. All I had to do is give him the instruments and explain some of the scholarly tricks, and he applied them very well, resulting in this PeerJ Computer Science publication: Citation.js: a format-independent, modular bibliography tool for the browser and command line (doi:10.7717/peerj-cs.214).

Give an explorer some tools, and they will study things, and they will improve our world.

So, Lars gave me a new instrument: citation.js. In the more than two years the tool now exists, I have used it for two things: first, I used it on my website to give references of typical literature. Second, I use it for the Groovy Cheminformatics with the Chemistry Development Kit and A lot of Bioclipse Scripting Language examples books, as explained in this blog post.

Now, Lars had already implemented a number of features requests I put in. The Altmetric logo was one of them, but also ORCID plugin, that will create a bibliography with just a short snippet of JavaScript and your ORCID identifier (oh, and a populated ORCID profile, of course).

He told me to use his template tool, and I gave it a try. I think I was an early adopter and the amount of documentation has improved since Friday, but with his help I wrote a plugin for PubMed identifiers. So, you can now simply put references in your webpages by just listing their PubMed identifiers (I used this tool to create a custom citation.js bundle with DOI, PubMed, and CSL support):

<html>
<head>
  <script src="./citation.js" type="text/javascript"></script>
  <script>
    const { Cite } = require('citation-js')
    
    async function main (pmid) {
        let example = await Cite.async(pmid)
    
        let output = example.format('bibliography', {
            format: 'html',
            template: 'vancouver',
            lang: 'en-US',
            append ({DOI}) { return `doi:${DOI}` }
        })
        document.getElementById("placeholder").innerHTML = output
    }
  </script>
</head>
<body onload="main('pmid:31281945')">
  <div id="placeholder">
</div>
</body>
</html>

Awesome! Give me some instrument, and I will try to find time to use it to study things. I think I'll be using citation.js in many projects in the coming years :) Note that the append() functionality can be used to add Altmetrics buttons or links to, say, EuropePMC. Well, just read his paper.

Give some a kid, and they will be proud.

No comments:

Post a Comment