openphacts / explorer2

Ember JS web application used for browsing the Open PHACTS Discovery Platform
MIT License
2 stars 1 forks source link

Open PHACTS Explorer 2 DOI

Introduction

The Open PHACTS Explorer is an HTML5 & CSS3 application for chemical information discovery and browsing. It is used to search for chemical compound and target information using a web search interface. It uses Ruby on Rails, Ember JS and OPS.JS. The Explorer uses the Open PHACTS Linked Data API.

Docker image

The Docker image openphacts/explorer2 can be used to run the explorer2 on any Linux host with Docker:

docker pull openphacts/explorer2
docker run -p 3000:3000 -e RAILS_ENV=development -it openphacts/explorer2 

This will start Explorer2 on http://localhost:3000/

The environment variables that can be set, together with their defaults:

-e RAILS_ENV=production
-e API_URL=https://beta.openphacts.org/2.1
-e API_APP_ID=161aeb7d
-e API_APP_KEY=cffc292726627ffc50ece1dccd15aeaf
-e EXPLORER_MAINTENANCE=FALSE
-e ES_SEARCH_URL=http://localhost:8839/search
-e AUTOCOMPLETE_URL=http://localhost:8839/autocomplete

The EXPLORER_MAINTENANCE flag forces the explorer to display a maintenance page if set to TRUE.

If you want to change the Dockerfile during test and development and build an explorer docker image from your local clone of the explorer2 repository then try:

docker build -t explorer .

To investigate the logs for the docker container you are running first list all the running containers with:

docker ps

Note the CONTAINER ID (or name) and run the following (replace CONTAINER_ID with actual ID or name):

docker exec -it CONTAINER_ID bash

This will allow you to navigate around the files inside the docker container and you can then look at the logs directory. Type exit to leave this container - the actual container will still keep running.

Technology

Ruby 1.9.3+, Ruby on Rails 3.2.x, Ember JS, Bootstrap CSS/JS

Setup

Deploying on a sub-uri

In the environment file ie development.rb and/or production.rb, add/uncomment the following:

#config.relative_url_root = "/my_app"
#config.assets.prefix = "/my_app/assets"

Change the paths to whatever is appropriate to your sub-uri. You must end the config.assets.prefix with /assets or the images will not be loaded correctly.
You can have multiple level sub-uris eg /my_app/version1.
It is recommended to clear out the cache ie rm tmp/cache when adding a sub-uri and also anything in public/assets (or public/assets/your-sub-uri) before you start the server to ensure the glyphicons are loaded correctly.
There is a handlebars helper called getImage which should be used instead of <img> tags when showing an image in the html.

Autocompleter

This uses Elastic Search via the Open PHACTS Search service.See env variables to pass in the URL above.

Testing

The Ember JS side of things uses the Qunit test framework with Karma for automation. The javascript test files are within app/assets/javascripts/tests. We recommend looking at the Ember testing guides but here is some setup info. The Karma test runner setup files are contained in the directory test/karma. The js to load and browsers to test are defined in karma.conf.js. To install Karma you will need Node JS (stop, come back, it's not that hard). Then you need to run npm install which installs the dependencies listed in the package.json file. These dependencies will be installed local to the karma directory so you will probably need to set up a path to find them export PATH="./node_modules/.bin:$PATH". You will also need Karma's command line interface npm install -g karma-cli. Then to run the tests do karma start.

Ketcher

The Explorer uses an embedded version of the Ketcher compound drawing tool by GGA Software Services.

Licence

The Explorer '2' source code is released under the MIT License. See licence.txt for more details.