Skip to content
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

feat(recap): Enables appellate attachment page purchases #4919

Merged
merged 10 commits into from
Jan 18, 2025

Conversation

ERosendo
Copy link
Contributor

Key changes.

  • Introduces a new function, is_appellate_court, which determines whether a given court ID belongs to an appellate court. This helper improves code readability and maintainability by adhering to the DRY principle.

  • Updates the fetch_attachment_page task and the get_att_report_by_rd method to support appellate attachment pages.

fixes #4862

This commit introduces a new function, is_appellate_court(), which  determines whether a given court ID belongs to an appellate court. This function is useful for filtering and categorizing courts based on their jurisdiction.
@ERosendo ERosendo force-pushed the 4862-feat-enable-appellate-attachment-page-purchases branch from d0e6952 to f5c8286 Compare January 14, 2025 06:36
@ERosendo ERosendo requested a review from mlissner January 14, 2025 06:36
Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

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

Looks pretty OK to me, though I might have expected another test or two, but that's not based on any knowledge of what tests we already have, just a thought.

I appreciate the addition of the helper function and the small tweaks to use it too. We should do more of this as we see these kinds of things. (It's OK to have their own PR too, if they're bigger and worth it.)

Onward to full review. :)

Thanks!

@mlissner mlissner requested a review from albertisfu January 14, 2025 15:12
@mlissner mlissner assigned albertisfu and unassigned mlissner Jan 14, 2025
Comment on lines 1797 to 1802
att_report = AttachmentPage(pacer_court_id, s)
att_report.query(rd.pacer_doc_id)
if is_appellate_court(pacer_court_id):
att_report = AppellateAttachmentPage(pacer_court_id, s)
else:
att_report = AttachmentPage(pacer_court_id, s)
Copy link
Contributor

Choose a reason for hiding this comment

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

While testing this with a real Fetch request, I noticed it was failing at this part:

It worked after applying this tweak:

Suggested change
att_report = AttachmentPage(pacer_court_id, s)
att_report.query(rd.pacer_doc_id)
if is_appellate_court(pacer_court_id):
att_report = AppellateAttachmentPage(pacer_court_id, s)
else:
att_report = AttachmentPage(pacer_court_id, s)
if is_appellate_court(pacer_court_id):
att_report = AppellateAttachmentPage(pacer_court_id, s)
else:
att_report = AttachmentPage(pacer_court_id, s)
att_report.query(rd.pacer_doc_id)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're correct. Thanks!

@albertisfu
Copy link
Contributor

Thanks @ERosendo this looks about right! In addition to my comments above:

  • I think this is a good opportunity to remove recap_docs.json from the RecapPdfFetchApiTest class and use factories instead.
  • I would recommend adding a couple of additional test cases to RecapPdfFetchApiTest to cover the district and appellate tweaks made in this PR: one to fetch a district attachment page and another to fetch an appellate attachment page. We can leverage mocks for AppellateAttachmentPage or AttachmentPage to confirm the correct report class is being called based on the court to which the request belongs. Additionally, we can use a couple of mocks for the parser methods, such as get_data_from_appellate_att_report or get_data_from_att_report, to return different data based on the court type being tested. A DictFactory, like AppellateAttachmentPageFactory, could be utilized in this process.

@albertisfu
Copy link
Contributor

One last comment, as we discussed on Slack:

  • In this PR we're not adding support for fetching ACMS attachment pages. Currently, such requests will fail. In the meantime, while we determine whether it will be possible to support them, would it be a good idea to add a custom error message for the failed FQ, such as: "ACMS attachment pages are not currently supported"?

@ERosendo ERosendo force-pushed the 4862-feat-enable-appellate-attachment-page-purchases branch from 4d11b86 to 05550e8 Compare January 17, 2025 19:52
@ERosendo
Copy link
Contributor Author

Thanks for your review @albertisfu

would it be a good idea to add a custom error message for the failed FQ, such as: "ACMS attachment pages are not currently supported"?

This makes perfect sense. I checked Juriscraper and discovered that the ACMSAttachmentPage class lacks an implementation for the query method.

Furthermore, I recalled that the extension currently does not send HTML data for ACMS cases. Instead, it sends JSON. Therefore, we need to determine if it's possible to query ACMS court data and receive a JSON response. If this direct JSON retrieval is not possible, we should also implement a method to parse the necessary data from the HTML response.

@ERosendo ERosendo requested a review from albertisfu January 17, 2025 20:10
@ERosendo ERosendo removed their assignment Jan 17, 2025
@mlissner
Copy link
Member

Can I suggest that we put the error message in place and make an issue for ACMS support for the next sprint?

@ERosendo
Copy link
Contributor Author

Can I suggest that we put the error message in place and make an issue for ACMS support for the next sprint?

@mlissner The error message was introduced in commit 05550e8(with tests) and here's the issue: #4938

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 changes look great! :shipit:

@mlissner mlissner merged commit 2b0cda5 into main Jan 18, 2025
15 checks passed
@mlissner mlissner deleted the 4862-feat-enable-appellate-attachment-page-purchases branch January 18, 2025 06:28
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.

Enable attachment page purchases for appellate cases.
3 participants