JustUtahCoders / utahexpungements.org

The frontend code for utahexpungements.org
MIT License
11 stars 19 forks source link

Parser logic failing with difference in docket formatting #174

Open oliviaclyde opened 4 years ago

oliviaclyde commented 4 years ago

Parser logic is failing due to docket formatting differences. It appears most dockets have indentations with white space inside each charge. Outlier case has a docket with left alignment on the charges section. This difference in alignment throws the parsing off and the "Offense Date" is parsed in the "Severity" section. The flag checking the severity of the charge then fails because the array returns empty of key words.

Reference docket: Axxxx xxxxx6862

Mengqi89 commented 4 years ago

This is what the parser yields:

{ "caseNumber": "191906862", "charges": [ { "statute": "76-5-202", "offenseName": "AGGRAVATED MURDER", "severity": "Offense Date: June 17, 2019" }, { "statute": "76-5-302", "offenseName": "AGGRAVATED KIDNAPPING", "severity": "Offense Date: June 17, 2019" }, { "statute": "76-8-306(1)", "offenseName": "OBSTRUCTING JUSTICE", "severity": "Offense Date: June 17, 2019" }, { "statute": "76-9-704", "offenseName": "ABUSE OR DESECRATION OF A DEAD HUMAN BODY", "severity": "Felony" } ], "accountSummary": [ { "name": "ACCOUNT SUMMARY", "collection": false } ] }