Skip to content
This repository

Government-wide search and notification website.

branch: master
Octocat-spinner-32 app silly monkeypatch to avoid the issue in paperclip 4.0/4.1 as describe… April 14, 2014
Octocat-spinner-32 config guarantee output when things are sent to sentry April 12, 2014
Octocat-spinner-32 deliveries Another pass at ripping out SMS, this is great April 11, 2014
Octocat-spinner-32 misc scratch code December 12, 2013
Octocat-spinner-32 public upgrade pjax to 1.8.1 April 11, 2014
Octocat-spinner-32 subscriptions Re-enable doc fetching for bills and regs April 10, 2014
Octocat-spinner-32 tasks suppress boilerplate sentry output, rename test, add another test to … April 12, 2014
Octocat-spinner-32 test Another pass at ripping out SMS, this is great April 11, 2014
Octocat-spinner-32 vendor Added Sentry as an option for exception handling, will fall back to n… April 11, 2014
Octocat-spinner-32 .gitignore First pass at env-conditional robots.txt January 30, 2014
Octocat-spinner-32 .ruby-version Updating to Ruby 2.1.1, adding section on updating Ruby to the README April 03, 2014
Octocat-spinner-32 .travis.yml only build master branch April 11, 2014
Octocat-spinner-32 Gemfile Added Sentry as an option for exception handling, will fall back to n… April 11, 2014
Octocat-spinner-32 Gemfile.lock Added Sentry as an option for exception handling, will fall back to n… April 11, 2014
Octocat-spinner-32 LICENSE framework of a sintra app August 04, 2011
Octocat-spinner-32 README.md Updating to Ruby 2.1.1, adding section on updating Ruby to the README April 03, 2014
Octocat-spinner-32 Rakefile remove sync inflection, so that environment doesn't need to be loaded March 24, 2014
Octocat-spinner-32 config.ru.example Use the environment's RACK_ENV if set November 15, 2013
Octocat-spinner-32 fabfile.py for now, manual restart again April 08, 2014
Octocat-spinner-32 reindex.md documenting some reindexing commands, gee can you guess why April 08, 2014
Octocat-spinner-32 scout.rb Added Sentry as an option for exception handling, will fall back to n… April 11, 2014
Octocat-spinner-32 unicorn.rb.example Tentative deployment information August 09, 2011
README.md

Scout

A government-wide search and notification system. Currently deployed to scout.sunlightfoundation.com.

Build Status

Setting Up

Scout is developed and tested on Ruby 2.1.0.

Recommended: use rbenv to install Ruby 2.1.0 to your home directory.

You need a MongoDB server. Scout will create its own database and collections as needed.

After a gem install bundler, install included dependencies with:

bundle install --local

Create configuration files:

cp config.ru.example config.ru
cp config/config.yml.example config/config.yml

Change anything in config.yml that needs to be changed. Among other things, you will need to add your own Sunlight API key. You can get an API key here. You can change the MongoDB configuration in this file if you need to.

Then run the app on port 8080 with:

bundle exec unicorn

What It Does

  • Alice visits the Scout website and searches for terms of interest to her, e.g. "intellectual property".
  • Alice subscribes to be sent messages via email when new items are published for those search terms: that is, new items related to her interest.
  • Soon after new items are published, Alice receives one email message per interest, which may contain multiple new items.

Notification settings

Alice may log in to configure notification settings:

  • She may add and verify a phone number to receive SMS messages in addition to email messages. If so, she receives one SMS message per interest.
  • She may change the email frequency from "immediate" to "daily", or turn off all notifications. If daily, she receives a single email message for all interests once per day.
  • She may configure interests to have different notification settings: she may set a notification to be sent immediately, daily or via SMS only, or she may turn off notifications for the interest.

Collections

  • Alice may tag interests. All interests with the same tag are called a collection of interests.
  • Collections are private by default, but if Alice fills in her user profile, she may share the collection in public.
  • Bob may subscribe to Alice's collection to be sent messages when new items are published related to the interests in the collection. If Alice makes the collection private again, Bob will no longer receive messages.

Other features

Scout also implements an "RSS/Atom to Email/SMS" feature.

Under the Hood

  • Scout checks for new items in multiple data sources. To add a new data source, you must write a subscription adapter. The adapter tells Scout how to query the data source with the search terms provided by its users.
  • When users subscribe to be sent messages, they create an interest. The user may choose to receive new items for all data sources, or just one. An interest will have one or more subscriptions per data source.

Re-use

We'd really love it if others used the Scout codebase to set up their own alert system. To that end, Scout's architecture is fairly well decoupled from the specific data sources that Sunlight's implementation currently uses.

But if you do want to set this up yourself, there will surely turn out to be more to do! Send konklone a message if this is something you're interested in.

Custom Adapters

Set the environment variable SCOUT_ADAPTER_PATH to the path to the directory containing your adapters, for example:

SCOUT_ADAPTER_PATH=/path/to/adapters bundle exec unicorn

Each file within this directory must define an adapter class, and the filename must be the lowercase, underscored version of the class name. The adapter class must be defined in a Subscriptions::Adapters module.

Maintaining Scout

It's helpful to understand a few things about keeping Scout running.

Upgrading Ruby

To upgrade the Ruby version, do the following in each environment Scout will run:

  1. Update rbenv and ruby-build, by visiting $HOME/.rbenv and $HOME/.rbenv/plugins/ruby-build and running git pull in both.
  2. Run rbenv install [version], where [version] might be 2.1.1 or 2.2.0.
  3. Update .ruby-version in the project root, to reflect the version you installed, and commit this to the repository.
  4. Activate the new Ruby version. (rbenv global [version] is one way to do this.)
  5. Install bundler with gem install bundler.
  6. Install dependencies with bundle install --local.

You should also run the test suite with rake to make sure everything is fine! But you probably only need to do that in one environment.

License

Copyright (c) 2011-2013 Sunlight Foundation, released under the GNU General Public License, Version 3.

Something went wrong with that request. Please try again.