-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eCourts Portal import proof of concept #431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments before testing
"VD-District Dismissals w/o Leave by DA - No Plea Agreement", | ||
"VD-Superior Dismissals w/o Leave by DA - No Plea Agreement", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Idea]
Maybe we can re-use the DISPOSITION_METHOD_CODE_MAP
constant. More data needed to see if Tyler Technology always uses the codes here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to dear_petition.petition.constants.DISMISSED_DISPOSITION_METHODS
dear_petition/portal/etl/load.py
Outdated
def import_portal_record(user, source): | ||
"""Import eCourts Portal records into models.""" | ||
logger.info("Importing Portal record") | ||
data = transform_portal_record(source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're formalizing the common data between CIPRS and Portal, we should probably create a dataclass, something like ParsedOffenseRecord
, that represents our parsed data.
@classmethod | ||
def parse_date(cls, v): | ||
if isinstance(v, str): | ||
return dt.datetime.strptime(v, "%m/%d/%Y") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the date string is in a different format? That's a common issue with CIPRS pdfs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it'll throw a ValidationError, which hopefully will get logged in Sentry.
>>> from dear_petition.portal.etl.parsers import case_info
>>> case_info.Charge(
... number=1,
... offense="BREAK OR ENTER A MOTOR VEHICLE",
... statute="14-56",
... degree="FNC",
... offense_date="January 1, 2001",
... filed_date="01/09/2001",
... )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/copelco/projects/dear-petition/.direnv/python-3.8/lib/python3.8/site-packages/pydantic/main.py", line 164, in __init__
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Charge
offense_date
Value error, time data 'January 1, 2001' does not match format '%m/%d/%Y' [type=value_error, input_value='January 1, 2001', input_type=str]
For further information visit https://errors.pydantic.dev/2.4/v/value_error
dear_petition/portal/etl/models.py
Outdated
if self.degree in ("FH", "FNC"): | ||
severity = "FELONY" | ||
elif self.degree in ("MNC",): | ||
severity = "MISDEMEANOR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use constants for all these strings
src/bookmarklet/bookmarklet.js
Outdated
|
||
document.body.appendChild(iframe); | ||
|
||
form.submit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an alert("Successfully submitted case summary to Expunction Tool");
after form.submit()
? And maybe we can clarify what they'd like to call the tool in case Expunction Tool isn't good
logger = logging.getLogger(__name__) | ||
|
||
COUNTY_COURT_REGEX = re.compile(r"([\w\s]+)(District|Superior) Court") | ||
FILENO_REGEX = re.compile(r"\d\dCR\d\d\d\d\d\d-\d\d\d") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure the number of digits is always the same? The ciprs reader just grabs all characters that match \w+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good question. I'm not sure. We need more records to see.
src/bookmarklet/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme is out of date in regards to compressing the bookmarklet at least. Is everything else still relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
src/bookmarklet/bookmarklet.js
Outdated
@@ -0,0 +1,47 @@ | |||
const POST_URL = import.meta.env.MODE === 'development' ? 'http://localhost:8000' : 'https://www.durhamexpunction.org'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Replace with base window.location url
…nto portal-import
Co-authored-by: Rob Gries <[email protected]>
Summary
Bookmarklet local dev
Inspiration:
Run tests
Local development
Add bookmarklet to your bookmarks bar
Log in and drag the "Portal Importer (development)" button to your bookmarks bar.
Search and import from eCourts Portal
Visit https://portal-nc.tylertech.cloud/Portal/Home/Dashboard/29 and search for
a record. Click bookmark when on record detail page.
Watch output from Django server.