ClientComm facilitates better communication between clients and case managers to increase the number of clients who successfully complete supervision.
5.1 million people are currently on probation or parole, and that number is projected to grow in the coming years as criminal justice reform continues to spread. Across the country, community supervision departments are managing greater numbers of people, with limited resources.
Community supervision personnel are tasked with maintaining public safety while helping their large caseloads navigate the terms of their release. It is vital for case managers to have a reliable way to contact each client, and today, people on community supervision are more likely to have a cell phone than a landline, and more likely to read a text than a letter in the mail.
ClientComm lets case managers send clients text messages from their computers or mobile devices. The text messages are sent from one department-wide phone number, and are not attached to individual case managers’ phones. Conversations between manager and client are kept together even if the client changes phone numbers, and can be printed or exported to your case management system.
In early 2016, we launched ClientComm with Salt Lake County Criminal Justice Services, which was struggling with individuals cycling in and out of jail due to missed court appearances or court-ordered treatment. Probation and Pretrial case managers are using ClientComm to text hundreds of their clients on a daily basis. ClientComm allows case managers to cut down on time lost playing phone tag and leaving voicemails. In minutes, case managers can remind, and have their client confirm, they will be at their next court date, or attend their next treatment class.
Our internal results in Salt Lake County show lower Failure to Appear rates, and time saved for case managers. We are currently undergoing a Randomized Control Test on the effectiveness of ClientComm in collaboration with researchers from the University of Virginia. ClientComm is now a central part of Code for America's product work on Safety and Justice, and is expanding to new jurisdictions across the country.
- Development Setup
- Production Deploy
- Restoring the DB< 8000 /li>
- Install Ruby with your ruby version manager of choice, like rbenv or RVM
- Check the ruby version in
.ruby-version
and ensure you have it installed locally e.g.rbenv install 2.4.0
- Install Postgres. If setting up Postgres.app, you will also need to add the binary to your path. e.g. Add to your
~/.bashrc
:export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin"
-
Install bundler (the latest Heroku-compatible version):
gem install bundler -v 1.15.1
-
Install other requirements:
bundle install
If you installed Postgres.app, you may need to install the
pg
gem independently with this command:gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
-
Create the databases:
rails db:create
-
Apply the schema to the databases:
rails db:schema:load RAILS_ENV=development
rails db:schema:load RAILS_ENV=test
- Install the Heroku CLI
- Copy
.env.example
to.env
and fill in the relevant values. - Start the server with
heroku local
. Take note of the port the server is running on, which may be set with thePORT
variable in your.env
file.
-
Buy an SMS-capable phone number on Twilio. You can use the web interface, or this script.
-
Install ngrok. If you are running npm, install with
npm install -g ngrok
. Otherwise download the binary and create a symlink. -
Start ngrok by entering
ngrok http 3000
in the terminal to start a tunnel (replace3000
with the port your application is running on if necessary). You should see an ngrok url displayed, e.g.https://e595b046.ngrok.io
. -
When your Twilio number receives an sms message, it needs to know where to send it. The application has an endpoint to receive Twilio webhooks at, for example,
https://e595b046.ngrok.io/incoming/sms/
. Click on your phone number in the Twilio web interface and enter this URL (with your unique ngrok hostname) in the A MESSAGE COMES IN field, under Messaging.Alternately, you can use this script to find your phone number's SID, then use this script to update the Twilio callback with your ngrok url.
- Phantom is required to run some of the feature tests. Download or install with Homebrew:
brew install phantomjs
- Test suite:
bin/rspec
. For more detailed logging useLOUD_TESTS=true bin/rspec
. - File-watcher:
bin/guard
when running will automatically run corresponding specs when a file is edited.
- Create a new lastpass note with this template:
mailgun_api_key = ""
mailgun_domain = ""
mailgun_smtp_password = ""
aws_access_key = ""
aws_secret_key = ""
mailgun_require_dkim = ""
route53_email_zone_id = ""
route53_app_zone_id = ""
heroku_email = ""
heroku_api_key = ""
heroku_app_name = ""
app_domain = ""
heroku_pipeline_id = ""
heroku_team = ""
Save the lastpass note as [INSTALL_NAME]-clientcomm-terraform (e.g. pima-clientcomm-terraform).
-
From the project root
cd deploy/terraform
and then run./apply.sh <(lpass show --notes [NAME_OF_NOTE])
to run terraform. This will set up a heroku instance and configure mailgun. -
Create a new twilio subaccount. Buy a number that matches the area code of where the delploy will be used.
-
Terraform should set the following config vars. Verify these are present:
Config Var | Comment |
---|---|
DEPLOY_BASE_URL | [APP_SUBDOMAIN].clientcomm.org |
MAILGUN_DOMAIN | [APP_SUBDOMAIN].clientcomm-email.org |
MAILGUN_PASSWORD | (from the lastpass note) |
LANG | en_US.UTF-8 |
RACK_ENV | production |
RAILS_ENV | production |
RAILS_LOG_TO_STDOUT | enabled |
RAILS_SERVE_STATIC_FILES | true |
MASS_MESSAGES | true |
UNCLAIMED_EMAIL | clientcomm+unclaimed@codeforamerica.org |
- You will need to set these Heroku config vars:
Config Var | Comment |
---|---|
INTERCOM_APP_ID | (same for all apps) |
MIXPANEL_TOKEN | (same for all apps) |
PAPERTRAIL_API_TOKEN | (provision the Papertrail addon) |
SECRET_KEY_BASE | run rake secret |
SENTRY_ENDPOINT | (same for all apps) |
SKYLIGHT_AUTHENTICATION | (same for all apps) |
TIME_ZONE | (rails time zone) |
TWILIO_ACCOUNT_SID | (get from the twilio account that you created) |
TWILIO_AUTH_TOKEN | (get from the twilio account that you created) |
TWILIO_PHONE_NUMBER | (get from the twilio account that you created) |
TYPEFORM_LINK | (set up in typeform, optional) |
- At this point, the instance should be up and running. The next step is to provision an Admin user:
heroku run rails c --app=[APP_NAME]
AdminUser.create(email: '', password: '', password_confirmation: '')
- Get the public URL for the databse backup:
heroku pg:backups:url --app [APP_NAME]
This should return a long AWS url for the most recent backup. - Restore the DB:
heroku pg:backups:restore [previously found url] DATABASE_URL --app [APP_NAME]
Do not forget to correctly escape the db url, either with backslashes or with single quotes.
Tomas Apodaca ( @tmaybe )