Subscribe to your city.
Ruby HTML JavaScript Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app Added modified skyline image of Los Angeles Jul 30, 2018
config Added Los Angeles Jul 30, 2018
db Only create postgis extension if it isn't already enabled Jul 16, 2018
doc Adding location of job health monitor to maintainer's notes Mar 22, 2017
docker Dockerfile needs a Ruby version bump as well Aug 6, 2018
images Add Citygram Architecture image Oct 15, 2014
lib Update database_helper to work on remote databases Jul 16, 2018
public civic.json in root Feb 22, 2015
spec Merge pull request #282 from SFDigitalServices/querying-publishers-by… Jul 24, 2018
.dockerignore In case of a local Heroku dump, don't include it in the Docker build … Dec 19, 2017
.env.sample Refactoring for twilio url to utilize env variables. Jul 30, 2015
.gitignore Ignoring Heroku DB dumps in repo as well Dec 19, 2017
.pairs moved all DigestHelper methods Jul 23, 2015
.rspec Format spec output as colored documentation May 26, 2014
.ruby-version Updating to Ruby 2.5.1 Aug 6, 2018
.slugignore Initial commit May 7, 2014
.travis.yml Changing naming style to simpler, fully explicit style Aug 6, 2018
Gemfile Updating to Ruby 2.5.1 Aug 6, 2018
Gemfile.lock Updating to Ruby 2.5.1 Aug 6, 2018
LICENSE.md Add license May 13, 2014
Procfile Lowering concurrency in an effort to save memory. We are in excess of… Oct 8, 2015
README.md Removing gemnasium Aug 6, 2018
Rakefile Setup sidekiq and add rake task to queue publisher updates May 27, 2014
Vagrantfile Brush off Vagrantfile Jun 7, 2018
app.rb removed differences from codeforamerica branch Jul 30, 2015
config.ru Conditionally enable CORS headers based on $CORS_ALLOWED_ORIGINS Jul 11, 2018
docker-compose.yml Refactoring SMS credentials to be multi-tenant and persisted in database Nov 21, 2017

README.md

Citygram Build Status Test Coverage Maintainability

Citygram is a geographic notification platform designed to work with open government data. It allows residents to designate area(s) of a city they are interested in and subscribe to one or more topics. When an event for a desired topic occurs in the subscriber's area of interest, a notification (email, SMS, or webhook) is delivered. Citygram is a Code for America project by the Charlotte and [Lexington] teams for the [2014 fellowship].

Lexington [2014 fellowship]: http://www.codeforamerica.org/geeks/our-geeks/2014-fellows/

Why are we doing this?

We believe that there is an opportunity to help residents better understand what’s going on in their area, when it’s going to happen, and why. By providing timely information to residents in areas that are relevant to them, the city can be proactive instead of reactive, build trust through transparency, and increase civic engagement across the board.

Who is this made by?

See the contributors list.

Technical Overview

Citygram is a web application written in Ruby.

Installation and configuration

Installation

Option 1:

For an OSX setup, you can use vagrant to get up and running quickly with virtual box and homebrew. This option will provide you with a smooth straight forward way of quickly getting you up and running.

# setup homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# setup virtualbox
brew cask install virtualbox

# starts up an ubuntu box and installs postgres and all other dependencies
vagrant up

# login to the box and start the program:
vagrant ssh
cd /vagrant
bundle exec foreman start

Option 2:

First, follow the instructions to install each of the following:

Then, in the command line, run the following to copy the citygram code locally and install all Ruby package dependencies:

git clone https://github.com/codeforamerica/citygram.git
cd citygram
bundle install

Configure Environment

Make sure your PostgreSQL server is running, then in the terminal run:

cp .env.sample .env
rake db:create db:migrate
rake db:create db:migrate DATABASE_URL=postgres://localhost/citygram_test

Running Citygram Website and Services

Basic things you'll want to do with your Citygram server:

Run the server

To boot up the complete application and run background jobs in development:

bundle exec foreman start

You can then open http://localhost:5000/ in your web browser.

Acquiring data

When you can run the application, you're capable of getting some example data.

Before running these commands, ensure foreman is running per the instructions in the previous section!

bundle exec rake publishers:download
bundle exec rake publishers:update

The first command downloads active publishers from Citygram. The second command will update those publishers from open data portals across the country.

Send a digest
rake digests:send
Send a a weekly Digest

For Heroku Scheduler users, there is a task that can be executed multiple times, but will only deliver mail on the environment's DIGEST_DAY.

ENV['DIGEST_DAY'] = 'wednesday'
rake digests:send_if_digest_day

Heroku Scheduler

Developing

As a developer you may want to:

Set up a Single City Installation

If you only need to support a single city you can specify the ROOT_CITY_TAG to bypass the index and load one city.

For example, https://www.citygram.nyc/ is a single city installation with the following environment variable

ROOT_CITY_TAG=new-york
Test the code

Run all tests in the spec/ directory, by running:

rake