Skip to content

Instantly share code, notes, and snippets.

@eseiver
Created February 6, 2018 19:33
Show Gist options
  • Save eseiver/04dd7dfda32b2224548c6e21ae9b533b to your computer and use it in GitHub Desktop.
Save eseiver/04dd7dfda32b2224548c6e21ae9b533b to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "import os\nos.environ['PLOS_CORPUS'] = '~/allofplos_xml' # or wherever your XML is saved if it's not in the default directory\n\nfrom allofplos import Corpus, Article\n\ncorpus = Corpus()\narticle = Article(corpus.dois[0])",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# editor info for 10 random articles\nfor doi in corpus.random_dois(10):\n article.doi = doi\n display(doi, article.editor)",
"execution_count": 5,
"outputs": [
{
"data": {
"text/plain": "'10.1371/journal.pone.0119530'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['Tohoku University, JAPAN'],\n 'author_roles': {None: ['Academic Editor']},\n 'author_type': None,\n 'contrib_initials': 'MK',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Makoto',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Kanzaki'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0107524'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['University of Cape Town, South Africa'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'CMG',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Clive M.',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Gray'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0063821'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['The University of Tokyo, Japan'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'CH',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Chunyan',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'He'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0097676'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['University of California, San Francisco, United States of America'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'LC',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Linda',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Chao'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0069855'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['Ferrarotto Hospital, University of Catania, Italy'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'DC',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Davide',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Capodanno'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0091056'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['University of Sydney, Australia'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'M(GC',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Maura (Gee) Geraldine',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Chapman'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pgen.0010032'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['University of Michigan, United States of America'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'GA',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Goncalo',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Abecasis'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": "Warning: authors not matched correctly to author_roles for 10.1371/journal.pcbi.0040024\n"
},
{
"data": {
"text/plain": "'10.1371/journal.pcbi.0040024'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['Adolf-Butenandt-Institut, Germany'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'MS',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Manfred',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Schliwa'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0181498'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['Columbia University, UNITED STATES'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'JS',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Jeffrey',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Shaman'}]"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "'10.1371/journal.pone.0132554'"
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": "[{'affiliations': ['Institute of Automation, Chinese Academy of Sciences, CHINA'],\n 'author_roles': {None: ['Editor']},\n 'author_type': None,\n 'contrib_initials': 'JT',\n 'contrib_type': 'editor',\n 'editor_type': None,\n 'email': None,\n 'footnotes': [],\n 'given_names': 'Jie',\n 'group_name': None,\n 'ids': [],\n 'rid_dict': {'aff': ['edit1']},\n 'surname': 'Tian'}]"
},
"metadata": {},
"output_type": "display_data"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# to limit dois by other factors:\nfor doi in corpus.iter_dois:\n article.doi = doi\n if article.pubdate.year >= 2017 and article.journal == 'PLOS ONE' and article.type_ == 'research-article':\n display(doi, article.editor)",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "py3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.6.4",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment