The orcid api and generating a bibtex file from it

| categories: orcid, python | tags:

I found this interesting package orcid-python 0.1 : Python Package Index . Unfortunately, it seems to have some issues and it did not work for me. But, the idea is pretty simple, there is a restful API (see http://members.orcid.org/api/tutorial-retrieve-data-public-api-curl-12-and-earlier ) that we can use to retrieve data. We explore that a bit here.

I have an orcid:0000-0003-2625-9232 which contains my data. First, we just retrieve some basic information using Python.

import requests
import json

resp = requests.get("http://pub.orcid.org/0000-0003-2625-9232",
                    headers={'Accept':'application/orcid+json'})

print json.dumps(resp.json(),
                 sort_keys=True,
                 indent=4, separators=(',', ': '))
{
    "message-version": "1.1",
    "orcid-profile": {
        "client-type": null,
        "group-type": null,
        "orcid": null,
        "orcid-activities": {
            "affiliations": null
        },
        "orcid-bio": {
            "applications": null,
            "contact-details": {
                "address": {
                    "country": {
                        "value": "US",
                        "visibility": null
                    }
                },
                "email": []
            },
            "delegation": null,
            "external-identifiers": {
                "external-identifier": [
                    {
                        "external-id-common-name": {
                            "value": "ResearcherID"
                        },
                        "external-id-orcid": {
                            "host": "orcid.org",
                            "path": "0000-0001-7707-4137",
                            "uri": "http://orcid.org/0000-0001-7707-4137",
                            "value": null
                        },
                        "external-id-reference": {
                            "value": "A-2363-2010"
                        },
                        "external-id-url": {
                            "value": "http://www.researcherid.com/rid/A-2363-2010"
                        }
                    },
                    {
                        "external-id-common-name": {
                            "value": "Scopus Author ID"
                        },
                        "external-id-orcid": {
                            "host": "orcid.org",
                            "path": "0000-0002-5982-8983",
                            "uri": "http://orcid.org/0000-0002-5982-8983",
                            "value": null
                        },
                        "external-id-reference": {
                            "value": "7004212771"
                        },
                        "external-id-url": {
                            "value": "http://www.scopus.com/inward/authorDetails.url?authorID=7004212771&partnerID=MN8TOARS"
                        }
                    }
                ],
                "visibility": null
            },
            "keywords": {
                "keyword": [
                    {
                        "value": "Computational catalysis, electrochemistry, CO2 capture"
                    }
                ],
                "visibility": null
            },
            "personal-details": {
                "family-name": {
                    "value": "Kitchin"
                },
                "given-names": {
                    "value": "John"
                }
            },
            "researcher-urls": {
                "researcher-url": [
                    {
                        "url": {
                            "value": "http://kitchingroup.cheme.cmu.edu"
                        },
                        "url-name": {
                            "value": "Research website"
                        }
                    }
                ],
                "visibility": null
            },
            "scope": null
        },
        "orcid-history": {
            "claimed": {
                "value": true
            },
            "completion-date": {
                "value": 1376581428004
            },
            "creation-method": "WEBSITE",
            "last-modified-date": {
                "value": 1427557747595
            },
            "source": null,
            "submission-date": {
                "value": 1376581211104
            },
            "visibility": null
        },
        "orcid-identifier": {
            "host": "orcid.org",
            "path": "0000-0003-2625-9232",
            "uri": "http://orcid.org/0000-0003-2625-9232",
            "value": null
        },
        "orcid-preferences": {
            "locale": "EN"
        },
        "type": "USER"
    }
}

That information is not too interesting, but it would allow you to scrape out my website, scopus id, and researcher id. Next, we look at the publications orcid knows about for me. These are integrated from a few sources, notably my ResearcherID:A-2363-2010, scopusid:7004212771, and http://crossref.org . The next code block prints the bibtex entry for the first few entries. The bibtex entries are not too well formed, and would need some cleaning, but it is a pretty good start.

import requests
import json

resp = requests.get("http://pub.orcid.org/0000-0003-2625-9232/orcid-works",
                    headers={'Accept':'application/orcid+json'})

results = resp.json()
for i, result in enumerate( results['orcid-profile']['orcid-activities']
                            ['orcid-works']['orcid-work']):
    print result['work-citation']['citation'].encode('utf-8') + '\n'
    if i == 2:
        break
@article{Xu_2015,doi = {10.1021/jp511426q},url = {https://doi.org/10.1021/jp511426q},year = 2015,month = {mar},publisher = {American Chemical Society ({ACS})},volume = {119},number = {9},pages = {4827--4833},author = {Zhongnan Xu and Jan Rossmeisl and John R. Kitchin},title = { A Linear Response {DFT}$\mathplus$ U Study of Trends in the Oxygen Evolution Activity of Transition Metal Rutile Dioxides },journal = {J. Phys. Chem. C}}

@article{Xu_2015,doi = {10.1063/1.4914093},url = {https://doi.org/10.1063/1.4914093},year = 2015,month = {mar},publisher = {{AIP} Publishing},volume = {142},number = {10},pages = {104703},author = {Zhongnan Xu and John R. Kitchin},title = {Relationships between the surface electronic and chemical properties of doped 4d and 5d late transition metal dioxides},journal = {J. Chem. Phys.}}

@article{Boes_2015,doi = {10.1016/j.susc.2015.02.011},url = {https://doi.org/10.1016/j.susc.2015.02.011},year = 2015,month = {mar},publisher = {Elsevier {BV}},author = {Jacob Boes and Peter Kondratyuk and Chunrong Yin and James B. Miller and Andrew J. Gellman and John R. Kitchin},title = {Core level shifts in Cu{\textendash}Pd alloys as a function of bulk composition and structure},journal = {Surface Science}}

Let us look at a tabular form of that data so it is sortable. We attempt to remove some duplicates based on the title and doi. The duplicates come about because there is more than one source where this data is pulled from. This is a little tricky, we do a case insensitive title comparison, but that still fails if the titles have different white space in them, e.g. "111" vs "1 1 1", and different sources do that. Also, the DOIs are sometimes missing, and sometimes have different cases, and sometimes are not correct. This code tries to fix most of those issues.

import requests
import json

resp = requests.get("http://pub.orcid.org/0000-0003-2625-9232/orcid-works",
                    headers={'Accept':'application/orcid+json'})
results = resp.json()

data = []
TITLES, DOIs = [], []

for i, result in enumerate( results['orcid-profile']['orcid-activities']
                            ['orcid-works']['orcid-work']):
    title = str(result['work-title']['title']['value'].encode('utf-8'))
    doi = 'None'

    for x in result.get('work-external-identifiers', []):
        for eid in result['work-external-identifiers']['work-external-identifier']:
            if eid['work-external-identifier-type'] == 'DOI':
                doi = str(eid['work-external-identifier-id']['value'].encode('utf-8'))

    # AIP journals tend to have a \n in the DOI, and the doi is the second line. we get
    # that here.
    if len(doi.split('\n')) == 2:
        doi = doi.split('\n')[1]

    pub_date = result.get('publication-date', None)
    if pub_date:
        year = pub_date.get('year', None).get('value').encode('utf-8')
    else:
        year = 'Unknown'

    # Try to minimize duplicate entries that are found
    dup = False
    if title.lower() in TITLES:
        dup = True
    if (doi != 'None'
        and doi.lower() in DOIs):
        dup = True

    if not dup:
        # truncate title to first 50 characters
        print('| {3} | {0}  | {1} | [[doi:{2}]]|'.format(title[0:50], year, doi, result['work-type']))

    TITLES.append(title.lower())
    DOIs.append(doi.lower())
| JOURNAL_ARTICLE  | A Linear Response DFT+ U Study of Trends in the Ox | 2015 | doi:10.1021/jp511426q                                |
| JOURNAL_ARTICLE  | Relationships between the surface electronic and c | 2015 | doi:10.1063/1.4914093                                |
| JOURNAL_ARTICLE  | Core level shifts in Cu–Pd alloys as a function    | 2015 | doi:10.1016/j.susc.2015.02.011                       |
| JOURNAL_ARTICLE  | Estimating bulk-composition-dependent H2 adsorptio | 2015 | doi:10.1021/cs501585k                                |
| JOURNAL_ARTICLE  | Probing the Coverage Dependence of Site and Adsorb | 2014 | doi:10.1021/jp508805h                                |
| JOURNAL_ARTICLE  | Relating the electronic structure and reactivity o | 2014 | doi:10.1016/j.catcom.2013.10.028                     |
| JOURNAL_ARTICLE  | Electrocatalytic Oxygen Evolution with an Immobili | 2014 | doi:10.1021/ja5015986                                |
| JOURNAL_ARTICLE  | Identifying Potential BO 2 Oxide Polymorphs for Ep | 2014 | doi:10.1021/am4059149                                |
| JOURNAL_ARTICLE  | Simulating temperature programmed desorption of ox | 2014 | doi:10.1007/s11244-013-0166-3                        |
| JOURNAL_ARTICLE  | Probing the effect of electron donation on CO2 abs | 2014 | doi:10.1039/c3ra47097k                               |
| JOURNAL_ARTICLE  | Effects of concentration, crystal structure, magne | 2014 | doi:10.1021/jp507957n                                |
| JOURNAL_ARTICLE  | Effects of O 2 and SO 2 on the Capture Capacity of | 2013 | doi:10.1021/ie400582a                                |
| JOURNAL_ARTICLE  | Number of outer electrons as descriptor for adsorp | 2013 | doi:None                                             |
| JOURNAL_ARTICLE  | Interactions in 1-ethyl-3-methyl imidazolium tetra | 2013 | doi:https://doi.org/10.1016/j.molstruc.2013.01.046 |
| JOURNAL_ARTICLE  | Comparisons of amine solvents for post-combustion  | 2013 | doi:https://doi.org/10.1016/j.ijggc.2013.06.020    |
| JOURNAL_ARTICLE  | Chemical and Molecular Descriptors for the Reactiv | 2012 | doi:10.1021/ie301419q                                |
| JOURNAL_ARTICLE  | Spectroscopic Characterization of Mixed Fe–Ni Ox   | 2012 | doi:10.1021/cs3002644                                |
| REPORT           | Modeling Coverage Dependence in Surface Reaction N | 2012 | doi:10.2172/1149701                                  |
| CONFERENCE_PAPER | Vibrational spectroscopy characterization of CO2-i | 2012 | doi:None                                             |
| CONFERENCE_PAPER | The role of electrolytes in the oxygen evolution r | 2012 | doi:None                                             |
| JOURNAL_ARTICLE  | The outlook for improved carbon capture technology | 2012 | doi:10.1016/j.pecs.2012.03.003                       |
| JOURNAL_ARTICLE  | Structure and Relative Thermal Stability of Mesopo | 2012 | doi:10.1111/j.1551-2916.2012.05236.x                 |
| JOURNAL_ARTICLE  | Preface: Trends in computational catalysis         | 2012 | doi:10.1007/s11244-012-9808-0                        |
| CONFERENCE_PAPER | Exergetic analysis of chemical looping reforming   | 2012 | doi:None                                             |
| JOURNAL_ARTICLE  | Evaluation of a Primary Amine-Functionalized Ion-E | 2012 | doi:10.1021/ie300452c                                |
| CONFERENCE_PAPER | Electrocatalytic water oxidation using iron-center | 2012 | doi:None                                             |
| JOURNAL_ARTICLE  | Effects of strain, d-band filling, and oxidation s | 2012 | doi:10.1063/1.4746117                                |
| BOOK             | Coverage dependent adsorption properties of atomic | 2012 | doi:10.1039/9781849734776-00083                      |
| CONFERENCE_PAPER | Comparisons of solvents for post-combustion CO2 ca | 2012 | doi:None                                             |
| CONFERENCE_PAPER | Characterization of an ion exchange resin for CO2  | 2012 | doi:None                                             |
| CONFERENCE_PAPER | Assessing the ability of using first principles to | 2012 | doi:None                                             |
| JOURNAL_ARTICLE  | Universality in Oxygen Evolution Electrocatalysis  | 2011 | doi:10.1002/cctc.201000397                           |
| CONFERENCE_PAPER | The effect of CO 2 partial pressure on capture wit | 2011 | doi:None                                             |
| CONFERENCE_PAPER | Preparation of Mesoporous La 0.8Sr 0.2MnO 3 infilt | 2011 | doi:10.1149/1.3570235                                |
| JOURNAL_ARTICLE  | Identification of sulfur-tolerant bimetallic surfa | 2011 | doi:10.1021/cs200039t                                |
| JOURNAL_ARTICLE  | Effects of strain, d-band filling, and oxidation s | 2011 | doi:10.1063/1.3631948                                |
| CONFERENCE_PAPER | Determining the conditions necessary for optimal C | 2011 | doi:None                                             |
| JOURNAL_ARTICLE  | Configurational correlations in the coverage depen | 2011 | doi:10.1063/1.3561287                                |
| CONFERENCE_PAPER | An electronic structure based understanding of ami | 2011 | doi:None                                             |
| JOURNAL_ARTICLE  | CO2 Adsorption on Supported Molecular Amidine Syst | 2010 | doi:10.1002/cssc.201000056                           |
| JOURNAL_ARTICLE  | Separation of CO2 from flue gas using electrochemi | 2010 | doi:10.1016/j.fuel.2009.11.036                       |
| JOURNAL_ARTICLE  | New solid-state table: estimating d-band character | 2010 | doi:10.1080/08927022.2010.481794                     |
| JOURNAL_ARTICLE  | Simple model explaining and predicting coverage-de | 2010 | doi:10.1103/PhysRevB.82.045414                       |
| CONFERENCE_PAPER | Intrinsic and extrinsic factors associated with CO | 2010 | doi:None                                             |
| JOURNAL_ARTICLE  | Electrochemical concentration of carbon dioxide fr | 2010 | doi:10.1149/1.3432440                                |
| CONFERENCE_PAPER | Catalyzing the catalyst: Hydrogen dissociation and | 2010 | doi:None                                             |
| JOURNAL_ARTICLE  | Uncertainty and figure selection for DFT based clu | 2009 | doi:10.1080/08927020902833137                        |
| JOURNAL_ARTICLE  | Sulphur poisoning of water-gas shift catalysts: Si | 2009 | doi:10.1080/08927020902833129                        |
| JOURNAL_ARTICLE  | Step decoration of chiral metal surfaces           | 2009 | doi:10.1063/1.3096964                                |
| JOURNAL_ARTICLE  | Relating the coverage dependence of oxygen adsorpt | 2009 | doi:10.1016/j.susc.2009.01.021                       |
| JOURNAL_ARTICLE  | Hydrogen Dissociation and Spillover on Individual  | 2009 | doi:10.1103/PhysRevLett.103.246102                   |
| JOURNAL_ARTICLE  | Correlations in coverage-dependent atomic adsorpti | 2009 | doi:10.1103/PhysRevB.79.205412                       |
| CONFERENCE_PAPER | Catalyzing the catalyst: Novel pathways to hydroge | 2009 | doi:None                                             |
| JOURNAL_ARTICLE  | Atomistic thermodynamics study of the adsorption a | 2009 | doi:10.1016/j.jcat.2008.11.020                       |
| CONFERENCE_PAPER | Ancillary oxygen-fired combustion using electroche | 2009 | doi:None                                             |
| CONFERENCE_PAPER | Adsorbate Cu interactions and catalyst morphologie | 2009 | doi:None                                             |
| CONFERENCE_PAPER | <title>Rotational isomeric state theory applied to | 2008 | doi:10.1117/12.776303                                |
| CONFERENCE_PAPER | The effect of hydration on the adsorption of carbo | 2008 | doi:None                                             |
| CONFERENCE_PAPER | Pt-decorated electrocatalysts for direct alcohol f | 2008 | doi:None                                             |
| CONFERENCE_PAPER | PEM-based electrochemical separation of gases      | 2008 | doi:None                                             |
| CONFERENCE_PAPER | First principles, atomistic thermodynamics for sul | 2008 | doi:None                                             |
| CONFERENCE_PAPER | Evaluating uncertainty in Ab initio phase diagrams | 2008 | doi:None                                             |
| JOURNAL_ARTICLE  | ENVR 1-Basic research needs to assure a secure ene | 2008 | doi:None                                             |
| OTHER            | Density functional theory studies of alloys in het | 2008 | doi:10.1039/b608782p                                 |
| JOURNAL_ARTICLE  | Alloy surface segregation in reactive environments | 2008 | doi:10.1103/PhysRevB.77.075437                       |
| CONFERENCE_PAPER | A first principles evaluation of the role of subst | 2008 | doi:None                                             |
| CONFERENCE_PAPER | Pt nanoparticle electrocatalyst synthesis for dire | 2007 | doi:None                                             |
| CONFERENCE_PAPER | Pt nanoparticle anode electrocatalysts for direct  | 2007 | doi:None                                             |
| JOURNAL_ARTICLE  | Response to &quot;comment on 'Trends in the exchan | 2006 | doi:10.1149/1.2358292                                |
| JOURNAL_ARTICLE  | Trends in the exchange current for hydrogen evolut | 2005 | doi:10.1149/1.1856988                                |
| JOURNAL_ARTICLE  | Trends in the chemical properties of early transit | 2005 | doi:10.1016/j.cattod.2005.04.008                     |
| CONFERENCE_PAPER | Alloy surface segregation in reactive environments | 2005 | doi:None                                             |
| JOURNAL_ARTICLE  | The role of adsorbate-adsorbate interactions in th | 2004 | doi:None                                             |
| JOURNAL_ARTICLE  | Role of strain and ligand effects in the modificat | 2004 | doi:10.1103/PhysRevLett.93.156801                    |
| JOURNAL_ARTICLE  | Origin of the overpotential for oxygen reduction a | 2004 | doi:10.1021/jp047349j                                |
| JOURNAL_ARTICLE  | Modification of the surface electronic and chemica | 2004 | doi:10.1063/1.1737365                                |
| JOURNAL_ARTICLE  | Elucidation of the active surface and origin of th | 2003 | doi:10.1016/j.susc.2003.09.007                       |
| JOURNAL_ARTICLE  | A four-point probe correlation of oxygen sensitivi | 2003 | doi:10.1016/j.susc.2003.08.041                       |
| JOURNAL_ARTICLE  | A comparison of gold and molybdenum nanoparticles  | 2003 | doi:10.1016/s0039-6028(02)02679-1                    |
| JOURNAL_ARTICLE  | H3PW12O40-functionalized tip for scanning tunnelin | 2002 | doi:10.1073/pnas.072514399                           |
| JOURNAL_ARTICLE  | Preparation of paramagnetic ligands for coordinati | 1997 | doi:None                                             |
| JOURNAL_ARTICLE  | Preparation and Characterization of a Bis-Semiquin | 1995 | doi:10.1021/jo00117a004                              |
| JOURNAL_ARTICLE  | SYNTHESIS AND CHARACTERIZATION OF TRISEMIQUINONE L | 1995 | doi:None                                             |

Not too bad. Clearly we could do a lot more work to fine tune exactly what data we retrieve, and then what to do with it. The tools are all here to do that.

Copyright (C) 2015 by John Kitchin. See the License for information about copying.

org-mode source

Org-mode version = 8.2.10

Discuss on Twitter