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

activity_report #282

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Alex-Devoid
Copy link

@Alex-Devoid Alex-Devoid commented Jan 16, 2020

As discussed, a parser for PACER's Docket Activity Report (https://ecf.azd.uscourts.gov/cgi-bin/DktActivityRpt.pl).

report = ActivityReport('azd', pacer_session)
report.query(open,closed,office,type,start,end,text)
print(report.data)
#returns results as JSON

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.

Pretty good stuff. Lots of smallish comments, I think. Maybe a few bigger ones.

One thing that's missing is tests. Can you look at our testing framework and add some of those too? Let me know if you need help.

Comment on lines +88 to +93
data = []

table = self.tree.xpath('//table')[0]

rows = table.xpath('.//tr')

Copy link
Member

Choose a reason for hiding this comment

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

This whitespace should go.


def _main():
if len(sys.argv) != 2:
print("Usage: python -m juriscraper.pacer.case_query filepath")
Copy link
Member

Choose a reason for hiding this comment

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

Update this please

self._metadata = data
return data

def query(self, open, closed, office, type, start, end, text):
Copy link
Member

Choose a reason for hiding this comment

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

Can't use type as a parameter, it's a Python keyword.

This should also support docket number, event category, case flags, and sorting.

Are start and end done the same as other examples in Juriscraper? I think they have different names elsewhere.

Finally, your docstring should outline the parameters using :param, as elsewhere.

Comment on lines +150 to +171
<option selected=""></option>
<option value="cv">Civil</option>
<option value="cr">Criminal</option>
<option value="em">Emergency Matter</option>
<option value="mj">Magistrate Judge</option>
<option value="mc">Miscellaneous</option>
<option value="md">Multi-District Litigation</option>
<option value="nr">Non Reportable</option>
<option value="nc">Non-Compliance</option>
<option value="po">Petty Offense</option>
<option value="ph">Pro Hac Vice Case</option>
<option value="pt">Probation Transfer</option>
<option value="ps">Prose Screening</option>
<option value="sc">Sealed Civil</option>
<option value="sm">Sealed Miscellaneous</option>
<option value="mb">Search Warrant</option>
<option value="sa">Staff Attorney Assignment</option>
<option value="at">Temporary Case Type</option>
<option value="vc">Virtual CR Case for 3rd Judge</option>
<option value="wi">Waiver of Indictment</option>
<option value="wt">Wire Tap</option>
<option value="gj">~Grand Jury</option>
Copy link
Member

Choose a reason for hiding this comment

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

Are these universal or per court? If the latter, we should either remove them from here (I think this is probably preferred) or note that loudly.

Comment on lines +174 to +175
start = 'm/d/yyyy'
end = 'm/d/yyyy'
Copy link
Member

Choose a reason for hiding this comment

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

These should be date objects. That way calling code doesn't have to think about dumb PACER date formatting decisions.

"""

assert self.session is not None, \
"session attribute of DocketReport cannot be None."
Copy link
Member

Choose a reason for hiding this comment

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

Update this, please.

Comment on lines +98 to +107
def isFlags(cols):
#Check for case flags. It's not always present.
try:
cols.index('Case Flags:')
except ValueError:
flag = "none"
return flag
else:
flag = cols[cols.index('Case Flags:')+3]
return flag
Copy link
Member

Choose a reason for hiding this comment

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

I don't think I would nest this here. Better to pull it out.

Copy link
Member

Choose a reason for hiding this comment

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

Also, shouldn't it be more like has_flags?

Comment on lines +115 to +127
u"docket_report_url":cols[1].xpath('@href')[0],
u"entered": cols[cols.index('Entered: ')+1],
u"time": cols[cols.index('Entered: ')+3],
u"filed": cols[cols.index('Filed: ')+1],
u"closed": cols[8],
u"event": cols[cols.index('Event:')+1],
u"case_flags": flags,
u"category": cols[cols.index('Category:')+1],
u"presider": cols[cols.index('Presider: ')+1],
u"office": cols[cols.index('Office:')+1],
u"docketed_by":cols[cols.index('Document: ')+5],
u"doc1":cols[cols.index('Document: ')+1].xpath('@href')[0],
u"doc_count":cols[cols.index('Document: ')+2]
Copy link
Member

Choose a reason for hiding this comment

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

It's hard to understand here what you're doing with the math and the indexing and whatnot. Could you pull some of these cols.index(xxx) bits into usefully named variables, maybe?

Formatting wise, these should have spaces around the + signs. Also, no whitespace before the tailing }.


def parse(self):
self._clear_caches()
print(self)
Copy link
Member

Choose a reason for hiding this comment

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

I assume printing this every time isn't desirable?

Copy link
Member

Choose a reason for hiding this comment

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

And if that's true, do we need this function at all?

@CLAassistant
Copy link

CLAassistant commented Dec 18, 2021

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants