Skip to content

NateV/Expungement-Generator

 
 

Repository files navigation

EG-Docker Version Notes

DEPRECATED This app in the process of deprecation.


This version of the Expungement Generator has a few minor modifications that make it easier to containerize. See the repository NateV/eg-docker for the docker-compose and Dockerfile that create Docker containers.

This version of the EG should be rebased every so often to make sure it stays up to date with the changes to the EG master branch.

Synopsis

The ExpungementGenerator is a web based utility that reads the PDF criminal record docket sheets generated by the Adminstrative Office of Pennsylvania Courts and determines whether a given arrest (or set of arrests) is able to be expungemed. If an arrest is able to be expunged, the EG generates an odt expungement petition, order, and IFP petition if applicable.

This project was created by Michael Hollander of Community Legal Services of Philadelphia in 2011 and has been continually refined since then. It is used by CLS, the Pennsylvania Lawyers for Social Equity, Legal Aid of Southeast Pennsylvania, and a number of other programs throughout PA.

Running with Docker

This project has been modified from the original expungment generator to more easily integrate with docker.

Frontend

The dockerfile Dockerfile describes a container holding the frontend of the Expungement Generator.

The frontend container image is hosted on dockerhub at https://hub.docker.com/r/natev/eg-docker-frontend/

Basic usage of the frontend:

docker run natev/eg-docker-frontend -p 8080:9090

And build with

docker build . -t natev/eg-docker-frontend:latest
docker push natev/eg-docker-frontend:latest

Note that apache in the container does not run on port 80.

You won't be able to accomplish much without a database, though, including logging in. So you'll need a database container running as well. natev/eg-docker-db provides a container with the right schema, and you can check out compose files int this repository for examples of how to set up containers to run a full EG.

Database

The db_dockerfile describes a container that will host the database backend of the expungement generator.

Use with the docker image natev/eg-docker-frontend.

It initializes with a single admin user, [email protected], password admin. Change this before using your Expungement Generator for anything.

Installation w/out Docker and Dependencies

The vast majority of the program is written in PHP and has been tested on PHP 5.5.12. It uses a mysql database (tested on 5.6).

There are three external dependencies, one of which is bundled with this code in git.

  • PHPWORD (https://github.com/PHPOffice/PHPWord) - a library that allows you to make template DOCX files and then use PHP to modify variables within the templates and generate DOCX files. I use version .13. I had to modify a line of code in TemplateProcessor.php to allow for multiline edits: in setValueForParts, I added $replace = preg_replace('\Ru', '</w:t><w:br/><w:t>', $replace); just after the line that sets UTF8 encoding. The modified TemplateProcessor.php file is in this repository. You can replace the one in PHPWord

  • pdftotext - This is available on both windows and linux systems. This can be found in the poppler-utils package on linux.

  • casperscraping - https://github.com/CLSPhila/casperscraping - admitedly a bad name. This is a library that uses casper to programatically scrape CPCMS. CPCMS is a very javascript heavy website and was impossible to scrape without casper.

  • sendgrip-php - (https://github.com/sendgrid/sendgrid-php). This is just for mailing the lookup files to legalserver. If you don't want to use the lookup feature or don't want to allow emailing, don't worry about this. You also want to play with lookup and mail*php to remove the mailing. Uses sendgrid to accomplish mailing, although you could use any way to send email.

You can install the template database using database.sql as the structure.

Development

You can set up a docker container specially configured to let you edit Expungement Generator files locally.

Follow these steps on your local machine (you need docker and docker-compose installed.)

  1. Clone the EG repository, and cd into the root of the repository.

  2. Install php composer on your host computer. If you're running linux, you can run curl -sS https://getcomposer.org/installer | php -- --install-dir ~/.local/bin/ --filename=composer to install it to your local user account.

  3. Set up the config.php file with cp docker-config.php Expungement-Generator/config.php

  4. Run compose install to install the EG's dependencies inside the mounted Expungement-Generator directory.

  5. Copy the php template processor into the PhpWord vendor directory: cp TemplateProcessor.php vendor/phpoffice/phpword/src/PhpWord/

  6. Start the docker container with docker-compose -f local-dev-compose.yml up. This file starts a database and a frontend container. But the frontend container that it uses mounts your local Expungment-Generator directory (sub-directory in this repository). SO changes you make on your host computer will be reflected in the running container.

Configuration and administration

Configuration variables

See docker-config.php and Expungement-Generator/config.php.example for samples of how to configure the Expungement Generator. The latter demonstrates how to create a config file that includes necessary settings such as the database connection string and password. The former demonstrates that it is also simple to configure the EG with environment variables.

Multiple organizations in a single instance of the EG

It is possible for a single instance of the EG to be available to users from multiple organizations. Configuring this in the user management page is probably self-explanatory.

However, if your instance of the EG has users from multiple organizations, only the hosting organization's "organization" in the EG should be configured to write expungements to the database.

If a guest organization needs to record their expungements, they should host their own instance of the EG.

Motivation

Expungements are the most effective way to help an individual with a criminal record to find employment. It is near impossible to find decent work if you have a record that is visible to the world. Expungements are both time consuming and require the attention of a lawyer to properly prepare. But they are also very boring for lawyers to prepare. In an organization like CLS where we prepare thousands of expungement petitions a year, it is critical to speed up the process and remove much of the rote work from the lawyers working on expungements. The EG does both of those things. I am currently working on EG 2.0, which will be more accessible to non-lawyer petitioners.

Contributors

If you are interested in contributing, please email [email protected].

License

Copyright Community Legal Services 2011-2018

About

Containerized version of mhollander's Expungement Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 96.0%
  • Hack 1.7%
  • CSS 1.3%
  • Other 1.0%