deardurham / dear-petition Goto Github PK
View Code? Open in Web Editor NEWPetition form generation app to streamline expunction process in North Carolina
Home Page: https://deardurham.org
License: MIT License
Petition form generation app to streamline expunction process in North Carolina
Home Page: https://deardurham.org
License: MIT License
I saw a comment in our Django entrypoint script that states "If only .env files supported variable expansion..." I think this might be a use case for Dockerize? https://github.com/jwilder/dockerize
@copelco Do you think there is value in adding Dockerize to our stack at this point, or have you more or less already emulated this functionality?
Currently the file number from the most recent record is displayed on the petition. If there are multiple records represented on a petition, the petition file number field should say:
Multiple, see below
This should be done in the mapper module.
Add name and date to appropriate fields. Check the "Petitioner's Attorney" checkbox.
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py", line 65, in __call__
return self.application(environ, start_response)
File "/usr/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 141, in __call__
response = self.get_response(request)
File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 75, in get_response
response = self._middleware_chain(request)
File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 36, in inner
response = response_for_exception(request, exc)
File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 90, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 125, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/usr/lib/python3.6/site-packages/django_extensions/management/technical_response.py", line 37, in null_technical_500_response
six.reraise(exc_type, exc_value, tb)
File "/usr/lib/python3.6/site-packages/six.py", line 695, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/usr/lib/python3.6/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/app/dear_petition/petition/views.py", line 38, in create_petition
output = form.save()
File "/app/dear_petition/petition/forms.py", line 97, in save
petition = Writer(form_data, self.batch, template_path, output)
File "/app/dear_petition/petition/writer.py", line 19, in __init__
self.data = map_data(form_data, batch)
File "/app/dear_petition/petition/data_dict.py", line 8, in map_data
record = batch.most_recent_record
File "/app/dear_petition/petition/models.py", line 141, in most_recent_record
return most_recent_record
UnboundLocalError: local variable 'most_recent_record' referenced before assignment
Check out petition #105 on production and figure out why it is producing a 500 error.
Currently we use Mailgun but it seems to be hard and/or impossible to configure the project to send mail using Mailgun for free. Let's try SendGrid. This will allow us to send users emails, for example for creating their accounts.
The current Pipfile breaks the Heroku deployment. It has been renamed to Pipfile.bak
until it's resolved.
I'm open to the idea of moving to using Pipfile if we can:
sudo apt-get install -qq libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms1-dev libwebp-dev
E: Package 'libtiff4-dev' has no installation candidate
E: Package 'liblcms1-dev' has no installation candidate
travis_time:end:135462cd:start=1565636043033281299,finish=1565636043537010181,duration=503728882
The command "sudo apt-get install -qq libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms1-dev libwebp-dev" failed and exited with 100 during .�[0m
Your build has been stopped.
https://travis-ci.org/deardurham/dear-petition/builds/570985937
Per #139, the API needs to accept these new fields and add them to the petition.
NamePetitioner
StreetAddr
MailAddr
City
State
ZipCode
Add additional comments field to petition generation form.
Only CHARGED offenses should appear on the petition
Right now, technically anyone can see records used to generate petitions in the tool. This was a concern that was raised during the meeting with Gina. Either we need to partition user files/cases so each user can only see their own or only admins can see the records. We will need to discuss the approach we want to take next meeting.
Ideally, we could test a PR before it's even merged. Currently, too many environment variables are required in app.json. I'm not sure how to get around this yet.
CI only runs tests for the users
app, since that's all that exists currently. Adding a few tests, even to just verify logins are required, would be ideal.
Will need to discuss what this looks like next meeting.
Add option to allow PDFs to be opened in the browser, rather than as an attachment.
We have been testing in Chrome, but Joseph uses Firefox. Some text appears too large in Firefox (dates in offense section do not fit in column). Also, saving as PDF in Firefox blanks the petition in Adobe Acrobat. Investigate these issues and determine if there is a fix.
When developing locally on the frontend and proxying to https://dear-petition-staging.herokuapp.com/, POST
requests fail:
2020-06-11T16:41:58.400638+00:00 heroku[router]: at=info method=POST path="/petition/api/token/" host=dear-petition-staging.herokuapp.com request_id=2e5d7840-7c25-4894-a00d-d7012d9c9520 fwd="127.0.0.1,71.70.229.1" dyno=web.1 connect=0ms service=67ms status=200 bytes=1031 protocol=https
2020-06-11T16:42:03.967550+00:00 heroku[router]: at=info method=POST path="/petition/api/batch/" host=dear-petition-staging.herokuapp.com request_id=afe4aa2b-5789-4d64-b828-d3233a34754a fwd="127.0.0.1,71.70.229.1" dyno=web.1 connect=1ms service=10ms status=403 bytes=475 protocol=https
Performing the same actions directly on staging work successfully.
Check out record #103 on production and figure out why it is missing the disposition method.
This field is not present in traffic accidents
When parsed properly, record.data["Offense Record"]["Records"]
will contain JSON like:
[
{
"Action": "CHARGED",
"Description": "SPEEDING(80 mph in a 65 mph zone)",
"Severity": "INFRACTION",
"Law": "G.S. 20-141(B)",
"Code": "4450"
},
{
"Action": "ARRAIGNED",
"Description": "SPEEDING(80 mph in a 65 mph zone)",
"Severity": "INFRACTION",
"Law": "G.S. 20-141(B)",
"Code": "4450"
},
{
"Action": "CONVICTED",
"Description": "IMPROPER EQUIP - SPEEDOMETER",
"Severity": "INFRACTION",
"Law": "G.S. 20-123.2",
"Code": "4418"
}
]
Ideally, these would be displayed on the CIPRS tab in a table, likely somewhere near here in the template.
The password reset views were not migrated to the React SPA. We can either:
This was mentioned in the meeting with Gina, but we were not provided an example. Let's discuss next meeting.
Petitions must be specific to district or superior courts. If a batch contains both CR and CRS records, then they must be entered into separate petition forms with the appropriate box checked.
In export app, offense dispositions need to be mapped to the following codes within the petition PDF:
On the petition generation page, the agency autocomplete allows selection of the same agency numerous times. Ideally the choices list would exclude the currently selected agencies.
Right now the only attorneys we have as options in the tool are Arnetta and Henry, who are no longer with DEAR. Joseph is to send us a list of attorneys that we should have as options in the tool.
Each row in the Petition PDF's offense section is keyed off of an incrementing index with these field names:
Fileno:1
ArrestDate:1
Description:1
DOOF:1
Disposition:1
DispositionDate:1
For each record.data["Offense Record"]["Records"]
, map:
record.file_no
-> Fileno:N
record.offense_date
-> ArrestDate:N
record.data["Offense Record"]["Records"][N]["Description"]
-> Description:N
record.offense_date
-> DOOF:N
record.disposition_method
-> Disposition:N
record.disposed_on
-> DispositionDate:N
DEAR team wants to be able to fill in client information for petition (Address, SSN, driver's license #, etc.). This information does not come from CIPRS, so needs to be filled in manually.
Not Guilty fields differ from Dismissed Charges:
AC:
dear_petition.petition.types.not_guilty
module exists, modeled after dear_petition.petition.types.dismissed
not_guilty.get_offense_records()
returns an OffenseRecord
queryset where:
Q(action="CHARGED")
Q(offense__verdict__iexact="Not Guilty")
dear_petition.petition.types.main.TYPE_MAP
includes mapping from constants. NOT_GUILTY
to get_offense_records()
abovedear_petition.petition.etl.load.create_batch_petitions()
includes a section to create distinct Petition
objectsIt is possible for a CIPRS record to have offense split into multiple tables on the record, and the parsers currently do not handle that well.
Adobe Acrobat can't see auto-filled text in the petition PDFs. This post implies it may be harder than expected. This issue was opened in pdfrw, but it's unresolved.
This may not be needed if #12 is a good enough workaround.
The React SPA is very simple to get running after cloning the repo:
npm i
npm run start
Ideally a frontend developer could point the backend API based on what was being developed:
This can be customized in package.json
under the proxy setting:
{
"proxy": "http://localhost:8000/"
}
AC:
I tried to go through the non-Docker local setup docs today, and was surprised that they stop after installing requirments, without instructions about setting up a database, running the server, etc. locally. If the project supports non-Docker setups, then we should either
Also set up and document pre-commit hook for black
Up to date petitioner addresses are not available on CIPRS records. Fillable address fields should be added to the generate page so that they can be included on all petitions:
batch["label"]
)They should be submitted alongside the other JSON to the generate API endpoint, e.g:
{
"petition": 11,
"ssn": "111-111-1111",
"drivers_license": "12345678",
"name": "",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"zipcode": "",
}
/petition/api/users/
will always return a single item list based on the logged in user. If the user is is_staff
, it will contain a URL path to the admin. If not, it will be blank.
AC:
These are findings of Guilty. There are two big differences from the Dismissed Charge fields.
AC:
dear_petition.petition.types.misdemeanor
module exists, modeled after dear_petition.petition.types.dismissed
not_guilty.get_offense_records()
returns an OffenseRecord
queryset where:
Q(action="CONVICTED")
Q(offense__verdict__iexact="Guilty")
dear_petition.petition.types.main.TYPE_MAP
includes mapping from constants. MISDEMEANOR
to get_offense_records()
abovedear_petition.petition.etl.load.create_batch_petitions()
includes a section to create distinct AOC-CR-281 Petition
objectsIf there's only a single offense date, the tool should calculate the age and fill in the Age
PDF field. However, if there are multiple offense dates represented on a petition, just fill the field with Varies
.
Users should be able to manually override the court record parsed fields.
510 South Dillard Street, Durham, NC 27701
This is a trickier but common situation where the defendant is charged with a higher-classification offense (typically a felony) but pleads guilty to a lesser-included offense (such as a misdemeanor).
Notes: DJ listed the phrase that is found on the CIPRS record. These are generally located in the “Disposition Method” field of the CIPRS record. In parenthesis, I listed the corresponding code that should be displayed in the petition’s “Disposition” column.
This form is used as an addendum to any expunction petition when there are additional LEO agencies and/or offenses that need to be listed and don’t fit on the petition.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.