Add Reviewers to Database

January 2014 Neil D. Lawrence

Updated October 2014

This notebook allows us to merge in reviewers from a CMT export file. It is to be used when you aren't confident about whether the reviewers being merged in are already in the data base or not. For this reason it will query you more carefully over whether a reviewer should be added.

Backing Up

The first thing is to load in the reviewer data base. I suggest you back up your data base before doing this operation just in case something goes wrong.

In [ ]:
import cmtutils
db = cmtutils.reviewerdb('test.db')

Adding Reviewers from CMT Export

Now we specify the source of (potential) reviewers we are loading in. In this notebook we consider two examples where we are loading in new data base users. In the first example the source could be the previous list of reviewers from the conference (found via a CMT export).

In [ ]:
# this file can be a CMT user list exported
# this field will tag the data base for the source of the user.
fieldname = 'FromAISTATS2012' 

Now we can add in the field for recording the reviewer source to the data base.

In [ ]:
db.add_field(fieldname, 'INTEGER') # add the recording field if it's not already present

# This line will set the field name to NULL if required. Turned off by default.
if False:
    db.update_fields(db.ids(), fieldname=fieldname, fieldvalue=None)

If we want to see the list of new reviewers we can check who they are. They are stored as a pandas data frame.

In [ ]:

Adding Reviewers to the Data Base

Try and match or add the reviewer to the system. You don't want to necessarily add them as reviewers straight away, but you may need to know the origin of the new users in the data base. For that reason we add the user_list field name to the data base and set its value to 1 if any users are added to the data base from this source.

You will be queried for each user whether you want them to be added to the local data base.

In [ ]:
db.add_users(new_users.reviewers, yes=False, query=True, fieldname=fieldname)

Now you have finished the queries you can check how many users you've added with the following SQL query on the data base.

In [ ]:
# This is number of added users.
db._execute_sql('SELECT COUNT(Active) FROM Reviewers WHERE ' + fieldname + '=1;')

Exporting Reviewers

Now we can export the reviewers ready for importing into CMT.

In [ ]:
db.export_reviewers(filename='aistats_2012_reviewers.txt', sql=fieldname + '=1')

Incorporating Google Sheet Information

For NIPS 2014 we had our area chairs suggest reviewers in a google spreadsheet. We used a form for this. The form created reviewer suggestions with the fields we need for CMT (We also stored our own suggestions for reviewers in a google spreadsheet. Below we show how to extract informatinon from the google spreadsheet (the spreadsheet key is set in the defaults.cfg file or your own .cmt_user.cfg configuration file).

In [ ]:
from config import config
spreadsheet_key = config.get('google docs', 'reviewer_candidate_key')
spreadsheet_name = 'Area Chair Reviewer Suggestions'
fieldname = 'AreaChairSuggestion'
ds = cmtutils.drive_store(spreadsheet_key, spreadsheet_name) # this opens the google sheet.
# Column_fields causes these new column names to replace those in the spreadsheet 
# (which come from the form) in the pandas DataFrame we recover
column_fields={'1':'TimeStamp', '2':'FirstName', '3':'LastName', '4':'MiddleNames', 
               '5':'Email', '6':'Institute', '7':'Nominator', '9':'ScholarID'}

Then if you want to add them to the data base you can use the add_users() feature as before.

In [ ]:
db.add_field(fieldname, 'INTEGER') # add the recording field if it's not already present
db.add_users(ds.reviewers, yes=False, query=True, fieldname=fieldname)

Now we can export a tab separated values file ready for import into CMT.

In [ ]:
db.export_reviewers(filename='area_chair_suggestions.txt', sql=fieldname +'=1')