Voting-record is a web app for tracking Portland, Maine city council votes.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
html
img
jsx
scss
server
shared
sql
.gitignore
AUTHORS
LICENSE
README.md
docker-compose.yml
gulpfile.js
package.json
psql.sh
sql.sh

README.md

voting-record

Voting-record is a web app for tracking Portland, Maine city council votes.

Data sources

Votes back as far as 2014 appear to be recorded in PDF's listed under City Council on http://www.portlandmaine.gov/AgendaCenter

Some record of orders as far back as fiscal year 2012/2013 (FY 12/13) can be found in PDF's listed under City Council on http://www.portlandmaine.gov/DocumentCenter

Contributing

Dependencies

Setup

npm install

Local development

We don't use package.json scripts because JSON doesn't allow comments.

To run the development servers (Postgres):

docker-compose up

You can shut them down with Ctrl+C.

To initialize the database:

./sql.sh sql/encoding.sql
# DID THAT SAY UTF8? IF NOT, GET IT FIXED!
./sql.sh sql/councilors.sql

To run database commands manually....

If you have psql installed, you can use it to connect just like you would to any Postgres running on localhost.

If you don't, you can use psql without installing it by running it from within Docker using this script:

./psql.sh

To run the frontend build process:

# if you don't have gulp installed globally
export PATH="$PWD/node_modules/.bin:$PATH"

gulp watch

To run the server:

node server

Files

  • See the config object in gulpfile.js for locations of the frontend files.
  • Database contents is in db. You can shut the database down and move that directory aside to start fresh.
  • S3 contents (files) are in s3-minio. You can shut minio (docker-compose) down and move that directory aside to start fresh.

Database

  • The database is Postgres.
  • The API uses hapi-node-postgres (which uses node-postgres (pg)) directly.
  • No ORM is in use. This probably makes development slower, but gives us less to learn and eliminates the likelihood of losing time to ORM limitations later.
  • Eventually, we'll want a database migrations tool. There's a Trello card tagged technical debt for adopting one.

If you ever include any variable in the first argument to request.pg.query, also include a half page comment on why the right way wouldn't work that time.