Skip to content

publicscience/brain

Repository files navigation

Public Science Brain

Setup

It's recommended that you use a virtualenv:

$ virtualenv-3.3 ~/envs/brain --no-site-packages
$ source ~/envs/brain/bin/activate

Run MongoDB:

$ mongod

Clone repo and then install dependencies:

$ git clone https://github.com/publicscience/brain.git
$ cd brain
$ pip install -r requirements.txt
$ python -m nltk.downloader punkt

Note that you may need to install numpy first:

$ pip install numpy

Setup Flask configuration:

$ mv config-sample.py config.py
$ vi config.py

Setup Twitter API access:

$ mv app/brain/config-sample.json app/brain/config.json
$ vi app/brain/config.json

(see below for more info)

Run tests to make sure everything's working:

$ nosetests

Run the Flask application:

$ python application.py

Check out the site at localhost:5000 (by default).

The important endpoints at the moment are /muses/ and /config/.

Twitter API

To setup Twitter API access for your Twitter account:

  1. Authorize Twitter development access to your account through here.

  2. Register your application through that process.

  3. On your app's page in the Twitter dev site, set its Access level to Read and write.

  4. Then generate an access token for your app.

  5. Set the required values in app/brain/config.json.

Dev Notes

/flask_mongoengine/wtf/orm.py
line 225 has a Python 3 incompatibility.
It uses iteritems(), it should be items().

Crontab example

0 * * * *  cd /srv/brain; /env/brain/bin/python -c "from app.brain import ponder; ponder()"
30 * * * *  cd /srv/brain; /env/brain/bin/python -c "from app.brain import consider; consider()"

About

the brain of public science

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published