Skip to content

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

License

Notifications You must be signed in to change notification settings

codefortulsa/courtbot

 
 

Repository files navigation

#Courtbot (Tulsa Edition) 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

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 SID>
heroku config:set TWILIO_AUTH_TOKEN=<twilio auth token>
heroku config:set TWILIO_PHONE_NUMBER=<your twilio phone number>
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 COURTBOT_TITLE=<name for courtbot>
heroku config:set REMINDER_DAYS_OUT=<number of days out to remind users (typically 1)>
heroku config:set API_TOKENS=[<list of api keys you wish to be honored when making privileged requests>]
heroku config:set COURTBOOK_URL=<courtbook url>
heroku config:set COURTBOOK_OAUTH_SECRET=<courtbook oauth secret>
heroku config:set COURTBOOK_OAUTH_CLIENT_ID=<courtbook oauth client id>
heroku config:set COURTBOOK_OAUTH_AUDIENCE=<courtbook oauth audience>
heroku config:set COURTBOOK_OAUTH_TOKEN_URL=<courtbook oauth token url>
heroku config:set OSCN_COUNTY=<county in oklahoma to pull case data from>
git push heroku master
heroku open

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

  • node runners/sendQueued.js (daily)
  • node runners/sendReminders.js (daily)

Running Unit Tests

The run the tests:

npm test

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 64.2%
  • Gherkin 28.1%
  • Shell 7.7%