datamade / django-councilmatic

:heartpulse: Django app providing core functions for *.councilmatic.org
http://councilmatic.org
MIT License
26 stars 16 forks source link

Create management command for importing Post shapes #249

Closed jeancochrane closed 5 years ago

jeancochrane commented 5 years ago

Overview

With the OCD model migration in #240, we stripped out the import_data script that imported boundaries into the app. Create an import_shapes command that will pull these boundaries from from an OCD API and associate them with their corresponding Post.

Closes #248.

Notes

When opening #248, we'd discussed trying to refactor boundaries to be served as static files instead of being stored in the Post.shape field. Ultimately we determined that would be a bigger refactor than we had scope for, so we went with the approach you see here, which simply refactors the old management command logic for the new models.

Testing instructions

Test these changes by following the instructions in chi-councilmatic: https://github.com/datamade/chi-councilmatic/pull/256

fgregg commented 5 years ago

Hi @jeancochrane, I'm sorry we should have written down what we thought the plan was after our conversation yesterday. I want the import_shapes to source the data from geojson file under version control instead of pulling that data from the API. I don't want us need to have Pittsburgh set up the API just to get their shapes in.

jeancochrane commented 5 years ago

Shouldn't be too difficult of a change I think, thanks for clarifying @fgregg!

fgregg commented 5 years ago

Reflecting a little on this on my train ride home. Post is not really the perfect place to put the borders of a division. However, right now within the OCD spec, there's not really a better place to put it.

This issue discusses the right approach (imo), but has not been implemented yet. https://github.com/opencivicdata/python-opencivicdata/issues/110

If and when it does, we can revisit this issue. No changes required now.

On Wed, Jun 26, 2019 at 5:06 PM Jean Cochrane notifications@github.com wrote:

@jeancochrane https://github.com/jeancochrane requested your review on:

249 https://github.com/datamade/django-councilmatic/pull/249 Create

management command for importing Post shapes.

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/datamade/django-councilmatic/pull/249?email_source=notifications&email_token=AAEDC3J2P6GUCQL5U4Q33RTP4PR7FA5CNFSM4H3LUDP2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOSGJUE6A#event-2442347128, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEDC3KNSTNKXHELJS7742TP4PR7FANCNFSM4H3LUDPQ .