From e936bf32255d2fc1a2cb9452c8c16763584489d4 Mon Sep 17 00:00:00 2001 From: Nicolas Sawyer Date: Sun, 13 Oct 2024 14:30:10 -0500 Subject: [PATCH] Parser end to end test (#160) * parser unittest multi html creator * added parser end-to-end unit test * making test = true for parser end to end unitest --------- Co-authored-by: Matt Allen --- resources/test_files/test_123456.html | 194 ++++++++++++++++++++++++++ resources/test_files/test_123456.json | 82 +++++++++++ src/parser/__init__.py | 3 +- src/tester/test_unittest.py | 7 + 4 files changed, 284 insertions(+), 2 deletions(-) create mode 100644 resources/test_files/test_123456.html create mode 100644 resources/test_files/test_123456.json diff --git a/resources/test_files/test_123456.html b/resources/test_files/test_123456.html new file mode 100644 index 0000000..2677249 --- /dev/null +++ b/resources/test_files/test_123456.html @@ -0,0 +1,194 @@ + + + + + + + + + +
Skip to Main Content Logout My Account Search Menu New Calendar Search Refine Search  + Back 
+ Location : All CourtsHelp
Register of Actions
+ Case No. CR-17-5152-C
The State of Texas vs. Zzzzzz Xxxxxx§
§
§
§
§
Case Type:Adult Felony
Date Filed:01/05/2016
Location:22nd District Court
Party Information
Lead Attorneys
DefendantXxxxxx, ZzzzzzFemale White
+ DOB: 02/15/1997
5'�6", 200 lbs
Richard Jones
��Court Appointed
512-632-2433(W)
  876 Main St
  Natalia, TX 78059
  SID: + TX03816410
 
StateThe State of Texas Yuuuuu Haaaaa
512-362-7711(W)
  712 S Stagecoach TRL
  San Marcos, TX 78666
Charge Information
+ Charges: Xxxxxx, Zzzzzz + Statute + + Level + + Date +
1. +  AGGRAVATED ASSAULT WITH A DEADLY WEAPON22.02(a)(2)Second Degree Felony10/25/2015
Events & Orders of the Court
   DISPOSITIONS
12/06/2016  
Plea (Judicial Officer: Boyer, Bruce)
1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON
Guilty
12/06/2016  
Disposition (Judicial Officer: Boyer, Bruce)
1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON
Deferred Adjudication
12/06/2016  
Deferred Adjudication (Judicial Officer: Boyer, Bruce)
1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON
CSCD 5 Years +
11/04/2019  
Amended Deferred Adjudication (Judicial Officer: Boyer, Bruce) Reason: Community Supervision Extended
1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON
CSCD 7 Years +
11/04/2019  
Amended Disposition (Judicial Officer: Boyer, Bruce) Reason: Community Supervision Extended
1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON
Amend Probation
   
   OTHER EVENTS AND HEARINGS
10/29/2015  Bond (Cash/Surety) After Release from Jail
See Bond Tab
01/05/2016  Indictment (Open Case)
01/05/2016  Court's Docket Sheet
02/09/2016  Returned To Sender
NOTICE OF ARRAIGNMENT +
02/24/2016  Arraignment  + (9:00 AM) + + (Judicial Officer Henry, William R) +
Result: Reset
02/24/2016  Application For Court Appointed Attorney/Order + (Judicial Officer: + Ramsay, Charles + ) +
MARTIN CLAUDER
03/15/2016  Waiver of Arraignment
03/15/2016  Waiver of Arraignment
Unsigned
03/23/2016  CANCELED   + Arraignment  + (9:00 AM) + + (Judicial Officer Henry, William R) +
Waived Arraignment
04/14/2016  Pre Trial Motions (Non-Evidentiary)  + (9:00 AM) + + (Judicial Officer Robison, Jack) +
Result: Reset
04/29/2016  Discovery Receipt Email from District Attorney
04/29/2016  Discovery Receipt Email from District Attorney
05/05/2016  Acknowledgement of Receipt of Discovery
05/12/2016  Pre Trial Motions (Non-Evidentiary)  + (9:00 AM) + + (Judicial Officer Steel, Gary L.) +
Result: Reset
06/15/2016  Pre Trial Motions (Non-Evidentiary)  + (9:00 AM) + + (Judicial Officer Henry, William R) +
Result: Reset
07/27/2016  Pre Trial Motions (Non-Evidentiary)  + (9:00 AM) + + (Judicial Officer Henry, William R) +
Result: Reset
07/27/2016  Bailiffs Certificate + (Judicial Officer: + Henry, William R + ) +
07/29/2016  Capias Issued
See Warrant Tab
07/29/2016  Capias Recalled
08/25/2016  Pre Trial Motions (Non-Evidentiary)  + (9:00 AM) + + (Judicial Officer Henry, William R) +
Result: Reset
09/26/2016  Pre Trial Motions (Non-Evidentiary)  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Reset
09/26/2016  Plea Bargain Agreement
11/07/2016  CANCELED   + Punishment Hearing  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Defendant's Request
12/06/2016  Punishment Hearing  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Def. Adjudication
12/06/2016  Trial Court 's Certification of Defendant's Right of Appeal + (Judicial Officer: + Boyer, Bruce + ) +
12/06/2016  Conditions of Probation
Deferred Adjudication +
12/06/2016  Court Cost (Bill of Cost)
12/09/2016  Motion/Order for Payment of Itemized Time/Services + (Judicial Officer: + Boyer, Bruce + ) +
03/30/2017  Amended Conditions of Probation
First Amended-Deferred Adjudication
10/24/2017  Show Cause Hearing  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Failure To Appear
10/24/2017  Bailiffs Certificate + (Judicial Officer: + Boyer, Bruce + ) +
10/25/2017  Capias Issued
See Warrant Tab
11/01/2017  Motion to Revoke Probation/Adjudicate Guilt (Reopen Case) + (Judicial Officer: + Boyer, Bruce + ) +
11/06/2017  Judge's Fiat + (Judicial Officer: + Boyer, Bruce + ) +
11/08/2017  Capias Issued
See Warrant Tab
09/03/2019  Order + (Judicial Officer: + Junkin, David + ) +
Appointing Attorney
09/05/2019  Capias Executed
See Warrant Tab
09/05/2019  Capias Executed
See Warrant Tab
09/06/2019  Bench Warrant (See Warrant Tab)
09/06/2019  Magistrate Warning
09/06/2019  Magistration Documents
09/08/2019  Application For Court Appointed Attorney/Order + (Judicial Officer: + Junkin, David + ) +
Denied
09/16/2019  Discovery Receipt Email from District Attorney
10/10/2019  Motion to Adjudicate  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Reset
11/04/2019  Motion to Adjudicate  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Prob Modified
11/04/2019  Court Writ
11/04/2019  Trial Court 's Certification of Defendant's Right of Appeal + (Judicial Officer: + Boyer, Bruce + ) +
11/04/2019  Stipulation of Evidence
11/20/2019  Motion/Order for Payment of Itemized Time/Services + (Judicial Officer: + Boyer, Bruce + ) +
12/03/2019  Court Cost (Bill of Cost)
05/05/2020  Motion To Waive Court Ordered Debts + (Judicial Officer: + Boyer, Bruce + ) +
Supervision Fees
02/09/2022  Motion to Revoke Probation/Adjudicate Guilt (Reopen Case) + (Judicial Officer: + Boyer, Bruce + ) +
02/15/2022  Judge's Fiat + (Judicial Officer: + Boyer, Bruce + ) +
02/23/2022  Capias Issued
See Warrant Tab
03/04/2024  Capias Executed
See Warrant Tab
03/08/2024  Bond (Cash/Surety) After Release from Jail
See Bond Tab
04/25/2024  Motion to Adjudicate  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Reset
05/01/2024  Acknowledgement of Receipt of Discovery
Discovery Receipt - Email CR-18-32131-A
05/07/2024  Application For Court Appointed Attorney/Order
Richard Jones
06/06/2024  Motion to Adjudicate  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Reset
07/01/2024  Motion to Adjudicate  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Result: Reset
08/12/2024  Motion to Adjudicate  + (9:00 AM) + + (Judicial Officer Boyer, Bruce) +
Financial Information
      
      
   Defendant Xxxxxx, Zzzzzz
   Total Financial Assessment 2,755.10
   Total Payments and Credits 712.00
    + Balance Due as of 07/21/2024 2,043.10
       
12/05/2016  Transaction Assessment   274.00
12/07/2016  Transaction Assessment   800.00
12/08/2016  Transaction Assessment   100.00
12/21/2016  Transaction Assessment   700.00
01/05/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (76.00)
01/06/2017  Transaction Assessment   25.00
01/09/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (88.00)
01/17/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (114.00)
01/23/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (75.00)
03/15/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (150.00)
05/08/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (75.00)
06/27/2017  Payment Receipt # 412412-DC Xxxxxx, Zzzzzz (134.00)
02/22/2018  Transaction Assessment   356.10
12/03/2019  Transaction Assessment   500.00
       
+
+ + + diff --git a/resources/test_files/test_123456.json b/resources/test_files/test_123456.json new file mode 100644 index 0000000..f267b46 --- /dev/null +++ b/resources/test_files/test_123456.json @@ -0,0 +1,82 @@ +{ + "Case Metadata": { + "code": "CR-17-5152-C", + "odyssey id": "test_123456", + "county": "hays" + }, + "Case Details": { + "name": "The State of Texas vs. Zzzzzz Xxxxxx", + "case type": "Adult Felony", + "date filed": "01/05/2016", + "location": "22nd District Court" + }, + "Defendent Information": { + "defendant": "Xxxxxx, Zzzzzz", + "sex": "Female", + "race": "White", + "date of birth": "DOB: 02/15/1997", + "height": "5'6\",", + "weight": "200", + "defense attorney": "Richard Jones", + "appointed or retained": "Court Appointed", + "defense attorney phone number": "512-632-2433(W)", + "defendant address": "876 Main St Natalia, TX 78059", + "SID": "TX03816410" + }, + "State Information": { + "prosecuting attorney": "Yuuuuu Haaaaa", + "prosectuing attorney phone number": "512-362-7711(W)" + }, + "Charge Information": [ + { + "charges": "AGGRAVATED ASSAULT WITH A DEADLY WEAPON", + "statute": "22.02(a)(2)", + "level": "Second Degree Felony", + "date": "10/25/2015" + } + ], + "Disposition Information": [ + { + "date": "12/06/2016", + "event": "Disposition", + "judicial officer": "Boyer, Bruce", + "details": [ + { + "charge": "1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON", + "outcome": "Deferred Adjudication" + } + ] + }, + { + "date": "11/04/2019", + "event": "Amended Disposition", + "judicial officer": "Boyer, Bruce) Reason: Community Supervision Extende", + "details": [ + { + "charge": "1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON", + "outcome": "Amend Probation" + } + ] + }, + { + "date": "12/06/2016", + "event": "Deferred Adjudication", + "judicial officer": "Boyer, Bruce", + "details": [ + { + "charge": "1. AGGRAVATED ASSAULT WITH A DEADLY WEAPON", + "outcome": "CSCD", + "additional_info": [ + "5 Years" + ] + } + ] + } + ], + "Top Charge": { + "charge name": "AGGRAVATED ASSAULT WITH A DEADLY WEAPON", + "charge level": "Second Degree Felony" + }, + "Dismissed Charges Count": 0, + "html_hash": "8d4a80173c700b37" +} \ No newline at end of file diff --git a/src/parser/__init__.py b/src/parser/__init__.py index b614a19..cf1e778 100644 --- a/src/parser/__init__.py +++ b/src/parser/__init__.py @@ -264,8 +264,7 @@ def parse( except Exception as e: logger.info(f"Error in parse: {e}") raise - - + if __name__ == "__main__": parser = Parser() parser.parse(county="hays", case_number=None, parse_single_file=True) diff --git a/src/tester/test_unittest.py b/src/tester/test_unittest.py index 48a2b90..1c7b84f 100644 --- a/src/tester/test_unittest.py +++ b/src/tester/test_unittest.py @@ -970,6 +970,13 @@ def test_write_error_log(self, mock_logger, mock_open_func): mock_open_func.assert_called_once_with(error_log_path, "w") + def test_parser_end_to_end(self, county="hays", case_number='123456'): + + parser = Parser() + parser.parse(county=county, + case_number=case_number, + parse_single_file=True, + test = True) class CleanTestCase(unittest.TestCase): def test_cleaner_hays(self):