ashlux / courtbot

Your friendly neighborhood court robot. Provides an api for getting court case information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

NOTES

This branch is for development of the Tulsa version. It's a WIP.

Courtbot

Courtbot is a simple web service for handling court case data. It offers a basic HTTP endpoint for integration with websites, and a set of advanced twilio workflows to handle text-based lookup.

Specifically, the twilio features include:

  • Reminders. If a case requires a court appearance, the app allows users to sign up for reminders, served 24 hours in advance of the case.
  • Queued Cases. If a case isn't in the system (usually because it takes two weeks for paper citations to be put into the computer), the app allows users to get information when it becomes available. The app continues checking each day for up to 16 days and sends the case information when found (or an apology if not).

Running Locally

First, install node, postgres.

Since the app uses twilio to send text messages, it requires a bit of configuration. Get a twilio account, create a .env file by running cp .env.sample .env, and add your twilio authentication information. While you're there, add a cookie secret and an encryption key (long random strings).

Install node dependencies

npm install

Then, to create the tables and load in initial data:

node utils/createQueuedTable.js
node utils/createRemindersTable.js
node runners/load.js

To start the web service:

npm start

Deploying to Heroku

First, get a twilio account and auth token as described above. Then:

heroku create <app name>
heroku addons:add heroku-postgresql
heroku addons:add scheduler
heroku config:set COOKIE_SECRET=<random string>
heroku config:set TWILIO_ACCOUNT=<twilio account>
heroku config:set TWILIO_AUTH_TOKEN=<twilio auth token>
heroku config:set TWILIO_PHONE_NUMBER=<twilio phone number>
heroku config:set PHONE_ENCRYPTION_KEY=<random string>
heroku config:set DATA_URL=<court records csv location>
heroku config:set COURT_PUBLIC_URL=<where to send people for more info>
heroku config:set QUEUE_TTL_DAYS=<# days to keep a citation on the search queue>
heroku config:set TIMEZONE=<standard timezone ex. America/Anchorage>
heroku config:set TIMEZONE_OFFSET=<Subtraction from GMT -08:00>
git push heroku master
heroku run node utils/createQueuedTable.js
heroku run node utils/createRemindersTable.js
heroku run node runners/load.js
heroku open

Finally, you'll want to setup scheduler to run the various tasks each day. Here's the recommended config:

scheduler settings

Scheduler Changes

  • node runners/sendQueued.js
  • node runners/sendReminders.js

Running Tests

Initialize the test database:

  • node test_utils/reset

Set up your environment variables:

  • cp .sample.env .env -OR- set your own

The run the tests:

npm test

Customizing

Case data

About

Your friendly neighborhood court robot. Provides an api for getting court case information.

License:ISC License


Languages

Language:JavaScript 100.0%