sketch-city / harvey-api

Harvey Needs API
http://harveyneeds.org
GNU General Public License v3.0
23 stars 39 forks source link

Automatically geocode on Shelter save #83

Closed tdooner closed 7 years ago

tdooner commented 7 years ago

Rather than requiring a backfill rake script, let's just geocode each Shelter entity before it is saved.

This commit adds the recommended after_validation :geocode hook in the geocode gem's documentation.

jwo commented 7 years ago

@tdooner Thanks for your contribution!

We have some bad-data in at least the harvey instance.... The address field should probably be combined with the city field to help out with #25 (more info on #28)

Can you add a test for something on "300 Main St" and that it wouldn't geocode without a city? I know that's a bit generic, but I think it's needed.

Also, we should do the same on Needs and CharitableOrganizations

tdooner commented 7 years ago

Hey @jwo, can you take another look? Hopefully this will not re-break everything?

jwo commented 7 years ago

@tdooner I have reservations here; I'll do some testing this weekend to try to see that it won't put pins back in new york city.

Eventually we'll move to geo-coding in the browser via a form (#28). I might feel more comfortable if we just do that.

tdooner commented 7 years ago

Were the pins in NY because of an ambiguous city name?

I'm going to stop working on this branch then, if you think this is the wrong approach. I thought it might be a good quick fix but apparently not so. Let me know if there is a different approach you would prefer me to spend time investing in.

jwo commented 7 years ago

We'll move forward with browser based geocoding.