Task/update playwright logic#1
Open
JERotter wants to merge 92 commits into
Open
Conversation
jackmanleydev
requested changes
Oct 30, 2025
jackmanleydev
left a comment
There was a problem hiding this comment.
Looks like a good start. Walked through a potential refactoring options for the excel script and examples of what that could look like. Holding off on going down that path until we get feedback from stakeholders, because most of that code could change if they want the data in a specific format.
drak72
reviewed
Nov 17, 2025
|
|
||
| The script connects to these live endpoints: | ||
|
|
||
| - **Summary API**: `https://ocyjm4kh1i.execute-api.us-east-1.amazonaws.com/prod/usjs/v1/summary` |
Contributor
There was a problem hiding this comment.
Hardcoding isn't...great overall.
Let's at least put a DNS name on top of this longer term. Will go through that process with PE.
…n randomizing the version numbers, some of which may not exist irl
…ers casued timeout errors)
…tional error message.
…ittent timeout; simplified name parser mapping
…e fallback for zip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes updates to:
scrape.ts -
const link = page.locator('[href*="/Report/${type}?"]');was updated to
const docketRow = page.locator('tr:has-text("${docketNum}")');const link = docketRow.locator('[href*="/Report/${type}?"]').first();to address a 'Resolved to 2 elements' error.
scrape.ts, type.ts and serialize.ts -
were updated to return the summary and docket URLs. The URLs we need include a dnh value that cannot be derived deterministically from the docket number — it’s generated and owned by the upstream system. To ensure our links remain accurate and resilient to system changes, we fetch the full URLs directly from the API instead of trying to reconstruct them client-side. This makes the automation future-proof and guarantees we always link to the correct court records.
CourtDataExcelScript.ts -
Added an Excel Office Script that invokes the scrAPI lambda and pulls data into the spreadsheets.
CourtDataExcelScript.ts:
🔹 Reads input
Takes docket numbers from the currently active worksheet (column A, rows 2–100)
🔹 Calls backend APIs
For each docket number:
Calls Summary API → returns defendant details + case and charge metadata
Calls Docket API → returns financial balance and payment info
🔹 Extracts and normalizes data
Parses full legal names into First / Middle / Last columns
Handles multiple cases, charges, and sentences per docket
Avoids null/undefined issues with safe fallbacks
🔹 Writes structured output into new worksheets
It creates and populates these tabs:
🔹 Adds interactive URL links
Summary and Docket hyperlinks for the first docket entry
Raw JSON data & links to allow auditors/devs to inspect the unprocessed API response directly
🔹 Performance and reliability features
Includes throttling (150ms delay) to avoid API rate limits
Includes error handling so one failed docket does not stop the entire run
Cleans prior data before writing fresh output