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

Skip bills with restricted view #251

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lametro/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def scrape(self, window=28, matter_ids=None) :

n_days_ago = datetime.datetime.utcnow() - datetime.timedelta(float(window))
for matter in matters:
# If this Boolean field is True, then do not scrape the Bill.
# This issue explains why a restricted Bill might appear (unwelcome) in the Legistar API:
# https://github.com/datamade/la-metro-councilmatic/issues/345#issuecomment-421184826
if matter['MatterRestrictViewViaWeb']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this always true or false and not none?

Copy link
Contributor Author

@reginafcompton reginafcompton Oct 17, 2018

Choose a reason for hiding this comment

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

The Legistar docs describe it as a boolean: http://webapi.legistar.com/Help/Api/PUT-v1-Client-Matters-MatterId A boolean, I believe, can be null, but that does not seem possible in this case, since the value of MatterRestrictViewViaWeb is determined Metro staff checking a box. That is, if the box is checked, then the value is true, and if the box is unchecked, then the value is false.

continue

matter_id = matter['MatterId']

date = matter['MatterIntroDate']
Expand Down Expand Up @@ -222,7 +228,6 @@ def scrape(self, window=28, matter_ids=None) :
media_type="application/pdf")

bill.extras = {'local_classification' : matter['MatterTypeName']}
bill.extras = {'restrict_view' : matter['MatterRestrictViewViaWeb']}

text = self.text(matter_id)

Expand Down