Collin County Court Monitor
Use the bundled scripts to run the same repeatable workflow each time:
- Prepare a CSV file matching the shape in references/input-csv-example.csv.
- Run
scripts/court_case_scraper.pyto scrape every case withscrape_flag=Y. - Run
scripts/generate_new_events_report.pyto produce a Markdown and CSV report for a scrape date. - Run
scripts/send_outlook_report.pywhen you want Outlook drafts or sent emails. - Use
scripts/run_daily_cycle.pywhen you want scraping, reporting, and optional Outlook delivery to run back to back.
Before running the workflow for another user, ask for:
- the working folder that should hold the case list, case CSV output, and report output
- the path to the case-list CSV if it is not in the working folder
- whether email routing should come from the
attorney_emailcolumn or from one override email address - whether the user wants Outlook drafts or immediate sends
Quick Start
Install dependencies:
python -m pip install -r .\scripts\requirements.txt
Run the full cycle:
python .\scripts\run_daily_cycle.py --input-csv .\cases.csv --case-output-dir .\court_scraper_output --report-output-dir .\court_scraper_reports --email-mode draft
Run the scraper only:
python .\scripts\court_case_scraper.py --input-csv .\cases.csv --output-dir .\court_scraper_output
Generate the latest report only:
python .\scripts\generate_new_events_report.py --input-dir .\court_scraper_output --output-dir .\court_scraper_reports
Create Outlook drafts using attorney_email from the case-list CSV:
python .\scripts\send_outlook_report.py --case-list-csv .\cases.csv --input-dir .\court_scraper_output --output-dir .\court_scraper_reports --mode draft
Send a combined report to one override address:
python .\scripts\send_outlook_report.py --case-list-csv .\cases.csv --input-dir .\court_scraper_output --output-dir .\court_scraper_reports --mode send --email-to reports@yourfirm.com
Workflow Notes
- Support only the public Collin County site and the
Casetab event table. - Require Chrome to be installed locally because Selenium drives a real browser.
- Require desktop Outlook on Windows for draft/send automation.
- Update
last_scraped_onin the input CSV after a successful scrape. - Use
YorNinscrape_flagso colleagues can maintain the list easily in Excel. - Support an optional
attorney_emailcolumn in the case-list CSV for per-attorney Outlook routing. - Write one CSV per cause number and append only unseen docket rows.
- Include both
scraped_dateandscraped_on_utcin each event row so later reports can filter by scrape day or exact timestamp. - Default the report generator to the latest
scraped_datepresent in the case CSVs when--report-dateis omitted. - Default the Outlook sender to drafts unless the user clearly asks to send immediately.
Resources
scripts/
court_case_scraper.py: scrape flagged cause numbers from the CSV file and update per-case CSVs.generate_new_events_report.py: create attorney-grouped Markdown and CSV reports for a scrape date.send_outlook_report.py: create Outlook drafts or send Outlook emails with report attachments.send_outlook_mail.ps1: PowerShell helper that drives the local Outlook desktop application.run_daily_cycle.py: run scraping, reporting, and optional Outlook delivery in one command.requirements.txt: minimal Python dependency list.
references/
input-csv-example.csv: example case-list payload for new matters.
Maintenance
- Inspect selectors in
scripts/court_case_scraper.pyif the Collin County site changes its markup or navigation flow. - Keep county-specific assumptions inside the scraper; do not silently reuse this skill for other counties without adapting selectors and routing.