SoPH Faculty Article Counts

Setup:

Initialize workspace with some code imports, etc.


In [1]:
# Import dependencies
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import uuid
%matplotlib inline
from IPython.html import widgets
from IPython.display import display
from IPython.display import HTML
from IPython.display import Javascript
from sophcollab.namesearch import PubmedNameSearch

Input:

Enter a list of faculty member names in the text box below (copy/paste from source, etc). The names may be written as either '{first} {last}' or '{last}, {first}', but should only be one per line. Then click the 'Run Search' button to start the search for publication information.


In [2]:
data = None
# Display form input widgets
names_input = widgets.TextareaWidget()
names_input.description = "Enter faculty names (one per line)"
display(names_input)
run_btn = widgets.ButtonWidget(description="Run Search")
display(run_btn)
div_id = str(uuid.uuid4())
progress_bar = HTML(
"""
<div style="width: 500px;">
    <div id="%s" style="background-color: blue; width: 0%%; display: block">&nbsp;</div>
</div>
""" % div_id)

def update_progress_bar(num_complete, total_num):
    display(Javascript("$('div#%s').width('%i%%')" % (div_id, round(float(num_complete)/total_num*100))))
            
def on_run_button_clicked(btn):
    global data
    display(progress_bar)
    # Run the article count search for the list of names
    article_counts = PubmedNameSearch(names_input.value.splitlines()).article_counts_by_name(update_progress_bar)
    if len(article_counts) > 0:
        data = pd.DataFrame.from_dict(article_counts, 'index')
        data.columns=["articles"]
    display(Javascript("$('div#%s').hide()" % (div_id)))

run_btn.on_click(on_run_button_clicked)

Output

Display the results of the search for article information for the faculty members.

Summary Statistics

Some simple summary statistics are shown below.


In [3]:
if data is not None:
    display(data.describe())
Histogram

A display of the occurances of faculty member article counts.


In [4]:
if data is not None:
    data.hist()
    plt.title("Faculty Article Counts")
    plt.xlabel("Number of Articles")
    plt.ylabel("Occurences")
Faculty Listing

Full listing of article counts for the given list of faculty


In [5]:
display(data)


None

In [ ]: