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

Import shapes with new management command #256

Merged
merged 5 commits into from
Jun 27, 2019

Conversation

jeancochrane
Copy link
Contributor

Overview

Following the changes in datamade/django-councilmatic#249, create a data directory to store Post shapes locally, and use the new import_shapes management command to load those shapes into the database.

Testing instructions

Test the Makefile

  • Confirm that you can recreate the data file:
    • cd data
    • make clean
    • make

Test the import_shapes command

def get_response(url, params=None, timeout=60, **kwargs):
"""
The OCD API has intermittently thrown 502 and 504 errors, so only proceed
when receiving an 'ok' status.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I adapted this function from https://github.com/datamade/django-councilmatic/blob/5387ae85ea289b22c4e0ea566fa89a1c43155ed0/councilmatic_core/management/commands/import_data.py#L3250-L3261, including the docstring. I'm not actually sure whether the docstring accurately represents what's going on in the function -- it seems to me that the method is simply a thin wrapper around requests to make sure that it A) uses a session and B) raises errors from non-200 status codes -- but the docstring seems to perhaps be communicating an aspect of the OCD API that is useful to know.

Copy link
Member

Choose a reason for hiding this comment

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

I think we don't want this. Let's just get https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Wards-2015-/sp34-6z76 and get into the right shape (see discussion in the other PR)

@jeancochrane jeancochrane requested a review from fgregg June 26, 2019 20:11
def get_response(url, params=None, timeout=60, **kwargs):
"""
The OCD API has intermittently thrown 502 and 504 errors, so only proceed
when receiving an 'ok' status.
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't want this. Let's just get https://data.cityofchicago.org/Facilities-Geographic-Boundaries/Boundaries-Wards-2015-/sp34-6z76 and get into the right shape (see discussion in the other PR)

@jeancochrane jeancochrane requested a review from fgregg June 26, 2019 22:06
Copy link
Member

@fgregg fgregg left a comment

Choose a reason for hiding this comment

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

thanks for bearing with me Jean

@jeancochrane jeancochrane merged commit 522342d into ocd Jun 27, 2019
@jeancochrane jeancochrane deleted the feature/jfc/import-geographies branch June 27, 2019 16:14
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.

2 participants