Skip to content
/ scibot Public
forked from SciCrunch/scibot

Receive an article, parse RRIDs, resolve them, create annotations, log results

License

Notifications You must be signed in to change notification settings

tkanai/scibot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RRID (aka SciBot)

A tool and companion service used to:

  • find RRIDs in articles
  • look them up in the SciCrunch resolver
  • create Hypothesis annotations that anchor to the RRIDs and display lookup results

Getting Started

  • Create the Hypothesis account under which annotations will be created
  • Generate an api token at https://hypothes.is/profile/developer
  • Specify HOST, PORT, API TOKEN, and USERNAME
  • python rrid.py
  • note and install missing libraries
  • python rrid.py

Capturing the bookmarklet

Visit http://HOST:PORT/bookmarklet which produces this page:

To install the bookmarklet, drag this link -- rrid -- to your bookmarks bar.

If you need to copy/paste the bookmarklet's code into a bookmarklet, it's here:

javascript:(function(){var xhr=new XMLHttpRequest();var params='uri='+location.href+'&data='+encodeURIComponent(document.body.innerText);xhr.open('POST','http://localhost:8080/rrid',true);xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');xhr.setRequestHeader('Access-Control-Allow-Origin','*');xhr.onreadystatechange=function(){if(xhr.readyState==4)console.log('rrids: '+xhr.responseText)};xhr.send(params)}());

Using the bookmarklet

Visit an article that contains RRIDs, click the bookmarklet

Checking results in the browser

The found RRIDs are logged to the JavaScript console

Checking results on the server

The found RRIDs are logged to timestamped files, along with the text of the article that was scanned for RRIDs

Setup on amazon

  1. ssh in to the host that will serve the script
  2. sudo yum install gcc libxml2 libxml2-devel libxslt libxslt-devel python34 python34-devel python34-pip
  3. sudo alternatives --set python /usr/bin/python3.4
  4. sudo pip install requests pyramid lxml
  5. clone this repository
  6. change host and port for external http access
  7. export RRIDBOT_USERNAME=someusername
  8. export RRIDBOT_GROUP=somegroupname
  9. unset HISTFILE
  10. export RRIDBOT_API_TOKEN=sometoken
  11. create a screen session
  12. in the screen session run sudo -E ~/scibot/rrid.py in the folder where you want to save the log files (-E preserves the environment variables)

Retrieving data

Use export.py to dump a spreadsheet of RRIDs mined from the data. In the folder for this git repository run the following commands.

  1. export RRIDBOT_USERNAME=someusername
  2. export RRIDBOT_GROUP=somegroupname
  3. unset HISTFILE
  4. export RRIDBOT_API_TOKEN=sometoken
  5. python export.py

About

Receive an article, parse RRIDs, resolve them, create annotations, log results

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%