Skip to content

Instantly share code, notes, and snippets.

@aanastasiou
Created June 19, 2017 20:49
Show Gist options
  • Save aanastasiou/47940583d3cff521eece438296b2fff0 to your computer and use it in GitHub Desktop.
Save aanastasiou/47940583d3cff521eece438296b2fff0 to your computer and use it in GitHub Desktop.
bibtex to JSONResume conversion
'''Athanasios Anastasiou June 2017
Reads a bib file and exports the 'publications' entry to be attached to some jsonResume file'''
import pybtex.database
import sys
import json
def formatEntry(anEntry):
'''Returns a dictionary with the required entries by the jsonresume schema'''
pubTitle = anEntry.fields['journal'] if 'journal' in anEntry.fields.keys() else anEntry.fields['booktitle'] if 'booktitle' in anEntry.fields.keys() else "";
return {"name":anEntry.fields['title'].replace("{","").replace("}","").replace("\&","\&"),
"publisher":pubTitle,
"releaseDate":anEntry.fields['year'] if 'year' in anEntry.fields.keys() else "",
"summary":anEntry.fields['abstract'] if 'abstract' in anEntry.fields.keys() else "",
"website":anEntry.fields['url'] if "url" in anEntry.fields.keys() else ""}
if __name__ == "__main__":
if len(sys.argv)<2:
sys.stdout.write("At least one parameter (the filename of the bibtex file containing the publications) is required.\n");
sys.exit(1)
else:
#Read bibtex
p = pybtex.database.parse_file(sys.argv[1])
#Build json
j = map(lambda x:formatEntry(x[1]),p.entries.items())
#Send to output
sys.stdout.write(json.dumps(j))
PyYAML==3.12
Pygments==2.2.0
argparse==1.2.1
backports.shutil-get-terminal-size==1.0.0
decorator==4.0.11
enum34==1.1.6
ipython==5.4.0
ipython-genutils==0.2.0
latexcodec==1.0.5
pathlib2==2.3.0
pexpect==4.2.1
pickleshare==0.7.4
prompt-toolkit==1.0.14
ptyprocess==0.5.1
pybtex==0.21
scandir==1.5
simplegeneric==0.8.1
six==1.10.0
traitlets==4.3.2
wcwidth==0.1.7
wsgiref==0.1.2
@article{anastasiou_barriers_2008,
title = {Barriers to the adoption of telehealth and the {Complete} {Ambient} {Assisted} {Living} {eXperiment} ({CAALYX})},
url = {https://doi.org/10.5281/zenodo.50075},
doi = {10.5281/zenodo.50075},
urldate = {2017-02-12},
author = {Anastasiou, Athanasios and Boulos, N Kamel Boulos and {The CAALYX Consortium}},
year = {2008},
note = {00000}
}
@inproceedings{athanasios_anastasiou_complete_2008,
title = {A {Complete} {Ambient} {Assisted} {Living} {eXperiment} ({CAALYX}) in {Second} {Life}®.},
url = {http://healthcybermap.org/CAALYXinSL/},
booktitle = {Proceedings of {MedNet}2008 - {The} 13th {World} {Congress} on the {Internet} in {Medicine}},
author = {{Athanasios Anastasiou} and Kamel Boulos, Maged N},
month = oct,
year = {2008},
note = {00000}
}
@article{jammeh_using_2015,
title = {Using {NHS} primary care data to identify undiagnosed dementia},
volume = {86},
number = {11},
journal = {Journal of Neurology, Neurosurgery \& Psychiatry},
author = {Jammeh, Emmanuel and Carroll, Camille and Pearson, Stephen and Escudero, Javier and Anastasiou, Athanasios and Zajicek, John and Ifeachor, Emmanuel},
year = {2015},
note = {00001},
pages = {e4--e4}
}
@inproceedings{anastasiou_novel_2010,
title = {A novel thresholding method for the analysis of functional connectivity networks of the brain},
booktitle = {Information {Technology} and {Applications} in {Biomedicine} ({ITAB}), 2010 10th {IEEE} {International} {Conference} on},
publisher = {IEEE},
author = {Anastasiou, Athanasios and Ifeachor, Emmanuel},
year = {2010},
note = {00001},
pages = {1--6}
}
@article{escudero_sensor_2013,
title = {Sensor {Proximity} {Bias} in {MEG} {Coherence}},
url = {https://doi.org/10.5281/zenodo.50073},
doi = {10.5281/zenodo.50073},
urldate = {2017-02-12},
author = {Escudero, Javier and Anastasiou, Athanasios and Fernandez, Alberto},
year = {2013},
note = {00000}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment