getmovement / deprecated-movement-rails-api

DEPRECATED Rails API for getmovement.org
1 stars 1 forks source link

As a volunteer, I want to find candidates near me so that I can join their campaign. #8

Open joshsmith opened 8 years ago

begedin commented 8 years ago

How would we determine what's near me? I'm not sure it's purely a distance thing.

There can be a campaign that deals with a certain town or place, but there can also be a wider-area campaign that's just as important to the volunteer.

joshsmith commented 8 years ago

It's not just distance, but probably congressional districts. I don't know that we can feasibly go lower than congressional right now. So it would have something to do with your address. The flow will realistically need to take into account someone's location and then allow them to edit it if it looks incorrect.

rthbound commented 8 years ago

Would we need to draw districts with something like KML? Update KML when district boundaries change?

joshsmith commented 8 years ago

@rthbound yes, I did some spiking on this in #51. I have a TIGER shapefile from the US Census Bureau that we can use for querying with PostGIS/RGeo to make this all work.

joshsmith commented 8 years ago

The CongressionalDistrict.for_location method will help solve of the locating candidates. This will be expanded into state legislative districts, etc. Obviously presidential level candidates will not need any special search functionality.

begedin commented 8 years ago

From the discussion in #3, would candidates we are talking about here be politicians?

What would the API be like then?

#app/controllers/politicians_controller.rb
def index
  render json: local_politicians + global_politicians
end

def local_politicians
  district = CongresionalDistrict.for_location(longitude: longitude, latitude: latitude)
  Politicians.where(district: district)
end

def global_politicians
  Politicians.global # not sure how we differentiate these. special flag?
end

def longitude
  params.require[:longitude]
end

def latitude
  params.require[:latitude]
end

Would that be about it?

joshsmith commented 8 years ago

I don't think we would even expose politicians directly like this. It's more a way to relate an individual to a Campaign or an Office.

A given campaign may be able to create or update a politician's information, but not without jumping through some sort of hoops first.

begedin commented 8 years ago

What would the API endpoint be here then?