-
-
Notifications
You must be signed in to change notification settings - Fork 182
feat(recap): Enhances appellate docket purchase to support ACMS cases #5960
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
Changes from 8 commits
488e37b
b665ac4
c7f3fa7
4074464
f27ec6a
02d6857
f00ce21
680d6ce
3ca9b36
4af3d81
79c33dd
a24588e
7e05d32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
from juriscraper.lib.string_utils import CaseNameTweaker, harmonize | ||
from juriscraper.pacer import ( | ||
ACMSAttachmentPage, | ||
AcmsCaseSearch, | ||
ACMSDocketReport, | ||
AppellateDocketReport, | ||
CaseQuery, | ||
|
@@ -65,6 +66,7 @@ | |
is_bankruptcy_court, | ||
is_long_appellate_document_number, | ||
mark_ia_upload_needed, | ||
should_check_acms_court, | ||
) | ||
from cl.custom_filters.templatetags.text_filters import oxford_join | ||
from cl.lib.filesizes import convert_size_to_bytes | ||
|
@@ -2348,7 +2350,7 @@ def create_or_update_docket_data_from_fetch( | |
fq: PacerFetchQueue, | ||
court_id: str, | ||
pacer_case_id: str | None, | ||
report: DocketReport | AppellateDocketReport, | ||
report: DocketReport | AppellateDocketReport | ACMSDocketReport, | ||
docket_data: dict[str, Any], | ||
) -> dict[str, str | bool]: | ||
"""Creates or updates docket data in the database from fetched data. | ||
|
@@ -2420,12 +2422,39 @@ def purchase_appellate_docket_by_docket_number( | |
:param fq: The PacerFetchQueue object | ||
:return: a dict with information about the docket and the new data | ||
""" | ||
report = AppellateDocketReport(map_cl_to_pacer_id(court_id), session) | ||
report.query(docket_number, **kwargs) | ||
acms_case_id = None | ||
|
||
if should_check_acms_court(court_id): | ||
acms_search = AcmsCaseSearch(court_id="ca9", pacer_session=session) | ||
acms_search.query(docket_number) | ||
acms_case_id = ( | ||
acms_search.data["pcx_caseid"] if acms_search.data else None | ||
) | ||
|
||
pacer_court_id = map_cl_to_pacer_id(court_id) | ||
report_class = ACMSDocketReport if acms_case_id else AppellateDocketReport | ||
report = report_class(pacer_court_id, session) | ||
|
||
if acms_case_id: | ||
# ACMSDocketReport only accepts the case ID; filters are not currently | ||
# supported for ACMS docket reports. | ||
report.query(acms_case_id) | ||
else: | ||
report.query(docket_number, **kwargs) | ||
|
||
docket_data = report.data | ||
if not docket_data: | ||
raise ParsingException("No data found in docket report.") | ||
|
||
if acms_case_id: | ||
docket_data["docket_entries"] = sorted( | ||
docket_data["docket_entries"], | ||
key=lambda d: ( | ||
d["date_filed"], | ||
d["document_number"] is None, | ||
d["document_number"], | ||
), | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember we have this sorting logic in a different method. Can we create a method with this logic that can be reused? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're correct. I'll add the new helper method and refactor this code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw when testing the fetch attachment page PR I found this docket: Which I retrieved using the fetch API in my local env. As you can see the entry 17 is in the wrong place due to date Field is being prioritized over the document number. ![]() I checked in PACER and the date filed is correct. Would it be possible to prioritize the document number, and use the date filed if it's None? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we just introduced a method to sort ACM entries, I think we could check whether all docket entries in the input have a document_number. If they do, we can sort purely by that number. Otherwise, we fall back to the existing sort function. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think this makes sense. We can leverage the fact that all entries are available when fetching the docket. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool! i'll refine the new helper method |
||
return create_or_update_docket_data_from_fetch( | ||
fq, court_id, None, report, docket_data | ||
) | ||
|
Uh oh!
There was an error while loading. Please reload this page.