Skip to content

feat(recap): Adds support for ACMS attachment page purchases #5971

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

Merged

Conversation

ERosendo
Copy link
Contributor

@ERosendo ERosendo commented Jul 14, 2025

Key changes:

  • Removes the early return in fetch_attachment_page for ACMS requests, allowing ACMS attachments to be properly processed.

  • Updates fetch_attachment_page logic to support ACMS documents by skipping HTML parsing and instead using structured data from the ACMS response. The appropriate document number is extracted from the ACMS payload and passed to merge_attachment_page_data along with the is_acms_attachment flag.

  • Refines get_att_report_by_rd to introduce logic to detect ACMS documents and select the appropriate ACMSAttachmentPage class. ACMS attachments are queried using both pacer_case_id and pacer_doc_id.

Depends on #5960 and freelawproject/juriscraper#1495

Fixes #4938

ERosendo added 3 commits July 14, 2025 10:05
Update `get_att_report_by_rd` to handle ACMS documents by selecting the
`ACMSAttachmentPage` class when appropriate.
This commit updates attachment page handling logic to accommodate ACMS documents by skipping HTML parsing and using structured data from the response. The appropriate document number is extracted from the ACMS payload, and the data is passed to `merge_attachment_page_data` with an `is_acms_attachment` flag. This enables
seamless processing of ACMS attachment pages alongside existing district and appellate workflows.
@ERosendo ERosendo changed the title 4938 feat adds support to purchase acms attachment pages feat(recap): Adds support for ACMS attachment page purchases Jul 14, 2025
This test verifies that ACMS attachment pages are correctly processed using the `ACMSAttachmentPage` class and that no district or appellate parsers are called. It also ensures the fetch is marked successful and the expected number of RECAP documents are created.
@ERosendo ERosendo force-pushed the 4938-feat-adds-support-to-purchase-acms-attachment-pages branch from 809b2e2 to 8f2912a Compare July 14, 2025 23:38
@ERosendo ERosendo marked this pull request as ready for review July 14, 2025 23:50
@ERosendo ERosendo requested a review from mlissner July 14, 2025 23:51
@ERosendo ERosendo linked an issue Jul 14, 2025 that may be closed by this pull request
@mlissner mlissner requested review from albertisfu and removed request for mlissner July 15, 2025 13:42
@mlissner mlissner assigned albertisfu and unassigned mlissner Jul 15, 2025
@mlissner mlissner moved this to To Do in Sprint (Web Team) Jul 15, 2025
@mlissner
Copy link
Member

Great. Thank you.

@albertisfu albertisfu moved this from To Do to In progress in Sprint (Web Team) Jul 16, 2025
Copy link
Contributor

@albertisfu albertisfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ERosendo this looks great.

Just a couple of minor comments and suggestions.

"cl.recap.tasks.get_pacer_cookie_from_cache",
return_value=None,
)
def test_fetch_att_page_no_cookies(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to remove this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that — I accidentally removed it while deleting the other test related to ACMS purchases

document_number = None
else:
document_number = att_data["document_number"]

try:
async_to_sync(merge_attachment_page_data)(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a good idea to update the PacerHtmlFiles storage for the attachment data within merge_attachment_page_data, so the attachment data is saved as JSON, similar to what you did for the docket data?

Comment on lines +1885 to +1886
docket_case_id = rd.docket_entry.docket.pacer_case_id
rd_entry_id = rd.pacer_doc_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we start ingesting ACMS email notifications that don't include a pacer_case_id, we'll retrieve it using the AcmsCaseSearch API. However, the pacer_doc_id will be empty for documents merged from ACMS email notifications.

So, I think it would be a good idea to check these values before querying the report as a safeguard. If either is missing, we could raise an error and store it in the FQ, so users understand why the fetch can't complete.

It might be better to perform this check in fetch_attachment_page, since that’s where these values are initially retrieved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I think it would be a good idea to check these values before querying the report as a safeguard.

Great idea — thanks! I'll update the code.

@albertisfu albertisfu moved this from In progress to To Do in Sprint (Web Team) Jul 16, 2025
@albertisfu albertisfu assigned ERosendo and unassigned albertisfu Jul 16, 2025
@ERosendo ERosendo assigned albertisfu and unassigned ERosendo Jul 17, 2025
@ERosendo ERosendo requested a review from albertisfu July 17, 2025 05:23
Base automatically changed from 5154-feat-add-support-to-purchase-acms-dockets to main July 17, 2025 19:28
@albertisfu albertisfu moved this from To Do to In progress in Sprint (Web Team) Jul 17, 2025
Copy link
Contributor

@albertisfu albertisfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @ERosendo this now looks great. Set to auto-merge.

@albertisfu albertisfu enabled auto-merge July 17, 2025 19:58
@albertisfu albertisfu merged commit a44ddb0 into main Jul 17, 2025
11 of 12 checks passed
@albertisfu albertisfu deleted the 4938-feat-adds-support-to-purchase-acms-attachment-pages branch July 17, 2025 20:04
@github-project-automation github-project-automation bot moved this from In progress to Done in Sprint (Web Team) Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Review: Implementing logic to purchase ACMS Attachment Pages
3 participants