Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Code Overview

Tyler Samples edited this page Dec 24, 2018 · 2 revisions

Courtbot is a relatively simple REST endpoint with cookies and a state machine. Using Elixir's pattern matching the state machine responses are based upon the message sent to the services, the case/hearing data imported, and the configuration set.

Controllers

  • TwilioController
    • /sms/:locale
    • /sms
      • 200, Content-Type: application/xml
      • Body, Twiml

Models

  • Queued: Phone number and a case number. This model is used when a case is not found when a user tries to subscribe (a record is only created if queued_ttl_days is set in config.) All the Queued records are checked after the import has been ran. If the case has been found, then the Queued record is deleted and a Subscriber is
  • Case: Case number that has many hearings and has many subscribers.
    • Case can additionally have a county field which can be used to handle to resolve case number duplications.
    • Case can also have a type (such as "Criminal" or "Violation") that can allow alternative responses to be served to the user.
  • Hearing: A time and date.
    • Hearings can additionally have a location (Courthouse, Room 123) and a detail (such as "Preliminary Hearing")
  • Subscriber: Belongs to Case and has a phone number.
  • Notification: Belongs to Subscriber.