Skip to content

inpho/pubssite

Repository files navigation

#pubssite README

Join the chat at https://gitter.im/iucogs/pubssite

API documentation

Note: This version is in development and this README is intended as a reference for project contributors

Citation functions

Collection functions

Parse a citation
URL: http://nupubs.cogs.indiana.edu/citation/parse
Method: POST
Input: A plaintext string in the body of the request
Output: A JSON object representing the newly created citation
Notes: Our project currently is using the excellent
Anystyle parser. We're still training it and working to improve its accuracy.

Retrieve one or more citations by their IDs
URL: http://nupubs.cogs.indiana.edu/citation/[IDs] Method: GET`
Input: A citation ID or a list of citation IDs delimited by commas. e.g.

http://nupubs.cogs.indiana.edu/citation/456
http://nupubs.cogs.indiana.edu/citation/456,452,4204

Output: A single JSON-encoded citation or a list of JSON-encoded citations

Retrieve a list of citations belonging to a given user
URL: http://nupubs.cogs.indiana.edu/citation/owner/[owner]
Method: GET
Input: String representing a nupubs user. e.g.

http://nupubs.cogs.indiana.edu/citation/owner/pjcraig

Output: A list containing JSON-encoded citations belonging to the nupubs user


Retrieve a list of citations belonging to a given collection
URL: http://nupubs.cogs.indiana.edu/collection/citations/[collection ID]
Method: GET
Input: A collection's ID. e.g.

http://nupubs.cogs.indiana.edu/collection/citations/345

Output: A JSON-encoded representation of the collection

Retrieve a collection by its collection id
URL: http://nupubs.cogs.indiana.edu/collection/[collection ID]
Method: GET
Input: A collection's ID. e.g.

http://nupubs.cogs.indiana.edu/collection/345

Output: A JSON-encoded representation of the collection

Retrieve a list of collections belonging to a given user
URL: http://nupubs.cogs.indiana.edu/collection/owner/[owner]
Method: GET
Input: A nupubs user. e.g.

http://nupubs.cogs.indiana.edu/collection/owner/pjcraig

Output: A list of JSON-encoded collections

Installing Pubssite

Installing MySQL Database

  1. Download and install MySQL Community Server 5.5:
    • Debian/Ubuntu: sudo apt-get install mysql-server-5.5 libmysqlclient-dev
  2. Download a database mirror (contact Jaimie).
  3. Import the database using the MySQL 5.5 Command Line Client (run mysql at a terminal or use the desktop shortcut):
    • CREATE DATABASE pubs; USE pubs; source pubs.backup.sql

Installing pubssite Python Code

  1. Install the Anaconda Python 2.7 Distribution.
  2. Open a terminal and run git clone git@github.com:iucogs/pubssite.git
  3. In the terminal run cd pubssite to access the folder.
  4. python setup.py develop will install the package and all dependencies.

Configuring the pubs.ini File

  1. Open the repository folder.
  2. Copy pubs.ini.template to pubs.ini
  3. Edit the pubs.ini template file:
    • Change the directive url = ... to url = mysql://user:password@localhost:3306/pubs?charset=utf8&use_unicode=1.
      • Note: Replace user and password with your mysql username (i.e., root) and password.

Installing Ruby and anystyle parser:

  1. Install Ruby:
    • Windows: RubyInstaller, then follow the directions for installing the "Development Kit", which has download links on the left column under the Ruby downloads.
    • Ubuntu/Debian: sudo apt-get install ruby-dev build-essential
  2. Install anystyle from terminal: gem install --user-install anystyle-parser
  3. If the user-install complains about not being in the PATH, then follow the directions at the Ruby Gems site

Launching the API

From the repository directory, run pserve development.ini.

Open a browser and go to http://localhost:6543/ to see the website running.