<commit_before># Setup

This file contains instructions to install and run the prototype.

## Requirements
Prior to installation, you need the basics:
* ruby 2.1.5
* python 3.x
* bundler
* PhantomJS 
  * See http://phantomjs.org/download.html
  * Note: the phantom team has not put out an NPM package, which is anticipated in version 2.1 https://github.com/Medium/phantomjs/issues/288
* nodejs & nodejs-legacy
  * `sudo apt-get install nodejs` and `sudo apt-get install nodejs-legacy`

## Installation

1. `npm install`
2. `rake db:reset`
3. `rake bower:install`

*Windows Users should perform the following steps using the Git Shell*

*Additional notes on dependency managmenet are in [doc/dependency_management.md](doc/dependency_management.md)*

## Python Setup (one-time)
1. `cd gruve`
2. `python setup.py develop` (or `sudo python setup.py develop`)

Note: if you have multiple versions, you may need to specify python 3.x 
(i.e. `sudo python3.4 setup.py develop`)

## Running Tests

* rspec `bundle exec rspec` (ruby unit tests, request specs, full stack feature specs)
* python `cd gruve then sudo python3.4 setup.py test` (unit tests for ETL scripts) - note: other python 3.x versions can be specified
* javascript `bundle exec rake teaspoon` (angular unit tests)

## Docker Containers
TODO <commit_msg>Added Docker Compose deployment steps<commit_after># Setup

This file contains instructions to install and run the prototype.

## Requirements
Prior to installation, you need the basics:
* ruby 2.1.5
* python 3.x
* bundler
* PhantomJS 
  * See http://phantomjs.org/download.html
  * Note: the phantom team has not put out an NPM package, which is anticipated in version 2.1 https://github.com/Medium/phantomjs/issues/288
* nodejs & nodejs-legacy
  * `sudo apt-get install nodejs` and `sudo apt-get install nodejs-legacy`

## Installation

1. `npm install`
2. `rake db:reset`
3. `rake bower:install`

*Windows Users should perform the following steps using the Git Shell*

*Additional notes on dependency managmenet are in [doc/dependency_management.md](doc/dependency_management.md)*

## Python Setup (one-time)
1. `cd gruve`
2. `python setup.py develop` (or `sudo python setup.py develop`)

Note: if you have multiple versions, you may need to specify python 3.x 
(i.e. `sudo python3.4 setup.py develop`)

## Running Tests

* rspec `bundle exec rspec` (ruby unit tests, request specs, full stack feature specs)
* python `cd gruve then sudo python3.4 setup.py test` (unit tests for ETL scripts) - note: other python 3.x versions can be specified
* javascript `bundle exec rake teaspoon` (angular unit tests)

## Docker Containers
This application can be deployed using the stsilabs/openfda-web docker image from dockerhub as well as the official standard postgres image (see https://registry.hub.docker.com/u/stsilabs/openfda-web/ and https://registry.hub.docker.com/_/postgres/). Deployments performed using this approach require only that the host server or service has Docker and Docker Compose installed.  

* Install Docker and Docker Compose on the host machine (see https://docs.docker.com/compose/install/).
* From the project root, launch Docker containers `docker-compose up`
* It takes several minutes for the application to seed its database.  During the seeding process no data will be available when accessing the site. Subsequent launches of the application via docker compose will re-use this data so re-seeding is not necessary.
{'fraction_non_alphanumeric': 0.0865162037037037, 'fraction_numerical': 0.011574074074074073, 'mean_word_length': 4.4015625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5950921', 'n_tokens_mistral': 1067, 'n_tokens_neox': 978, 'n_words': 439}