bbc/connected-data-amanita

Name: connected-data-amanita

Owner: BBC

Description: API for Content Graph

Created: 2018-02-07 16:23:54.0

Updated: 2018-05-15 13:37:22.0

Pushed: 2018-05-15 13:37:20.0

Homepage: null

Size: 292

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Content Graph API

API for reading from the Content Graph/Store. Currently, the API is capable of interfacing with two databases: Stardog (may be generalised to any SPARQL1.1 store), and Elasticsearch. Client specific code resides in the clients directory and the clients are listed in api.py, all other code is/should be client-agnostic.

Run Locally
1. Create a virtualenv, install dependencies:
on3 -m venv env
v/bin/activate
 install -r requirements.txt
2. Set up environmental variables:
For use with Stardog
rt DB_CLIENT='stardog'
rt DB_ENDPOINT=http://$SERVER:$PORT/content-graph-test/query
rt DB_USER=$USERNAME
rt DB_PASS=$PASSWORD
For use with Elastic
rt DB_CLIENT='elasticsearch'
rt DB_ENDPOINT=http://localhost:9200
rt DB_USER=$USERNAME
rt DB_PASS=$PASSWORD

Resources to run Elasticseaerch stack locally.

3. Run the service:
=5001 \
ONPATH=.:$PYTHONPATH \
on -m app.api
4. Visit the application at http://localhost:5001.
Style

Check if your code is PEP8 compliant:

destyle app --max-line-length=119
Tests

Run tests using:

ONPATH=.:$PYTHONPATH py.test --cov-report term-missing --cov=app tests/ --cov-branch -vv

NB: SPARQL client not fully covered - still need to refactor tests.

Building & Deployment

This app is provided as with a Dockerfile which is used to build a container. This should then be pushed to a container registry and deployed either as a manual process or using something such as build triggers and a continuous delivery platform like Spinnaker.


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.