monarch-initiative/phenopacket-scraper-api

Name: phenopacket-scraper-api

Owner: Monarch Initiative

Description: REST API for phenopacket-scraper

Created: 2016-06-23 19:16:17.0

Updated: 2016-06-28 20:15:26.0

Pushed: 2016-08-23 18:36:41.0

Homepage: null

Size: 21

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Phenopacket-Scraper Api

REST API for phenopacket-scraper

Setup:

To get the project's source code, clone the github repository:

$ git clone https://github.com/monarch-initiative/phenopacket-scraper-api.git

Install VirtualEnv using the following:

$ [sudo] pip install virtualenv

Create and activate your virtual environment (with python 3):

$ virtualenv -p python3 venv
$ source venv/bin/activate

Clone the phenopacket-python respository:

$ git clone https://github.com/phenopackets/phenopacket-python.git

Install it in your virtual environment:

$ cd phenopacket-python
$ ../venv/bin/python setup.py install

Add this to the end of ~/.profile or ~/.bash_profile file to add phenopacket-python directory to your python environment variables:

$ export PYTHONPATH=$PYTHONPATH:[path of phenopacket-python directory]

For Example:

$ export PYTHONPATH=$PYTHONPATH:/Users/Gauss/Home/phenopacket-python

Install all the required packages:

$ venv/bin/pip3 install -r requirements.txt

Create your database and the superuser by running this from the phenopacketscraper/ directory of the repository:

$ python manage.py migrate
$ python manage.py createsuperuser
Usage

To run the server enter the following in the 'phenopacketscraper/' directory of the repository

$ python manage.py runserver

Now you can go to your browser and test the api using:

http://localhost:8000/api/test/

To scrape data from a url you can enter the following in your browser:

http://localhost:8000/api/scrape/?url=[url]

To annotate data from a url you can enter the following in your browser:

http://localhost:8000/api/annotate/?url=[url]

To generate phenopacket of a given webpage you can enter the following in your browser:

http://localhost:8000/api/phenopacket/?url=[url]

Or by using curl in your terminal. For annotation you can enter the following

$ curl -H 'Accept: application/json; indent=4' http://localhost:8000/api/annotate/?url=[url]

For instance you can use http://molecularcasestudies.cshlp.org/content/2/2/a000703.abstract in place of [url] for testing.

To generate phenopackets you can enter the following in your terminal:

$ curl -H 'Accept: application/json; indent=4' http://localhost:8000/api/phenopacket/?url=[url]

To run the test cases, enter the following in the 'phenopacketscraper/' directory of the repository

$ python manage.py test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.