Wednesday, February 2, 2011

Populate LinkedIn Publications using PubMed IDs

Note:  The LinkedIn-PubMed script has been updated and is discussed here.

LinkedIn now gives you the ability to add publications to your LinkedIn profile. Currently, each publication must be added manually including title, author list, data, abstract, etc. which can be a real drag if you need to enter more than a couple publications. If you're a Firefox user, you can use this simple script to fill in publication data by entering only a PubMed ID.

To install the script:
  1. Install the GreaseMonkey Firefox extension by going here and hitting "Add to Firefox".
  2. Install the LinkedIn-PubMed ID Lookup script by going here and hitting "Install".
  3. Edit your profile on the LinkedIn site and go down to the link that says "Add a publication". This link will come after your "Experience" section.
  4. You should see at the top of the form an input box for PubMed ID. Enter your id and hit the search button. The form should be filled out with the publication information as acquired from PubMed. If you're happy with the results, hit submit. Otherwise, edit to your liking and hit submit.

Here are screen shots of what the LinkedIn page looks like before you install the script:

and after:

Here's what the form looks like after submitting a PubmedId:

Some Technical Details

I imagine it's only a matter of time before LinkedIn adds PubMed look up or an equivalent convenience, so I didn't want to invest a huge amount of time in this endeavor. GreaseMonkey was a natural choice as it's designed for the task of enhancing existing web sites and doing mash-ups. In this case, I needed to make calls out to Entrez's EFetch, parse the XML response and populate the fields in the LinkedIn form. GreaseMonkey made the PubMed look up a snap, as its GM_xmlhttpRequest method allows for cross-site http requests, something normal JavaScript disallows for security reasons. GreaseMonkey scripts are written in JavaScript and I also brought in jQuery to facilitate manipulating the website's DOM.

As it turned out, the hardest part of the whole project was dealing with the author list. First, LinkedIn automatically includes the LinkedIn user's name in the authors list, so I needed to try to identify and remove the user in the authors reported by PubMed so that it wouldn't appear twice. My simple minded check has been working for my publications, but will surely slip up in some harder cases. The second problem was working with LinkedIn's own JavaScript used to make the author list dynamically increase or decrease as authors get added. In the end, blowing away their scripting and replacing it with my own seemed like the most expedient route. I borrowed heavily from their code to do this and the end result is a bit of an ugly jQuery/straight DOM jumble.

I was able to successfully enter all my publications, but I am certain there will be instances where it falls flat. Let me know how it works for you!